Skip to content

[6.0] Allow borrowing without underscore in pattern matches. #2600

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

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Apr 12, 2024

Explanation: Allows borrowing x in addition to _borrowing x in pattern matches when the BorrowingSwitch experimental feature flag is enabled.
Scope: New feature enablement
Issue: rdar://126305009
Original PR: #2599
Risk: Low. The new syntax is enabled in a way that should keep the keyword usage contextual so that existing code does not break.
Testing: Swift CI, compatibility test suite
Reviewer: @ahoppen

@jckarter
Copy link
Contributor Author

Please test with following pull request:
swiftlang/swift#72996

@swift-ci Please test

1 similar comment
@jckarter
Copy link
Contributor Author

Please test with following pull request:
swiftlang/swift#72996

@swift-ci Please test

@jckarter jckarter force-pushed the borrowing-switch-no-underscore-6.0 branch from 27d551f to b0a84b6 Compare April 12, 2024 16:07
@jckarter
Copy link
Contributor Author

Please test with following pull request:
swiftlang/swift#72996

@swift-ci Please test

Comment on lines -733 to +730
substructure: ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier("_borrowing"))),
substructure: ExprSyntax(DeclReferenceExprSyntax(baseName: .identifier("borrowing"))),
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to continue having tests for _borrowing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My hope is that the warning I added in swiftlang/swift#72996 will get the early adopters over the new syntax so I can clean up the temporary syntax in a follow up commit.

@ahoppen
Copy link
Member

ahoppen commented Apr 12, 2024

swiftlang/swift#72996

@swift-ci Please test Windows

@jckarter jckarter merged commit 7347d30 into swiftlang:release/6.0 Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants