Skip to content

Commit 415efac

Browse files
committed
[Tests] Distributed/NFC: Add a test-case for rdar://109207043
1 parent 642ff23 commit 415efac

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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_REF:%.*]] = bitcast i8* {{.*}} to %T15no_to_arg_leaks9SomeClassC**
25+
// CHECK: %toDestroy = load %T15no_to_arg_leaks9SomeClassC*, %T15no_to_arg_leaks9SomeClassC** [[ARG_REF]]
26+
// CHECK-NEXT: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T15no_to_arg_leaks9SomeClassC*)*)(%T15no_to_arg_leaks9SomeClassC* %toDestroy)
27+
distributed func take<T>(_: SomeClass<T>) {
28+
}
29+
}
30+
31+
func test() async throws {
32+
let system = DefaultDistributedActorSystem()
33+
34+
let local = Greeter(actorSystem: system)
35+
let ref = try Greeter.resolve(id: local.id, using: system)
36+
37+
try await ref.take(SomeClass<Int>())
38+
}

0 commit comments

Comments
 (0)