Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hjwylde opened this issue Oct 23, 2024 · 0 comments

Comments

@hjwylde
Copy link
Contributor

hjwylde commented Oct 23, 2024

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>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant