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

Syntax error in one line def with a command call as right-hand side #242

Open
aibaars opened this issue Sep 21, 2023 · 1 comment
Open

Comments

@aibaars
Copy link
Contributor

aibaars commented Sep 21, 2023

The following ruby code causes an extraction error when parsed.

def foo() = raise NotImplementedError

The parse tree looks as follows in the tree-sitter playground

program [0, 0] - [1, 0]
  method [0, 0] - [0, 37]
    name: identifier [0, 4] - [0, 7]
    parameters: method_parameters [0, 7] - [0, 9]
    ERROR [0, 12] - [0, 17]
      identifier [0, 12] - [0, 17] <-- raise
    constant [0, 18] - [0, 37]     <-- NotImplementedError

This code is correct ruby syntax.

The problem is the command call on the right-hand side, things parse correctly with a parenthesized argument list.

def foo() = raise(NotImplementedError)
program [0, 0] - [1, 0]
  method [0, 0] - [0, 38]
    name: identifier [0, 4] - [0, 7]
    parameters: method_parameters [0, 7] - [0, 9]
    call [0, 12] - [0, 38]
      method: identifier [0, 12] - [0, 17]
      arguments: argument_list [0, 17] - [0, 38]
        constant [0, 18] - [0, 37]

This problem was reproduced with CodeQL version 2.4.5.

Originally reported at github/codeql#14279

@mitio
Copy link

mitio commented Oct 25, 2024

Hey folks, has anyone been able to look into this? Appreciate any update on the matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants