Commit Graph

18 Commits

Author SHA1 Message Date
Slava Pestov
02e402721d RequirementMachine: Print opaque archetypes using the 'stable' representation 2022-03-22 17:20:48 -04:00
Slava Pestov
cca936e790 RequirementMachine: Don't consider protocol typealiases with UnboundGenericType
These are stealth generic typealiases and should not participate in the
rewrite system.
2022-03-21 12:19:29 -04:00
Slava Pestov
54c83ead9e RequirementMachine: Make some low-cost assertions unconditional 2022-03-11 17:28:01 -05:00
Slava Pestov
5404754cb7 RequirementMachine: More concise printed output for concrete type and superclass symbols
Types cannot contain Terms, so the Symbol representation uses
GenericTypeParameterTypes whose index refers to an array of
"substitution" Terms.

We can (ab)use the PrintOptions.AlternateTypeNames mechanism
to print those GenericTypeParamTypes as if they were Terms.
2022-02-16 16:27:40 -05:00
Slava Pestov
0cf2881edf RequirementMachine: Simplify Symbol internal storage 2022-02-07 18:57:45 -05:00
Slava Pestov
0d0bcb2ff1 RequirementMachine: Simplify the Symbol API for removal of merged associated types 2022-02-07 18:57:45 -05:00
Slava Pestov
037dc98845 RequirementMachine: Generalize compare() methods to return None instead of asserting on incomparable symbols 2022-02-07 08:20:59 -05:00
Slava Pestov
4f3d05f502 RequirementMachine: Remove Symbol::getSuperclass() 2022-02-04 22:47:19 -05:00
Slava Pestov
1d5fdc3e62 RequirementMachine: Implement linear order on concrete type symbols with the same concrete type 2021-12-13 16:51:51 -05:00
Slava Pestov
26293c4695 RequirementMachine: Factor out Symbol::withConcreteSubstitutions() 2021-12-07 15:31:47 -05:00
Slava Pestov
d19b15b66c RequirementMachine: Introduce Symbol::Kind::ConcreteConformance 2021-12-06 23:04:46 -05:00
Slava Pestov
0571b65cb8 RequirementMachine: Move protocol linear order from ProtocolGraph to RewriteContext 2021-10-21 19:00:10 -04:00
Slava Pestov
941438d6c8 RequirementMachine: New linear order on associated type symbols
Previously we said that if P1 inherits from P2, then [P1:T] < [P2:T].

However, this didn't generalize to merged associated type symbols;
we always had [P1&P2:T] < [P3:T] even if P3 inherited from both P1
and P2.

This meant that the 'merge' operation did not preserve order, which
fired an assertion in the completion logic.

Fix this by generalizing the linear order to compare the 'support'
of protocols rather than the 'depth', where the 'support' is
defined as the size of the transitive closure of the set under
protocol inheritance.

Then, if you have something like

  protocol P1 {}
  protocol P2 {}
  protocol P3 : P1, P2 {}

The support of 'P1 & P2' is 2, and the support of 'P3' is 3,
therefore [P3:T] < [P1&P2:T] in this example.

Fixes <rdar://problem/83768458>.
2021-10-21 19:00:10 -04:00
Slava Pestov
0309cfa3d6 RequirementMachine: Reduction order on symbols should compare associated type name before protocols
The canonical order on associated types compares the name before the
protocol, so for example T.[P2:A] < T.[P1:B]. Make sure the reduction
order does the same so that we correctly compute canonical types in
this case.
2021-09-09 23:40:28 -04:00
Slava Pestov
92ac06a25b RequirementMachine: Rules store uniqued Terms 2021-08-05 21:42:50 -04:00
Slava Pestov
ed966e7337 RequirementMachine: Add histograms for symbol kinds and term length 2021-08-05 21:42:50 -04:00
Slava Pestov
fb5d180afd RequirementMachine: Superclass and concrete type symbols should not contain type variables 2021-08-05 21:42:49 -04:00
Slava Pestov
7adfd86e37 RequirementMachine: Split off Symbol.cpp and Term.cpp from RewriteSystem.cpp 2021-08-05 21:42:49 -04:00