File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -7433,9 +7433,15 @@ bool InvalidMemberRefOnProtocolMetatype::diagnoseAsError() {
7433
7433
if (auto *whereClause = extension->getTrailingWhereClause ()) {
7434
7434
auto sourceRange = whereClause->getSourceRange ();
7435
7435
note.fixItInsertAfter (sourceRange.End , " , Self == <#Type#> " );
7436
- } else {
7437
- auto nameRepr = extension->getExtendedTypeRepr ();
7438
- note.fixItInsertAfter (nameRepr->getEndLoc (), " where Self == <#Type#>" );
7436
+ } else if (auto nameRepr = extension->getExtendedTypeRepr ()) {
7437
+ // Type repr is not always available so we need to be defensive
7438
+ // about its presence and validity.
7439
+ if (nameRepr->isInvalid ())
7440
+ return true ;
7441
+
7442
+ if (auto noteLoc = nameRepr->getEndLoc ()) {
7443
+ note.fixItInsertAfter (noteLoc, " where Self == <#Type#>" );
7444
+ }
7439
7445
}
7440
7446
7441
7447
return true ;
You can’t perform that action at this time.
0 commit comments