Skip to content

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

Merged
grynspan merged 5 commits into
mainfrom
jgrynspan/test-content-nominal-types-only
Jan 22, 2025
Merged

Make all test content types directly conform to TestContent.#920
grynspan merged 5 commits into
mainfrom
jgrynspan/test-content-nominal-types-only

Conversation

@grynspan

@grynspan grynspan commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Windows

/// - 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
Copy Markdown
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
Copy Markdown
Contributor Author

@swift-ci test

1 similar comment
@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Linux

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test macOS

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Windows

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

1 similar comment
@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Windows

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test macOS

@grynspan grynspan merged commit 8836b38 into main Jan 22, 2025
@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