@@ -2,16 +2,35 @@ func testAmbiguousFunctionReference() {
2
2
func foo( a: Int ) { }
3
3
func foo( a: String ) { }
4
4
5
- // RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):7 %s -- %s | %FileCheck %s
5
+ // RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):7 %s -- %s | %FileCheck %s --check-prefix LOCAL_FUNC
6
6
_ = foo
7
7
8
- // RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):7 %s -- %s | %FileCheck %s
8
+ // RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):7 %s -- %s | %FileCheck %s --check-prefix LOCAL_FUNC
9
9
_ = foo ( a: UInt ( 1 ) )
10
+
11
+ // LOCAL_FUNC: source.lang.swift.ref.function.free
12
+ // LOCAL_FUNC: <Declaration>func foo(a: <Type usr="s:Si">Int</Type>)</Declaration>
13
+ // LOCAL_FUNC: SECONDARY SYMBOLS BEGIN
14
+ // LOCAL_FUNC: source.lang.swift.ref.function.free
15
+ // LOCAL_FUNC: <Declaration>func foo(a: <Type usr="s:SS">String</Type>)</Declaration>
16
+ // LOCAL_FUNC: SECONDARY SYMBOLS END
10
17
}
11
18
12
- // CHECK: source.lang.swift.ref.function.free (2:8-2:19)
13
- // CHECK: <Declaration>func foo(a: <Type usr="s:Si">Int</Type>)</Declaration>
14
- // CHECK: SECONDARY SYMBOLS BEGIN
15
- // CHECK: source.lang.swift.ref.function.free (3:8-3:22)
16
- // CHECK: <Declaration>func foo(a: <Type usr="s:SS">String</Type>)</Declaration>
17
- // CHECK: SECONDARY SYMBOLS END
19
+
20
+
21
+ struct TestDeduplicateResults {
22
+ // The constraints system produces multiple solutions here for the argument type but
23
+ // all reference the same declaration. Check that we de-duplicate them and that we
24
+ // don’t report any secondary sybmols.
25
+ static func staticFunc( _ duration: Int ) { }
26
+
27
+ func test( ) {
28
+ // RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):10 %s -- %s | %FileCheck %s --check-prefix STATIC_FUNC
29
+ Self . staticFunc ( 1 * 1e9 )
30
+ }
31
+
32
+ // STATIC_FUNC: source.lang.swift.ref.function.method.static
33
+ // STATIC_FUNC: <Declaration>static func staticFunc(_ duration: <Type usr="s:Si">Int</Type>)</Declaration>
34
+ // STATIC_FUNC: SECONDARY SYMBOLS BEGIN
35
+ // STATIC_FUNC-NEXT: SECONDARY SYMBOLS END
36
+ }
0 commit comments