-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Redo diagnostics for escaping captures and non-escaping parameter call restriction [5.1] #23923
Merged
slavapestov
merged 6 commits into
swiftlang:swift-5.1-branch
from
slavapestov:noescape-diagnostics-5.1
Apr 11, 2019
Merged
Redo diagnostics for escaping captures and non-escaping parameter call restriction [5.1] #23923
slavapestov
merged 6 commits into
swiftlang:swift-5.1-branch
from
slavapestov:noescape-diagnostics-5.1
Apr 11, 2019
Conversation
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
I'm about to replace all of this with a SIL pass.
The new pass is based on existing asserts in DiagnoseStaticExclusivity. They were compiled out in release builds and only checked for captures of inout parameters. This patch converts the assertions into diagnostics and adds checks for captures of non-escaping function values. Unlike the Sema-based checks that this replaces, the new code handles transitive captures from recursive local functions, which means certain invalid code that used to compile will now be rejected with an error. The new analysis also looks at the ultimate usages of a local function instead of just assuming all local functions are escaping, which fixes issues where the compiler would reject valid code. Fixes a bunch of related issues, including: - <rdar://problem/29403178> - <https://bugs.swift.org/browse/SR-8546> / <rdar://problem/43355341> - <https://bugs.swift.org/browse/SR-9043> / <rdar://problem/45511834>
…ibutes Some diagnostics got worse, but I think the reduction in compiler complexity is worth it, and copy-and-pasting Swift 2 code is not likely to produce great results anyway. Also, this corrects an oversight where we did not reject @pseudogeneric on function types in AST parsing.
This fixes a test involving transitive captures of local functions, as well as an infinite recursion possible with the old code. Fixes <rdar://problem/34496304>.
slavapestov
changed the title
Noescape diagnostics 5.1
Redo diagnostics for escaping captures and non-escaping parameter call restriction [5.1]
Apr 10, 2019
@swift-ci Please test |
Build failed |
@swift-ci Please test macOS |
@swift-ci Please test source compatibility |
This was referenced Apr 11, 2019
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
5.1 cherry-pick of #23878 and #23907.