Skip to content

[ConstraintSystem] Attempt to select disjunctions that split constrai… #16810

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 24, 2018
Merged

[ConstraintSystem] Attempt to select disjunctions that split constrai… #16810

merged 1 commit into from
May 24, 2018

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented May 24, 2018

…nt systems.

When selecting the next disjunction to attempt, try to find one that
is a disjunction of bindings where the type being bound is the
converted-to type in a conversion constraint. Attempting these early
makes it possible to split constraint systems, eliminating exponential
behavior.

Fixes: rdar://problem/40344044

…nt systems.

When selecting the next disjunction to attempt, try to find one that
is a disjunction of bindings where the type being bound is the
converted-to type in a conversion constraint. Attempting these early
makes it possible to split constraint systems, eliminating exponential
behavior.

Fixes: rdar://problem/40344044
@rudkx rudkx requested a review from xedin May 24, 2018 00:30
@rudkx
Copy link
Contributor Author

rudkx commented May 24, 2018

@swift-ci Please smoke test

@rudkx
Copy link
Contributor Author

rudkx commented May 24, 2018

@swift-ci Please test source compatibility

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.

This seems reasonable, also makes me wonder if we should prioritize disjunctions related to implicitly unwrapped optionals in general because they give more context just like coercions?

@rudkx
Copy link
Contributor Author

rudkx commented May 24, 2018

@xedin I am not sure if this is what you mean, but one thought I had when I was doing the IUO work is that we should probably prioritize any disjunction that consists strictly of bind constraints in the same way we try to find a type variable we can bind before looking at disjunctions, since attempting types tends to cause us to be able to fail faster.

I'll try pushing a PR with a change to prefer those if none linked to a conversion is found and see if it helps (or hurts) any of the existing tests we have in the validation suite.

@rudkx rudkx merged commit 4310145 into swiftlang:master May 24, 2018
@rudkx rudkx deleted the rdar40344044 branch May 24, 2018 05:15
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