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
D93: an empty literal fed from another by-use-typed literal is refused ("empty sequence literal requires expected type"); the by-use pass does not chain #2532
D93 (a collection literal's binding takes its type from its uses) does not chain through another literal-typed binding. On main (installed v0.15.3.0-g8182ccfb1):
fn main:
var site_paths = []
site_paths.push("x")
var files = []
for p in site_paths:
if not files.contains(p): files.push(p) # error: empty sequence literal requires expected type (at `var files = []`)
print(f"{files.len()}")
With let site_paths: List[str] = ["x"] instead, the same files types fine from files.push(p); var files = [] + files.push("a"), contains before the first push, a push inside a nested loop and if, and a push of an element view (ends.push(v[i])) all work. What fails is only the chain: files's demand comes from p, whose type comes from site_paths, itself decided by the same literal-demand pass, so files.push(p) reads an undecided type and the literal is refused. The spec (§4.3c: "an empty literal waits for the first use that fixes its element type") makes no exception for a use whose own type is a decided-later literal; the pass should iterate (or order the demands) until no literal's uses change. Found writing tools/sweep_some_at_option_demand.w (2026-10-21), where three var xs = [] fed from other by-use lists carry explicit types with a comment naming this issue.
Activity
D144: a binding from a place of plain bits takes the value, any other…