You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
TypeLoader#load_project fails due to changes in the Sorbet file-table-json generator.
The Sorbet file-table-json default parameter behaviour seems to have changed. Parlour's code changes into the user provided directory and calls the generator without passing in any folder path, under the assumption that the generator will use the current working directory if no path is provided. However, the generator now requires the folder path to be provided explicitly.
To Reproduce
Call TypeLoader.load_project on any folder.
Expected behavior
TypeLoader.load_project should return the RbiObjects.
Actual behavior
Traceback (most recent call last):
6: from lib/gelato/parser.rb:10:in `<main>'
5: from /Users/mikeroher/.rvm/gems/ruby-2.7.0/gems/sorbet-runtime-0.5.9057/lib/types/private/methods/_methods.rb:268:in `block in _on_method_added'
4: from /Users/mikeroher/.rvm/gems/ruby-2.7.0/gems/sorbet-runtime-0.5.9057/lib/types/private/methods/call_validation.rb:161:in `validate_call'
3: from /Users/mikeroher/.rvm/gems/ruby-2.7.0/gems/sorbet-runtime-0.5.9057/lib/types/private/methods/call_validation.rb:161:in `bind_call'
2: from /Users/mikeroher/.rvm/gems/ruby-2.7.0/gems/parlour-6.0.1/lib/parlour/type_loader.rb:63:in `load_project'
1: from /Users/mikeroher/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/json/common.rb:156:in `parse'
/Users/mikeroher/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/json/common.rb:156:in `parse': 783: unexpected token at '' (JSON::ParserError)
How to Fix
The fix for this is to add the root folderpath as a parameter to the generator. This occurs on line 58 of type_loader.rb.
Cheers for reporting! I'll aim to push out a fix for this soon, and try to put it behind a version gate so users of older Sorbets don't get errors when we pass an unexpected argument.
@mikeroher I'm afraid I don't seem to be able to reproduce this on the latest Sorbet (0.5.9058) - what version of Sorbet are you using?
Either way, the form of -p file-table-json where an argument is passed seems to be valid on even relatively old versions of Sorbet, so if the no-argument form is causing problems somewhere, I see no harm in changing how we invoke it :)
Describe the bug
TypeLoader#load_project fails due to changes in the Sorbet file-table-json generator.
The Sorbet
file-table-json
default parameter behaviour seems to have changed. Parlour's code changes into the user provided directory and calls the generator without passing in any folder path, under the assumption that the generator will use the current working directory if no path is provided. However, the generator now requires the folder path to be provided explicitly.To Reproduce
Call TypeLoader.load_project on any folder.
Expected behavior
TypeLoader.load_project should return the RbiObjects.
Actual behavior
How to Fix
The fix for this is to add the root folderpath as a parameter to the generator. This occurs on line 58 of
type_loader.rb
.Current code:
Corrected code:
The text was updated successfully, but these errors were encountered: