Skip to content

[Diagnostics] Ported tuple mismatch diagnostic to new diagnostic framework #26391

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 2 commits into from
Aug 2, 2019

Conversation

sl
Copy link
Contributor

@sl sl commented Jul 29, 2019

This pull request ports the old tuple assignment diagnostic to the new diagnostic framework. Additionally adds tests relating to the diagnostic and updates the tests so they no longer have _ types.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-11224.

@sl sl requested a review from xedin July 29, 2019 17:13
@sl
Copy link
Contributor Author

sl commented Jul 29, 2019

@swift-ci please smoke test

@sl sl force-pushed the port-tuple-assignment-diagnostic branch from af44c9c to a3b56c2 Compare July 29, 2019 17:45
@sl
Copy link
Contributor Author

sl commented Jul 29, 2019

@swift-ci please smoke test

var (m, n) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(_, _)', tuples have a different number of elements}}
var (o, p, q, r) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(_, _, _, _)', tuples have a different number of elements}}
var (m, n) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(Int, Int)', tuples have a different number of elements}}
var (o, p, q, r) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(Int, Int, Int, Any)', tuples have a different number of elements}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice improvement :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice indeed!

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

Overall looks great! Needs some polish.

var (m, n) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(_, _)', tuples have a different number of elements}}
var (o, p, q, r) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(_, _, _, _)', tuples have a different number of elements}}
var (m, n) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(Int, Int)', tuples have a different number of elements}}
var (o, p, q, r) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(Int, Int, Int, Any)', tuples have a different number of elements}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice indeed!

@sl
Copy link
Contributor Author

sl commented Aug 2, 2019

@swift-ci please smoke test

@sl sl force-pushed the port-tuple-assignment-diagnostic branch from e1556d5 to 6dd88c2 Compare August 2, 2019 00:19
@sl
Copy link
Contributor Author

sl commented Aug 2, 2019

@swift-ci please smoke test

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

Looks even better! I have a small suggestion about a new fix and its application logic though which need to get addressed before we merge.

@sl sl force-pushed the port-tuple-assignment-diagnostic branch from 6dd88c2 to 0fa9ec3 Compare August 2, 2019 17:55
@sl
Copy link
Contributor Author

sl commented Aug 2, 2019

@swift-ci please smoke test

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

:shipit:

@xedin
Copy link
Contributor

xedin commented Aug 2, 2019

@swift-ci please smoke test Linux platform

@xedin xedin merged commit 2cfcdf4 into swiftlang:master Aug 2, 2019
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.

4 participants