-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Migrate expression completions to solver-based #41633
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
[CodeCompletion] Migrate expression completions to solver-based #41633
Conversation
bc8a25a
to
f698b2c
Compare
SolutionApplicationTarget target(closure, closure, | ||
ContextualTypePurpose::CTP_CallArgument, | ||
contextualType, /*isDiscarded=*/false); | ||
setSolutionApplicationTarget(closure, target); |
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.
@xedin I’m pretty sure this part is not correct. As we discussed, I’m using SolutionApplicationTarget
to convey the contextual type of the ClosureExpr
. I’m not entirely sure what you’d expect for the decl context, contextual type purpose and isDiscarded
. AFAICT, we don’t really know the contextual type purpose and whether it’s discarded inside resolveClosure
.
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'd suggest you add a new ContextualTypePurpose
- CTP_Closure
, declaration context of this target should be the one associated with constraint system and isDiscarded
is false
in here.
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.
Thanks. I changed it.
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.
Looked only at the last commit.
SolutionApplicationTarget target(closure, closure, | ||
ContextualTypePurpose::CTP_CallArgument, | ||
contextualType, /*isDiscarded=*/false); | ||
setSolutionApplicationTarget(closure, target); |
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'd suggest you add a new ContextualTypePurpose
- CTP_Closure
, declaration context of this target should be the one associated with constraint system and isDiscarded
is false
in here.
/// "resolved" concrete type. | ||
/// If no type has been computed for this node or if \c node is null, returns | ||
/// the null type. | ||
Type getResolvedTypeIfAvailable(ASTNode node) const; |
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 don't see any uses of this but I'd say that if ASTNode doesn't have a type it's either not associated with the solution which is an issue on the caller side, or it didn't get recorded during constraint generation, which makes it a bug in the solver.
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.
Oh, looks like the need for that method has gone away at some point during my development. I just removed it.
121603e
to
666658e
Compare
666658e
to
53a677f
Compare
@swift-ci Please smoke test |
@swift-ci Please SourceKit stress test |
Stress tester run: https://ci.swift.org/job/swift-PR-macos-with-sourcekit-stress-tester/44/ This needs some XFails due to SR-16012 and a performance problem I’m addressing in separately in #41917. |
53a677f
to
e2a62f1
Compare
@swift-ci Please smoke test |
- SR-14694: A few timeout issues were resolved by swiftlang/swift#41917 and others were introduced by swiftlang/swift#41633. - SR-16012: A couple more cases were caused by migrating expression completions to solver-based swiftlang/swift#41633
Migrate
StmtOrExpr
completions to solver-based.