Steps to reproduce
Analyze the following file with TypeProf.
Point = Struct.new(:x, :y) do
def initialize(x = 0, y = 0)
super
end
end
Point.new
Point.new(3, 4)
Expected behavior
The initialize defined inside the block should override the one auto-generated by Struct.new. The RBS output should contain only one initialize:
class Point
def x: -> Integer
def x=: (untyped) -> untyped
def y: -> Integer
def y=: (untyped) -> untyped
def initialize: (?Integer, ?Integer) -> void
def self.[]: (?Integer, ?Integer) -> Point
end
Actual behavior
$ bin/typeprof reproduce.rb
# TypeProf 0.32.0
# reproduce.rb
class Point
def x: -> Integer
def x=: (untyped) -> untyped
def y: -> Integer
def y=: (untyped) -> untyped
def initialize: (Integer, Integer) -> void
def self.[]: (Integer, Integer) -> Point
def initialize: (?Integer, ?Integer) -> void
end
def initialize appears twice. rbs parse accepts it, but rbs validate rejects it:
$ rbs -I out.rbs validate
E, [2026-05-25T22:24:05.802363 #47971] ERROR -- rbs: out.rbs:9:2...9:44: ::Point#initialize has duplicated definitions in out.rbs:11:2...11:46 (RBS::DuplicatedMethodDefinitionError)
def initialize: (Integer, Integer) -> void
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
System configuration
Ruby version: ruby 4.0.5
TypeProf version: 0.32.0
Steps to reproduce
Analyze the following file with TypeProf.
Expected behavior
The
initializedefined inside the block should override the one auto-generated byStruct.new. The RBS output should contain only oneinitialize:Actual behavior
def initializeappears twice.rbs parseaccepts it, butrbs validaterejects it:System configuration
Ruby version: ruby 4.0.5
TypeProf version: 0.32.0