-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make capturing unique values in closures easier
Closures defined using `fn move` that capture `uni T` values now expose them as `mut T` instead of `uni mut T`. This makes working with these values easier. Changelog: added
- Loading branch information
1 parent
0fd8ad9
commit e12d2b3
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class A {} | ||
|
||
fn example1 { | ||
let a = recover [A()] | ||
let b = recover fn { a.push(A()) } | ||
} | ||
|
||
fn example2 { | ||
let a = recover [A()] | ||
let b = recover fn move { a.push(A()) } | ||
} | ||
|
||
# fn_move_captures_uni.inko:5:24 error(invalid-symbol): the variable 'a' exists, but its type ('uni Array[A]') prevents it from being captured | ||
# fn_move_captures_uni.inko:5:31 error(invalid-type): the receiver of this call requires sendable arguments, but 'A' isn't sendable |