Skip to content

Commit 473b573

Browse files
committed
[test] add a definition that shouldn't compile
1 parent b14f2b9 commit 473b573

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

validation-test/stdlib/CollectionDiagnostics.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,23 @@ struct CollectionWithNonDefaultSubSequence: Collection {
154154
public subscript(position: Int) -> Int { position }
155155
}
156156

157+
struct MutableCollectionWithNonDefaultSubSequence: MutableCollection {
158+
public var startIndex: Int
159+
public var endIndex: Int
160+
161+
public typealias SubSequence = Self
162+
163+
public func index(after i: Int) -> Int { i+1 }
164+
public subscript(position: Int) -> Int {
165+
get { position }
166+
set { _ = newValue }
167+
}
168+
169+
public subscript(bounds: Range<Index>) -> Self {
170+
Self(startIndex: bounds.startIndex, endIndex: bounds.endIndex)
171+
}
172+
}
173+
157174
// FIXME: Remove -verify-ignore-unknown.
158175
// <unknown>:0: error: unexpected note produced: possibly intended match
159176
// <unknown>:0: error: unexpected note produced: possibly intended match

0 commit comments

Comments
 (0)