Skip to content

[4.2][IDE] Don't widen source range for AccessorDecl #17876

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 2 commits into from
Jul 18, 2018

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jul 11, 2018

  • Explaination: Range-info in SourceKit matches selection range and the range of the declaration. Previously, range-info for braces of implicit getter with attributes used to hit assertion because of mis-handing of attribute ranges. This change improves handling of attribute ranges for accessor, and pattern binding declarations so it doesn't hits assertion anymore.
  • Scope: Affects range-info for PatternBindingDecl, AccessorDecl, VarDecl.
  • Issue: rdar://problem/41073182
  • Risk: Low. Although changes are in lib/AST, it's called only from range-info analyzer.
  • Testing: Added regression test cases.
  • Reviewed By: Jordan Rose ([CodeComplete] Fix crasher when completing inout IUO variable #17926), Xi Ge ([IDE] Don't widen source range for AccessorDecl #17239)

Syntactically, Attributes for AccessorDecl are not part of AccessorDecl,
but part of PatternBindingDecl. When the selected range is the brace for
implicit getter, it should be considered as selecting getter decl
regardless of the attributes.

Conversely, we should widen source range for PatternBindingDecl by
looking into declared VarDecls because, in AST, attributes on
PatternBindingDecl are attached to VarDecls.

rdar://problem/41073182
@rintaro
Copy link
Member Author

rintaro commented Jul 11, 2018

@swift-ci Please test

Attributes on explicit accessor decl may have attributes. Only when the
range contains those attributes, the range-info should report
`SingleDecl`.
@rintaro
Copy link
Member Author

rintaro commented Jul 13, 2018

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Jul 17, 2018

@swift-ci Please nominate

@akyrtzi akyrtzi merged commit bb4e019 into swiftlang:swift-4.2-branch Jul 18, 2018
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