Skip to content

Commit 24bb013

Browse files
committed
[Tests] Distributed/NFC: Add a test-case for rdar://109207043
1 parent 8569c9d commit 24bb013

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/Inputs/FakeDistributedActorSystems.swift
2+
// RUN: %target-swift-frontend -module-name no_to_arg_leaks -emit-irgen -disable-availability-checking -I %t 2>&1 %s | %IRGenFileCheck %s -check-prefix CHECK-%target-import-type
3+
4+
// UNSUPPORTED: back_deploy_concurrency
5+
// REQUIRES: concurrency
6+
// REQUIRES: distributed
7+
8+
// REQUIRES: CPU=x86_64 || CPU=arm64
9+
10+
// UNSUPPORTED: OS=windows-msvc
11+
12+
import Distributed
13+
import FakeDistributedActorSystems
14+
15+
@available(SwiftStdlib 5.5, *)
16+
typealias DefaultDistributedActorSystem = FakeActorSystem
17+
18+
final class SomeClass<T>: Sendable, Codable {
19+
init() {}
20+
}
21+
22+
distributed actor Greeter {
23+
// CHECK-LABEL: define linkonce_odr hidden swifttailcc void @"$s15no_to_arg_leaks7GreeterC4takeyyAA9SomeClassCyxGYaKlFTETF"
24+
// CHECK: [[ARG_ADDR:%.*]] = bitcast i8* {{.*}} to %T15no_to_arg_leaks9SomeClassC**
25+
// CHECK: %destroy = bitcast i8* {{.*}} to void (%swift.opaque*, %swift.type*)*
26+
// CHECK-NEXT: [[OPAQUE_ARG_ADDR:%.*]] = bitcast %T15no_to_arg_leaks9SomeClassC** [[ARG_ADDR]] to %swift.opaque*
27+
// CHECK-NEXT: call void %destroy(%swift.opaque* noalias [[OPAQUE_ARG_ADDR]], %swift.type* %arg_type)
28+
distributed func take<T>(_: SomeClass<T>) {
29+
}
30+
}
31+
32+
func test() async throws {
33+
let system = DefaultDistributedActorSystem()
34+
35+
let local = Greeter(actorSystem: system)
36+
let ref = try Greeter.resolve(id: local.id, using: system)
37+
38+
try await ref.take(SomeClass<Int>())
39+
}

0 commit comments

Comments
 (0)