lowerNullCoalesce fed resolveOptionalInner's .unresolved (returned for a non-optional lhs) into the merge-block params / optionalUnwrap / RHS target type, reaching codegen and panicking 'unresolved type reached LLVM emission'. Guard: when inferExprType(nc.lhs) is a resolved non-optional type, emit a located diagnostic and bail; an .unresolved lhs (prior error) is excluded to avoid double-report. ?? is optional-only per specs.md (error unions use or/catch), so rejecting a failable lhs is correct; comptime panic closed too. Regression: examples/diagnostics/1200-diagnostics-null-coalesce-non-optional.sx. Verified by 3 adversarial reviews, suite 790/0. Filed adjacent bug 0180 (?? lowering defects for generic/alias/tuple optional lhs).
6 lines
255 B
Plaintext
6 lines
255 B
Plaintext
error: left operand of '??' must be an optional, but has type 'i64'
|
|
--> examples/diagnostics/1200-diagnostics-null-coalesce-non-optional.sx:15:8
|
|
|
|
|
15 | x := 5 ?? 7; // <- left operand of '??' must be an optional, but has type 'i64'
|
|
| ^
|