steep icon indicating copy to clipboard operation
steep copied to clipboard

Defining Proc with untyped parameter raises NoMethodError on RBS::Types::UntypedFunction

Open Coridyn opened this issue 1 year ago • 1 comments

Issue Steep raises an error when it encounters the definition for a "proc with an untyped parameter"

Running Ruby 3.3.0 and Steep 1.7.1

Steps to reproduce

  1. Define this proc in an .rbs file:
# rbs
type untyped_proc = ^(?) -> void
  1. Run steep check
  2. Steep will raise this error
[Steep 1.7.1] [typecheck:typecheck@10] [background] Unexpected error: #<NoMethodError: undefined method `map_type_name' for an instance of RBS::Types::UntypedFunction>

(see attached proc-with-untyped-parameter-error.txt file for full stacktrace)


I think this definition of a proc is correct, as shown in the current RBS syntax document:

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

Coridyn avatar Sep 26 '24 15:09 Coridyn

I think this is a bug of the RBS gem. So I posted ruby/rbs#2054 to fix this.

tk0miya avatar Oct 07 '24 17:10 tk0miya