mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
There is a short-circuiting hack in the constraint solver that speeds up solving, but isn't generally sound. If we allow unavailable decls to be considered "favored", this can fire and result in our choosing a solution that involves the unavailable decl where other solutions exist. Fixes rdar://problem/32570734.
18 lines
335 B
Swift
18 lines
335 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 4
|
|
|
|
// Ensure that we do not select the unavailable failable init as the
|
|
// only solution and then fail to typecheck.
|
|
protocol P {}
|
|
|
|
class C : P {
|
|
@available(swift, obsoleted: 4)
|
|
public init?(_ c: C) {
|
|
}
|
|
|
|
public init<T : P>(_ c: T) {}
|
|
}
|
|
|
|
func f(c: C) {
|
|
let _: C? = C(c)
|
|
}
|