   }
 }
 
+// global to track available IDs
+var nextID: Int = 1
+
 @available(SwiftStdlib 5.5, *)
 struct FakeTransport: ActorTransport {
   func decodeIdentity(from decoder: Decoder) throws -> AnyActorIdentity {

func test() async {
  let transport = FakeTransport()

  _ = LocalWorker(transport: transport)
  // CHECK: assign type:LocalWorker, id:ActorAddress(address: "[[ID:.*]]")
  // CHECK: ready actor:main.LocalWorker, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
  // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))

  _ = PickATransport1(kappa: transport, other: 0)
  // CHECK: assign type:PickATransport1, id:ActorAddress(address: "[[ID:.*]]")
  // CHECK: ready actor:main.PickATransport1, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
  // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))

  _ = try? Throwy(transport: transport, doThrow: false)
  // CHECK: assign type:Throwy, id:ActorAddress(address: "[[ID:.*]]")
  // CHECK: ready actor:main.Throwy, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
  // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))

  _ = try? Throwy(transport: transport, doThrow: true)
  // CHECK: assign type:Throwy, id:ActorAddress(address: "[[ID:.*]]")
  // CHECK-NOT: ready
  // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))

  _ = try? ThrowBeforeFullyInit(transport: transport, doThrow: true)
  // CHECK: assign type:ThrowBeforeFullyInit, id:ActorAddress(address: "[[ID:.*]]")
  // FIXME: The two checks below should work, but do not currently, so they're disabled (rdar://84533820).
  // MISSING-CHECK-NOT: ready actor:main.ThrowBeforeFullyInit
  // MISSING-CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))

  _ = await PickATransport2(other: 1, theTransport: transport)
  // CHECK: assign type:PickATransport2, id:ActorAddress(address: "[[ID:.*]]")
  // CHECK: ready actor:main.PickATransport2, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))

  // FIXME: The checks for this initializer should NOT pass, but currently do. (rdar://84533820)
  _ = await Bug_CallsReadyTwice(transport: transport, wantBug: true)
  // CHECK: assign type:Bug_CallsReadyTwice, id:ActorAddress(address: "[[ID:.*]]")
  // CHECK:      ready actor:main.Bug_CallsReadyTwice, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
  // CHECK-NEXT: ready actor:main.Bug_CallsReadyTwice, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))

  // TODO: it's not obvious why the resigns happen later for the async ones.
  // might need to find a way to force the deallocation at a specific point,
  // or just use check-dag or something.

  // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
  // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
}

@available(SwiftStdlib 5.5, *)

// UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime

// FIXME(distributed): we need to revisit what's going on on windows with distributed actors rdar://83859906
// UNSUPPORTED: OS=windows-msvc

import _Distributed

