Skip to content

Commit

Permalink
[tests] Add regression tests for SR-13732
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianoPAlmeida committed Oct 16, 2020
1 parent 883d583 commit 8858152
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/Constraints/lvalues.swift
Expand Up @@ -241,3 +241,28 @@ func wump<T>(to: T, _ body: (G<T>) -> ()) {}

wump(to: 0, { $0[] = 0 })
// expected-error@-1 {{missing argument for parameter #1 in call}}

// SR-13732
extension MutableCollection {
public mutating func writePrefix<I: IteratorProtocol>(from source: inout I)
-> (writtenCount: Int, afterLastWritten: Index)
where I.Element == Element
{
fatalError()
}

public mutating func writePrefix<Source: Collection>(from source: Source)
-> (writtenCount: Int, afterLastWritten: Index, afterLastRead: Source.Index)
where Source.Element == Element
{
fatalError()
}

}

func testWritePrefixIterator() {
var a = Array(0..<10)

var underflow = (1..<10).makeIterator()
var (writtenCount, afterLastWritten) = a.writePrefix(from: underflow) // expected-error {{passing value of type 'IndexingIterator<(Range<Int>)>' to an inout parameter requires explicit '&'}} {{62-62=&}}
}

0 comments on commit 8858152

Please sign in to comment.