Skip to content

[6.0][SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST #72516

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 22, 2024

  • Explanation: Previously cursor info for declarations was always extracted from the AST, even if we ran the completion-like fallback cursor info that provides values for ambiguous results in expressions. Change cursor info for declarations in this completion-like path to inspect the constraint system solutions instead. This has two benefits:
    • We can now report ambiguous variable types
    • We are more robust in the generation of results for declarations inside closures. If the closure has an error, we won’t apply the solution to the AST and thus any cursor info that tried to get types out of the AST would fail.
  • Scope: Cursor info on declarations if the standard cursor info that inspects the already-built AST fails
  • Risk: Low, this fallback only kicks in if the AST-based cursor info fails or produces results with an error type
  • Testing: Added a test case
  • Issue: rdar://123845208
  • Reviewer: @hamishknight on [SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST #72370

…utions that haven’t aren’t applied to the AST ye

This has two benefits:
1. We can now report ambiguous variable types
2. We are more robust in the generation of results for declarations inside closures. If the closure has an error, we won’t apply the solution to the AST and thus any cursor info that tried to get types out of the AST would fail.

rdar://123845208
@ahoppen ahoppen requested a review from a team as a code owner March 22, 2024 07:28
@ahoppen ahoppen changed the title [SourceKit] Allow generation of cursor info for declarations from sol… [SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST Mar 22, 2024
@bnbarham bnbarham changed the title [SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST [6.0][SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST Mar 22, 2024
@ahoppen
Copy link
Member Author

ahoppen commented Mar 25, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit d426b6f into swiftlang:release/6.0 Mar 25, 2024
@ahoppen ahoppen deleted the ahoppen/6.0/decl-cursor-info-from-solution branch March 25, 2024 22:23
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.

2 participants