Skip to content

[WIP] Serialization traits for data dependencies #1232

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jul 21, 2025

Experimental .serialized(for:) trait. Example use cases:

import Foundation

@Test(.serialized(for: \ProcessInfo.environment["HAS_FREEZER"]))
func `HAS_FREEZER environment variable`() {
  _ = setenv("HAS_FREEZER", "1", 1)
  #expect(FoodTruck.hasFreezer)
  _ = setenv("HAS_FREEZER", "0", 1)
  #expect(!FoodTruck.hasFreezer)
}

@Test(.serialized(for: *))
func `Uses lots of different state, seriously, just scads of it`() { ... }

Name subject to extreme bikeshedding!

Resolves rdar://135288463.

Checklist:

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

@grynspan grynspan added this to the Swift 6.x (main) milestone Jul 21, 2025
@grynspan grynspan self-assigned this Jul 21, 2025
@grynspan grynspan added enhancement New feature or request concurrency 🔀 Swift concurrency/sendability issues public-api Affects public API traits Issues and PRs related to the trait subsystem or built-in traits labels Jul 21, 2025
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan force-pushed the jgrynspan/dependency-trait branch 2 times, most recently from b81b073 to d54a0ba Compare July 21, 2025 20:02
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan force-pushed the jgrynspan/dependency-trait branch from d54a0ba to 0856c1d Compare July 21, 2025 20:17
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan force-pushed the jgrynspan/dependency-trait branch 2 times, most recently from 935f2ab to 9066f51 Compare July 21, 2025 22:23
@grynspan grynspan changed the title [WIP] Dependency traits [WIP] Serialization traits for data dependencies Jul 21, 2025
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan force-pushed the jgrynspan/dependency-trait branch 6 times, most recently from 15b0eaa to e6e2f85 Compare July 22, 2025 19:08
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan force-pushed the jgrynspan/dependency-trait branch from e6e2f85 to eca0abb Compare July 22, 2025 19:28
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan force-pushed the jgrynspan/dependency-trait branch from eca0abb to 147f34d Compare July 22, 2025 20:34
@grynspan grynspan force-pushed the jgrynspan/dependency-trait branch from 147f34d to 5ffab44 Compare July 22, 2025 21:15
@grynspan
Copy link
Contributor Author

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concurrency 🔀 Swift concurrency/sendability issues enhancement New feature or request public-api Affects public API traits Issues and PRs related to the trait subsystem or built-in traits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant