Skip to content

Commit cbacadf

Browse files
committed
---
yaml --- r: 323295 b: refs/heads/tensorflow-next c: db2d388 h: refs/heads/master i: 323293: ad25a5b 323291: 8148b28 323287: 1e30328 323279: 460b7ec 323263: 23da612
1 parent d6a71f7 commit cbacadf

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,4 +1461,4 @@ refs/heads/master-rebranch: 86e95c23aa0d37f24ec138b7853146c1cead2e40
14611461
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14621462
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14631463
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec
1464-
refs/heads/tensorflow-next: f7574e4670c5f562dfc2903358496385914cfd77
1464+
refs/heads/tensorflow-next: db2d388117d42e8e4797bae6527ac346bbdd17a9
Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,48 @@
1+
public protocol Proto {
2+
associatedtype Assoc
3+
func method() -> Assoc
4+
}
5+
16
public class Base {}
27

3-
public protocol Proto {}
8+
public class Derived: Base, Proto {
9+
public func method() -> Int {}
10+
}
411

5-
public func foo() -> some Base & Proto {
6-
class Derived: Base, Proto {}
7-
return Derived()
12+
public struct S {
13+
public func foo<T>(x: T) -> some Base & Proto {
14+
return Derived()
15+
}
816
}
917

10-
// RUN: %sourcekitd-test -req=cursor -pos=5:13 %s -- %s | %FileCheck %s
11-
// CHECK: <Declaration>public func foo() -&gt; some <Type usr=[[Base_USR:.*]]>Base</Type> &amp; <Type usr=[[Proto_USR:.*]]>Proto</Type></Declaration>
12-
// CHECK: <decl.function.free><syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>foo</decl.name>() -&gt; <decl.function.returntype><syntaxtype.keyword>some</syntaxtype.keyword> <ref.class usr=[[Base_USR]]>Base</ref.class> &amp; <ref.protocol usr=[[Proto_USR]]>Proto</ref.protocol></decl.function.returntype></decl.function.free>
18+
func test(value: S) {
19+
let _ = value.foo(x: 12)
20+
}
21+
22+
// RUN: %sourcekitd-test -req=cursor -pos=13:15 %s -- %s -module-name Test | %FileCheck %s -check-prefix=DECLSITE
23+
// DECLSITE: source.lang.swift.decl.function.method.instance (13:15-13:27)
24+
// DECLSITE-NEXT: foo(x:)
25+
// DECLSITE-NEXT: s:4Test1SV3foo1xQrx_tlF
26+
// DECLSITE-NEXT: <T> (S) -> (T) -> some Base & Proto
27+
// DECLSITE-NEXT: $s1xQrx_tcluD
28+
// DECLSITE-NEXT: <Declaration>public func foo&lt;T&gt;(x: <Type usr=[[T_USR:.*]]>T</Type>) -&gt; some <Type usr=[[Base_USR:.*]]>Base</Type> &amp; <Type usr=[[Proto_USR:.*]]>Proto</Type></Declaration>
29+
// DECLSITE-NEXT: <decl.function.method.instance><syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>foo</decl.name>&lt;<decl.generic_type_param usr=[[T_USR]]><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>&gt;(<decl.var.parameter><decl.var.parameter.argument_label>x</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.generic_type_param usr=[[T_USR]]>T</ref.generic_type_param></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><syntaxtype.keyword>some</syntaxtype.keyword> <ref.class usr=[[Base_USR]]>Base</ref.class> &amp; <ref.protocol usr=[[Proto_USR]]>Proto</ref.protocol></decl.function.returntype></decl.function.method.instance>
30+
31+
// RUN: %sourcekitd-test -req=cursor -pos=13:43 %s -- %s -module-name Test | %FileCheck %s -check-prefix=PROTO_AFTER_SOME
32+
// PROTO_AFTER_SOME: source.lang.swift.ref.protocol (1:17-1:22)
33+
// PROTO_AFTER_SOME-NEXT: Proto
34+
// PROTO_AFTER_SOME-NEXT: s:4Test5ProtoP
35+
// PROTO_AFTER_SOME-NEXT: Proto.Protocol
36+
// PROTO_AFTER_SOME-NEXT: $s4Test5Proto_pmD
37+
// PROTO_AFTER_SOME-NEXT: <Declaration>public protocol Proto</Declaration>
38+
// PROTO_AFTER_SOME-NEXT: <decl.protocol><syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>protocol</syntaxtype.keyword> <decl.name>Proto</decl.name></decl.protocol>
39+
40+
// RUN: %sourcekitd-test -req=cursor -pos=19:17 %s -- %s -module-name Test | %FileCheck %s -check-prefix=USESITE
41+
// USESITE: source.lang.swift.ref.function.method.instance (13:15-13:27)
42+
// USESITE-NEXT: foo(x:)
43+
// USESITE-NEXT: s:4Test1SV3foo1xQrx_tlF
44+
// USESITE-NEXT: <T> (S) -> (T) -> some Base & Proto
45+
// USESITE-NEXT: $s1xQrx_tcluD
46+
// USESITE-NEXT: <Container>$s4Test1SVD</Container>
47+
// USESITE-NEXT: <Declaration>public func foo&lt;T&gt;(x: T) -&gt; some <Type usr=[[Base_USR:.*]]>Base</Type> &amp; <Type usr=[[Proto_USR:.*]]>Proto</Type></Declaration>
48+
// USESITE-NEXT: <decl.function.method.instance><syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>foo</decl.name>&lt;<decl.generic_type_param usr=[[T_USR:.*]]><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>&gt;(<decl.var.parameter><decl.var.parameter.argument_label>x</decl.var.parameter.argument_label>: <decl.var.parameter.type>T</decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><syntaxtype.keyword>some</syntaxtype.keyword> <ref.class usr=[[Base_USR]]>Base</ref.class> &amp; <ref.protocol usr=[[Proto_USR]]>Proto</ref.protocol></decl.function.returntype></decl.function.method.instance>

0 commit comments

Comments
 (0)