1- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COVARIANT_RETURN_CONV | % FileCheck %s --check-prefix=COVARIANT_RETURN_CONV
1+ // RUN: %target-swift-ide-test -batch- code-completion -source-filename %s -filecheck %raw- FileCheck -completion-output-dir %t
22
33class BaseClass {
44 func returnSelf( ) -> Self { }
@@ -7,14 +7,22 @@ class BaseClass {
77class DerivedClass : BaseClass {
88 var value : Int
99 func foo( ) { }
10- }
1110
12- func test ( value : DerivedClass ) {
13- value . returnSelf ( ) . #^COVARIANT_RETURN_CONV ^#
14- // COVARIANT_RETURN_CONV: Begin completions, 4 items
15- // COVARIANT_RETURN_CONV-DAG: Keyword[self]/CurrNominal: self[#DerivedClass#];
16- // COVARIANT_RETURN_CONV-DAG: Decl[InstanceVar]/CurrNominal: value[#Int#];
17- // COVARIANT_RETURN_CONV-DAG: Decl[InstanceMethod]/CurrNominal: foo()[#Void#];
18- // COVARIANT_RETURN_CONV-DAG: Decl[InstanceMethod]/Super: returnSelf()[#Self#];
19- // COVARIANT_RETURN_CONV: End completions
11+ func testWithStaticSelf ( ) {
12+ self . returnSelf ( ) . #^COVARIANT_SELF_RETURN_STATIC ? check = COVARIANT_SELF_RETURN ^#
13+ }
14+
15+ func testWithDynamicSelf ( ) -> Self {
16+ self . returnSelf ( ) . #^COVARIANT_SELF_RETURN_DYNAMIC ? check = COVARIANT_SELF_RETURN^#
17+ return self
18+ }
2019}
20+
21+ // COVARIANT_SELF_RETURN: Begin completions, 6 items
22+ // COVARIANT_SELF_RETURN-DAG: Keyword[self]/CurrNominal: self[#{{Self|DerivedClass}}#];
23+ // COVARIANT_SELF_RETURN-DAG: Decl[InstanceVar]/CurrNominal: value[#Int#];
24+ // COVARIANT_SELF_RETURN-DAG: Decl[InstanceMethod]/CurrNominal: foo()[#Void#];
25+ // COVARIANT_SELF_RETURN-DAG: Decl[InstanceMethod]/Super: returnSelf()[#Self#];
26+ // COVARIANT_SELF_RETURN-DAG: Decl[InstanceMethod]/CurrNominal: testWithStaticSelf()[#Void#];
27+ // COVARIANT_SELF_RETURN-DAG: Decl[InstanceMethod]/CurrNominal: testWithDynamicSelf()[#Self#];
28+ // COVARIANT_SELF_RETURN: End completions
0 commit comments