Skip to content

Stop emitting @preconcurrency for Foundation imports on Linux - #969

Merged
czechboy0 merged 2 commits into
apple:mainfrom
zunda-pixel:drop-foundation-preconcurrency
Oct 13, 2026
Merged

czechboy0 merged 2 commits into
apple:mainfrom
zunda-pixel:drop-foundation-preconcurrency

Conversation

@zunda-pixel

@zunda-pixel zunda-pixel commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

On Linux, generated files import URL, Data and Date with @preconcurrency, which triggers a StrictMemorySafety warning. With warnings as errors, generated code fails to build. The attribute is unnecessary since the runtime requires Swift 6.2, where these types are Sendable on Linux.

Modifications

Remove @preconcurrency from the generated Foundation imports, and update the reference and example sources.

Generated code depends on swift-openapi-runtime, which requires Swift
6.2. On Linux in Swift 6.2, URL, Data and Date come from swift-foundation
and are Sendable, so the @preconcurrency attribute is no longer needed.
Under strict memory safety it produces a warning, which becomes an error
in generated sources for adopters building with warnings as errors.
@zunda-pixel
zunda-pixel force-pushed the drop-foundation-preconcurrency branch from b5033f9 to 2b70508 Compare October 11, 2026 17:56
@czechboy0
czechboy0 self-requested a review October 11, 2026 18:13

@czechboy0 czechboy0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @zunda-pixel 🙏

I also cleaned up the generator code that emits this, while we're in this area.

@czechboy0
czechboy0 enabled auto-merge (squash) October 13, 2026 15:27
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Oct 13, 2026
@czechboy0
czechboy0 disabled auto-merge October 13, 2026 15:59
@czechboy0
czechboy0 merged commit bf578ce into apple:main Oct 13, 2026
47 of 50 checks passed
@zunda-pixel
zunda-pixel deleted the drop-foundation-preconcurrency branch October 15, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants