ir: fix tuple literal element widths (construction was garbage)
A tuple_init's element values must match its field types exactly — LLVM
`insertvalue` does no implicit conversion. An inferred `pair := (40, 2)`
lowered its elements under the enclosing fn's `target_type` (e.g. main's
s32 return), producing i32 values, while the field types were inferred
independently as s64. The {i64,i64} aggregate was filled with i32
constants, so reading any element back returned garbage (40 + 2^32) and
tuple equality was always false.
lowerTupleLiteral now lowers each element under its resolved field type
(the contextual target tuple's fields when present, else per-element
inference) and coerces to it, so value width always matches field width.
Assignment to a tuple-typed field/element now also propagates the target
tuple type. Adds examples/190-tuple-values.sx as a regression test and
examples/probes/tuple-baseline.sx as the Step 0.4 audit artifact.
This commit is contained in:
1
tests/expected/190-tuple-values.exit
Normal file
1
tests/expected/190-tuple-values.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
11
tests/expected/190-tuple-values.txt
Normal file
11
tests/expected/190-tuple-values.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
pair 40 2
|
||||
named 10 10 20
|
||||
locals 40 2
|
||||
field 7 9
|
||||
ret 2 1
|
||||
pass 11
|
||||
eq true
|
||||
concat 1 4
|
||||
rep 1 2
|
||||
mem true
|
||||
lex true
|
||||
Reference in New Issue
Block a user