mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fixes: - rdar://112785081 - https://github.com/apple/swift/issues/67906 - https://github.com/apple/swift/issues/68160
26 lines
597 B
Swift
26 lines
597 B
Swift
// RUN: %target-typecheck-verify-swift -disable-availability-checking
|
|
|
|
struct G<each T>: Sequence {
|
|
typealias Element = Int
|
|
typealias Iterator = [Int].Iterator
|
|
|
|
consuming func makeIterator() -> Iterator {
|
|
fatalError()
|
|
}
|
|
}
|
|
|
|
// expected-note@+1 {{in call to function 'foo'}}
|
|
func foo<each T>(_: repeat each T) -> G<repeat each T> {
|
|
.init()
|
|
}
|
|
|
|
// expected-error@+2 {{for-in loop requires '(repeat each T) -> G<repeat each T>' to conform to 'Sequence'}}
|
|
// expected-error@+1 {{generic parameter 'each T' could not be inferred}}
|
|
for a in foo {
|
|
print(a)
|
|
}
|
|
|
|
for a in foo() {
|
|
print(a)
|
|
}
|