Skip to content

[6.4.x] Support non-finite floats in exit test captures - #1842

Open
Kyle-Ye wants to merge 2 commits into
swiftlang:release/6.4.xfrom
Kyle-Ye:bugfix/fix-exit-test-non-finite-floats-6.4
Open

[6.4.x] Support non-finite floats in exit test captures#1842
Kyle-Ye wants to merge 2 commits into
swiftlang:release/6.4.xfrom
Kyle-Ye:bugfix/fix-exit-test-non-finite-floats-6.4

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Allow exit test capture lists to round-trip NaN and positive and
negative infinity.

### Motivation:

Exit-test value capturing became available in Swift 6.3. Captured values
are JSON-encoded in the parent process and decoded in the subprocess.
The default JSON coding strategies reject non-finite floating-point
values even though `Float` and `Double` satisfy the `Codable` and
`Sendable` requirements for captured values.

Fixes swiftlang#1836.

### Modifications:

Configure matching non-conforming floating-point encoding and decoding
strategies specifically for the exit-test captured-value transport,
using an internal coding user-info key so other JSON call sites retain
their default behavior.

Use `"NaN"`, `"Infinity"`, and `"-Infinity"` as the JSON string
representations, following conventions used by other JSON encoders.

Add a parameterized regression test covering positive infinity, negative
infinity, and NaN, including validation that their classification and
sign survive the round trip.

### AI Disclosure:

Codex was used to help investigate the exit-test capture path, research
JSON prior art, and draft and refine the implementation, tests, and PR
text. I reviewed the resulting changes and verified the regression test
locally.

### Checklist:

- [x] Code and documentation follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] No public symbols are renamed or modified, so no DocC references
need updating.

### Future discussion

I suggest this should also be cherry-picked into release/6.4 and
release/6.3.
@Kyle-Ye

Kyle-Ye commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

#1837 (comment)

As discussed here, I'll wait for a future 6.4.1 release. cc @grynspan

@grynspan grynspan added enhancement New feature or request exit-tests ☠️ Work related to exit tests exit-test-capture-lists 🥍 Work related to exit test capture lists ai-assisted 🤖 This issue or pull request was created (in whole or in part) by an AI or LLM. labels Aug 18, 2026
@grynspan grynspan modified the milestone: Swift 6.4.0 Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted 🤖 This issue or pull request was created (in whole or in part) by an AI or LLM. enhancement New feature or request exit-test-capture-lists 🥍 Work related to exit test capture lists exit-tests ☠️ Work related to exit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants