Skip to content

Restrict implicit opening of existentials based on the generic function's requirements #42085

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

DougGregor
Copy link
Member

Rather than looking solely at the existential argument of a generic
function to determine whether it self-conforms, compare the
existential argument against each of the protocols to which the
corresponding generic parameter conforms. This better models when the
existential value itself will successfully meet the requirements of
the generic function, and therefore not require opening.

This provides far better source compatibility by not changing
semantics of existing, well-formed calls, and eliminates the need to
special-case CoW-related operations in the standard library.

…on's requirements

Rather than looking solely at the existential argument of a generic
function to determine whether it self-conforms, compare the
existential argument against each of the protocols to which the
corresponding generic parameter conforms. This better models when the
existential value itself will successfully meet the requirements of
the generic function, and therefore not require opening.

This provides far better source compatibility by not changing
semantics of existing, well-formed calls, and eliminates the need to
special-case CoW-related operations in the standard library.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit edc49bc into swiftlang:main Mar 29, 2022
@DougGregor DougGregor deleted the implicit-open-generic-func-reqs-check branch March 29, 2022 22:07
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.

1 participant