Skip to content

[CodeCompletion] Migrate AccessorBeginning to solver-based #41922

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 21, 2022

Migrate code completion at the start of an accessor to solver-based.

@ahoppen ahoppen force-pushed the pr/migrage-accessorbeginning-solver-based branch 2 times, most recently from 96b1cca to 28fcdc1 Compare March 24, 2022 17:08
@ahoppen ahoppen marked this pull request as ready for review March 24, 2022 17:09
@ahoppen ahoppen requested a review from rintaro March 24, 2022 17:09
@ahoppen
Copy link
Member Author

ahoppen commented Mar 24, 2022

@swift-ci Please SourceKit stress test

@ahoppen
Copy link
Member Author

ahoppen commented Mar 24, 2022

@swift-ci Please smoke test

Comment on lines 1407 to 1413
if (!CodeCompleteTokenExpr) {
// Happens when completing inside e.g.
// var x: Int {
// get { ... }
// #^COMPLETE^#
// }
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused. You modified parseGetSet to pass the CodeCompletionExpr. Is this reachable?

Copy link
Member

Choose a reason for hiding this comment

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

If we don't have a test case checking not suggesting expressions here, could you add some?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I did apparently fix the bug multiple times in incompatible ways. I updated the PR.

We basically have test cases to test we aren’t producing expressions in complete_accessor.swift, where a lot of global results are disallowed in these places. The way it worked in this PR was that completion lookup simply failed completely and didn’t produce any results, which left us with the keyword results only.

assert(CurDeclContext);

addKeywords(CompletionContext.getResultSink(), MaybeFuncBody);
Copy link
Member

Choose a reason for hiding this comment

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

I think you should remove another addKeyword call below (Line 1426)

@rintaro
Copy link
Member

rintaro commented Mar 24, 2022

Also please remove the existing case CompletionKind::AccessorBeginning branch from doneParsing()

@ahoppen ahoppen force-pushed the pr/migrage-accessorbeginning-solver-based branch from 28fcdc1 to fa98911 Compare March 25, 2022 08:24
@ahoppen
Copy link
Member Author

ahoppen commented Mar 25, 2022

@swift-ci Please SourceKit stress test

@ahoppen
Copy link
Member Author

ahoppen commented Mar 25, 2022

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Mar 25, 2022

@swift-ci Please smoke test macOS

if (!Lookup.gotCallback()) {
Lookup.fallbackTypeCheck(CurDeclContext);
if (CodeCompleteTokenExpr) {
// Happens when completing inside e.g.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Happens when completing inside e.g.
// 'CodeCompletionTokenExpr == nullptr' happens when completing inside e.g.

because this is inside if (CodeCompeltionToken) branch.

@ahoppen ahoppen force-pushed the pr/migrage-accessorbeginning-solver-based branch from fa98911 to 8cd5bbd Compare April 3, 2022 14:46
@ahoppen
Copy link
Member Author

ahoppen commented Apr 3, 2022

@swift-ci Please smoke test

@ahoppen ahoppen merged commit 9456fa1 into swiftlang:main Apr 5, 2022
@ahoppen ahoppen deleted the pr/migrage-accessorbeginning-solver-based branch April 13, 2022 06: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