Skip to content

[Diagnostics] Extract backward scan deprecation warning into a fix/diagnostic #33364

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
merged 4 commits into from
Aug 7, 2020

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Aug 7, 2020

Instead of trying to detect this issue during solution application let's add a fix every
time trailing closure is matched via a backward scan. This also makes it easy to diagnose
subscript, unresolved member calls and other expressions which allow unlabeled
trailing closures.

xedin added 4 commits August 6, 2020 16:55
…osure matches

Diagnose situations when trailing closure has been matched to a specific
parameter via a deprecated backward scan.

```swift
func multiple_trailing_with_defaults(
  duration: Int,
  animations: (() -> Void)? = nil,
  completion: (() -> Void)? = nil) {}

multiple_trailing_with_defaults(duration: 42) {} // picks `completion:`
```
@xedin xedin requested review from DougGregor and hborla August 7, 2020 18:57
@xedin
Copy link
Contributor Author

xedin commented Aug 7, 2020

@swift-ci please smoke test

Copy link
Member

@hborla hborla left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Much nicer, thank you!

@xedin xedin merged commit 08771ab into swiftlang:master Aug 7, 2020
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.

3 participants