Skip to content

Commit bdfa927

Browse files
author
Itai Ferber
committed
Fix crash in AST printing
Extensions need not have nominal types, e.g. extension Int : Codable { ... } where typealias Codable = Encodable & Decodable
1 parent 3e6eb8f commit bdfa927

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ struct SynthesizedExtensionAnalyzer::Implementation {
203203
unsigned countInherits(ExtensionDecl *ED) {
204204
unsigned Count = 0;
205205
for (auto TL : ED->getInherited()) {
206-
if (shouldPrint(TL.getType()->getAnyNominal(), Options))
206+
auto *nominal = TL.getType()->getAnyNominal();
207+
if (nominal && shouldPrint(nominal, Options))
207208
Count ++;
208209
}
209210
return Count;

0 commit comments

Comments
 (0)