This commit is contained in:
agra
2026-03-02 21:00:55 +02:00
parent 2f4f898d54
commit bbb5426777
42 changed files with 483 additions and 9023 deletions

View File

@@ -1,26 +0,0 @@
// Issue 0008: Chained ?? (null coalescing) doesn't work
//
// `a ?? b ?? c` where a: ?f32, b: ?f32, c: f32 fails with:
// "narrowing conversion from '?f32' to 'f32' requires explicit 'xx' cast"
//
// It parses as (a ?? b) ?? c, and the first ?? rejects ?f32 as the rhs.
//
// Expected: ?? should either be right-associative so it parses as a ?? (b ?? c),
// or allow ?T as the rhs (returning ?T when rhs is optional, T when rhs is concrete).
//
// Workaround: use parentheses — a ?? (b ?? c)
Foo :: struct {
x: ?f32;
y: ?f32;
}
main :: () -> void {
f := Foo.{ x = 1.0, y = 2.0 };
// This works:
ok := f.x ?? (f.y ?? 0.0);
// This should also work but fails:
bad := f.x ?? f.y ?? 0.0;
}