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
A pipeline's result cannot take ?? without parentheses; a comprehension is not comptime-evaluable #2142
error: undefined variable at the ??. (xs.iter() |> max()) ?? 0.0 compiles. Expected: ?? applies to the pipeline's result, as it does to a method chain's.
2. A list comprehension in a comptime fn.
comptime fn squares(n: i32): [i * i for i in 0..n]
const SQUARES: Vec[i32] = comptime squares(8)
error: expression kind 64 is not comptime-evaluable yet. The loop form (var table = Vec[i32].new(), for i in 0..n: table.push(i * i)) evaluates; the README still uses it for that reason.
3. A bare None inside a tuple compared with a typed tuple.
(Some("a".to_lower()), 1) == (None, 1)
error: comparison operands must have the same tuple type: (Option[str], i32) and (Option, i32). The left operand's type decides the right's.
Workarounds in use: the parentheses in README's largest; the loop in README's squares; a typed binding in test/behavior/behav_2137_structural_equality.w.
More of the same family, found testing #2145 (same on main a45324c):
for (i, x) in names.iter() |> enumerate(): … → "cannot iterate over EnumerateIter[VecIter[str], str]: a for iterable implements Iter[T] …". A pipeline's adapter is not a for iterable.
names.iter() |> position(it == "a") → "comparison operands must have compatible types" at it == "a" (any(it == "a") is fine).
let kept = names.iter() |> filter(…) |> collect[Vec]() is a Vec[&str]; kept[0] == "a" → "comparison operands must have compatible types" (a view of a view of a str against a str).
xs.iter_ref() |> sum() over Vec[i32] → invalid LLVM (add ptr): sum over views of a Copy element has no materialization. This is what stops Vec.iter() yielding views for Copy elements too (D22 contextual Copy in pipelines).
Item 1 is the spec's precedence, not a parser bug: §9.9's table puts ?? at level 10 with +, and |> at level 5, so xs.iter() |> max() ?? 0.0 is xs.iter() |> (max() ?? 0.0), and max alone is an undefined name. The compiler conforms.
It needs a ruling to change. Recommendation: move ?? below |> (its own level between 4 and 5), so a default applies to the pipeline's result. That is the reading a reader assumes, and stage() ?? d as a pipeline stage has no use I can construct. C# puts ?? near the bottom of its table; Swift's nil-coalescing sits above comparison and below arithmetic casts; neither has a pipeline operator to rank against. Cost: a + b ?? c would become (a + b) ?? c instead of a + (b ?? c); a sweep of the tree for ?? beside an arithmetic or bitwise operator would show whether anything relies on today's grouping.
Item 2 (a comprehension at comptime) landed in #2151 (main 6b0c99d); README's squares is one line. Item 1 waits for a precedence ruling (see above). Items 3 to 7 are open.
Items 3, 5, 6 and 7 landed on main 0ade380 (#2172); item 4 landed with #2150; item 2 with #2151. Only item 1 (the precedence of ?? against |>) is open, and it waits for a ruling.
All three parts verified on the merged tree: (1) xs.iter() |> max() ?? 0.0 parses (D95 precedence); (2) comptime fn squares(n: i32): [i * i for i in 0..n] evaluates (SQUARES.len() == 8); (3) (Some("a".to_lower()), 1) == (None, 1) type-checks and is false.
Activity
ehartford commentedon Oct 5, 2026
More of the same family, found testing #2145 (same on main a45324c):
for (i, x) in names.iter() |> enumerate(): …→ "cannot iterate overEnumerateIter[VecIter[str], str]: aforiterable implementsIter[T]…". A pipeline's adapter is not aforiterable.names.iter() |> position(it == "a")→ "comparison operands must have compatible types" atit == "a"(any(it == "a")is fine).let kept = names.iter() |> filter(…) |> collect[Vec]()is aVec[&str];kept[0] == "a"→ "comparison operands must have compatible types" (a view of a view of a str against a str).xs.iter_ref() |> sum()overVec[i32]→ invalid LLVM (add ptr):sumover views of a Copy element has no materialization. This is what stopsVec.iter()yielding views for Copy elements too (D22 contextual Copy in pipelines).ehartford commentedon Oct 5, 2026
Item 1 is the spec's precedence, not a parser bug: §9.9's table puts
??at level 10 with+, and|>at level 5, soxs.iter() |> max() ?? 0.0isxs.iter() |> (max() ?? 0.0), andmaxalone is an undefined name. The compiler conforms.It needs a ruling to change. Recommendation: move
??below|>(its own level between 4 and 5), so a default applies to the pipeline's result. That is the reading a reader assumes, andstage() ?? das a pipeline stage has no use I can construct. C# puts??near the bottom of its table; Swift's nil-coalescing sits above comparison and below arithmetic casts; neither has a pipeline operator to rank against. Cost:a + b ?? cwould become(a + b) ?? cinstead ofa + (b ?? c); a sweep of the tree for??beside an arithmetic or bitwise operator would show whether anything relies on today's grouping.comptime: a list comprehension is comptime-evaluable (#2142) (#2151)
ehartford commentedon Oct 5, 2026
Item 2 (a comprehension at comptime) landed in #2151 (main 6b0c99d); README's
squaresis one line. Item 1 waits for a precedence ruling (see above). Items 3 to 7 are open.sema, codegen: a D93 decision survives the second check; const array …
ehartford commentedon Oct 5, 2026
Items 3, 5, 6 and 7 landed on main 0ade380 (#2172); item 4 landed with #2150; item 2 with #2151. Only item 1 (the precedence of
??against|>) is open, and it waits for a ruling.spec v7.24 (D95): let _ drops; pub const takes its value's type; ?? b…
D95 + D96: let _ drops; pub const takes its value's type; ?? below |>…
ehartford commentedon Oct 5, 2026
Fixed on main by stack #2196 (merged as efb765c), battery green on a21e326; the regression test for it landed with the fix.
ehartford commentedon Oct 5, 2026
All three parts verified on the merged tree: (1)
xs.iter() |> max() ?? 0.0parses (D95 precedence); (2)comptime fn squares(n: i32): [i * i for i in 0..n]evaluates (SQUARES.len() == 8); (3)(Some("a".to_lower()), 1) == (None, 1)type-checks and is false.