mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Since we weren't assigning region counters until we were emitting function bodies, we would crash while walking the expressions in default arguments. This assigns the counters earlier and fixes up the ASTWalker to expect that. Swift SVN r25445
19 lines
737 B
Swift
19 lines
737 B
Swift
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_default_args %s | FileCheck %s
|
|
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_default_args.closureInArgs
|
|
// CHECK: [[@LINE+2]]:39 -> [[@LINE+2]]:55 : 1
|
|
// CHECK: [[@LINE+1]]:57 -> {{[0-9]+}}:2 : 0
|
|
func closureInArgs(f : (Int -> Int) = { i1 in i1 + 1 }) {
|
|
f(3)
|
|
}
|
|
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_default_args.hasDefaultArgs
|
|
// CHECK: [[@LINE+1]]:35 -> {{[0-9]+}}:2 : 0
|
|
func hasDefaultArgs(i : Int = 10) {
|
|
}
|
|
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_default_args.autoClosureInArgs
|
|
// CHECK: [[@LINE+1]]:50 -> {{[0-9]+}}:2 : 0
|
|
func autoClosureInArgs(b : Bool = true && false) {
|
|
}
|