Skip to content

Sema: Finish hollowing out SolverScope #76921

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 8 commits into from
Oct 9, 2024

Conversation

slavapestov
Copy link
Contributor

The scope now just records three things: the current number of type variables, the position in the trail, and the number of scopes seen so far.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@@ -1033,7 +1031,6 @@ class ConjunctionStep : public BindingStep<ConjunctionElementProducer> {
private:
/// Restore best and current scores as they were before conjunction.
void restoreCurrentScore(const Score &solutionScore) const {
CS.CurrentScore = CurrentScore;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this method needs to be renamed now since it no longer restores the score, only adds hole + fixes scores from the closure to indicate that the body failed to type-check.

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to do this to make sure that we rank solutions with invalid closures appropriately and don’t produce a valid solution if a multi-statement closure failed.

}

// Make sure that element is solved in isolation
// by dropping all scoring information.
for (unsigned i = 0; i < NumScoreKinds; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we wrap this into a “resetScore” method or something like that?

@xedin
Copy link
Contributor

xedin commented Oct 9, 2024

@swift-ci please clean test

@slavapestov
Copy link
Contributor Author

@xedin agreed on both suggestions, I'll deal with them in the next PR if you don't mind because I have a few more commits coming up already

@xedin
Copy link
Contributor

xedin commented Oct 9, 2024

Sure, no worries!

@slavapestov slavapestov merged commit 24e5a82 into swiftlang:main Oct 9, 2024
7 checks passed
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