@@ -71,7 +71,11 @@ func useDerived(generic: MyGeneric<Int>, generic2: MyGeneric<Any>, derived: MyDe
7171
7272// ---
7373
74- protocol MyProtocol {
74+ protocol MyParentProtocol {
75+ var source0 : Int { get }
76+ }
77+
78+ protocol MyProtocol : MyParentProtocol {
7579 var source1 : Int { get }
7680 var source2 : Int { get }
7781}
@@ -81,21 +85,29 @@ class MyImpl<T> : MyProtocol {
8185}
8286
8387extension MyImpl {
88+ var source0 : Int { get { return 0 } }
8489 var source2 : Int { get { return 0 } }
8590}
8691
8792func useProtocol( proto: MyProtocol , impl: MyImpl < Int > , impl2: MyImpl < Any > ) {
93+ _ = proto. source0 // SOURCE
8894 _ = proto. source1 // SOURCE
8995 _ = proto. source2 // SOURCE
96+ _ = impl. source0 // SOURCE
9097 _ = impl. source1 // SOURCE
9198 _ = impl. source2 // SOURCE
99+ _ = impl2. source0 // SOURCE
92100 _ = impl2. source1 // SOURCE
93101 _ = impl2. source2 // SOURCE
94102}
95103
96104// ---
97105
98- protocol MyProtocol2 {
106+ protocol MyParentProtocol2 {
107+ var source0 : Int { get }
108+ }
109+
110+ protocol MyProtocol2 : MyParentProtocol2 {
99111 var source1 : Int { get }
100112 var source2 : Int { get }
101113}
@@ -105,14 +117,48 @@ class MyImpl2<T> {
105117}
106118
107119extension MyImpl2 : MyProtocol2 {
120+ var source0 : Int { get { return 0 } }
108121 var source2 : Int { get { return 0 } }
109122}
110123
111124func useProtocol2( proto: MyProtocol2 , impl: MyImpl2 < Int > , impl2: MyImpl2 < Any > ) {
125+ _ = proto. source0 // SOURCE
112126 _ = proto. source1 // SOURCE
113127 _ = proto. source2 // SOURCE
114- _ = impl. source1 // SOURCE [NOT DETECTED]
115- _ = impl. source2 // SOURCE [NOT DETECTED]
116- _ = impl2. source1 // SOURCE [NOT DETECTED]
117- _ = impl2. source2 // SOURCE [NOT DETECTED]
128+ _ = impl. source0 // SOURCE
129+ _ = impl. source1 // SOURCE
130+ _ = impl. source2 // SOURCE
131+ _ = impl2. source0 // SOURCE
132+ _ = impl2. source1 // SOURCE
133+ _ = impl2. source2 // SOURCE
134+ }
135+
136+ // ---
137+
138+ protocol MyProtocol3 {
139+ func source1( ) -> Int
140+ func source2( ) -> Int
141+ func source3( ) -> Int
142+ }
143+
144+ class MyParentClass3 {
145+ func source1( ) -> Int { return 0 }
146+ }
147+
148+ class MyClass3 : MyParentClass3 {
149+ func source2( ) -> Int { return 0 }
150+ func source3( ) -> Int { return 0 }
151+ }
152+
153+ extension MyClass3 : MyProtocol3 {
154+ }
155+
156+ class MyChildClass3 : MyClass3 {
157+ override func source3( ) -> Int { return 0 }
158+ }
159+
160+ func useProtocol3( impl: MyChildClass3 ) {
161+ _ = impl. source1 ( ) // not a source (`MyProtocol3.source1` is the declared source and `MyParentClass3` doesn't extend it)
162+ _ = impl. source2 ( ) // SOURCE
163+ _ = impl. source3 ( ) // SOURCE
118164}
0 commit comments