@@ -1351,38 +1351,6 @@ static void diagnoseUnboundGenericType(Type ty, SourceLoc loc) {
1351
1351
}
1352
1352
}
1353
1353
1354
- // Produce a diagnostic if the type we referenced was an
1355
- // associated type but the type itself was erroneous. We'll produce a
1356
- // diagnostic here if the diagnostic for the bad type witness would show up in
1357
- // a different context.
1358
- static void maybeDiagnoseBadConformanceRef (DeclContext *dc,
1359
- Type parentTy,
1360
- SourceLoc loc,
1361
- TypeDecl *typeDecl) {
1362
- auto protocol = dyn_cast<ProtocolDecl>(typeDecl->getDeclContext ());
1363
-
1364
- // If we weren't given a conformance, go look it up.
1365
- ProtocolConformance *conformance = nullptr ;
1366
- if (protocol) {
1367
- auto conformanceRef = lookupConformance (parentTy, protocol);
1368
- if (conformanceRef.isConcrete ())
1369
- conformance = conformanceRef.getConcrete ();
1370
- }
1371
-
1372
- // If any errors have occurred, don't bother diagnosing this cross-file
1373
- // issue.
1374
- ASTContext &ctx = dc->getASTContext ();
1375
- if (ctx.Diags .hadAnyError ())
1376
- return ;
1377
-
1378
- auto diagCode =
1379
- (!protocol || (conformance && !conformance->getConditionalRequirementsIfAvailable ()))
1380
- ? diag::unsupported_recursion_in_associated_type_reference
1381
- : diag::broken_associated_type_witness;
1382
-
1383
- ctx.Diags .diagnose (loc, diagCode, typeDecl, parentTy);
1384
- }
1385
-
1386
1354
// / Returns a valid type or ErrorType in case of an error.
1387
1355
static Type resolveTypeDecl (TypeDecl *typeDecl, DeclContext *foundDC,
1388
1356
const TypeResolution &resolution,
@@ -1392,16 +1360,6 @@ static Type resolveTypeDecl(TypeDecl *typeDecl, DeclContext *foundDC,
1392
1360
// depends on the current context and where the type was found.
1393
1361
Type type = resolution.resolveTypeInContext (typeDecl, foundDC,
1394
1362
repr->hasGenericArgList ());
1395
-
1396
- if (type->hasError () && foundDC &&
1397
- (isa<AssociatedTypeDecl>(typeDecl) || isa<TypeAliasDecl>(typeDecl))) {
1398
- auto fromDC = resolution.getDeclContext ();
1399
- assert (fromDC && " No declaration context for type resolution?" );
1400
- maybeDiagnoseBadConformanceRef (fromDC, foundDC->getDeclaredInterfaceType (),
1401
- repr->getNameLoc ().getBaseNameLoc (),
1402
- typeDecl);
1403
- }
1404
-
1405
1363
return applyGenericArguments (type, resolution, silContext, repr);
1406
1364
}
1407
1365
@@ -1934,8 +1892,7 @@ static Type resolveQualifiedIdentTypeRepr(const TypeResolution &resolution,
1934
1892
const auto parentRange = repr->getBase ()->getSourceRange ();
1935
1893
auto isExtensionBinding = options.is (TypeResolverContext::ExtensionBinding);
1936
1894
1937
- auto maybeDiagnoseBadMemberType = [&](TypeDecl *member, Type memberType,
1938
- AssociatedTypeDecl *inferredAssocType) {
1895
+ auto maybeDiagnoseBadMemberType = [&](TypeDecl *member, Type memberType) {
1939
1896
bool hasUnboundOpener = !!resolution.getUnboundTypeOpener ();
1940
1897
1941
1898
// Type aliases might require adjustment due to @preconcurrency.
@@ -1985,13 +1942,6 @@ static Type resolveQualifiedIdentTypeRepr(const TypeResolution &resolution,
1985
1942
}
1986
1943
}
1987
1944
1988
- // Diagnose a bad conformance reference if we need to.
1989
- if (!options.contains (TypeResolutionFlags::SilenceErrors) &&
1990
- inferredAssocType && memberType->hasError ()) {
1991
- maybeDiagnoseBadConformanceRef (DC, parentTy, repr->getLoc (),
1992
- inferredAssocType);
1993
- }
1994
-
1995
1945
// If there are generic arguments, apply them now.
1996
1946
return applyGenericArguments (memberType, resolution, silContext, repr);
1997
1947
};
@@ -2021,7 +1971,7 @@ static Type resolveQualifiedIdentTypeRepr(const TypeResolution &resolution,
2021
1971
if (auto *typeDecl = repr->getBoundDecl ()) {
2022
1972
auto memberType =
2023
1973
TypeChecker::substMemberTypeWithBase (typeDecl, parentTy);
2024
- return maybeDiagnoseBadMemberType (typeDecl, memberType, nullptr );
1974
+ return maybeDiagnoseBadMemberType (typeDecl, memberType);
2025
1975
}
2026
1976
2027
1977
// Phase 1: Find and bind the type declaration.
@@ -2063,7 +2013,6 @@ static Type resolveQualifiedIdentTypeRepr(const TypeResolution &resolution,
2063
2013
// If we didn't find anything, complain.
2064
2014
Type memberType;
2065
2015
TypeDecl *member = nullptr ;
2066
- AssociatedTypeDecl *inferredAssocType = nullptr ;
2067
2016
if (!memberTypes) {
2068
2017
// If we're not allowed to complain or we couldn't fix the
2069
2018
// source, bail out.
@@ -2078,11 +2027,10 @@ static Type resolveQualifiedIdentTypeRepr(const TypeResolution &resolution,
2078
2027
} else {
2079
2028
memberType = memberTypes.back ().MemberType ;
2080
2029
member = memberTypes.back ().Member ;
2081
- inferredAssocType = memberTypes.back ().InferredAssociatedType ;
2082
2030
repr->setValue (member, nullptr );
2083
2031
}
2084
2032
2085
- return maybeDiagnoseBadMemberType (member, memberType, inferredAssocType );
2033
+ return maybeDiagnoseBadMemberType (member, memberType);
2086
2034
}
2087
2035
2088
2036
static bool isDefaultNoEscapeContext (TypeResolutionOptions options) {
0 commit comments