Skip to content

Conversation

DougGregor
Copy link
Member

Handle call-vs-tuple and subscript-vs-collection-expr disambiguation using the same "no trivia" rule that we used to disambiguite "unsafe.x" (which we treat as a member access) from "unsafe .x" (which we treat as an unsafe expression with a leading-dot member access).

Fixes rdar://146459104.

… generally

Handle call-vs-tuple and subscript-vs-collection-expr disambiguation using the
same "no trivia" rule that we used to disambiguite "unsafe.x" (which we
treat as a member access) from "unsafe .x" (which we treat as an unsafe
expression with a leading-dot member access).

Fixes rdar://146459104.
@DougGregor
Copy link
Member Author

@swift-ci please test

assertParse(
"""
func f() {
unsafe ()
Copy link
Member

Choose a reason for hiding this comment

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

Technically, this is still source breaking because we parse it as a call to unsafe right now. But maybe it’s not too bad in practice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is. I'm trying to thread the needle here to the point where the source breakage in practice is near-zero, but we don't have to do semantic disambiguation for unsafe.

@DougGregor DougGregor enabled auto-merge March 7, 2025 18:20
@DougGregor DougGregor merged commit 5f5371d into swiftlang:main Mar 8, 2025
22 checks passed
@DougGregor DougGregor deleted the se-0458-postfix-disambig branch March 8, 2025 02:55
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