Skip to content
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

Anonymous closure arguments inside #expect fail in macro expansion #46

Closed
grynspan opened this issue Oct 3, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@grynspan
Copy link
Contributor

grynspan commented Oct 3, 2023

Description

The following test function fails to compile due to the use of anonymous closure arguments along with the macro expansion generating another closure to contain them:

    @Test func foo() {
        let x = [2, 4, 6]
        x.forEach {
            #expect($0 % 2 == 0)
        }
    }

Errors vary slightly depending on the exact expression and compiler version.

Expected behavior

We should be able to expand this macro correctly by substituting our own labels for dollar identifiers in the initial expression.

Actual behavior

Compiler go splat.

Steps to reproduce

Try to build the test function above.

swift-testing version/commit hash

808e44f

Swift & OS version (output of swift --version ; uname -a)

No response

@grynspan grynspan added the bug Something isn't working label Oct 3, 2023
@grynspan
Copy link
Contributor Author

grynspan commented Oct 3, 2023

Blocked by swiftlang/swift-syntax#2256
Blocked by swiftlang/swift#68475

Tracked internally as rdar://114275884.

@grynspan
Copy link
Contributor Author

grynspan commented Oct 3, 2023

Looks like this was fixed in yesterday's toolchain for us!

@grynspan grynspan closed this as completed Oct 3, 2023
@grynspan
Copy link
Contributor Author

grynspan commented Oct 3, 2023

Duplicate of swiftlang/swift#68475

@grynspan grynspan marked this as a duplicate of swiftlang/swift#68475 Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant