Skip to content

[CSBindings] Don't try to rank bindings based on number of defaults i… #16590

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
May 15, 2018

Conversation

xedin
Copy link
Contributor

@xedin xedin commented May 14, 2018

…f they are literal

Number of defaults is a fallback condition if there are no other
differences, but pontential bindings which are literal should always
be ranked lower than anything else because there is a higher chance
that such bindings are wrong because their full set might not have
been resolved yet.

Resolves: rdar://problem/39616039

@xedin xedin requested a review from rudkx May 14, 2018 07:51
@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@swift-ci please test source compatibility

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.

This seems problematic, as do the other tests that are looking at properties of x.

Consider what happens if you take the bindings from two type variables, T1 and T2, and pass them into this function twice, in different orders. You can end up with
T1 < T2 being false, and T2 < T1 being false, which implies that T1 == T2.

Based on your commit message, you're attempting to look for differences in type bindings other than the number of defaults, so this change does not seem consistent with that goal.

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@rudkx There is a check for formBindingScore(x) < formBindingScore(y) already which does the actual comparison, this is just intended to make sure that type variable with default not no literal is going to be worth then a type variable without defaults but with literal bindings.

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

I'll make it so it always tests both sides to make this less ambiguous.

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@rudkx suggested even better approach - we can just check formBindingScore in reverse to get the same effect here instead checking for subtype and literals, currently testing it out.

…f they are literal

Number of defaults is a fallback condition if there are no other
differences, but pontential bindings which are literal should always
be ranked lower than anything else because there is a higher chance
that such bindings are wrong because their full set might not have
been resolved yet.

Resolves: rdar://problem/39616039
@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6fb5281afc5a7fc01cb00f50e4e029f05ba6690a

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 6fb5281afc5a7fc01cb00f50e4e029f05ba6690a

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@swift-ci please test source compatibility

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

@swift-ci please test macOS platform

@xedin
Copy link
Contributor Author

xedin commented May 14, 2018

Both failed with EOFException, re-running...

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, thanks!

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