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
D128 gap: a comprehension's binding is not typed by its uses ( at ) #2343
Spec: §4.2.1 D128 (locals typed by their uses), §4.3c (D93 types a bracket literal's binding by its uses), §13.6.
fn assert_list_i32(xs: []i32, a: i32, b: i32, c: i32): ...
let src = [(1, 2), (3, 4), (5, 6)]
let sums = [a + b for (a, b) in src]
assert_list_i32(sums, 3, 7, 11) // wrong argument type: List[isize]
D93 records a use-demand only for a bracket-literal binding (NK_ARRAY_LIT); a comprehension's binding gets no demand, and the demand would have to reach src's tuple elements through the comprehension's pattern. By law 1 the compiler can establish i32 here (the one use says it). test/spec/spec_ss13_6_comprehensions.w carries let src: List[(i32, i32)] until this lands; the annotation comes out with the fix.
Fixtures carrying annotations until this lands (each is the comprehension-binding gap or a literal flowing through a generic/builtin result the demand cannot reach): test/spec/spec_ss13_6_comprehensions.w (src/pairs: List[(str, i32)], 0i32.. ranges), test/debug_alloc/da_comprehension_try_releases_collection.w and da_comprehension_iteration_temps.w (0i32..), test/debug_alloc/da_2019_cancel_inside_*.w (xs.fold(0i32, …): a builtin's result from a literal init), test/spec/spec_ss13_5d_loop_value.w (let x: i32 = loop: break 20), test/spec/spec_ss18_7_core_language.w (let t: (i32, i32, i32), a tuple local demanded through an element read). D128 lands with these; the annotations come out with the fixes.
Fixed on branch d115-d120 (commit b8ce24c): a comprehension's binding is a literal's binding for D93 demands, and a loop or clause binding over a literal's binding carries a D128 demand to that literal, a tuple pattern position by position. Also fixes the plain loop let a1 = [1, 2, 3]; for x in a1: narrow(x). Fixture: test/behavior/behav_2343_comprehension_binding_by_use.w; the annotation in test/spec/spec_ss13_6_comprehensions.w is gone. int-local-rechecks stays 0 for the compiler.
Activity
ehartford commentedon Oct 11, 2026
Fixtures carrying annotations until this lands (each is the comprehension-binding gap or a literal flowing through a generic/builtin result the demand cannot reach):
test/spec/spec_ss13_6_comprehensions.w(src/pairs: List[(str, i32)],0i32..ranges),test/debug_alloc/da_comprehension_try_releases_collection.wandda_comprehension_iteration_temps.w(0i32..),test/debug_alloc/da_2019_cancel_inside_*.w(xs.fold(0i32, …): a builtin's result from a literal init),test/spec/spec_ss13_5d_loop_value.w(let x: i32 = loop: break 20),test/spec/spec_ss18_7_core_language.w(let t: (i32, i32, i32), a tuple local demanded through an element read). D128 lands with these; the annotations come out with the fixes.D128: tests for the shapes; fixtures outside the rule's words carry a…
d126 locals (#2342)
ehartford commentedon Oct 11, 2026
Fixed on branch d115-d120 (commit b8ce24c): a comprehension's binding is a literal's binding for D93 demands, and a loop or clause binding over a literal's binding carries a D128 demand to that literal, a tuple pattern position by position. Also fixes the plain loop
let a1 = [1, 2, 3]; for x in a1: narrow(x). Fixture: test/behavior/behav_2343_comprehension_binding_by_use.w; the annotation in test/spec/spec_ss13_6_comprehensions.w is gone. int-local-rechecks stays 0 for the compiler.D114/D128 gaps (#2333, #2336, #2343), D111 clones (#2271), D115 Amend…
ehartford commentedon Oct 11, 2026
Merged to main in e4861e1 (#2349), battery green.