rbs icon indicating copy to clipboard operation
rbs copied to clipboard

'RBS::Types::Proc#map_type_name': undefined method 'map_type_name' for an instance of RBS::Types::UntypedFunction (NoMethodError)

Open hjwylde opened this issue 4 months ago • 0 comments

Hey, not sure if this is meant to be valid or not, but while trying to write various tests I came across this sample which errors on rbs -Isig validate:

class Foo
  def t: -> (^(?) -> void)
end

I believe it's valid syntax (from the docs), but correct me if I'm wrong on that.

_proc_ ::= `^` _parameters?_ _self-type-binding?_ _block?_ `->` _type_
         | `^` `(` `?` `)` `->` _type_                                   # Proc type with untyped parameter

I'm using Ruby 3.4.0-preview2, and RBS 3.6.1.

The stack trace is:

/Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/types.rb:1428:in 'RBS::Types::Proc#map_type_name': undefined method 'map_type_name' for an instance of RBS::Types::UntypedFunction (NoMethodError)

          type: type.map_type_name(&block),
                    ^^^^^^^^^^^^^^
Did you mean?  map_type
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:793:in 'RBS::Environment#absolute_type'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:775:in 'block in RBS::Environment#resolve_method_type'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/types.rb:1002:in 'RBS::Types::Function#map_type'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/method_type.rb:66:in 'RBS::MethodType#map_type'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:774:in 'RBS::Environment#resolve_method_type'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:681:in 'block in RBS::Environment#resolve_member'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:679:in 'Array#map'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:679:in 'RBS::Environment#resolve_member'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:570:in 'block in RBS::Environment#resolve_declaration'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:567:in 'Array#map'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:567:in 'RBS::Environment#resolve_declaration'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:512:in 'block (2 levels) in RBS::Environment#resolve_type_names'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:508:in 'Array#map'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:508:in 'block in RBS::Environment#resolve_type_names'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:500:in 'Hash#each'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/environment.rb:500:in 'RBS::Environment#resolve_type_names'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/cli/validate.rb:53:in 'RBS::CLI::Validate#initialize'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/cli.rb:447:in 'Class#new'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/cli.rb:447:in 'RBS::CLI#run_validate'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/lib/rbs/cli.rb:140:in 'RBS::CLI#run'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/lib/ruby/gems/3.4.0+0/gems/rbs-3.6.1/exe/rbs:7:in '<top (required)>'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/bin/rbs:25:in 'Kernel#load'
	from /Users/hjwylde/.asdf/installs/ruby/3.4.0-preview2/bin/rbs:25:in '<main>'

hjwylde avatar Oct 23 '24 01:10 hjwylde