Skip to content

Commit c283028

Browse files
committed
[SIL] Print full nested enum type name
ASTPrinter should print an extended type for enums, (same as structs and classes) along with enum parents.
1 parent 76af5c5 commit c283028

File tree

3 files changed

+298
-259
lines changed

3 files changed

+298
-259
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,12 @@ static void printExtendedTypeName(Type ExtendedType, ASTPrinter &Printer,
17721772
Printer << ".";
17731773
}
17741774
}
1775+
if (auto et = ExtendedType->getAs<EnumType>()) {
1776+
if (auto ParentType = et->getParent()) {
1777+
ParentType.print(Printer, Options);
1778+
Printer << ".";
1779+
}
1780+
}
17751781

17761782
// Respect alias type.
17771783
if (isa<NameAliasType>(ExtendedType.getPointer())) {

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)