Skip to content

Fix covariant erasure for constrained existentials #65785

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

angela-laar
Copy link
Contributor

@angela-laar angela-laar commented May 9, 2023

Constrained existential should be type erased to a dependent upper bound for parameterized protocols and generic classes.

let t: (any Sequence<Int>) = [1, 2]

for value in t {
    let v = value + 1 // the existential is opened so that `value` is generic parameter Int instead of Any
}

Fixes rdar://101343646

@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from 53ab11f to b7ea961 Compare May 9, 2023 02:01
@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from b7ea961 to 4014438 Compare May 9, 2023 02:11
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test macOS

@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch 2 times, most recently from f78b63c to b3d3263 Compare May 9, 2023 20:20
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch 2 times, most recently from 4eb2968 to d900dcd Compare May 9, 2023 23:22
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from d900dcd to 8a4f965 Compare May 10, 2023 23:34
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from 32670ee to 7c16b27 Compare May 11, 2023 19:04
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from 7c16b27 to 68186ce Compare May 12, 2023 06:57
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test macOS

@angela-laar
Copy link
Contributor Author

angela-laar commented May 12, 2023

Looks like a test in swiftpm/Tests is failing for macOS

@angela-laar angela-laar requested a review from rintaro as a code owner May 15, 2023 23:07
@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from fcbd2e1 to c56f99e Compare May 15, 2023 23:15
Constrained existentials should be type erased to an upper bound that is dependent on other type parameters.
@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from c56f99e to b5400ba Compare May 15, 2023 23:19
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

Opened existentials should be erased to the dependent upper bound
if the dependent member can be reduced to a concrete type. This
allows the generic signature to support parameterized protocol types
and bound generic class types by producing a more specific constraint
instead of just a plain protocol or class.
@angela-laar angela-laar force-pushed the fix-covariant-erasure-for-constrained-existentials branch from b5400ba to a9f1096 Compare May 17, 2023 22:40
@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test

@angela-laar
Copy link
Contributor Author

@swift-ci please smoke test linux

@xedin
Copy link
Contributor

xedin commented May 18, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor

xedin commented May 18, 2023

@swift-ci please test macOS platform

@xedin
Copy link
Contributor

xedin commented May 18, 2023

MovieSwift UPASS is unrelated to these changes.

@xedin
Copy link
Contributor

xedin commented May 18, 2023

:shipit:

@xedin xedin merged commit 3b1f392 into swiftlang:main May 18, 2023
angela-laar pushed a commit to angela-laar/swift that referenced this pull request Jun 6, 2023
…sure-for-constrained-existentials

Fix covariant erasure for constrained existentials
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.

3 participants