-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix frozen lambda captures untracked (#112)
* Cosntraint => Constraint * Gives an error when trying to capture (or use) an untracked function from a frozen context (async/pure lambda).
- Loading branch information
Showing
6 changed files
with
41 additions
and
7 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
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
Empty file.
24 changes: 24 additions & 0 deletions
24
tests/src/frontend/typechecking/invalid/frozen_lambda_captures_untracked.exp_err
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,24 @@ | ||
File "./typechecking/invalid/frozen_lambda_captures_untracked.sk", line 6, characters 13-15: | ||
You cannot capture this variable | ||
4 | | ||
5 | untracked fun main(): void { | ||
6 | _ = () ~> foo(); | ||
| ^^^ | ||
7 | } | ||
|
||
File "./typechecking/invalid/frozen_lambda_captures_untracked.sk", line 6, characters 13-15: | ||
Mutable because of this position | ||
4 | | ||
5 | untracked fun main(): void { | ||
6 | _ = () ~> foo(); | ||
| ^^^ | ||
7 | } | ||
|
||
File "./typechecking/invalid/frozen_lambda_captures_untracked.sk", line 6, characters 7-17: | ||
Because this closure was declared as pure (~>) | ||
Try '->' instead | ||
4 | | ||
5 | untracked fun main(): void { | ||
6 | _ = () ~> foo(); | ||
| ^^^^^^^^^^^ | ||
7 | } |
7 changes: 7 additions & 0 deletions
7
tests/src/frontend/typechecking/invalid/frozen_lambda_captures_untracked.sk
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,7 @@ | ||
untracked fun foo(): Int { | ||
0 | ||
} | ||
|
||
untracked fun main(): void { | ||
_ = () ~> foo(); | ||
} |