@@ -536,10 +536,10 @@ Type TypeResolution::resolveTypeInContext(TypeDecl *typeDecl,
536
536
typeDecl->getDeclContext ()->getSelfProtocolDecl ()) {
537
537
// When looking up a nominal type declaration inside of a
538
538
// protocol extension, always use the nominal type and
539
- // not the protocol 'Self' type.
540
- if (!foundDC-> getDeclaredInterfaceType ())
541
- return ErrorType::get (ctx);
542
-
539
+ // not the protocol 'Self' type. This is invalid and will
540
+ // be diagnosed anyway, but we want to avoid an invariant
541
+ // violation from trying to construct a nominal type with
542
+ // a generic parameter as its parent type.
543
543
selfType = foundDC->getDeclaredInterfaceType ();
544
544
} else {
545
545
// Otherwise, we want the protocol 'Self' type for
@@ -735,7 +735,8 @@ void swift::diagnoseInvalidGenericArguments(SourceLoc loc,
735
735
// / error.
736
736
// /
737
737
// / \see TypeResolution::applyUnboundGenericArguments
738
- static Type applyGenericArguments (Type type, TypeResolution resolution,
738
+ static Type applyGenericArguments (Type type,
739
+ const TypeResolution &resolution,
739
740
SILTypeResolutionContext *silContext,
740
741
DeclRefTypeRepr *repr) {
741
742
auto options = resolution.getOptions ();
@@ -1249,7 +1250,7 @@ static void maybeDiagnoseBadConformanceRef(DeclContext *dc,
1249
1250
1250
1251
// / Returns a valid type or ErrorType in case of an error.
1251
1252
static Type resolveTypeDecl (TypeDecl *typeDecl, DeclContext *foundDC,
1252
- TypeResolution resolution,
1253
+ const TypeResolution & resolution,
1253
1254
SILTypeResolutionContext *silContext,
1254
1255
UnqualifiedIdentTypeRepr *repr) {
1255
1256
// Resolve the type declaration to a specific type. How this occurs
@@ -1306,7 +1307,7 @@ static std::string getDeclNameFromContext(DeclContext *dc,
1306
1307
// /
1307
1308
// / \returns either the corrected type, if possible, or an error type to
1308
1309
// / that correction failed.
1309
- static Type diagnoseUnknownType (TypeResolution resolution,
1310
+ static Type diagnoseUnknownType (const TypeResolution & resolution,
1310
1311
Type parentType,
1311
1312
SourceRange parentRange,
1312
1313
DeclRefTypeRepr *repr,
@@ -1570,7 +1571,7 @@ static SelfTypeKind getSelfTypeKind(DeclContext *dc,
1570
1571
}
1571
1572
}
1572
1573
1573
- static void diagnoseGenericArgumentsOnSelf (TypeResolution resolution,
1574
+ static void diagnoseGenericArgumentsOnSelf (const TypeResolution & resolution,
1574
1575
UnqualifiedIdentTypeRepr *repr,
1575
1576
DeclContext *typeDC) {
1576
1577
ASTContext &ctx = resolution.getASTContext ();
@@ -1597,7 +1598,7 @@ static void diagnoseGenericArgumentsOnSelf(TypeResolution resolution,
1597
1598
// / \returns Either the resolved type or a null type, the latter of
1598
1599
// / which indicates that some dependencies were unsatisfied.
1599
1600
static Type
1600
- resolveUnqualifiedIdentTypeRepr (TypeResolution resolution,
1601
+ resolveUnqualifiedIdentTypeRepr (const TypeResolution & resolution,
1601
1602
SILTypeResolutionContext *silContext,
1602
1603
UnqualifiedIdentTypeRepr *repr) {
1603
1604
const auto options = resolution.getOptions ();
@@ -1773,7 +1774,7 @@ static void diagnoseAmbiguousMemberType(Type baseTy, SourceRange baseRange,
1773
1774
// / lookup within the given parent type, returning the type it
1774
1775
// / references.
1775
1776
// / \param silContext Used to look up generic parameters in SIL mode.
1776
- static Type resolveQualifiedIdentTypeRepr (TypeResolution resolution,
1777
+ static Type resolveQualifiedIdentTypeRepr (const TypeResolution & resolution,
1777
1778
SILTypeResolutionContext *silContext,
1778
1779
Type parentTy,
1779
1780
QualifiedIdentTypeRepr *repr) {
0 commit comments