[6.3][Concurrency] Mark a type as nonisolated if a conformance requires it #87057
+150
−7
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.
Explanation:
When default isolation is set to
MainActora type should be considerednonisolatedif it's primary definition is stated to conform to aSendableorSendableMetatypeprotocol. But default isolation computation currently produces "unspecified" instead which cannot be used as a condition during conformance isolation inference and so some implied conformances are wrongly considered to be@MainActor.The change adjusts the default isolation computation to produce
nonisolatedisolation in the case described above and adds a condition to the conformance isolation checking to prevent inferring@MainActorfrom an extension if a type itself isnonisolated.Resolves: rdar://166542727
Main branch PR: [Concurrency] Mark a type as
nonisolatedif a conformance requires it #86682Risk: Low. This change allows more code to type-check in
@MainActoras default isolation mode and affects only extensions.Reviewed By: @hborla
Testing: Added new test-cases to the suite.