-
Notifications
You must be signed in to change notification settings - Fork 120
Closed
Labels
bug🪲 Something isn't working🪲 Something isn't workingtraitsIssues and PRs related to the trait subsystem or built-in traitsIssues and PRs related to the trait subsystem or built-in traits
Milestone
Description
Description
The @Suite
macro is expanding to incorrect code.
If we have
@Suite(
.serialized // my comment
)
struct AsyncProcessTests.self {
// Includes @Test definitions
}
A compilation error occurs.
Expected behavior
Compilation fails with the following
`- /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager-2/Tests/BasicsTests/AsyncProcessTests.swift:508:1: note: expanded code originates here
506 | #expect(result.exitStatus == .terminated(code: 0))
507 | }
508 | }
+--- macro expansion @Suite ----------------------------------------
| 7 | AsyncProcessTests.self,
| 8 | traits: [
| 9 | .serialized // my comment],sourceLocation: Testing.SourceLocation(fileID: "BasicsTests/AsyncProcessTests.swift", filePath: "/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager-2/Tests/BasicsTests/AsyncProcessTests.swift", line: 26, column: 2)
| | `- error: expected ',' separator
|10 | )
|11 | ]
+-------------------------------------------------------------------
509 |
510 | extension AsyncProcess {
Actual behavior
The code comment should be ignore and compilation should not occur.
Steps to reproduce
- Create the following file
import Testing @Suite( .serialized // my comment ) struct MyTestStructure {}
- run
swift test
swift-testing version/commit hash
Unknown
Swift & OS version (output of swift --version ; uname -a
)
Mac OS 15.x
❯ swift --version
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0
Metadata
Metadata
Assignees
Labels
bug🪲 Something isn't working🪲 Something isn't workingtraitsIssues and PRs related to the trait subsystem or built-in traitsIssues and PRs related to the trait subsystem or built-in traits