Skip to content

Commit b489baa

Browse files
committed
Add two regression tests for bugs already fixed
1 parent 0b2e168 commit b489baa

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference
2+
// RUN: %target-typecheck-verify-swift -disable-experimental-associated-type-inference
3+
4+
struct CustomCollection<T>: RandomAccessCollection {
5+
struct CustomIndices: RandomAccessCollection {
6+
var count: Int { fatalError() }
7+
8+
var startIndex: Int { fatalError() }
9+
var endIndex: Int { fatalError() }
10+
11+
subscript(index: Int) -> Int { fatalError() }
12+
}
13+
14+
var count: Int { fatalError() }
15+
var indices: CustomIndices { fatalError() }
16+
var startIndex: Int { fatalError() }
17+
var endIndex: Int { fatalError() }
18+
func index(before i: Int) -> Int { fatalError() }
19+
func index(after i: Int) -> Int { fatalError() }
20+
subscript(index: Int) -> T { fatalError() }
21+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference
2+
// RUN: not %target-typecheck-verify-swift -disable-experimental-associated-type-inference
3+
4+
func f<T: Sequence>(_: T) -> T.Element {}
5+
6+
let x: Int = f(CustomCollection<Int>())
7+
8+
struct CustomCollection<Element>: RandomAccessCollection, MutableCollection {
9+
typealias SubSequence = ArraySlice<Element>
10+
typealias Index = Int
11+
typealias Indices = Range<Int>
12+
13+
var startIndex: Int { fatalError() }
14+
var endIndex: Int { fatalError() }
15+
var first: Element? { fatalError() }
16+
var last: Element? { fatalError() }
17+
18+
subscript(position: Index) -> Element {
19+
get { fatalError() }
20+
set { fatalError() }
21+
}
22+
23+
subscript(bounds: Indices) -> SubSequence {
24+
get { fatalError() }
25+
set { fatalError() }
26+
}
27+
}
28+

0 commit comments

Comments
 (0)