`steep check` hangs if library types have syntax errors
When classes that are specified as a library in the Steepfile have a syntax error, the steep check executable hangs and requires a force quit to end the process.
Example:
Generate type definitions using rbs for activerecord:
rbs prototype rb activerecord-6.1.4/**/*.rb > ~/Documents/GitHub/repo/lib/sig/activerecord/6.1/activerecord-generated.rbs
Reference lib/sig as a repo_path in the Steepfile
Run steep check, and you will see a similar error:
#<RBS::Parser::SyntaxError: parse error on value: #<RBS::Parser::LocatedValue:0x00007fbca1bb0598 @location=#<RBS::Location:1260 @buffer=/Users/john/Documents/repo/lib/sig/activerecord/6.1/activerecord-generated.rbs, @pos=202181...202184, source='def', start_line=4790, start_column=8>, @value=:def> (kDEF)>
parser.y:1752:in `on_error'
(eval):3:in `_racc_do_parse_c'
(eval):3:in `do_parse'
parser.y:1457:in `parse_signature'
but the process will not have exited.
I would expect the process to exit with a failure status code if it runs into a syntax error.
I seem to have a similar issue. I hit the following exception, which seems to come from some unhandled parsing issue, and then steep just hangs, which, irrespective of the cause for the exception, is not what I would have expected:
[Steep 0.44.1] [typecheck:typecheck@3] [background] Unexpected error: #<NoMethodError: undefined method `type' for nil:NilClass>
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/source.rb:88:in `construct_mapping'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/source.rb:77:in `parse'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/services/type_check_service.rb:324:in `block in type_check_file'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:37:in `tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/services/type_check_service.rb:323:in `type_check_file'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/services/type_check_service.rb:279:in `block (2 levels) in typecheck_source'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep.rb:164:in `measure'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/services/type_check_service.rb:273:in `block in typecheck_source'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:37:in `tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/services/type_check_service.rb:272:in `typecheck_source'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/server/type_check_worker.rb:182:in `handle_job'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:53:in `block (2 levels) in run'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:37:in `tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/tagged_logging.rb:99:in `tagged'
[Steep 0.44.1] [typecheck:typecheck@3] [background] vendor/bundle/ruby/3.0.0/gems/steep-0.44.1/lib/steep/server/base_worker.rb:43:in `block in run'
steep 0.43.1 showed the same problem, but it seems 0.42.0 does not.
I've experienced this as well. I find that if I use Ruby version 3.1.1 on an Intel Mac ([x86_64-darwin21]) with Steep version 1.4.0 this does not occur.
It was reproducible with Steep version 1.4.0 with Ruby version 3.0.2.