Skip to content

Commit 8858152

Browse files
[tests] Add regression tests for SR-13732
1 parent 883d583 commit 8858152

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Constraints/lvalues.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,28 @@ func wump<T>(to: T, _ body: (G<T>) -> ()) {}
241241

242242
wump(to: 0, { $0[] = 0 })
243243
// expected-error@-1 {{missing argument for parameter #1 in call}}
244+
245+
// SR-13732
246+
extension MutableCollection {
247+
public mutating func writePrefix<I: IteratorProtocol>(from source: inout I)
248+
-> (writtenCount: Int, afterLastWritten: Index)
249+
where I.Element == Element
250+
{
251+
fatalError()
252+
}
253+
254+
public mutating func writePrefix<Source: Collection>(from source: Source)
255+
-> (writtenCount: Int, afterLastWritten: Index, afterLastRead: Source.Index)
256+
where Source.Element == Element
257+
{
258+
fatalError()
259+
}
260+
261+
}
262+
263+
func testWritePrefixIterator() {
264+
var a = Array(0..<10)
265+
266+
var underflow = (1..<10).makeIterator()
267+
var (writtenCount, afterLastWritten) = a.writePrefix(from: underflow) // expected-error {{passing value of type 'IndexingIterator<(Range<Int>)>' to an inout parameter requires explicit '&'}} {{62-62=&}}
268+
}

0 commit comments

Comments
 (0)