RequirementMachine: Fix minimization when protocol is constrained to a class that conforms to the protocol #41615
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Consider this example:
The GenericSignatureBuilder thinks the minimized signature is
<T where T : P>
. The RequirementMachine would minimize it down to<T where T : C>
. The latter is more correct, since the conformance here is concrete and no witness table needs to be passed in at runtime, however for strict binary compatibility we need to produce the same signature as the GenericSignatureBuilder.Accomplish this by changing the minimal conformances algorithm to detect "circular concrete conformance rules", which take the form
Where Q : P. These rules are given special handling. Ordinarily a protocol conformance rule is eliminated before a concrete conformance rule; however concrete conformances derived from circular conformances are considered to be redundant from the get-go, preventing protocol conformances that can be written in terms of such concrete conformances from themselves becoming redundant.
Fixes rdar://problem/89633532.