File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 11// RUN: %target-typecheck-verify-swift
22
3+ func assertEqualTypes< T> ( _: T . Type , _: T . Type ) { }
4+
35struct Pair < A, B> {
46 var a : A
57 var b : B
@@ -28,3 +30,33 @@ extension Pair: Collection where A == B {
2830 return i + 1
2931 }
3032}
33+
34+ // https://github.com/apple/swift/issues/52024
35+ protocol VectorBase : RandomAccessCollection where Index == Int , Element == Elle {
36+ associatedtype Elle
37+
38+ var data : Array < Elle > { get set }
39+ init ( data: Array < Elle > )
40+ }
41+
42+ protocol Vector : VectorBase { }
43+ extension Vector where Elle: FloatingPoint {
44+ // RandomAccessCollection
45+ var indices : Range < Int > { get { } }
46+ var startIndex : Int { get { } }
47+ var endIndex : Int { get { } }
48+
49+ // MutableCollection
50+ subscript( i: Index ) -> Elle {
51+ get { } set { }
52+ }
53+ }
54+
55+ do {
56+ struct VectorF : Vector {
57+ var data : Array < Float >
58+ init ( data: Array < Float > ) { }
59+ }
60+
61+ assertEqualTypes ( VectorF . Elle. self, Float . self)
62+ }
You can’t perform that action at this time.
0 commit comments