You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optional chaining on a tuple element (o?.1): Sema types it wrong, and inside an f-string MIR lowering fails with no source location #1503
Spec §10.3: expr?.field → expr.map(v => v.field), result Option[U]. A tuple element is a field (§4.8 pair.0), and the parser accepts an integer after ?. (Parser.parse_optional_chain).
fn main:
let o: Option[(str, i32)] = Some(("xyz".clone(), 4))
print(f"{o?.1}")
error: MIR lowering failed for function 'main' in optchain_f.w; AST codegen was removed, so this function cannot be compiled (re-run with WITH_MIR_AUDIT=1 to inspect unsupported nodes)
error: code generation failed
This error is loud but gives no source location, and it is a MIR failure rather than a Sema type.
The struct-field form works: type P { a: i32 }, print(f"{o?.a}") prints Some(4).
Expected: o?.1 has type Option[i32], first(o) ?? 0 prints 4, and print(f"{o?.1}") prints Some(4).
Activity
Lexer: a number after `.` or `?.` is a tuple index, an integer, never…
Lexer: a number after `.` or `?.` is a tuple index, an integer, never…