Crash with generics
marcandre opened this issue · 1 comments
marcandre commented
Trying with matrix
, with a hint rbs using generics, I get a crash.
I bypassed the crash calling warn
, but it crashes further down. I didn't investigate more.
Are generics supported?
RBS hint file I'm trying (it's the last commit of my PR):
class Matrix[unchecked out Elem]
@rows : Array[Array[Elem]]
end
class Vector[unchecked out Elem]
@elements : Array[Elem]
end
Error I'm getting:
$ bundle exec typeprof ../matrix/sig/matrix.rbs ../matrix/lib/matrix.rb -o ../matrix/sig/matrix_gen.rbs
bundler: failed to load command: typeprof (/Users/mal/.rvm/gems/ruby-head/bin/typeprof)
ArgumentError: wrong number of arguments (given 1, expected 2)
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:708:in `warn'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:658:in `get_ivar'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:673:in `block in add_ivar_write!'
/Users/mal/ruby/typeprof/lib/typeprof/type.rb:90:in `each_child'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:672:in `add_ivar_write!'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:945:in `set_instance_variable'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:1372:in `step'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:807:in `type_profile'
/Users/mal/ruby/typeprof/lib/typeprof/config.rb:87:in `analyze'
/Users/mal/ruby/typeprof/exe/typeprof:6:in `<top (required)>'
/Users/mal/.rvm/gems/ruby-head/bin/typeprof:23:in `load'
/Users/mal/.rvm/gems/ruby-head/bin/typeprof:23:in `<top (required)>'
After bypassing that bug:
[23:50][~/ruby/typeprof(master)]$ bundle exec typeprof ../matrix/sig/matrix.rbs ../matrix/lib/matrix.rb -o ../matrix/sig/matrix_gen.rbs
bundler: failed to load command: typeprof (/Users/mal/.rvm/gems/ruby-head/bin/typeprof)
NoMethodError: undefined method `get_method' for #<TypeProf::Type::Var:0x00007ff5b4f1f9a8 @name=:Elem>
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:1929:in `do_send'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:1204:in `block in step'
/Users/mal/ruby/typeprof/lib/typeprof/type.rb:90:in `each_child'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:1203:in `step'
/Users/mal/ruby/typeprof/lib/typeprof/analyzer.rb:807:in `type_profile'
/Users/mal/ruby/typeprof/lib/typeprof/config.rb:87:in `analyze'
/Users/mal/ruby/typeprof/exe/typeprof:6:in `<top (required)>'
/Users/mal/.rvm/gems/ruby-head/bin/typeprof:23:in `load'
/Users/mal/.rvm/gems/ruby-head/bin/typeprof:23:in `<top (required)>'