Skip to content

Commit 29b08a9

Browse files
committed
Add two test cases that regressed after a previous attempt at fixing a bug
1 parent b489baa commit 29b08a9

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference
2+
// RUN: %target-typecheck-verify-swift -disable-experimental-associated-type-inference
3+
4+
// REQUIRES: objc_interop
5+
6+
import Foundation
7+
8+
public struct CustomCollection<T>: RandomAccessCollection {
9+
public typealias Indices = Range<Int>
10+
11+
public var startIndex: Int { fatalError() }
12+
public var endIndex: Int { fatalError() }
13+
public var count: Int { fatalError() }
14+
15+
public subscript(position: Int) -> T {
16+
get { fatalError() }
17+
set { fatalError() }
18+
}
19+
20+
public var underestimatedCount: Int { fatalError() }
21+
}
22+
23+
extension CustomCollection: ContiguousBytes where Element == UInt8 {
24+
public func withUnsafeBytes<R>(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R {
25+
fatalError()
26+
}
27+
}
28+
29+
extension CustomCollection: DataProtocol where Element == UInt8 {
30+
public var regions: CollectionOfOne<CustomCollection<UInt8>> {
31+
fatalError()
32+
}
33+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference
2+
// RUN: %target-typecheck-verify-swift -disable-experimental-associated-type-inference
3+
4+
// REQUIRES: objc_interop
5+
6+
import Foundation
7+
8+
public struct CustomCollection<Element>: RandomAccessCollection, MutableCollection, ExpressibleByArrayLiteral {
9+
public typealias Indices = Range<Int>
10+
public typealias Index = Int
11+
12+
public init() {}
13+
14+
public init(arrayLiteral elements: Element ...) {
15+
fatalError()
16+
}
17+
}
18+
19+
extension CustomCollection {
20+
public var startIndex: Int { fatalError() }
21+
public var endIndex: Int { fatalError() }
22+
23+
public subscript(position: Int) -> Element {
24+
get { fatalError() }
25+
set { fatalError() }
26+
}
27+
}
28+
29+
extension CustomCollection: RangeReplaceableCollection {
30+
public mutating func append(_ newElement: Element) { }
31+
public mutating func append<S: Sequence>(contentsOf newElements: S) where S.Element == Element { }
32+
public mutating func reserveCapacity(_ minimumCapacity: Int) { }
33+
public mutating func removeAll(keepingCapacity keepCapacity: Bool = false) { }
34+
public mutating func replaceSubrange<C: Collection>(_ subRange: Range<Int>, with newElements: C) where C.Element == Element { }
35+
}
36+
37+
extension CustomCollection {
38+
public func withUnsafeBytes<R>(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R { fatalError() }
39+
}
40+
41+
extension CustomCollection: ContiguousBytes where Element == UInt8 { }
42+
43+
extension CustomCollection: DataProtocol where Element == UInt8 {
44+
public var regions: CollectionOfOne<CustomCollection<UInt8>> { fatalError() }
45+
}

0 commit comments

Comments
 (0)