Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should raise ParsingError instead of ArgumentError #1652

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented Nov 27, 2023

I noticed that there are cases where obvious syntax errors are being reported as ArgumentError, so I have corrected this issue.

actual

$ bundle exec rbs parse --method-type -e '(foo` untyped) -> void'
bundler: failed to load command: rbs (/Users/ksss/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/bin/rbs)
/Users/ksss/src/github.com/ksss/rbs/lib/rbs/parser_aux.rb:12:in `_parse_method_type': negative string size (or size too big) (ArgumentError)

expect

$ bundle exec rbs parse --method-type -e '(foo` untyped) -> void'
-e:1:4...1:5: Syntax error: unexpected token for function parameter name, token=``` (tOPERATOR) (RBS::ParsingError)

  (foo` untyped) -> void
      ^

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@soutaro soutaro added this to the RBS 3.4 milestone Nov 27, 2023
@soutaro soutaro added this pull request to the merge queue Nov 27, 2023
Merged via the queue into ruby:master with commit c5c2aee Nov 27, 2023
24 checks passed
@ksss ksss deleted the syntax-error-function-param branch November 27, 2023 09:39
soutaro added a commit that referenced this pull request Dec 20, 2023
@soutaro soutaro added the Released PRs already included in the released version label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

2 participants