Files
swift-mirror/validation-test/compiler_crashers/040-optional-in-generics.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))