Skip to content

Conversation

tk0miya
Copy link
Contributor

@tk0miya tk0miya commented Oct 19, 2024

To support attr_accessor, reader and writer for singleton class, this converts them to the mere method definitions.

class Foo
  class << self
    attr_accessor :bar
  end
end

The above code will converted into the followings:

class Foo
  %a{pure}
  def self.bar: () -> untyped
  def self.bar=: (untyped) -> untyped
end

@soutaro
Copy link
Owner

soutaro commented Nov 18, 2024

@tk0miya Thank you for opening this PR. I guess we can just use attr_reader self.bar: untyped syntax?

@tk0miya tk0miya force-pushed the support_singleton_attr_accessors branch from 1402ea0 to 1b95167 Compare November 18, 2024 14:55
@tk0miya
Copy link
Contributor Author

tk0miya commented Nov 18, 2024

OMG! I don't know such a strong syntax. Now I fixed!

To support attr_accessor, reader and writer for singleton class, this
converts them to the mere method definitions.

```ruby
class Foo
  class << self
    attr_accessor :bar
  end
end
```

The above code will converted into the followings:

```ruby
class Foo
  attr_accessor self.bar: untyped
end
```
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.

None yet

2 participants