Skip to content

Commit f3de3b4

Browse files
committed
SIL: set the @async attribute for top-level functions correctly
1 parent 0accc02 commit f3de3b4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,7 @@ getFunctionInterfaceTypeWithCaptures(TypeConverter &TC,
25112511
auto innerExtInfo =
25122512
AnyFunctionType::ExtInfoBuilder(FunctionType::Representation::Thin,
25132513
funcType->isThrowing())
2514+
.withAsync(funcType->isAsync())
25142515
.build();
25152516

25162517
return CanAnyFunctionType::get(

test/SILGen/hop_to_executor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct GlobalActor {
5757
static var shared: MyActor = MyActor()
5858
}
5959

60-
// CHECK-LABEL: sil hidden [ossa] @$s4test0A11GlobalActoryyYF : $@convention(thin) () -> () {
60+
// CHECK-LABEL: sil hidden [ossa] @$s4test0A11GlobalActoryyYF : $@convention(thin) @async () -> () {
6161
// CHECK: [[F:%[0-9]+]] = function_ref @$s4test11GlobalActorV6sharedAA02MyC0Cvau : $@convention(thin) () -> Builtin.RawPointer
6262
// CHECK: [[P:%[0-9]+]] = apply [[F]]() : $@convention(thin) () -> Builtin.RawPointer
6363
// CHECK: [[A:%[0-9]+]] = pointer_to_address %2 : $Builtin.RawPointer to [strict] $*MyActor
@@ -75,7 +75,7 @@ struct GenericGlobalActorWithGetter<T> {
7575
static var shared: MyActor { return MyActor() }
7676
}
7777

78-
// CHECK-LABEL: sil hidden [ossa] @$s4test0A28GenericGlobalActorWithGetteryyYF : $@convention(thin) () -> () {
78+
// CHECK-LABEL: sil hidden [ossa] @$s4test0A28GenericGlobalActorWithGetteryyYF : $@convention(thin) @async () -> () {
7979
// CHECK: [[MT:%[0-9]+]] = metatype $@thin GenericGlobalActorWithGetter<Int>.Type
8080
// CHECK: [[F:%[0-9]+]] = function_ref @$s4test28GenericGlobalActorWithGetterV6sharedAA02MyD0CvgZ : $@convention(method) <τ_0_0> (@thin GenericGlobalActorWithGetter<τ_0_0>.Type) -> @owned MyActor
8181
// CHECK: [[A:%[0-9]+]] = apply [[F]]<Int>([[MT]]) : $@convention(method) <τ_0_0> (@thin GenericGlobalActorWithGetter<τ_0_0>.Type) -> @owned MyActor

0 commit comments

Comments
 (0)