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
editor.rb:6: Not enough arguments provided for method Object#function_with_default_arg_first. Expected: 1..2, got: 1 https://srb.help/7004
6 |function_with_default_arg_first('bar')
^^^^^
editor.rb:2: Object#function_with_default_arg_first defined here
2 |def function_with_default_arg_first(a='foo', b)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Errors: 1
Expected behavior
Type checking should pass
The example is weird code (default positional args should be last), but it's technically valid Ruby (Ruby docs even include a similar example). I ran into this error when adding typing to code that calls a method in a third-party library with a default nil optional argument before required arguments.
The error presented here made investigating particularly tricky, as Expected: 1..2, got: 1 made it seem like it shouldn't be an error in the first place, as 1 satisfies 1..2.
The text was updated successfully, but these errors were encountered:
This is often used with #where so the only arguments passed to the #update are the kwargs for attributes. Trying to type this will result in any of those valid calls being raised as errors.
Input
→ View on sorbet.run
Observed output
Expected behavior
Type checking should pass
The example is weird code (default positional args should be last), but it's technically valid Ruby (Ruby docs even include a similar example). I ran into this error when adding typing to code that calls a method in a third-party library with a default
nil
optional argument before required arguments.The error presented here made investigating particularly tricky, as
Expected: 1..2, got: 1
made it seem like it shouldn't be an error in the first place, as 1 satisfies 1..2.The text was updated successfully, but these errors were encountered: