mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We support a special DefaultArgumentKind::NilLiteral, but it was only used for synthesized and imported default arguments as well. Let's also use it for parsed default arguments that are exactly 'nil', so that rethrows checking can special-case them.
12 lines
492 B
Swift
12 lines
492 B
Swift
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
|
|
|
|
public func takesAnInt(_: Int? = nil) {}
|
|
|
|
// CHECK-LABEL: sil [ossa] @$s21default_arguments_nil15callsTakesAnIntyyF : $@convention(thin) () -> () {
|
|
// CHECK: [[NIL:%.*]] = enum $Optional<Int>, #Optional.none!enumelt
|
|
// CHECK: [[FN:%.*]] = function_ref @$s21default_arguments_nil10takesAnIntyySiSgF
|
|
// CHECK: apply [[FN]]([[NIL]]) : $@convention(thin) (Optional<Int>) -> ()
|
|
// CHECK: return
|
|
public func callsTakesAnInt() {
|
|
takesAnInt()
|
|
} |