Files
swift-mirror/validation-test/compiler_crashers_fixed/0096-issue-46855.swift
Hamish Knight 4e811c3a88 [test] Merge crasher directories
There is no longer much of a good reason to keep these separate,
merge them.
2025-10-18 12:51:30 +01:00

40 lines
876 B
Swift

// RUN: not %target-swift-frontend -emit-ir -primary-file %s
// https://github.com/apple/swift/issues/46855
//
// FIXME: Should this type check?
struct ArrayWrapper<Element>: Collection
where Element: Comparable {
private var store = [Element]()
typealias SubSequence = ArrayWrapper<Element>
init(_ values: [Element]) {
store = values
}
var startIndex: Int {
return store.startIndex
}
var endIndex: Int {
return store.endIndex
}
subscript(position: Int) -> Iterator.Element {
return store[index]
}
func makeIterator() -> AnyIterator<Element> {
var index = 0
return AnyIterator {
guard index < self.store.count else { return nil }
defer { index += 1 }
return self.store[index]
}
}
}
print(ArrayWrapper([22, 3, 1, 44, 6, 22]))