-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] Downgrade errors to warnings when Sendable
requirement is inferred from a preconcurrency protocol
#81960
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
Conversation
@swift-ci please test |
@@ -123,7 +123,7 @@ case q(Q.Type, Int) // expected-warning{{associated value 'q' of 'Sendable'-conf | |||
} | |||
|
|||
struct S: Sendable { | |||
var tuple: ([Q.Type], Int) // expected-warning{{stored property 'tuple' of 'Sendable'-conforming struct 'S' has non-Sendable type '([any Q.Type], Int)'}} | |||
var tuple: ([Q.Type], Int) // expected-warning{{stored property 'tuple' of 'Sendable'-conforming struct 'S' has non-Sendable type 'any Q.Type'}} |
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.
I like that the diagnostic structurally looks through types with conditional conformances and points out the type that is actually non-Sendable
. It might be nice as a follow up to somehow tailor the diagnostic in the case where the property type contains the non-Sendable
type.
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.
This was the inconsistency between enum elements and properties, the former printed the mismatched type and the latter the whole type. Maybe for inner type we should use contains
or uses
instead of has
something like:
stored property 'tuple' of 'Sendable'-conforming struct 'S' contains a non-Sendable type 'any Q.Type'
?
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.
Yeah I think contains
sounds good!
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.
I'll change it in this PR since CI is broken anyway due to stdlib changes.
@swift-ci please test macOS platform |
@swift-ci please clean test macOS platform |
@swift-ci please test Linux |
@swift-ci please test Windows platform |
…econcurrencyProtocol` The new name better reflects the intention for this Sendable check kind.
…t is inferred from a preconcurrency protocol If a type gets `Sendable` conformace requirement through another `@preconcurrency` protocol the error should be downgraded even with strict concurrency checking to allow clients time to address the new requirement. Resolves: rdar://146027395
…appears inside of a member type
@swift-ci please test Linux platform |
@swift-ci please test Windows platform |
@swift-ci please test Linux platform |
@swift-ci please test macOS platform |
If a type gets
Sendable
conformance requirement through another@preconcurrency
protocol the error should be downgraded evenwith strict concurrency checking to allow clients time to address
the new requirement.
Resolves: rdar://146027395