Skip to content

[TypeChecker] TypeChecker::isSubtypeOf should recognize Sendable s… #70502

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Dec 15, 2023

…ubtyping

A sendable type can be a subtype of a non-Sendable type.
That is currently established via a fix (for function types) and score change
(SK_MissingSynthesizableConformance for regular nominal types).
TypeChecker::isSubtypeOf should recognize its presence and fail.

@xedin
Copy link
Contributor Author

xedin commented Dec 15, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 15, 2023

@swift-ci please test source compatibility

@xedin xedin force-pushed the subtype-between-sendable-and-non-sendable branch from f4d724b to 6b60f15 Compare December 15, 2023 22:30
@xedin xedin changed the title [TypeChecker] TypeChecker::isSubtypeOf should recognize @Sendable s… [TypeChecker] TypeChecker::isSubtypeOf should recognize Sendable s… Dec 15, 2023
@xedin
Copy link
Contributor Author

xedin commented Dec 15, 2023

Generalized this to Sendable interactions in type context.

@xedin
Copy link
Contributor Author

xedin commented Dec 15, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 15, 2023

@swift-ci please test source compatibility

…ubtyping

A sendable function can be a subtype of a non-@sendable function,
that is currently established via a fix. `TypeChecker::isSubtypeOf`
should recognize its presence and fail.
…btyping

A sendable type can be a subtype of a non-Sendable type, i.e.
`any X & Sendable` vs. `X` where `X` is a class. The solver
adjusts `MissingSynthesizableConformance` to indicate that
one of the types is missing `Sendable` and that needs to be
recognized by `TypeChecker::isSubtypeOf`.
@xedin xedin force-pushed the subtype-between-sendable-and-non-sendable branch from 6b60f15 to 359ea14 Compare December 20, 2023 19:02
@xedin
Copy link
Contributor Author

xedin commented Dec 20, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 20, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 20, 2023

Source compat failure is due to [UPASS_RxReactiveObjC](https://ci.swift.org/job/swift-PR-source-compat-suite-macos/1279/artifact/swift-source-compat-suite/UPASS_RxReactiveObjC_4.2_BuildSwiftPackage.log)

@xedin
Copy link
Contributor Author

xedin commented Dec 20, 2023

Please test with following pull request:
swiftlang/swift-source-compat-suite#874

@swift-ci Please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 21, 2023

@swift-ci please test source compatibility

@xedin xedin merged commit d49445b into swiftlang:main Mar 8, 2024
@xedin
Copy link
Contributor Author

xedin commented Mar 8, 2024

@swift-ci please smoke test

xedin added a commit to xedin/swift that referenced this pull request Apr 5, 2024
This approach regressed existing ternary expressions that join to `any Sendable`
and one brach is inferred from the ternary type variable.
xedin added a commit to xedin/swift that referenced this pull request Apr 5, 2024
This approach regressed existing ternary expressions that join to `any Sendable`
and one branch is inferred from the ternary type variable.
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