// A declared pair's ends are complementary: the parent is Edge[In, Out] and the // child Edge[Out, In]. Handing the PARENT to a target that takes the child type // is a type mismatch, not a runtime check (D22.6). // // expected: the spawn argument and the target parameter must agree package main type Req struct { Body []byte `cap:"1024"` } func worker(ep Edge[Req, int32]) (closed chan struct{}) { for { select { case <-closed: return closed case r := <-ep.Recv: _ = r } } } func main() { select { case <-shutdown: return default: } parent, child := edge[int32, Req]{2} _ = child done := spawn(worker, parent) close(parent.Send) <-done }