Repository: soutaro/steep (Ruby)

Issue:
`UnexpectedError: undefined method 'level_of_children'` on `Array#to_h`
Given this code:

``` ruby
class MyClass
  def register_block(field_names, &block)
    field_names.to_h do |field_name|
      [field_name, block]
    end
  end
end
```

And this RBS file:

```
class MyClass
  def register_block: (::Array[::String]) { (String) -> void } -> ::Hash[::String, ^(String) -> void]
end
```

`steep check` results in errors:

```
.............................[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)] Unexpected error: #<NoMethodError: undefined method `level_of_children' for #<Steep::AST::Types::Proc:0x000000015973e240>>
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/ast/types/proc.rb:54:in `level'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/constraints.rb:263:in `block (2 levels) in solution'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/constraints.rb:249:in `yield_self'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/constraints.rb:249:in `block in solution'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/constraints.rb:241:in `each_key'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/constraints.rb:241:in `solution'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3488:in `block (2 levels) in try_method_type'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3274:in `apply_solution'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3487:in `block in try_method_type'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/check.rb:48:in `push_variable_bounds'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3330:in `try_method_type'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3197:in `block (3 levels) in type_method_call'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/typing.rb:231:in `new_child'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3186:in `block (2 levels) in type_method_call'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `block in tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:38:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3185:in `block in type_method_call'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3184:in `map'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3184:in `type_method_call'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:2928:in `type_send_interface'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:3109:in `type_send'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1000:in `block (2 levels) in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:995:in `yield_self'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:995:in `block in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `block in tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:38:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:748:in `synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:2444:in `check'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_c.lass.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1049:in `block (3 levels) in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:269:in `block in with_method_constr'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/check.rb:48:in `push_variable_bounds'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:268:in `with_method_constr'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1027:in `block (2 levels) in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1024:in `yield_self'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1024:in `block in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `block in tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:38:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:748:in `synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1526:in `block (3 levels) in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:532:in `block in with_class_constr'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/subtyping/check.rb:48:in `push_variable_bounds'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:531:in `with_class_constr'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1516:in `block (2 levels) in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1487:in `yield_self'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:1487:in `block in synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `block in tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:38:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/type_construction.rb:748:in `synthesize'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/services/type_check_service.rb:388:in `type_check'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/services/type_check_service.rb:327:in `block in type_check_file'
.[Steep 1.0.0] [typecheck:..typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `block in tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:38:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/services/type_check_service.rb:325:in `type_check_file'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/services/type_check_service.rb:281:in `block (2 levels) in typecheck_source'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep.rb:171:in `measure'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/services/type_check_service.rb:275:in `block in typecheck_source'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `block in tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:38:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/services/type_check_service.rb:274:in `typecheck_source'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/server/type_check_worker.rb:197:in `handle_job'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/server/base_worker.rb:54:in `block (2 levels) in run'
[Steep 1.0.0] [typecheck:typechec.k@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `block in tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:38:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/tagged_logging.rb:114:in `tagged'
[Steep 1.0.0] [typecheck:typecheck@2] [background] [#typecheck_source(path=lib/my_class.rb)] [#type_check_file(lib/my_class.rb@lib)] [synthesize:(1:1)] [synthesize:(2:3)] [synthesize:(3:5)]   /Users/myron/Development/sq-elasticgraph-ruby/bundle/ruby/2.7.0/gems/steep-1.0.0/lib/steep/server/base_worker.rb:44:in `block in run'
..F...........................

lib/my_class.rb:3:4: [error] UnexpectedError: undefined method `level_of_children' for #<Steep::AST::Types::Proc:0x000000015973e240>
│ Diagnostic ID: Ruby::UnexpectedError
│
└     field_names.to_h do |field_name|
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```



Discussion:

Patch:
diff --git a/lib/steep/ast/types/proc.rb b/lib/steep/ast/types/proc.rb
index 738af4453..87b72d561 100644
--- a/lib/steep/ast/types/proc.rb
+++ b/lib/steep/ast/types/proc.rb
@@ -45,6 +45,8 @@ def free_variables()
           end
         end
 
+        include Helper::ChildrenLevel
+
         def level
           children = type.params.each_type.to_a + [type.return_type]
           if block


Test patch:
diff --git a/test/type_construction_test.rb b/test/type_construction_test.rb
index e3688e0e7..8d3a3412b 100644
--- a/test/type_construction_test.rb
+++ b/test/type_construction_test.rb
@@ -9216,4 +9216,38 @@ def foo
       end
     end
   end
+
+  def test_issue_583
+    with_checker <<-EOF do |checker|
+module Issue583
+  class TestArray[unchecked out Elem] < Object
+    def to_h: () -> Hash[untyped, untyped]
+      | [T, S] () { (Elem) -> [ T, S ] } -> Hash[T, S]
+  end
+
+  class TestClass
+    def register_block: (TestArray[::String]) { (String) -> void } -> ::Hash[::String, ^(String) -> void]
+  end
+end
+    EOF
+
+      source = parse_ruby(<<-'RUBY')
+module Issue583
+  class TestClass
+    def register_block(field_names, &block)
+      field_names.to_h do |field_name|
+        [field_name, block]
+      end
+    end
+  end
+end
+      RUBY
+
+      with_standard_construction(checker, source) do |construction, typing|
+        type, _ = construction.synthesize(source.node)
+
+        assert_no_error typing
+      end
+    end
+  end
 end