|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-frontend -emit-module-path=%t/RAD.swiftmodule -module-name=RAD -enable-experimental-feature RuntimeDiscoverableAttrs -disable-availability-checking %S/Inputs/runtime_attrs.swift |
| 3 | +// RUN: %target-swift-frontend -primary-file %s -emit-ir -I %t -swift-version 5 -enable-experimental-feature RuntimeDiscoverableAttrs -disable-availability-checking | %IRGenFileCheck %s |
| 4 | + |
| 5 | +// REQUIRES: asserts |
| 6 | +// REQUIRES: OS=macosx |
| 7 | +// REQUIRES: concurrency |
| 8 | + |
| 9 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC15asyncExternallyyyKcvpfaAA17FlagForAsyncFuncsHF" |
| 10 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyyYaKcvpfaAA17FlagForAsyncFuncsHF" |
| 11 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyySiYacvpfaAA17FlagForAsyncFuncsHF" |
| 12 | +// CHECK: @"$s28runtime_attributes_on_actors9TestActorC11doSomething_1xySi_SaySiGztYacvpfaAA17FlagForAsyncFuncsHF" |
| 13 | +// CHECK: @"$s28runtime_attributes_on_actors13globalAsyncFnSaySSGyYacvpfaAA07FlagForF5FuncsHF" |
| 14 | + |
| 15 | +// CHECK: @"$s28runtime_attributes_on_actors17FlagForAsyncFuncsVHa" = internal constant |
| 16 | +// CHECK-SAME: i32 5 |
| 17 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC15asyncExternallyyyKcvpfaAA17FlagForAsyncFuncsHF" |
| 18 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyyYaKcvpfaAA17FlagForAsyncFuncsHF" |
| 19 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyySiYacvpfaAA17FlagForAsyncFuncsHF" |
| 20 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors9TestActorC11doSomething_1xySi_SaySiGztYacvpfaAA17FlagForAsyncFuncsHF" |
| 21 | +// CHECK-SAME: %swift.accessible_function* @"$s28runtime_attributes_on_actors13globalAsyncFnSaySSGyYacvpfaAA07FlagForF5FuncsHF" |
| 22 | + |
| 23 | +import Distributed |
| 24 | + |
| 25 | +@runtimeMetadata |
| 26 | +struct FlagForAsyncFuncs { |
| 27 | + init<Act>(attachedTo: (Act) async throws -> Void) {} |
| 28 | + init<Act>(attachedTo: (Act, Int, [Int]) async throws -> Void) {} |
| 29 | + init<Act>(attachedTo: (Act, Int) async -> Void) {} |
| 30 | + init(attachedTo: () async -> [String]) {} |
| 31 | +} |
| 32 | + |
| 33 | +distributed actor TestActor { |
| 34 | + typealias ActorSystem = LocalTestingDistributedActorSystem |
| 35 | + |
| 36 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC15asyncExternallyyyKcvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 37 | + @FlagForAsyncFuncs distributed func asyncExternally() throws {} |
| 38 | + |
| 39 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyyYaKcvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 40 | + @FlagForAsyncFuncs distributed func doSomething() async throws {} |
| 41 | + |
| 42 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC11doSomethingyySiYacvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 43 | + @FlagForAsyncFuncs nonisolated func doSomething(_: Int) async {} |
| 44 | + |
| 45 | + // CHECK-LABEL: define hidden swiftcc void @"$s28runtime_attributes_on_actors9TestActorC11doSomething_1xySi_SaySiGztYacvpfaAA17FlagForAsyncFuncs"(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg* noalias nocapture sret(%T28runtime_attributes_on_actors17FlagForAsyncFuncsVSg) %0) |
| 46 | + @FlagForAsyncFuncs distributed func doSomething(_: Int, x: [Int]) async {} |
| 47 | +} |
0 commit comments