; task.join.cancel: a cancelled parent gets its child's handle back (not joined, ; loans kept), forwards the request and joins normally. ; expect: run ; schedules: 20 ; result: 13 ; phase: 3 ; spec: docs/spec/04-concurrency-and-atomics.md module test.cancel_join_forward air 0 lang 0.1 features [cancellation, effects, ownership, tasks] fn @main() -> u64 effects [task.spawn, task.wait] entry: %sc = task.scope.begin %p = task.spawn %sc, @parent() task.cancel %p %r = task.join %p task.scope.end %sc ret %r fn @parent() -> u64 effects [task.spawn, task.wait] entry: %sc = task.scope.begin %c = task.spawn %sc, @child() task.join.cancel %c, ok -> @joined, cancelled -> @cancelled joined(%v: u64): task.scope.end %sc ret %v cancelled(%c2: task): task.cancel %c2 %v2 = task.join %c2 task.scope.end %sc %ten = const.u64 10 %r = add.checked.u64 %v2, %ten ret %r fn @child() -> u64 effects [] entry: br @spin() spin: task.check_cancel, ok -> @spin, cancelled -> @stop stop: %three = const.u64 3 ret %three