AaronC81 / sord

Convert YARD docs to Sorbet RBI and Ruby 3/Steep RBS files
https://sord.aaronc.cc
MIT License
299 stars 18 forks source link

Properly output class signature for core-exts with generic parameters #163

Open postmodern opened 1 year ago

postmodern commented 1 year ago

Describe the bug

When generating RBS type signatures for core-ext classes, sord --rbs outputs them as regular classes. They need to be outputted with generic parameters for rbs/steep to properly validate them:

To Reproduce

class Array
  def my_ext
    # ...
  end
end
$ sord --rbs defs.rbs
$ cat defs.rbs

Expected behavior

class Array[unchecked out T]
  def my_ext: () ...
end

Actual behavior

class Array
  def my_ext: () ...
end

Additional information