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 [] in one branch of an if expression is not typed from the other branch #3060
§3 / D93 (collection literal by use): an empty [] takes its element type from how it is used. In an if expression whose other branch is a List[T], the [] has that type, but the compiler refuses it:
fn hosts(n: i32) -> List[i32]: [n]
let xs = if true: hosts(1) else: []
error: empty sequence literal requires expected type
Expected: xs: List[i32], the then-branch's type (as let xs = [] followed by xs.push(1) already infers). Found 2026-11-07 writing let op_hosts = if cj >= 0: self.facade_method_host(sym) else: [] in src/SemaFacade.w under the pinned seed; the workaround is to nest the if so no branch is empty (the D194 stack does that; remove it when this lands).
Merged to main ae20d89 (#3248): an arm that is a bare [] takes the other arm's type (§4.3c rule 1: it waits for its first use, and beside another arm that use is the join). Fixture test/behavior/behav_3060_empty_literal_arm_takes_the_other_arms_type.w.
Activity
D194 (#3010): retained pointer cases of a variadic contract; census p…
Issues batch A: #1021 #1022 #1023 #2760 #3057 #3060 #3086 #3113 #3114 (…
ehartford commentedon Nov 11, 2026
Merged to main ae20d89 (#3248): an arm that is a bare
[]takes the other arm's type (§4.3c rule 1: it waits for its first use, and beside another arm that use is the join). Fixture test/behavior/behav_3060_empty_literal_arm_takes_the_other_arms_type.w.