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
Closure parameter annotation with a generic type parses as its argument: (v: Vec[i32]) => v.len() types v as i32 #1402
Spec: §9.3 Closures (parameters may be annotated; (v: &W) => v.n with a non-generic type works).
fn main:
var xs: Vec[i32] = Vec.new()
xs.push(1)
let f = (v: &Vec[i32]) => v.len()
print(f(&xs))
Actual (installed v0.15.2.1, main dd786a4 stage1): error: unknown method 'len' for type 'i32' at v.len(). The same for (v: Vec[i32]) =>. The rendered closure in a follow-on diagnostic reads |v: i32|: the annotation keeps only the bracketed type argument.
Expected: v: &Vec[i32], prints 1.
A non-generic annotation (type W { n: i32 }, (v: &W) => v.n) is typed correctly.
Found while writing the #1379 fixture (an explicitly typed Option.filter predicate). Workaround used there: the typed-parameter cell uses a non-generic payload ((q: &P) => ...).
Activity
Option.filter's predicate observes `&T`; filter / inspect / context r…
Restore Vec.clone in drop-state storage; pin the cross-unit receiver …
Closure parameter annotations keep a generic type whole: (v: &Vec[i32…
Closure parameter annotations keep a generic type whole: (v: &Vec[i32…
ehartford commentedon Sep 26, 2026
Verified fixed on main 55739d4 (release binary): (v: &Vec[i32]) => v.len() types correctly, prints 1.