Skip to content

Fully-qualify reference to 'Comment' type in #expect expansion when comment argument isn't a string literal#1645

Merged
stmontgomery merged 1 commit into
swiftlang:mainfrom
stmontgomery:qualify-comment
Mar 31, 2026
Merged

Fully-qualify reference to 'Comment' type in #expect expansion when comment argument isn't a string literal#1645
stmontgomery merged 1 commit into
swiftlang:mainfrom
stmontgomery:qualify-comment

Conversation

@stmontgomery

Copy link
Copy Markdown
Contributor

This fixes a build error which can arise in the code emitted by #expect when the comment argument is not a string literal and the module the #expect appears in has a custom type visible named Comment, conflicting with the testing library's built-in type by that name.

Fixes #1641

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 this to the Swift 6.4.0 (main) milestone Mar 30, 2026
@stmontgomery stmontgomery self-assigned this Mar 30, 2026
@stmontgomery stmontgomery requested a review from grynspan as a code owner March 30, 2026 22:11
@stmontgomery stmontgomery added the bug 🪲 Something isn't working label Mar 30, 2026
@stmontgomery stmontgomery added the macros 🔭 Related to Swift macros such as @Test or #expect label Mar 30, 2026
@stmontgomery stmontgomery merged commit 983efcd into swiftlang:main Mar 31, 2026
27 checks passed
@stmontgomery stmontgomery deleted the qualify-comment branch March 31, 2026 14:32
stmontgomery added a commit that referenced this pull request Apr 1, 2026
…n when comment argument isn't a string literal (#1648)

- **Explanation**:
This fixes a build error which can arise in the code emitted by
`#expect` when the `comment` argument is not a string literal and the
module the `#expect` appears in has a custom type visible named
`Comment`, conflicting with the testing library's built-in type by that
name.
- **Scope**: Affects a narrow use case of expectations: those which
include custom comment arguments which aren't string literals
- **Issues**: #1641
- **Original PRs**: #1645
- **Risk**: Low; affects a corner case in the expansion of `#expect` and
`#require` macros
- **Testing**: Added a new regression test
- **Reviewers**: @grynspan
stmontgomery added a commit that referenced this pull request Apr 1, 2026
…when comment argument isn't a string literal (#1652)

- **Explanation**:
This fixes a build error which can arise in the code emitted by
`#expect` when the `comment` argument is not a string literal and the
module the `#expect` appears in has a custom type visible named
`Comment`, conflicting with the testing library's built-in type by that
name.
- **Scope**: Affects a narrow use case of expectations: those which
include custom comment arguments which aren't string literals
- **Issues**: #1641
- **Original PRs**: #1645
- **Risk**: Low; affects a corner case in the expansion of `#expect` and
`#require` macros
- **Testing**: Added a new regression test
- **Reviewers**: @grynspan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working macros 🔭 Related to Swift macros such as @Test or #expect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swift Testing macro not fully qualifying types in its expansion

2 participants