@@ -2158,8 +2158,7 @@ bool ConformanceChecker::checkObjCTypeErasedGenerics(
2158
2158
2159
2159
void ConformanceChecker::recordTypeWitness (AssociatedTypeDecl *assocType,
2160
2160
Type type,
2161
- TypeDecl *typeDecl,
2162
- bool performRedeclarationCheck) {
2161
+ TypeDecl *typeDecl) {
2163
2162
2164
2163
// If we already recoded this type witness, there's nothing to do.
2165
2164
if (Conformance->hasTypeWitness (assocType)) {
@@ -2210,26 +2209,6 @@ void ConformanceChecker::recordTypeWitness(AssociatedTypeDecl *assocType,
2210
2209
}
2211
2210
} else {
2212
2211
// If there was no type declaration, synthesize one.
2213
-
2214
- // If we're just setting an error, double-check that nobody has
2215
- // introduced a type declaration since we deduced one. This can
2216
- // happen when type-checking a different conformance deduces a
2217
- // different type witness with the same name. For non-error cases,
2218
- // the caller handles this.
2219
- if (performRedeclarationCheck && type->hasError ()) {
2220
- switch (resolveTypeWitnessViaLookup (assocType)) {
2221
- case ResolveWitnessResult::Success:
2222
- case ResolveWitnessResult::ExplicitFailed:
2223
- // A type witness has shown up, and will have been
2224
- // recorded. There is nothing more to do.
2225
- return ;
2226
-
2227
- case ResolveWitnessResult::Missing:
2228
- // The type witness is still missing: create a new one.
2229
- break ;
2230
- }
2231
- }
2232
-
2233
2212
auto aliasDecl = new (TC.Context ) TypeAliasDecl (SourceLoc (),
2234
2213
SourceLoc (),
2235
2214
assocType->getName (),
@@ -2294,8 +2273,7 @@ void ConformanceChecker::recordTypeWitness(AssociatedTypeDecl *assocType,
2294
2273
auto overriddenRootConformance =
2295
2274
overriddenConformance->getConcrete ()->getRootNormalConformance ();
2296
2275
ConformanceChecker (TC, overriddenRootConformance, GlobalMissingWitnesses)
2297
- .recordTypeWitness (overridden, type, typeDecl,
2298
- /* performRedeclarationCheck=*/ true );
2276
+ .recordTypeWitness (overridden, type, typeDecl);
2299
2277
}
2300
2278
}
2301
2279
@@ -3197,12 +3175,12 @@ ResolveWitnessResult ConformanceChecker::resolveTypeWitnessViaLookup(
3197
3175
auto interfaceType = viable.front ().MemberType ;
3198
3176
if (interfaceType->hasArchetype ())
3199
3177
interfaceType = interfaceType->mapTypeOutOfContext ();
3200
- recordTypeWitness (assocType, interfaceType, viable.front ().Member , true );
3178
+ recordTypeWitness (assocType, interfaceType, viable.front ().Member );
3201
3179
return ResolveWitnessResult::Success;
3202
3180
}
3203
3181
3204
3182
// Record an error.
3205
- recordTypeWitness (assocType, ErrorType::get (TC.Context ), nullptr , false );
3183
+ recordTypeWitness (assocType, ErrorType::get (TC.Context ), nullptr );
3206
3184
3207
3185
// If we had multiple viable types, diagnose the ambiguity.
3208
3186
if (!viable.empty ()) {
0 commit comments