-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[6.0] Fix LifetimeDependenceDiagnostics to ignore closure captures #72665
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
Closed
Conversation
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
…ift, obsoleted: 1)` Using version `2` here is just weird for no reason.
It’s a caseless enum, but there’s no reason to change this aspect of it.
…events toolchain builds from succeeding" This reverts commit 0266c6d.
This reverts commit 13e7aff.
[gardening] update copyright notice [gardening] update copyright notice [gardening] update copyright notice [gardening] update copyright notice
…rk when using Optional and other stdlib features
…s a suppressible feature
Fixes the missing diagnostic about the availability of the setter of `x` in the following example: ``` struct S { var x: Int { get { 0 } @available(*, unavailable) set {} } } var s = S() s[keyPath: \.x] = 1 ``` Resolves rdar://124977727
In the following example, the writeback via the property `b` should be diagnosed since `b`'s setter is unavailable: ``` struct A { struct B { var x: Int = 0 } private var _b: B = B() var b: B { get { _b } @available(*, unavailable) set { _b = newValue } } } var a = A() a.b.x = 1 ``` Resolves rdar://125019717
When inserting type checks for pre-specialized functions, the existing return-block can only be re-used if it has no arguments. Otherwise we are creating an argument-less branch to a block with arguments. rdar://124638266
[6.0] Serialization: update for new diagnostics format
[6.0][CSSimplify] Mark all type variables in member type as holes if base is a hole
ClosureLifetimeFixup now emits mark_dependence [nonescaping]. Those should be ignored by diagnostics. In the capture case, the dependence has already been resolved, and may not match the SIL patterns that we expect for source-level lifetime dependencies. Fixes rdar://125375685 ([nonescapable] Fix lifetime-dependence diagnostics in the stdlib) (cherry picked from commit 36b9ed4)
(cherry picked from commit 1e0035f)
-enable-experimental-feature NonescapableTypes now only controls syntax and some type inferrence features. (cherry picked from commit f19d94c)
Hit save too soon |
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.
Fix LifetimeDependenceDiagnostics to ignore closure captures
ClosureLifetimeFixup now emits mark_dependence [nonescaping]. Those should be
ignored by diagnostics. In the capture case, the dependence has already been
resolved, and may not match the SIL patterns that we expect for source-level
lifetime dependencies.
Fixes rdar://125375685 ([nonescapable] Fix lifetime-dependence diagnostics in the stdlib)x
This allows us to always-enable lifetime-depenence diagnostics.
This PR also includes obvious, harmless fixes to move-only diagnostics to allow adding
nonescapable unit tests.
Fix MoveOnlyDiagnostics, ConsumOperator...Checkers diagnostics
Emitting a note with an invalid source location is actively
harmful. It confuses users and tools, makes it impossible to write
unit tests. In this case, the note simply says "use here", so it's
completely free of information without the source location.
--- CCC ---
Explanation: Fix LifetimeDependenceDiagnostics to ignore closure captures
Scope: Allows NonescapableTypes to be enabled by default
Radar/SR Issue: rdar://125375685 ([nonescapable] Fix lifetime-dependence diagnostics in the stdlib)
Original PR: #72635
Risk: This bypasses new compiler functionality for code that does not require that functionality. It lowers risk.
Testing: Unit tests added
Reviewer: @meg-gupta