Skip to content

[5.10][CodeCompletion] Fix issue in which parts of a result builder were incorrectly skipped #70899

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 1 commit into from
Jan 17, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jan 12, 2024

  • Explanation: getLoc does not necessarily return the start location of the location (e.g. for a.b().c() it returns the location of c because that’s the location of the call). But we used the location from getLoc as the start location of the synthesized buildExpression call. In the added test case, this means that the buildExpression call only contained everlay() {} and not the code completion token. We thus inferred that we could skip it the entire MyStack {}.pnTabGesture {}.everlay() {} call for code completion, which isn’t correct.
  • Scope: Source locations of expressions in result builders that support buildExpression
  • Risk: Very low
  • Testing: Added regression test
  • Issue: rdar://120798355
  • Reviewer: @xedin on [CodeCompletion] Fix issue in which parts of a result builder were incorrectly skipped #70898

@ahoppen ahoppen requested a review from a team as a code owner January 12, 2024 23:10
@ahoppen
Copy link
Member Author

ahoppen commented Jan 12, 2024

@swift-ci Please test

@ahoppen ahoppen changed the title [CodeCompletion] Fix issue in which parts of a result builder were in… [CodeCompletion] Fix issue in which parts of a result builder were incorrectly skipped Jan 12, 2024
@ahoppen ahoppen changed the title [CodeCompletion] Fix issue in which parts of a result builder were incorrectly skipped [5.10][CodeCompletion] Fix issue in which parts of a result builder were incorrectly skipped Jan 12, 2024
…correctly skipped

`getLoc` does not necesarrily return the start location of the location (e.g. for `a.b().c()` it returns the location of `c` because that’s the location of the call). But we used the location from `getLoc` as the start location of the synthesized `buildExpression` call. In the added test case, this means that the `buildExpression` call only contained `everlay() {}` and not the code completion token. We thus infered that we could skip it the entire `MyStack {}.pnTabGesture {}.everlay() {}` call for code completion, which isn’t correct.

rdar://120798355
@ahoppen ahoppen force-pushed the ahoppen/5.10/rdar120798355 branch from ccdf222 to e64ec00 Compare January 13, 2024 01:10
@ahoppen
Copy link
Member Author

ahoppen commented Jan 13, 2024

@swift-ci Please test

@airspeedswift
Copy link
Member

Original: #70898

@bnbarham
Copy link
Contributor

@swift-ci please test Windows platform

@ahoppen ahoppen enabled auto-merge January 17, 2024 01:29
@ahoppen ahoppen merged commit 3c09829 into swiftlang:release/5.10 Jan 17, 2024
@ahoppen ahoppen deleted the ahoppen/5.10/rdar120798355 branch January 29, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants