Skip to content

Require sendable userInfo values in JSON.withEncoding(of:userInfo:_:) #955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

stmontgomery
Copy link
Contributor

@stmontgomery stmontgomery commented Feb 12, 2025

swift-foundation recently landed a change (in swiftlang/swift-foundation#764) which requires any Sendable values in JSONEncoder.userInfo. This causes a build failure in swift-testing:

JSON.swift:44:28: error: type 'Any' does not conform to the 'Sendable' protocol 
42 | 
43 |     // Set user info keys that clients want to use during encoding.
44 |     encoder.userInfo.merge(userInfo, uniquingKeysWith: { _, rhs in rhs})
   |                            `- error: type 'Any' does not conform to the 'Sendable' protocol

This PR adjusts our userInfo: parameter require any Sendable values. The values we were passing to this utility were already sendable, luckily.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@stmontgomery stmontgomery added bug 🪲 Something isn't working build 🧱 Affects the project's build configuration or process labels Feb 12, 2025
@stmontgomery stmontgomery added this to the Swift 6.x milestone Feb 12, 2025
@stmontgomery stmontgomery self-assigned this Feb 12, 2025
@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@tshortli
Copy link
Contributor

Reverted in #957 due to Swift CI breakage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working build 🧱 Affects the project's build configuration or process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants