Files
swift-mirror/validation-test/compiler_crashers_fixed/0186-rdar46497155.swift
Hamish Knight 4e811c3a88 [test] Merge crasher directories
There is no longer much of a good reason to keep these separate,
merge them.
2025-10-18 12:51:30 +01:00

32 lines
517 B
Swift

// RUN: %target-typecheck-verify-swift
protocol P {
func isEqual(_ other: P) -> Bool
}
struct A {
var value: P? = nil
}
struct B {
func foo() throws -> A {}
}
struct E {
func getB(_ flag: inout Bool) throws -> B {
return B()
}
}
func foo(arr: [E], other: P) -> Bool {
return arr.compactMap { i in
var flag = false
return try? i.getB(&flag)
}.compactMap { u -> P? in // Ok
guard let a = try? u.foo() else { return nil }
return a.value!
}.contains {
$0.isEqual(other)
}
}