Commit Graph

8 Commits

Author SHA1 Message Date
Slava Pestov
ea15d9f9b2 Stop passing -warn-redundant-requirements in tests 2024-02-02 14:57:19 -05:00
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
f39372b33d RequirementMachine: Turn off redundant requirement warnings by default and add -warn-redundant-requirements frontend flag 2022-05-10 01:49:56 -04:00
Holly Borla
2f7018b605 [RequirementMachine] Don't suppress redundancy diagnostics when the
non-explicit, non-redundant replacement rule is not in the rewrite
system's minimization domain.
2022-03-09 12:14:58 -08:00
Slava Pestov
e4973158d8 AST: -debug-generic-signatures protocol-qualifies DependentMemberTypes 2022-01-19 22:36:15 -05:00
Slava Pestov
82a494e31b RequirementMachine: Go back to doing three passes in homotopy reduction
First pass:
- Eliminate rules with unresolved name symbols in LHS
- Eliminate simplified non-conformance rules

Second pass:
- Eliminate non-minimal conformance rules

Third pass:
- Eliminate all other non-conformance rules

If you have a concrete requirement with a non-canonical substitution, like

    A : P, A == G<B.T>

We add an induced rule for the abstract type witness,

    A.T == B.T

This rule has a rewrite path in terms of the previous two rules, but we
want to try to eliminate the other two rules first.

This new ordering ensures we eliminate the simplified rule A == G<B.T> and
compute minimal conformances before we get around to considering A.T == B.T,
which can no longer be eliminated by that point.

If we eliminate A.T == B.T first, we end up with simplified concrete
type and concrete conformance rules which cannot be eliminated:

    A.[concrete: G<B.T>] => A
    A.[concrete: G<B.T> : P] => A

This changes the minimized signature in an incompatible way in two test cases.

In Generics/rdar83308672.swift, the signature becomes equivalent to what the
GSB used to output.

In Generics/sr10532.swift, the GSB would output an invalid signature anyway,
so it doesn't matter.
2021-12-17 10:04:52 -05:00
Slava Pestov
a729bebbc4 RequirementMachine: Improved rule deletion heuristic
Instead of finding the best redundancy candidate from the first
homotopy generator that has one, find the best redundancy
candidate from *all* homotopy generators that have one.

This correctly minimizes the "Joe Groff monoid" without hitting
the assertion guarding against simplified rules being non-redundant.

It also brings us closer to being able to correctly minimize
the protocol from https://bugs.swift.org/browse/SR-7353.
2021-10-27 00:38:33 -04:00
Slava Pestov
8ab330a32d RequirementMachine: Add some testcases 2021-10-09 19:11:15 -04:00