Skip to content

[ConstraintSystem] InferSendableFromCaptures: Mark unapplied operator references as @Sendable #76136

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

Merged
merged 6 commits into from
Sep 2, 2024

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Aug 28, 2024

Operator references don't have a base type and could be found via
unqualified lookup, adjustFunctionTypeForConcurrency should handle
them specifically.

Resolves: rdar://131321053

@xedin xedin requested review from ktoso and hborla as code owners August 28, 2024 22:26
@xedin
Copy link
Contributor Author

xedin commented Aug 28, 2024

Apparently expressions like let _: @Sendable (Int, Int) -> Int = (+) crash in verifier today because ExprRewriter doesn't inject FunctionConversionExpr for that. I'll fix that separately.

@xedin
Copy link
Contributor Author

xedin commented Aug 28, 2024

@swift-ci please test

xedin added 2 commits August 30, 2024 15:24
… references as `@Sendable`

Both of these functions are single-apply instance members,
even though their names could be compound the application
is still a regular call with like `next(isolation: ...)`
vs. `next(isolation:)(...)` it would have to be for a "compound"
application.

Operator references don't have a base type and could be found via
unqualified lookup, `adjustFunctionTypeForConcurrency` should handle
them specifically.

Resolves: rdar://131321053
@xedin xedin requested a review from hamishknight August 30, 2024 22:35
@xedin
Copy link
Contributor Author

xedin commented Aug 30, 2024

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 30, 2024

@swift-ci please test source compatibility

xedin added 2 commits August 30, 2024 17:04
…Levels` to detect partial applications

We used to detect partial applications based on member locators
and parent expressions, but using function reference kind +
check to see if self is applied is such simpler and hits both
uses of `isPartialApplication`.
@xedin
Copy link
Contributor Author

xedin commented Aug 31, 2024

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Aug 31, 2024

@swift-ci please test source compatibility

Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

…ly applied instance methods on non-Sendable base

In situations like:

```
class A {
  func test() {}
}
```

Fully uncurried function type should be @sendable but inner method
cannot be because it captures a non-Sendable type `A` when applied.
@xedin
Copy link
Contributor Author

xedin commented Sep 2, 2024

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Sep 2, 2024

@swift-ci please test source compatibility

@xedin xedin requested a review from hamishknight September 2, 2024 07:23
@xedin xedin merged commit bd313de into swiftlang:main Sep 2, 2024
7 checks passed
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.

2 participants