Skip to content

Commit 3770869

Browse files
authored
Merge pull request #14704 from polac24/ast-nested-enum-type
[SIL] Print full nested enum type name
2 parents 046fb41 + ff05efe commit 3770869

File tree

3 files changed

+294
-267
lines changed

3 files changed

+294
-267
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,14 +1760,8 @@ static void printExtendedTypeName(Type ExtendedType, ASTPrinter &Printer,
17601760
PrintOptions Options) {
17611761
auto Nominal = ExtendedType->getAnyNominal();
17621762
assert(Nominal && "extension of non-nominal type");
1763-
if (auto ct = ExtendedType->getAs<ClassType>()) {
1764-
if (auto ParentType = ct->getParent()) {
1765-
ParentType.print(Printer, Options);
1766-
Printer << ".";
1767-
}
1768-
}
1769-
if (auto st = ExtendedType->getAs<StructType>()) {
1770-
if (auto ParentType = st->getParent()) {
1763+
if (auto nt = ExtendedType->getAs<NominalType>()) {
1764+
if (auto ParentType = nt->getParent()) {
17711765
ParentType.print(Printer, Options);
17721766
Printer << ".";
17731767
}

test/SIL/printer_include_decls.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,18 @@ class Foo {
3636

3737
func m() {}
3838
// CHECK: func m()
39+
40+
enum E {}
41+
// CHECK: enum E
3942
}
4043

4144
func bar(x: Foo) -> Int {
4245
return x.x
4346
}
4447
// CHECK: func bar(x: Foo) -> Int
48+
49+
extension Foo.E {
50+
// CHECK: extension Foo.E {
51+
func e(x: Foo.E) {}
52+
// CHECK: func e(x: Foo.E)
53+
}

0 commit comments

Comments
 (0)