mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
all cases of missing generic parameters. In `ComponentStep::take` when there are no bindings or disjunctions, use hole propagation to default remaining free type variables that aren't for generic parameters and continue solving. Rather than using a defaultable constraint for holes, assign a fixed type directly when we have no bindings to try.
33 lines
598 B
Swift
33 lines
598 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
|
|
// expected-error@-1 {{generic parameter 'ElementOfResult' could not be inferred}}
|
|
var flag = false
|
|
return try? i.getB(&flag)
|
|
}.compactMap { u -> P? in
|
|
guard let a = try? u.foo() else { return nil }
|
|
return a.value!
|
|
}.contains {
|
|
$0.isEqual(other)
|
|
}
|
|
}
|