Skip to content

Commit 3e95214

Browse files
committed
[CodeCompletion] Add test case for some/any type relations
This test case used to fail at some point but it’s passing now. Add it so that we don’t break it in the future. rdar://97897857
1 parent 352632b commit 3e95214

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck --completion-output-dir %t
3+
4+
protocol Shape {}
5+
6+
struct Square : Shape {}
7+
8+
struct Test {
9+
let protocolType: Shape
10+
let structType: Square
11+
12+
func testAny() -> any Shape {
13+
return self.#^WITH_ANY_CONTEXTUAL_TYPE^#
14+
// WITH_ANY_CONTEXTUAL_TYPE-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Convertible]: protocolType[#any Shape#];
15+
// WITH_ANY_CONTEXTUAL_TYPE-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Convertible]: structType[#Square#];
16+
}
17+
18+
func testSome() -> some Shape {
19+
return self.#^WITH_SOME_CONTEXTUAL_TYPE^#
20+
// WITH_SOME_CONTEXTUAL_TYPE-DAG: Decl[InstanceVar]/CurrNominal: protocolType[#any Shape#];
21+
// WITH_SOME_CONTEXTUAL_TYPE-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Convertible]: structType[#Square#];
22+
}
23+
}

0 commit comments

Comments
 (0)