Skip to content

[5.7][CodeCompletion] Avoid crash for not recommended item without a decl #59508

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

rintaro
Copy link
Member

@rintaro rintaro commented Jun 16, 2022

Cherry-pick #59490 into release/5.7

  • Explanation: Generating diagnostics for "not recommended" items requires an associated declaration. However, there are cases such as function call pattern items where there's no associated decl because the callee is an expression. Ideally it should emit a diagnostic, but for now, to avoid the crash, don't emit diagnostics unless the item has the associated decl.
  • Scope: Code completion
  • Risk: Low. Just adding a nullptr check
  • Issues: rdar://95306033
  • Testing: Added a regression test case
  • Reviewer: Ben Barham (@bnbarham)

Generating diagnostics for "not recommended" items requires an
associated declaration. However, cases like this:

  func test(fn: (Int) async -> Void) {
    fn(#^HERE^#)
  }

For the function call pattern item, there's no associated decl because
the callee is an expression. Ideally it should emit a diagnostic, but
for now, to avoid the crash, don't emit diagnostics unless the item has
the associated decl.

rdar://95306033
(cherry picked from commit e748ab4)
@rintaro rintaro requested a review from a team as a code owner June 16, 2022 20:58
@rintaro
Copy link
Member Author

rintaro commented Jun 16, 2022

@swift-ci Please test

@rintaro rintaro merged commit 2eda219 into swiftlang:release/5.7 Jun 17, 2022
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