Skip to content

[ConstraintSystem] Extend solver support for designated types for ope… #19909

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

[ConstraintSystem] Extend solver support for designated types for ope… #19909

merged 1 commit into from
Oct 16, 2018

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Oct 16, 2018

…rators.

Have the constraint solver consider multiple designated types for an
operator. We currently consider the overloads from each in turn,
stopping as soon as we have a solution. As a result, we can still end
up with exponential type checking in some cases if an operator has
more than a single designated type. This still allows us to reduce the
base of that exponent, though, which makes it possible to increase the
number of expressions we can type check successfully in practice.

…rators.

Have the constraint solver consider multiple designated types for an
operator. We currently consider the overloads from each in turn,
stopping as soon as we have a solution. As a result, we can still end
up with exponential type checking in some cases if an operator has
more than a single designated type. This still allows us to reduce the
base of that exponent, though, which makes it possible to increase the
number of expressions we can type check successfully in practice.
@rudkx rudkx requested a review from xedin October 16, 2018 07:30
@rudkx
Copy link
Contributor Author

rudkx commented Oct 16, 2018

@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.

LGTM!

return true;
if (auto *extensionDecl = dyn_cast<ExtensionDecl>(parentDecl)) {
parentDecl = extensionDecl->getExtendedNominal();
if (parentDecl == designatedNominal) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use a extract resize + add into a separate function to deduplicate logic here for types and extensions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll do that in a follow-up.

@rudkx rudkx merged commit 3d6c93f into swiftlang:master Oct 16, 2018
@rudkx rudkx deleted the extend-operator-designated-type branch October 16, 2018 17:42
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