-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ConstraintSystem] Refactor disjunction partitioning #19962
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
[ConstraintSystem] Refactor disjunction partitioning #19962
Conversation
Change the order of statements but nothing functional.
…types. Move this into a separate function.
Unnest code by splitting it out into lambdas.
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are couple of comments but otherwise LGTM!
lib/Sema/CSSolver.cpp
Outdated
designatedNominalTypes[designatedTypeIndex]; | ||
|
||
if (parentDecl == designatedNominal) { | ||
auto &constraints = definedInDesignatedType[designatedTypeIndex]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think bodies of both of these if
s could be unified into:
// preamble
auto *parentDC = functionDecl->getParent();
auto *parentDecl = parentDC->getSelfNominalTypeDecl();
// in the body
if (parentDecl == designatedNominal) {
auto &container = parentDC->isExtensionContext() ? definedInExtensionOfDesignatedType : definedInDesignatedType;
container[designatedTypeIndex].push_back(constraint);
return true;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, something like this should work.
lib/Sema/CSSolver.cpp
Outdated
} | ||
} | ||
SmallVector<SmallVector<unsigned, 4>, 4> definedInDesignatedType; | ||
SmallVector<SmallVector<unsigned, 4>, 4> definedInExtensionOfDesignatedType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why would we'd want to pass these into a partitionForDesignatedTypes
call instead of just making both local in there because they are not used partitionDisjunction
?...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oversight. Will fix momentarily.
@swift-ci Please smoke test |
@rudkx Is this really the reason that Driver/sdk-apple.swift test case is failing now in CI? There aren't any other commits: |
@atrick That would be pretty unusual. It looks like another run is happening now so we can see how far that gets. I did a complete |
No description provided.