Skip to content

SR-2505: Fix "Call arguments did not match up" assertion #5286

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 1 commit into from
Oct 14, 2016

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Oct 14, 2016

Always check arguments of the tuple type against corresponding parameters,
otherwise for a single argument functions e.g. foo(_ a: Any) after SE-0046
type checker is going to produce incorrect solution.

Resolves SR-2505.

@xedin
Copy link
Contributor Author

xedin commented Oct 14, 2016

/cc @rudkx

@rudkx rudkx self-assigned this Oct 14, 2016
@rudkx
Copy link
Contributor

rudkx commented Oct 14, 2016

@xedin Can you add a test case similar to the gist that I posted as well? https://gist.github.com/rudkx/3fa7aca590f344f5613337644a21b97f

You can remove the three prints, the associated type, typealias, protocol Initable, etc. and just leave enough in to ensure that we continue to call the correct test() method.

@xedin
Copy link
Contributor Author

xedin commented Oct 14, 2016

@rudkx Sure, i'll do it right away.

@xedin
Copy link
Contributor Author

xedin commented Oct 14, 2016

@rudkx Done!

@rudkx
Copy link
Contributor

rudkx commented Oct 14, 2016

@xedin Great! I'll start tests now and take a closer look at the change tomorrow.

@xedin
Copy link
Contributor Author

xedin commented Oct 14, 2016

Thanks!

@rudkx
Copy link
Contributor

rudkx commented Oct 14, 2016

@swift-ci Please smoke test

Copy link
Contributor

@rudkx rudkx left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM. Make those changes and I'll re-run tests and merge.

let c_2505 = C_2505(arg: [C2_2505()]) // expected-error {{argument labels '(arg:)' do not match any available overloads}} expected-note {{overloads for 'C_2505' exist}}

// make sure that behavior related to allowing trailing closures to match functions
// with Any as a final parameter is unchanged due to change made by SR-2505
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you clarify this comment to say that the test is to ensure that we continue to select the function that does not have Any as a final parameter?

}
}

let _ = C_SR_2505().call(C_SR_2505())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you move this whole test into closures.swift instead?

I think it probably makes more sense there.

@xedin
Copy link
Contributor Author

xedin commented Oct 14, 2016

@rudkx Absolutely!

@xedin
Copy link
Contributor Author

xedin commented Oct 14, 2016

@rudkx Done - rebased with the latest master, changed tests as you requested.

@@ -1,3 +1,4 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the extra line here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, sorry, I don't know how it got there...

Always check arguments of the tuple type against corresponding parameters,
otherwise for a single argument functions e.g. foo(_ a: Any) after SE-0046
type checker is going to produce incorrect solution.
Copy link
Contributor

@rudkx rudkx left a comment

Choose a reason for hiding this comment

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

LGTM. Will restart tests & merge.

@rudkx
Copy link
Contributor

rudkx commented Oct 14, 2016

@swift-ci Please smoke test and merge.

@xedin
Copy link
Contributor Author

xedin commented Oct 14, 2016

Looks like auto-merge feature is still broken in CI :(

@rudkx rudkx merged commit 3a493b2 into swiftlang:master Oct 14, 2016
@rudkx
Copy link
Contributor

rudkx commented Oct 14, 2016

Thanks for the patch!

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