Commit Graph

3 Commits

Author SHA1 Message Date
Doug Gregor
de66b0c25c [GSB] Warn about redeclarations of associated types from inherited protocols.
Introduce a warning about redeclaring the associated types from an
inherited protocol in the protocol being checked:

* If the new declaration is an associated type, note that the
  declaration could be replaced by requirements in the protocol's
  where clause.
* If the new declaration is a typealias, note that it could be
  replaced by a same-type constraint in the protocol's where clause.
2017-04-24 07:55:42 -07:00
Doug Gregor
eaee4add8a [GSB] Track all conformance constraint sources.
Move the storage for the protocols to which a particular potential
archetype conforms into EquivalenceClass, so that it is more easily
shared. More importantly, keep track of *all* of the constraint
sources that produced a particular conformance requirement, so we can
revisit them later, which provides a number of improvements:

* We can drop self-derived requirements at the end, once we've
  established all of the equivalence classes
* We diagnose redundant conformance requirements, e.g., "T: Sequence"
  is redundant if "T: Collection" is already specified.
* We can choose the best path when forming the conformance access
  path.
2017-03-16 23:15:37 -10:00
Doug Gregor
200d7d77f1 [Archetype builder] Infer same-type constraints for same-named associated types.
When two associated types with the same name are on the same dependent
type T, introduce a same-type constraint between the the corresponding
potential archetypes. This eliminates ordering dependencies in the
archetype builder.

Fixes the reduced test case from rdar://problem/23149063, but doesn't
fully address the idea that we should be tracking associated type
redeclarations in a meaningful way.
2017-01-24 19:36:44 -08:00