Skip to content

Keep the get read accessor for function-typed @Model properties on Swift 6.4 - #75

Merged
mansbernhardt merged 1 commit into
mainfrom
fix/function-typed-read-accessor-swift-6.4
Sep 14, 2026
Merged

mansbernhardt merged 1 commit into
mainfrom
fix/function-typed-read-accessor-swift-6.4

Conversation

@mansbernhardt

Copy link
Copy Markdown
Collaborator

Summary

  • The 6.3 IRGen crash (ScalarPairTypeInfo<FuncTypeInfo,…>::loadAsTake when a _read coroutine yields a closure whose signature carries an indirectly-passed struct, >4 fields) is not fixed in Swift 6.4 / Xcode 27.0. The #if compiler(>=6.4) gate in ModelTrackedMacro.makeGetSet re-enabled _read for function-typed properties on 6.4, so any debug build of a client with e.g. var make: @Sendable (String) -> SixFieldStruct SIGSEGVs swift-frontend.
  • Drop the gate: the plain get carve-out now applies on every compiler version. Observation is unchanged (same _$modelSource[read:] subscript); the _modify write path never had the problem.
  • Un-gate the macro snapshot test (testModelClosureProperty), update the doc comments, add the CHANGELOG entry.

Verification

  • Standalone repro (@Model struct M { var make: @Sendable (String) -> SixFieldStruct }) crashes swift-frontend 6.4 against main; compiles with this branch.
  • Full suite under Xcode 26 (CI's toolchain): 869/869 passed; SwiftModelMacroTests 29/29.
  • Parallel-apple's Imagien iOS build on Xcode 27 succeeded with this patch via a local .package(path:) override (reported by the parallel-apple session).

Note: the suite itself does not compile on Swift 6.4 yet (sending-closure region-isolation errors in a few test files) — separate, unrelated to this change.

🤖 Generated with Claude Code

…Swift 6.4

The 6.3 IRGen crash (`ScalarPairTypeInfo<FuncTypeInfo,…>::loadAsTake` when a
`_read` coroutine yields a closure whose signature carries an indirectly-passed
struct) is not fixed in Swift 6.4 / Xcode 27.0: `@Model struct M { var make:
@sendable (String) -> SixFieldStruct }` still SIGSEGVs swift-frontend in a debug
build. The `#if compiler(>=6.4)` gate that re-enabled `_read` for function types
therefore turned every such client into a compile failure on the new toolchain.

Drop the gate so the `get` carve-out applies on every compiler, un-gate the
macro snapshot test, and add the CHANGELOG entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mansbernhardt
mansbernhardt merged commit 65e436b into main Sep 14, 2026
7 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.

1 participant