Skip to content

[5.3][Parse] Avoid delayed member parsing for type decl with missing brace #32197

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

rintaro
Copy link
Member

@rintaro rintaro commented Jun 5, 2020

Cherry-pick of #32191 into release/5.3

  • Explanation: Fixes a crash in fast-code-completion. When there's a type declaration with missing member decl clause (i.e. { ... }), it used to subjected to delayed member parsing. It was unnecessary because we know it cannot parse anything. Moreover, it used to cause crashes in fast-code-completion when such declarations are inside the function body because fast-completion does not support delayed member parsing inside function bodies. This patch fixes it by eagerly caching an empty member list to the type/extension decl.
  • Scope: Parsing with erroneous type or extension declarations. Code completion.
  • Risk: Low. Although this patch touches the main completion parser, it only affects code-completion effectively.
  • Issues: rdar://problem/63921896
  • Testing: Added regression test case.
  • Reviewer: Ben Langumuir (@benlangmuir ), Xi Ge (@nkcsgexi )

Cache empty member list so that 'IterableDeclContext::loadAllMembers()'
doesn't perform delayed member parsing.

Fixes: rdar://problem/63921896
(cherry picked from commit bdfe1b1)
@rintaro rintaro requested a review from a team as a code owner June 5, 2020 00:58
@rintaro
Copy link
Member Author

rintaro commented Jun 5, 2020

@swift-ci Please test

@theblixguy theblixguy added the r5.3 label Jun 5, 2020
@rintaro rintaro changed the title [Parse] Avoid delayed member parsing for type decl with missing brace [5.3][Parse] Avoid delayed member parsing for type decl with missing brace Jun 5, 2020
@rintaro
Copy link
Member Author

rintaro commented Jun 5, 2020

@swift-ci Please nominate

@rintaro
Copy link
Member Author

rintaro commented Jun 5, 2020

Windows failure is unrelated

Failing Tests (1):
    Swift(windows-x86_64) :: IRGen/framepointer_arm64.sil

@tkremenek tkremenek merged commit 8a9d7b7 into swiftlang:release/5.3 Jun 5, 2020
@AnthonyLatsis AnthonyLatsis added swift 5.3 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants