ruby/typeprof

Methods defined in a Struct.new block end up on parent module

wagenet opened this issue · 0 comments

Customer = Struct.new(:name, :address) do
  def greeting
    "Hello #{name}!"
  end
end

Generated:

class Object
  private
  def greeting: -> String
end

class Customer < Struct[untyped]
  attr_accessor name(): untyped
  attr_accessor address(): untyped
end