Skip to content

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

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
Jun 18, 2018

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jun 15, 2018

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 Jun 15, 2018

@swift-ci Please smoke test

@rintaro rintaro requested a review from nkcsgexi June 15, 2018 17:30
Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rintaro
Copy link
Member Author

rintaro commented Jun 18, 2018

Added a test case.
@swift-ci Please smoke test

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 Jun 18, 2018

@swift-ci Please smoke test

@rintaro rintaro merged commit 02eaf61 into swiftlang:master Jun 18, 2018
@rintaro rintaro deleted the rdar41073182 branch June 18, 2018 05:11
@jrose-apple
Copy link
Contributor

Ah, what about attributes that are on the accessors?

var foo: Int {
  @inlinable get { return 0 }
}

@rintaro
Copy link
Member Author

rintaro commented Jul 11, 2018

Ah, I will look into it. Thanks!

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.

3 participants