Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise
void value expression
in begin clauses
In some cases Prism was either not raising an appropriate `void value expression` error, or raising that error when the syntax is considered valid. To fix this Prism needs to check whether we have other clauses on the `begin` rather than just returning `cast->statements`. * If the `cast->statements` are null and the `cast->ensure_clause` is not null, set the code to `cast->ensure_clause` * else * If there is a `cast->rescue_clause` * Check if `cast->statements` are null and `cast->rescue_clause->statements` are null, and return `NULL` * Check if there is an `else_clause`, and set the node to `cast->else_clause`. * Otherwise return `cast->statements` as the node * return `cast->statements` as the node See tests for test cases. Note I took these directly from CRuby so if desired I can delete them since the test will now pass. This only fixes one test in the `test_parse` file, taking failures from 14 to 13. This fixes `TestParse#test_void_value_in_rhs` and is related to issue #2791.
- Loading branch information