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
Unannotated generic struct literal: 'cannot infer generic method type parameter T' though the initializer decides it #1739
A struct literal of a generic type bound without an annotation leaves the type parameter uninferred for method calls, although the field initializers determine it:
type Stack[T] { items: Vec[T] }
impl[T] Stack[T]:
fn count() -> i32: self.items.len() as i32
fn main:
let st = Stack { items: ["p".clone(), "q".clone()] }
print(st.count())
error: cannot infer generic method type parameter 'T'
let st: Stack[str] = … works. The mission: the initializer already determines T, so the annotation is ceremony. Found testing #1724 (gen methods on generic owners behave the same).
Activity
Sema: a collection literal at a generic `Vec[T]` destination builds t…
Type checker: D74 entry sources and chain moves, field-view bindings (w…
sema, codegen: a List's adapters are its iterator's; the eager map/fi…