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

Aberta
#2,066 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
45/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
ruby
Domínio
devtools

Direção de pesquisa

Comece por lib/rbs/types.rb em torno de RBS::Types::Proc#map_type_name e, em seguida, siga a stack por lib/rbs/environment.rb até o ponto de entrada de validate. Reproduza o problema com rbs -Isig validate usando a assinatura de exemplo. Está concluído quando a sintaxe documentada de Proc para parâmetros sem tipo for validada sem gerar NoMethodError.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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>'
Linguagem predominante
Ruby
Estrelas
2.2k
Forks
263
Merge médio
1d 20h
PRs com merge (30d)
64

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de ruby/rbs

Todas as issues de ruby/rbs

Issues semelhantes

Mais issues de Ruby

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.