Skip to content

Ignore #: annotation on attr_* calls#1176

Merged
soutaro merged 1 commit intomasterfrom
ignore-attributes
Jun 21, 2024
Merged

Ignore #: annotation on attr_* calls#1176
soutaro merged 1 commit intomasterfrom
ignore-attributes

Conversation

@soutaro
Copy link
Owner

@soutaro soutaro commented Jun 21, 2024

This improves the compatibility with rbs-inline, where attr_* calls may be annotated for the type of the attributes.

Steep now ignores #: annotations given to attr_reader, attr_accessor, and attr_writer calls without receivers. If you really need some type annotation to your custom attr_reader (likes) calls, you need to add self. receiver or surround them with parens.

class Foo
  # Type declaration for rbs-inline, Steep ignores the annotation
  attr_reader :foo #: String

  # Steep detects the annotation because it's with `self` receiver
  self.attr_reader :foo #: String

  # Steep detects the annotation because of the parens
  (attr_reader :foo) #: String
end

@soutaro
Copy link
Owner Author

soutaro commented Jun 21, 2024

rbs-inline currently uses #:: syntax, but I will make it to #:. And this PR is needed to avoid the conflict.

@soutaro soutaro added this to the Steep 1.8 milestone Jun 21, 2024
@soutaro soutaro merged commit ab8cc91 into master Jun 21, 2024
@soutaro soutaro deleted the ignore-attributes branch June 21, 2024 06:40
@soutaro soutaro added the Released The PR is already included in a published release label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Released The PR is already included in a published release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant