mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Resetting score to `0.1` is intended to make sure that the solver picks the outermost disjunction in literal chains like `1 + 2 + 3 ...` because that would provide context to the inner choices. Resolves: https://github.com/swiftlang/swift/issues/78371 Resolves: rdar://142105691
23 lines
508 B
Swift
23 lines
508 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// https://github.com/swiftlang/swift/issues/78371
|
|
|
|
// Note that the test has to use a standard operator because
|
|
// custom ones are not optimized.
|
|
|
|
struct Scalar : Equatable {
|
|
init(_: UInt8) {}
|
|
init?(_: Int) {}
|
|
}
|
|
|
|
func ==(_: Scalar, _: Scalar) -> Bool { }
|
|
|
|
extension Optional where Wrapped == Scalar {
|
|
static func ==(_: Wrapped?, _: Wrapped?) -> Wrapped { }
|
|
}
|
|
|
|
func test(a: Scalar) {
|
|
let result = a == Scalar(0x07FD)
|
|
let _: Scalar = result // Ok
|
|
}
|