-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-type-systemArea: Type systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Description
fn make_adder(x: int) -> @fn(int) -> int { |y| x + y }
The above function gives a compile error:
mismatched types: expected @fn(int) -> int
but found &fn(int) -> int
(expected @ closure, found & closure)
If I change the expression syntax into an explicit return:
fn make_adder(x: int) -> @fn(int) -> int { return |y| x + y; }
the code compiler (and runs) without error.
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.