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
A one-line method body that is a struct literal parses as a braced block inside extend #2998
type P { a: i32, b: i32 }
type S { n: i32 }
extend S:
fn pair(x: i32): P { a: x, b: self.n }
fn free(a: i32): P { a, b: 1 } // fine
let s = S { n: 2 }
print(s.pair(1).b)
error: unknown field 'b' for type 'Unit'
Inside extend (and presumably impl), fn name(args): Type { … } reads the { as a braced body, so the method returns Unit; the same one-line body on a free function parses as the struct literal. §29.13's inline-colon form is the least-ceremony spelling for a constructor-like method (the mission's style rule: "inline the colon when the body is very small"), so a method cannot be written the way a free function can. Found rewriting examples/service (make_profile, build). Expected: the body after : is an expression, and a Name { that names a type is the literal, in a method as in a function.
Activity
#2998, #2984, #3004, #3011, #3034, #2950: six spec-gap fixes and conf…