mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Tests] NFC: Move Double/CGFloat test because it tests local type method which is printed at the end
This commit is contained in:
@@ -337,19 +337,6 @@ func test_implicit_conversion_clash_with_partial_application_check() {
|
||||
}
|
||||
}
|
||||
|
||||
// rdar://99352676
|
||||
// CHECK-LABEL: sil hidden [ossa] @$s34implicit_double_cgfloat_conversion20test_init_validationyyF : $@convention(thin) () -> () {
|
||||
func test_init_validation() {
|
||||
class Foo {
|
||||
static let bar = 100.0
|
||||
|
||||
func getBar() -> CGFloat? {
|
||||
return Self.bar
|
||||
// CHECK: function_ref @$s12CoreGraphics7CGFloatVyACSdcfC : $@convention(method) (Double, @thin CGFloat.Type) -> CGFloat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func test_ternary_and_nil_coalescing() {
|
||||
func test(_: Double?) {}
|
||||
|
||||
@@ -389,3 +376,31 @@ func test_cgfloat_operator_is_attempted_with_literal_arguments(v: CGFloat?) {
|
||||
let ratio = v ?? (2.0 / 16.0)
|
||||
let _: CGFloat = ratio // Ok
|
||||
}
|
||||
|
||||
// Make sure that optimizer doesn't favor CGFloat -> Double conversion
|
||||
// in presence of CGFloat initializer, otherwise it could lead to ambiguities.
|
||||
func test_explicit_cgfloat_use_avoids_ambiguity(v: Int) {
|
||||
func test(_: CGFloat) -> CGFloat { 0 }
|
||||
func test(_: Double) -> Double { 0 }
|
||||
|
||||
func hasCGFloatElement<C: Collection>(_: C) where C.Element == CGFloat {}
|
||||
|
||||
let arr = [test(CGFloat(v))]
|
||||
hasCGFloatElement(arr) // Ok
|
||||
|
||||
var total = 0.0 // This is Double by default
|
||||
total += test(CGFloat(v)) + CGFloat(v) // Ok
|
||||
}
|
||||
|
||||
// rdar://99352676
|
||||
// CHECK-LABEL: sil private [ossa] @$s34implicit_double_cgfloat_conversion20test_init_validationyyF3FooL_C6getBar12CoreGraphics7CGFloatVSgyF : $@convention(method) (@guaranteed Foo) -> Optional<CGFloat>
|
||||
func test_init_validation() {
|
||||
class Foo {
|
||||
static let bar = 100.0
|
||||
|
||||
func getBar() -> CGFloat? {
|
||||
return Self.bar
|
||||
// CHECK: function_ref @$s12CoreGraphics7CGFloatVyACSdcfC : $@convention(method) (Double, @thin CGFloat.Type) -> CGFloat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user