mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
26 lines
410 B
Swift
26 lines
410 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// https://github.com/apple/swift/issues/56212
|
|
|
|
enum E {
|
|
case foo(String)
|
|
}
|
|
|
|
struct Test {
|
|
var bar: E?
|
|
}
|
|
|
|
struct S {
|
|
func evaluate(_: Test) -> [Test] {
|
|
return []
|
|
}
|
|
|
|
func test(set: Set<String>) {
|
|
let flattened = set.flatMap { element in
|
|
evaluate(Test(bar: .foo(element)))
|
|
}
|
|
|
|
let _: [Test] = flattened // Ok (find .`bar` after unwrap)
|
|
}
|
|
}
|