Skip to content

[CodeCompletion] Report type relations when completing inside result builders #42210

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 Apr 6, 2022

This requires navigating the constraint system solution to retrieve the argument type of the buildBlock call. The comments in the code should describe what I’m doing.

rdar://83846531

@ahoppen ahoppen force-pushed the pr/result-builder-type-relations-solver-based branch from c37d627 to 1f84ca5 Compare April 7, 2022 06:19
@ahoppen ahoppen marked this pull request as ready for review April 7, 2022 06:20
@ahoppen ahoppen requested a review from xedin April 7, 2022 06:20
@ahoppen
Copy link
Member Author

ahoppen commented Apr 7, 2022

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Apr 7, 2022

@swift-ci Please SourceKit stress test

// it. Look for a ArgumentConversion constraint that allows us to retrieve
// the argument type var.
for (auto argConstraint : CS.getConstraintGraph().gatherConstraints(
typeVar, ConstraintGraph::GatheringKind::AllMentions)) {
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 you don't need AllMentions in this case or the latter one EquivalenceClass should be sufficient because the constraint in question is associated directly with the type variable the search is performed for.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually it might even be enough to just iterate over direct constraints in both cases via ConstraintGraphNode::getConstraints()

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.

solveForCodeCompletion changes look good! I left a comment that would be good to address before this is merged.

ahoppen added 3 commits April 8, 2022 11:16
…completion

We record fixes while solving normal expressions for code completion and we should do the same when solving result builders if we are reporting the solutions to completion callbacks.
Helped me while debugging and might help others as well.
…builders

This requires navigating the constraint system solution to retrieve the argument type of the `buildBlock` call. The comments in the code should describe what I’m doing well enough.

rdar://83846531
@ahoppen ahoppen force-pushed the pr/result-builder-type-relations-solver-based branch from 1f84ca5 to 0b9644a Compare April 8, 2022 09:25
@ahoppen
Copy link
Member Author

ahoppen commented Apr 8, 2022

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Apr 14, 2022

@swift-ci Please SourceKit stress test

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