Skip to content

Make all test content types directly conform to TestContent. #920

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
merged 5 commits into from
Jan 22, 2025

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jan 20, 2025

This PR eliminates the TestContentAccessorResult associated type from the (currently internal, potentially eventually API) TestContent protocol. This associated type needed to be ~Copyable so ExitTest could be used with it, but that appears to pose some problems for the compiler (rdar://143049814&143080508).

Instead, we remove the associated type and just say "the test content record is the type that conforms to TestContent". ExitTest is happy with this, but Test's produced type is a non-nominal function type, so we wrap that function in a small private type with identical layout and have that type conform.

The ultimate purpose of this PR is to get us a bit closer to turning TestContent into a public or tools-SPI protocol that other components can use for test discovery.

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 enhancement New feature or request tools integration 🛠️ Integration of swift-testing into tools/IDEs labels Jan 20, 2025
@grynspan grynspan added this to the Swift 6.x milestone Jan 20, 2025
@grynspan grynspan self-assigned this Jan 20, 2025
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Windows

@@ -230,7 +230,7 @@ private func _findSection(named sectionName: String, in hModule: HMODULE) -> Sec
///
/// - Returns: An array of structures describing the bounds of all known test
/// content sections in the current process.
private func _sectionBounds(_ kind: SectionBounds.Kind) -> [SectionBounds] {
private func _sectionBounds(_ kind: SectionBounds.Kind) -> some Sequence<SectionBounds> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Drive-by fix, this should be a lazy sequence rather than an array.

@grynspan
Copy link
Contributor Author

@swift-ci test

1 similar comment
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Linux

@grynspan
Copy link
Contributor Author

@swift-ci test macOS

@grynspan
Copy link
Contributor Author

@swift-ci test Windows

@grynspan
Copy link
Contributor Author

@swift-ci test

1 similar comment
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Linux

This PR eliminates the `TestContentAccessorResult` associated type from the
(currently internal, potentially eventually API) `TestContent` protocol. This
associated type needed to be `~Copyable` so `ExitTest` could be used with it,
but that appears to pose some _problems_ for the compiler (rdar://143049814&143080508).

Instead, we remove the associated type and just say "the test content record is
the type that conforms to `TestContent`". `ExitTest` is happy with this, but
`Test`'s produced type is a non-nominal function type, so we wrap that function
in a small private type with identical layout and have that type conform.

The ultimate purpose of this PR is to get us a bit closer to turning
`TestContent` into a public or tools-SPI protocol that other components can use
for test discovery.
…mentation to tell devs not to use our typealias because it'll almost certainly break them in the future
… not a collection, and may not be enumerable twice--cast to array for the bulk of the test
@grynspan grynspan force-pushed the jgrynspan/test-content-nominal-types-only branch from c35cde4 to 266405c Compare January 21, 2025 19:28
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Windows

@grynspan
Copy link
Contributor Author

@swift-ci test macOS

@grynspan grynspan merged commit 8836b38 into main Jan 22, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/test-content-nominal-types-only branch January 22, 2025 00:39
@grynspan grynspan added the discovery 🔎 test content discovery label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discovery 🔎 test content discovery enhancement New feature or request tools integration 🛠️ Integration of swift-testing into tools/IDEs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants