-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Capture Checking of Lazy Vals #24261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+654
−22
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,63 @@ | ||
| -- Error: tests/neg-custom-args/captures/lazyvals-sep.scala:30:6 ------------------------------------------------------- | ||
| 30 | r.set(current * 100) // error - exclusive access in initializer | ||
| | ^^^^^ | ||
| | Cannot call update method set of TestClass.this.r | ||
| | since the access is in lazy value lazyVal2, which is not an update method. | ||
| -- Error: tests/neg-custom-args/captures/lazyvals-sep.scala:36:12 ------------------------------------------------------ | ||
| 36 | () => r.set(current); r.get() // error, even though exclusive access is in closure, not initializer | ||
| | ^^^^^ | ||
| | Cannot call update method set of TestClass.this.r | ||
| | since the access is in lazy value lazyVal3, which is not an update method. | ||
| -- Error: tests/neg-custom-args/captures/lazyvals-sep.scala:42:10 ------------------------------------------------------ | ||
| 42 | r.set(100) // error | ||
| | ^^^^^ | ||
| | Cannot call update method set of TestClass.this.r | ||
| | since the access is in lazy value lazyVal4, which is not an update method. | ||
| -- Error: tests/neg-custom-args/captures/lazyvals-sep.scala:61:6 ------------------------------------------------------- | ||
| 61 | r.set(200) // error | ||
| | ^^^^^ | ||
| | Cannot call update method set of TestClass.this.r | ||
| | since the access is in lazy value lazyVal6, which is not an update method. | ||
| -- Error: tests/neg-custom-args/captures/lazyvals-sep.scala:71:6 ------------------------------------------------------- | ||
| 71 | r.set(200) // error | ||
| | ^^^^^ | ||
| | Cannot call update method set of TestClass.this.r | ||
| | since the access is in lazy value lazyVal8, which is not an update method. | ||
| -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyvals-sep.scala:72:12 --------------------------------- | ||
| 72 | Wrapper(r) // error | ||
| | ^ | ||
| |Found: Ref^{TestClass.this.r.rd} | ||
| |Required: Ref^ | ||
| | | ||
| |Note that capability TestClass.this.r.rd is not included in capture set {}. | ||
| | | ||
| |Note that {cap} is an exclusive capture set of the mutable type Ref^, | ||
| |it cannot subsume a read-only capture set of the mutable type Ref^{TestClass.this.r.rd}. | ||
| | | ||
| |where: ^ and cap refer to a fresh root capability classified as Mutable created in lazy value lazyVal8 when checking argument to parameter ref of constructor Wrapper | ||
| | | ||
| | longer explanation available when compiling with `-explain` | ||
| -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyvals-sep.scala:77:12 --------------------------------- | ||
| 77 | Wrapper(r) // error | ||
| | ^ | ||
| |Found: Ref^{TestClass.this.r.rd} | ||
| |Required: Ref^ | ||
| | | ||
| |Note that capability TestClass.this.r.rd is not included in capture set {}. | ||
| | | ||
| |Note that {cap} is an exclusive capture set of the mutable type Ref^, | ||
| |it cannot subsume a read-only capture set of the mutable type Ref^{TestClass.this.r.rd}. | ||
| | | ||
| |where: ^ and cap refer to a fresh root capability classified as Mutable created in lazy value lazyVal9 when checking argument to parameter ref of constructor Wrapper | ||
| | | ||
| | longer explanation available when compiling with `-explain` | ||
| -- Error: tests/neg-custom-args/captures/lazyvals-sep.scala:82:8 ------------------------------------------------------- | ||
| 82 | r.set(0) // error exclusive access in conditional | ||
| | ^^^^^ | ||
| | Cannot call update method set of TestClass.this.r | ||
| | since the access is in lazy value lazyVal10, which is not an update method. | ||
| -- Error: tests/neg-custom-args/captures/lazyvals-sep.scala:90:8 ------------------------------------------------------- | ||
| 90 | r.set(42) // error | ||
| | ^^^^^ | ||
| | Cannot call update method set of TestClass.this.r | ||
| | since the access is in lazy value lazyVal11, which is not an update method. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future head-scratchers:
++on iterators are by-name on the RHS, and so will capturethisby virtue of accessing the lazy val_reversed