@@ -100,52 +100,26 @@ CheckTypeWitnessResult checkTypeWitness(Type type,
100100 const NormalProtocolConformance *Conf,
101101 SubstOptions options = None);
102102
103- // / Describes the means of inferring an abstract type witness.
104- enum class AbstractTypeWitnessKind : uint8_t {
105- // / The type witness was inferred via a same-type-to-concrete constraint
106- // / in a protocol requirement signature.
107- Fixed,
108-
109- // / The type witness was inferred via a defaulted associated type.
110- Default,
111-
112- // / The type witness was inferred to a generic parameter of the
113- // / conforming type.
114- GenericParam,
115- };
116-
117103// / A type witness inferred without the aid of a specific potential
118104// / value witness.
119105class AbstractTypeWitness {
120- AbstractTypeWitnessKind Kind;
121106 AssociatedTypeDecl *AssocType;
122107 Type TheType;
123108
124- // / When this is a default type witness, the declaration responsible for it .
125- // / May not necessarilly match \c AssocType.
109+ // / The defaulted associated type that was used to infer this type witness .
110+ // / Need not necessarilly match \c AssocType, but their names must .
126111 AssociatedTypeDecl *DefaultedAssocType;
127112
128- AbstractTypeWitness (AbstractTypeWitnessKind Kind,
129- AssociatedTypeDecl *AssocType, Type TheType,
130- AssociatedTypeDecl *DefaultedAssocType)
131- : Kind(Kind), AssocType(AssocType), TheType(TheType),
113+ public:
114+ AbstractTypeWitness ( AssociatedTypeDecl *AssocType, Type TheType,
115+ AssociatedTypeDecl *DefaultedAssocType = nullptr )
116+ : AssocType(AssocType), TheType(TheType),
132117 DefaultedAssocType (DefaultedAssocType) {
133118 assert (AssocType && TheType);
119+ assert (!DefaultedAssocType ||
120+ (AssocType->getName () == DefaultedAssocType->getName ()));
134121 }
135122
136- public:
137- static AbstractTypeWitness forFixed (AssociatedTypeDecl *assocType, Type type);
138-
139- static AbstractTypeWitness forDefault (AssociatedTypeDecl *assocType,
140- Type type,
141- AssociatedTypeDecl *defaultedAssocType);
142-
143- static AbstractTypeWitness forGenericParam (AssociatedTypeDecl *assocType,
144- Type type);
145-
146- public:
147- AbstractTypeWitnessKind getKind () const { return Kind; }
148-
149123 AssociatedTypeDecl *getAssocType () const { return AssocType; }
150124
151125 Type getType () const { return TheType; }
0 commit comments