Symbol-Array loop and `define_method` finds only one method.
ellcs opened this issue · 1 comments
ellcs commented
Hello! The last time i tried define_method
typeprof couldn't handle it at all. I am happy that it changed and it is nice to see the progress.
Issue
As you can see i provide an array of method names, iterate over them and create an empty method.
My expectation would be that the class Human
would have two methods in the typeprof output: :a
and :b
. But only :a
is shown.
I am quite sure this is a hard bug, because it relies on loop unwrapping.
ruby
class Human
define_method(:fo) { }
[:a, :b].each { |m|
define_method(m) { }
}
end
rbs
output
# TypeProf 0.12.0
# Classes
class Human
def a: -> nil
end
## Version info:
## * Ruby: 3.0.0
## * RBS: 1.0.3
## * TypeProf: 0.12.0
Try it on playground:
mame commented
Thank you for your report! TypeProf analyzed the code correctly, but the output of b
was unintentionally filtered out. Now TypeProf (in master) produces the following result.
# TypeProf 0.12.0
# Classes
class Human
def fo: -> nil
def a: -> nil
def b: -> nil
end