swift
90b8bc7c - [Concurrency] withDeadline scope: shield masks scope cancel, tests + polish

Commit
142 days ago
[Concurrency] withDeadline scope: shield masks scope cancel, tests + polish Runtime fix: cancellation shields now mask scope cancellation the same way they mask whole-task cancellation, matching child-task semantics. Before this change, `withTaskCancellationShield { Task.isCancelled }` inside a cancelled `withDeadline { }` returned true; inside a spawned+cancelled child Task it returned false. That divergence violated the design goal that `withDeadline` observably behaves as-if it were a child task. - TaskPrivate.h: AsyncTask::isCancelled(ignoreShield=false) now short-circuits to false when a shield is active, before walking the cancellation-scope chain - Clock.swift: drop UInt8 raw values and .walltime case from SystemClockID (no public WallClock exists, and the runtime redesign no longer uses the raw values); rewrite the docstring - TaskCancellation.swift: drop stray @extensible attribute (not a real attribute; non-frozen is the default for public enums under library evolution) Tests: - with_deadline_basic.swift: port proposal Examples 2-5 (nested inner-tighter and outer-tighter shapes) and add two-clock (Continuous+Suspending) composition + withDeadline(in:) shorthand coverage - withdeadline_semantic_parity_with_child_task.swift: 6 pairwise scenarios that run the SAME shape twice (child-Task variant + withDeadline variant) and FileCheck-compare identically-tagged output lines. Covers: local cancel observability, no-leak-to-parent, handler-inside-fires, handler-outside- does-not-fire, shield-hides-isCancelled (the case that flushed out the bug), and ambient-cancel-propagates-in
Author
Parents
Loading