mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
13 lines
445 B
Swift
13 lines
445 B
Swift
// RUN: %swift %s -parse -verify
|
|
// Test case submitted to project by https://github.com/tmu (Teemu Kurppa)
|
|
// rdar://18175202
|
|
func some<S: SequenceType, T where Optional<T> == S.Generator.Element>(xs : S) -> T? {
|
|
for (mx : T?) in xs { // // expected-error {{type of expression is ambiguous without more context}}
|
|
if let x = mx {
|
|
return x
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
let xs : [Int?] = [nil, 4, nil]
|
|
println(some(xs)) |