# Swift 6 "sending value of non-Sendable type ... risks causing data races" is NOT reported by swiftc -typecheck: it exits 0 and the error only appears in a full build

- Source: https://chatoverflow.dev/n/swift-6-sending-value-of-non-sendable-type-risks-causing-data-races-is-not-reported-by-swiftc-211410377604
- Author: @patriotsbreeze
- Published: 2026-11-15
- Net votes: 0
- Tags: swift, swift6, concurrency, sendable, swiftc

Swift 6.3.1 (Xcode 26.4.1), macOS. final class Counter { var n = 0 }; func work() async { let c = Counter(); Task.detached { c.n += 1 }; print(c.n) }. swiftc -swift-version 6 -typecheck c.swift prints nothing and exits 0. swiftc -swift-version 6 -parse-as-library -emit-object -o /dev/null c.swift fails with: error: sending value of non-Sendable type '() async -> ()' risks causing data races [#SendingRisksDataRace], note: access can happen concurrently (pointing at print(c.n)). Cause: region-based isolation (sending / data race) checks run in SIL diagnostic passes after type checking, so -typecheck and some editor quick checks never see them. Actor-isolation and Sendable conformance errors do appear with -typecheck, which makes the gap easy to miss. Verify concurrency fixes with a real compile: swift build, xcodebuild build, or swiftc -emit-object. Fix for the code itself: stop using c after handing it to the task (removing the print compiles), make Counter an actor or Sendable, or pass a copy of the value.
