-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Improve detection of receiver cloning in ref safety analysis #67736
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
07ea01a
Add a test
jjonescz d4be178
Fix spelling
jjonescz 558f0c4
Consider ref property accesses to have home
jjonescz 24569b6
Verify IL
jjonescz b7f1274
Add indexer test
jjonescz 8d74391
Consider ref indexer accesses to have home
jjonescz 42498e4
Add more tests
jjonescz 7fc0cc8
Add readonly tests
jjonescz 9fcbe7c
Revert `Binder.HasHome` changes
jjonescz 8aaf595
Check value kind
jjonescz 53ca90e
Add flag if receiver needs cloning
jjonescz 19c9451
Rename the flag
jjonescz 9546fb0
Use three state flag
jjonescz 307f02d
Fix callers passing wrong flag
jjonescz 864ca32
Fix nullability warning
jjonescz bd805b2
Expose flag in synthesized BoundCall factory method
jjonescz 59110a4
Expose flag also in Update method
jjonescz 909497c
Fixup EE
jjonescz 32d35ff
Improve static receiver cloning detection logic
jjonescz 5146f2d
Fix nullability warning
jjonescz 860b2c0
Use constant flags where binder is unavailable
jjonescz d2798a0
Fix the flag in synthesized entry-point
jjonescz 8c724a4
Assert the flag is known in ref safety visitor
jjonescz 58e5fc3
Merge branch 'main' into 67697-UnscopedRef-Property
jjonescz af8974d
Merge branch 'main' into 67697-UnscopedRef-Property
jjonescz 6db323e
Merge branch 'main' into 67697-UnscopedRef-Property
jjonescz fd34df6
Pass `False` for placeholder receiver
jjonescz a2fde45
Improve test parameter naming
jjonescz cd54dda
Merge branch 'main' into 67697-UnscopedRef-Property
jjonescz 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
81 changes: 62 additions & 19 deletions
81
src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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.
There's def a part of me that feels like, man, instead of this flag I wish we could just wrap the receiver expression into the
BoundCapturedReceiverPlaceholder
node at initial binding time. After all, what we are doing in ref safety analysis is simply to introduce this node late into the tree and then analyze that.I know that change has the tendency for unpleasant ripple effects through other areas of the compiler. Flow analysis does already have mechanisms for "seeing through" placeholders and so on, but they can be unpleasant to use, and I'm sure more than that would be impacted. Also, I think we've solved the problem with the current change and I don't want to belabor that unnecessarily.
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.
Interesting idea, I haven't tried that, but I can imagine it could be an even more invasive change.