soutaro / steep

Static type checker for Ruby
MIT License
1.36k stars 83 forks source link

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

Open Coridyn opened 1 week ago

Coridyn commented 1 week ago

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