Skip to content

Commit 7b873c3

Browse files
committed
Add more async top-level silgen testing
Adding testing for the error and top-level-captures to ensure the expected SIL is still being emitted when the top-level is an asynchronous context.
1 parent 9132963 commit 7b873c3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

test/SILGen/top_level_captures.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
2+
// RUN: %target-swift-frontend -enable-experimental-async-top-level -emit-silgen %s | %FileCheck %s
23

34
guard let x: Int = nil else { while true { } }
45

test/SILGen/toplevel_errors.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
1+
// RUN: %target-swift-emit-silgen %s | %FileCheck %s --check-prefixes='CHECK,SYNC-CHECK'
2+
// RUN: %target-swift-emit-silgen -enable-experimental-async-top-level %s | %FileCheck %s --check-prefixes='CHECK,ASYNC-CHECK'
23

34
enum MyError : Error {
45
case A, B
@@ -17,7 +18,10 @@ throw MyError.A
1718
// CHECK: br bb2([[ERR2]] : $Error)
1819

1920
// CHECK: bb1([[T0:%.*]] : $Int32):
20-
// CHECK: return [[T0]] : $Int32
21+
// SYNC-CHECK: return [[T0]] : $Int32
22+
// ASYNC-CHECK: [[EXITFUNC:%[0-9]+]] = function_ref @exit
23+
// ASYNC-CHECK: {{[0-9]+}} = apply [[EXITFUNC]]([[T0]])
24+
// ASYNC-CHECK: unreachable
2125

2226
// CHECK: bb2([[T0:%.*]] : @owned $Error):
2327
// CHECK: builtin "errorInMain"([[T0]] : $Error)

0 commit comments

Comments
 (0)