Commit Graph

6 Commits

Author SHA1 Message Date
Slava Pestov
dac8d666ee Stop passing -requirement-machine-{abstract,inferred,protocol}-signatures flags in tests
These flags are now no-ops.
2022-05-10 12:56:17 -04:00
Slava Pestov
cdcc8ed8fc RequirementMachine: Enable loop normalization by default 2022-03-26 22:12:12 -04:00
Slava Pestov
b6a641bc07 RequirementMachine: New way of introducing concrete conformance rules
Define the relation as

    [concrete: C].[P] =>> [concrete: C].[concrete: C : P]

instead of

    [concrete: C].[P] =>> [concrete: C : P]

This changes the rewrite loop recorded for a rule T.[concrete: C : P]
to have (T.[concrete: C] => T) appearing twice in context instead of
just once.

We don't ever want a concrete conformance rule to be able to imply a
concrete type rule. This became possible with loop normalization
because the single occurrence of (T.[concrete: C] => T).[P] could
cancel with a subsequent step (T => T.[concrete: C]).[P] in another
rewrite loop after substitution.
2022-03-08 23:21:58 -05:00
Slava Pestov
8e09ba8b45 RequirementMachine: Introduce 'concrete contraction' pre-processing pass before building rewrite system
See the comment at the top of ConcreteContraction.cpp for a detailed explanation.

This can be turned off with the -disable-requirement-machine-concrete-contraction
pass, mostly meant for testing. A few tests now run with this pass both enabled
and disabled, to exercise code paths which are otherwise trivially avoided by
concrete contraction.

Fixes rdar://problem/88135912.
2022-02-25 11:48:38 -05:00
Slava Pestov
d39c667e26 RequirementMachine: New elimination order based on projection count
We want to prefer to eliminate rules that are not concrete type rules,
unless non-concrete type rule in question is a projection. For example,
suppose that this rule comes from a protocol:

    T.T == G<T.U, T.V>

And these three rules are in our minimization domain:

    a) T.T == G<Int, W>
    b) T.U == Int
    c) T.V == W

Then a) implies both b) and c), and vice versa.

In this case, we want to keep T.U == Int and T.V == W, and eliminate
T.T == G<Int, W>.

T.T == G<Int, W> is concrete and T.V == W is not, but because T.V == W
is defined by a projection, we still prefer to eliminate T.T == G<Int, W>
over T.V == W.
2022-02-09 11:31:35 -05:00
Slava Pestov
8e94fff3d4 RequirementMachine: Fix up concrete conformance handling in minimal conformances algorithm 2022-01-27 18:54:03 -05:00