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 1
1
// RUN: %target-typecheck-verify-swift
2
2
3
+ func assertEqualTypes< T> ( _: T . Type , _: T . Type ) { }
4
+
3
5
struct Pair < A, B> {
4
6
var a : A
5
7
var b : B
@@ -28,3 +30,33 @@ extension Pair: Collection where A == B {
28
30
return i + 1
29
31
}
30
32
}
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