-
Notifications
You must be signed in to change notification settings - Fork 10.5k
TypeCheckType: Fix existential any
migration diagnostics for extra-modular protocols
#65112
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
TypeCheckType: Fix existential any
migration diagnostics for extra-modular protocols
#65112
Conversation
/// value requirement. | ||
/// | ||
/// @Note This method does not take the state of language features into | ||
/// account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also pass in the usage context into existentialRequiresAny
so the method itself accounts for language feature state, but the ExistentialRequiresAny
request does not. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to but that is what the serializer calls to obtain the evaluation result, which is somewhat misleading in my opinion. I think we should rename the request to something like HasSelfOrAssociatedTypeRequirements
and pair it with a method to use in the serializer so that existentialRequiresAny
could account for language feature state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 that sounds like a good approach to me (and we don't need to do that as part of this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@swift-ci please smoke test |
Hah. That's true! |
…modular protocols
1939ca0
to
8d1d526
Compare
@swift-ci please smoke test |
@AnthonyLatsis will you please cherry-pick this to |
Sure. I was waiting for a green light on #65132 so that I can cherry-pick it as well. I’ve got more related fixes coming up and I would prefer them to layer up cleanly on both branches. |
any
migration diagnostics for extra-modular protocols
There are two issues:
ExistentialRequiresAnyRequest
is dependent on whether theExistentialAny
feature is enabled in the current compiler invocation, but the evaluation is bypassed for deserialized protocols because the result of the request is part of the serialized record. This madeexistentialRequiresAny()
independent of the feature state for deserialized protocols (Enabling upcoming featureExistentialAny
does not work for standard library protocols. #65034).ExistentialRequiresAnyRequest
must not depend on the feature state, or else is will persist in module files and override the feature state for protocols originating in those modules. In other words, the feature must not be enforced on protocols originating in a different module just because that module was compiled with the feature enabled.Resolves #65034
IMO there is no reason not to accept this into 5.9, but I would also vote to take it into 5.8 because the issue affects the new migration experience for a pretty impactful upcoming feature.