Consider this example:
protocol P : C {}
class C : P {}
<T where T : P>
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
[P].[concrete: C : Q]
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.
Consider this protocol and generic signature:
class C {}
protocol P : C {}
<T where T : P>
Normally the forwarding substitution map for the generic environment
looks like this:
- T := <<archetype for T>>
_ T : P := <<abstract conformance to P>>
However, if the class itself conforms to P, ie
class C : P {}
Then the conformance T : P must be the concrete conformance. Handle
this properly in MakeAbstractConformanceForGenericType.