Skip to content
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

Extend "uses concurrency features" checks for closures currently being type checked #40544

Merged
merged 2 commits into from
Dec 14, 2021

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented Dec 14, 2021

When type-checking a closure, use the type that it will have in context (e.g., considering inferred @Sendable and async) to determine whether that closure should perform strict checking. This allows us to better detect when we should diagnose data races in Swift 5.x code.

Fixes SR-15131 / rdar:https://problem/82535088.

…e body.

Use this to enable better detection of async contexts when determining
whether to diagnose problems with concurrency.

Part of SR-15131 / rdar:https://problem/82535088.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

… features

When evaluating whether code is within a closure that uses concurrency
features, use the type of the closure as it's known during type checking,
so that contextual information (e.g., it's passed to a `@Sendable` or
`async` parameter of function type) can affect the result. This
corrects the definition for doing strict checking within a minimal
context for the end result of the type-check, rather than it's initial
state, catching more issues.

Fixes SR-15131 / rdar:https://problem/82535088.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor changed the title Generalize and cache the "closure effects" determined from the closure body Extend "uses concurrency features" checks for closures currently being type checked Dec 14, 2021
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant