Skip to content

Commit fdcbefc

Browse files
committed
[Completion] Add a test case for CaseIterable enum in other file
Make sure 'allCases' is suggested even if the enum decl is in a different file. rdar://problem/57489427
1 parent 12fd207 commit fdcbefc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/IDE/complete_multifile.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct Lens<T> {
2525
}
2626
}
2727

28-
enum MyEnum: String {
28+
enum MyEnum: String, CaseIterable {
2929
case foo = "foo"
3030
case bar = "bar"
3131
}
@@ -72,13 +72,15 @@ func testDynamicMemberLookup(lens: Lens<Point>) {
7272
}
7373
func testRawRepresentable() {
7474
MyEnum.#^MYENUM_DOT^#
75-
// MYENUM_DOT: Begin completions, 7 items
75+
// MYENUM_DOT: Begin completions, 9 items
7676
// MYENUM_DOT-DAG: Keyword[self]/CurrNominal: self[#MyEnum.Type#];
7777
// MYENUM_DOT-DAG: Keyword/CurrNominal: Type[#MyEnum.Type#];
7878
// MYENUM_DOT-DAG: Decl[EnumElement]/CurrNominal: foo[#MyEnum#];
7979
// MYENUM_DOT-DAG: Decl[EnumElement]/CurrNominal: bar[#MyEnum#];
8080
// MYENUM_DOT-DAG: Decl[TypeAlias]/CurrNominal: RawValue[#String#];
8181
// MYENUM_DOT-DAG: Decl[Constructor]/CurrNominal: init({#rawValue: String#})[#MyEnum?#];
82+
// MYENUM_DOT-DAG: Decl[TypeAlias]/CurrNominal: AllCases[#[MyEnum]#];
83+
// MYENUM_DOT-DAG: Decl[StaticVar]/CurrNominal: allCases[#[MyEnum]#];
8284
// MYENUM_DOT-DAG: Decl[InstanceMethod]/Super: hash({#(self): MyEnum#})[#(into: inout Hasher) -> Void#];
8385
// MYENUM_DOT: End completions
8486
}

0 commit comments

Comments
 (0)