Skip to content

Commit 28e700d

Browse files
committed
move tests
1 parent a629fed commit 28e700d

File tree

3 files changed

+86
-30
lines changed

3 files changed

+86
-30
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
}

test/type/runtime_discoverable_attrs.swift

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// REQUIRES: asserts
66

77
import RuntimeAttrs
8-
import Distributed
98

109
@runtimeMetadata
1110
struct Flag<T> {
@@ -306,35 +305,6 @@ extension InvalidConformanceTest2 : Flagged & EnumFlagged {}
306305
// expected-note@-3 {{protocol 'Flagged' requires reflection metadata attribute @Flag}}
307306
// expected-note@-4 {{protocol 'EnumFlagged' requires reflection metadata attribute @EnumFlag}}
308307

309-
typealias DefaultDistributedActorSystem = LocalTestingDistributedActorSystem
310-
311-
distributed actor TestDistributedActor {
312-
@FlagForAsyncFuncs distributed func asyncExternallyDist() throws {}
313-
314-
@FlagForAsyncFuncs distributed func doSomethingDist() async throws {}
315-
316-
@FlagForAsyncFuncs nonisolated func doSomethingNonisolated(_: Int) async {}
317-
318-
@FlagForAsyncFuncs distributed func doSomethingDist(_: Int, x: [Int]) async {}
319-
}
320-
321-
@ActorFlag
322-
distributed actor TestDistributedActor2 {}
323-
324-
@runtimeMetadata
325-
enum ActorFlag<A> {
326-
case actor(A.Type)
327-
case distributedActor(A.Type)
328-
}
329-
330-
extension ActorFlag where A: Actor {
331-
init(attachedTo: A.Type) { self = .actor(attachedTo) }
332-
}
333-
extension ActorFlag where A: DistributedActor {
334-
init(attachedTo: A.Type) { self = .distributedActor(attachedTo) }
335-
}
336-
337-
338308
@Flag
339309
struct ValidConformance1 {}
340310
extension ValidConformance1 : Flagged {} // Ok
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module %S/Inputs/RuntimeAttrs.swift -o %t
3+
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-feature RuntimeDiscoverableAttrs -I %t
4+
5+
// REQUIRES: asserts
6+
7+
import RuntimeAttrs
8+
import Distributed
9+
10+
typealias DefaultDistributedActorSystem = LocalTestingDistributedActorSystem
11+
12+
@runtimeMetadata
13+
struct FlagForAsyncFuncs {
14+
init<Act>(attachedTo: (Act) async throws -> Void) {}
15+
init<Act>(attachedTo: (Act, Int, inout [Int]) async throws -> Void) {}
16+
init<Act>(attachedTo: (Act, Int) async -> Void) {}
17+
init(attachedTo: () async -> [String]) {}
18+
}
19+
20+
@ActorFlag
21+
distributed actor TestDistributedActor {
22+
@FlagForAsyncFuncs distributed func asyncExternallyDist() throws {} // ok
23+
24+
@FlagForAsyncFuncs distributed func doSomethingDist() async throws {} // ok
25+
26+
@FlagForAsyncFuncs nonisolated func doSomethingNonisolated(_: Int) async {} // ok
27+
28+
@FlagForAsyncFuncs distributed func doSomethingDist(_: Int, x: [Int]) async {} // ok
29+
}
30+
31+
@runtimeMetadata
32+
enum ActorFlag<A> {
33+
case actor(A.Type)
34+
case distributedActor(A.Type)
35+
}
36+
37+
extension ActorFlag where A: DistributedActor {
38+
init(attachedTo: A.Type) { self = .distributedActor(attachedTo) }
39+
}

0 commit comments

Comments
 (0)