File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -1294,9 +1294,13 @@ namespace {
1294
1294
OS << " \" )" ;
1295
1295
});
1296
1296
}
1297
- auto lifetimeString = getDumpString (VD->getLifetimeAnnotation ());
1298
- if (!lifetimeString.empty ())
1299
- printFlag (lifetimeString);
1297
+ // In some cases, getLifetimeAnnotation() can fail before extension
1298
+ // binding. hasResolvedImports() approximates an extension binding check.
1299
+ if (VD->getModuleContext ()->hasResolvedImports ()) {
1300
+ auto lifetimeString = getDumpString (VD->getLifetimeAnnotation ());
1301
+ if (!lifetimeString.empty ())
1302
+ printFlag (lifetimeString);
1303
+ }
1300
1304
}
1301
1305
1302
1306
void printCommon (NominalTypeDecl *NTD, const char *Name, StringRef Label,
@@ -1802,8 +1806,13 @@ void swift::printContext(raw_ostream &os, DeclContext *dc) {
1802
1806
break ;
1803
1807
1804
1808
case DeclContextKind::ExtensionDecl:
1805
- if (auto extendedNominal = cast<ExtensionDecl>(dc)->getExtendedNominal ()) {
1809
+ if (auto repr = cast<ExtensionDecl>(dc)->getExtendedTypeRepr ()) {
1810
+ repr->print (os);
1811
+ } else if (cast<ExtensionDecl>(dc)->hasBeenBound ()) {
1812
+ auto extendedNominal = cast<ExtensionDecl>(dc)->getExtendedNominal ();
1806
1813
printName (os, extendedNominal->getName ());
1814
+ } else {
1815
+ os << " <unbound>" ;
1807
1816
}
1808
1817
os << " extension" ;
1809
1818
break ;
You can’t perform that action at this time.
0 commit comments