fix: diagnose ?(?T) tuple-payload mismatch instead of malformed IR (issue 0165)
In type position (T) is a 1-tuple (specs.md:843), so ?(?i64) is optional(tuple(?i64)); assigning a bare ?i64 had coerceToType classify .none and pass the value through, then optionalWrap built a corrupt insertvalue that aborted the LLVM verifier. After coercing toward an optional's child, verify the coerced type equals the child type (stmt.zig decl-init + coerce.zig .optional_wrap); on mismatch emit a located diagnostic (tuple-specific note only when the child is a tuple). formatTypeName now renders tuples as (x: i64, y: i64). Regressions: optionals/0911 (nested optional via alias, round-trip), diagnostics/1195 (the mismatch diagnostic). Updated diagnostics/1101 + protocols/0414 goldens for the improved tuple type-name rendering. Verified by 3 adversarial reviews. Filed adjacent bug 0171 (?any child not canonicalized).
This commit is contained in:
@@ -1381,7 +1381,7 @@
|
||||
@str.1477 = private unnamed_addr constant [19 x i8] c"*__VL__i64__Vtable\00", align 1
|
||||
@str.1478 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1
|
||||
@str.1479 = private unnamed_addr constant [5 x i8] c"null\00", align 1
|
||||
@str.1480 = private unnamed_addr constant [7 x i8] c"*tuple\00", align 1
|
||||
@str.1480 = private unnamed_addr constant [11 x i8] c"*(VL__i64)\00", align 1
|
||||
@str.1481 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1
|
||||
@str.1482 = private unnamed_addr constant [5 x i8] c"null\00", align 1
|
||||
@str.1483 = private unnamed_addr constant [21 x i8] c"**Combined__i64__i64\00", align 1
|
||||
@@ -16197,7 +16197,7 @@ if.else.1256: ; preds = %entry
|
||||
%loadN = load i64, ptr %allocaN, align 8
|
||||
%call = call { ptr, i64 } @int_to_hex_string(ptr %0, i64 %loadN)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } { ptr @str.1481, i64 3 }, { ptr, i64 } %call)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } { ptr @str.1480, i64 6 }, { ptr, i64 } %callN)
|
||||
%callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } { ptr @str.1480, i64 10 }, { ptr, i64 } %callN)
|
||||
br label %if.merge.1257
|
||||
|
||||
if.merge.1257: ; preds = %if.else.1256, %if.then.1255
|
||||
|
||||
Reference in New Issue
Block a user