Skip to content

[SR-5869][Parse/Sema] Expand recovery support for trailing closure in statement conditions #12457

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

Closed
wants to merge 1 commit into from

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 16, 2017

Fixes: SR-5869

Formerly, the recovering logic only handled trailing closures at outermost position.
This PR expands it to handle trailing closures in middle of expressions:

test.swift:2:16: error: trailing closure requires parentheses for disambiguation in this context
if nums.filter { $0 % 2 == 0 }.isEmpty { 
              ~^
              (               )
test.swift:5:16: error: trailing closure requires parentheses for disambiguation in this context
if nums.filter { $0 % 2 == 0 } == [2, 4] { 
              ~^
              (               )

@rintaro
Copy link
Member Author

rintaro commented Oct 16, 2017

@swift-ci Please smoke test

case ExprKind::Array:
case ExprKind::Dictionary:
// Don't dig into expression which syntactically enclose other
// expressinos. e.g. [...], (...), and { ... }
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: expressinos

Copy link
Member

Choose a reason for hiding this comment

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

I could really go for an expressino right now.

@CodaFi
Copy link
Contributor

CodaFi commented Nov 18, 2019

@swift-ci please smoke test

@rintaro
Copy link
Member Author

rintaro commented Nov 19, 2019

Closing. This has been superseded by #25165 which is reverted.
We should make this diagnostic warning (#25165 (comment)).

@rintaro rintaro closed this Nov 19, 2019
@owenv
Copy link
Contributor

owenv commented Nov 19, 2019

I’d forgotten about #25165, thanks for the reminder! I should be able to get back to that pretty soon and turn it into a warning

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.

5 participants