Skip to content

GSB: Narrow scope of conditional requirement inference #36460

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

slavapestov
Copy link
Contributor

If we have a conformance requirement T : P, and a concrete type
requirement T == G<...>, and G conditionally conforms to P,
we would infer the conditional requirements of G needed to
satisfy the conformance.

However, if the conformance requirement T : P was not explicit,
this would mean in practice that we would need to infer an
infinite number of conditional requirements, because there
might be an infinite number of types T for which T : P.

Previously we would infer these up to some limit, based on
how many levels of nested types the GSB had expanded.

Since this is untenable, let's instead change the rules so
that conditional requirement inference is only performed
when the concretizing requirement was explicit.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

If we have a conformance requirement T : P, and a concrete type
requirement T == G<...>, and G _conditionally_ conforms to P,
we would infer the conditional requirements of G needed to
satisfy the conformance.

However, if the conformance requirement T : P was not explicit,
this would mean in practice that we would need to infer an
infinite number of conditional requirements, because there
might be an infinite number of types T for which T : P.

Previously we would infer these up to some limit, based on
how many levels of nested types the GSB had expanded.

Since this is untenable, let's instead change the rules so
that conditional requirement inference is only performed
when the concretizing requirement was explicit.
@slavapestov slavapestov force-pushed the non-well-founded-conditional-requirement-inference branch from dc16a2e to 8e4598e Compare March 17, 2021 03:29
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov slavapestov merged commit 24e4aad into swiftlang:main Mar 17, 2021
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