Skip to content

fix: resolve Swift 6.2 sending violations in ActivityContextManagerTests#52

Merged
nachoBonafonte merged 1 commit intoopen-telemetry:mainfrom
gmoraleda:fix/swift-6.2-compat
Apr 16, 2026
Merged

fix: resolve Swift 6.2 sending violations in ActivityContextManagerTests#52
nachoBonafonte merged 1 commit intoopen-telemetry:mainfrom
gmoraleda:fix/swift-6.2-compat

Conversation

@gmoraleda
Copy link
Copy Markdown
Contributor

Summary

  • Remove nonisolated from createAsyncSpan so it inherits @MainActor from the enclosing test class
  • Remove outdated #if compiler(>=5.10) #warning(...) block

Swift 6.2 (Xcode 26) treats sending diagnostics as hard errors even with -strict-concurrency=minimal. The nonisolated async func createAsyncSpan caused 18 errors because passing non-Sendable Span values from @MainActor Task closures to a nonisolated async method crosses an isolation boundary. Removing nonisolated keeps the method on the main actor, eliminating the boundary.

Test plan

  • swift build --build-tests — 0 errors (was 18)
  • swift test — 508 tests, 0 failures

Remove `nonisolated` from `createAsyncSpan` so it inherits `@MainActor`
from the enclosing class. Swift 6.2 flags sending non-Sendable `Span`
values to nonisolated async methods as a hard error, even with
`-strict-concurrency=minimal`. Keeping the method on the main actor
eliminates the isolation boundary.

Also remove the outdated `#if compiler(>=5.10) #warning(...)` block.
@nachoBonafonte nachoBonafonte merged commit 434a566 into open-telemetry:main Apr 16, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants