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
CRuby tests/specs passing #2791
Milestone
Comments
kddnewton
changed the title
CRuby
CRuby tests/specs passing
May 8, 2024
make test-all RUN_OPTS="--parser=prism"
passing
2 tasks
eileencodes
added a commit
to eileencodes/prism
that referenced
this issue
May 13, 2024
With the following statement: ```ruby x = begin ensure return end ``` Prism wasn't raising the appropriate `void value expression` error. In this code example, the `cast->statements` will be NULL. To get the appropriate behavior and raise the error, the node needs to be assigned to `cast->ensure_node->statements`. Otherwise no error is raised. Note: this is related to ruby#2791 but doesn't fix the failures in `test/ruby/test_parse.rb` because the format is different. But before we can fix that, it needs to raise an error.
eileencodes
added a commit
to eileencodes/prism
that referenced
this issue
May 14, 2024
With the following statement: ```ruby x = begin ensure return end ``` Prism wasn't raising the appropriate `void value expression` error. In this code example, the `cast->statements` will be NULL. To get the appropriate behavior and raise the error, the node needs to be assigned to `cast->ensure_node->statements`. Otherwise no error is raised. Note: this is related to ruby#2791 but doesn't fix the failures in `test/ruby/test_parse.rb` because the format is different. But before we can fix that, it needs to raise an error.
eileencodes
added a commit
to eileencodes/prism
that referenced
this issue
May 15, 2024
Prism wasn't raising the appropriate `void value expression` error. In this code example, the `cast->statements` will be NULL. To get the appropriate behavior and raise the error, the node needs to be assigned to `cast->ensure_node->statements`. Otherwise no error is raised. This fixes the following code: ```ruby x = begin ensure return end ``` In addition, Prism was raising for code that is valid. The begin value expression check also needs to take rescue clauses into account. If the rescue clause has an else, we want to use the `statements` from that node, otherwise we should use the `statements` from the `rescue` clause. This fixes the following code (which should not throw a syntax error): ```ruby x = begin return; rescue; end x = begin return; rescue; return; else end ``` This fixes `TestParse#test_void_value_in_rhs` and is related to issue ruby#2791.
eileencodes
added a commit
to eileencodes/prism
that referenced
this issue
May 15, 2024
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, I'm checking whether the `begin` node has an `else_clause`, `rescue_clause`, or `ensure_clause` and setting the returned `node` to that instead of always returning `cast->statements`. In the `ensure_clause` case, the `ensure_clause` node should only be used if `statements` is `NULL`. `rescue_clause` and `else_clause` should be used regardless of whether `statements is `NULL`. 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 testin the `test_parse` file, taking failures from 14 to 13. This fixes `TestParse#test_void_value_in_rhs` and is related to issue ruby#2791.
eileencodes
added a commit
to eileencodes/prism
that referenced
this issue
May 23, 2024
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, I'm checking whether the `begin` node has an `else_clause`, `rescue_clause`, or `ensure_clause` and setting the returned `node` to that instead of always returning `cast->statements`. In the `ensure_clause` case, the `ensure_clause` node should only be used if `statements` is `NULL`. `rescue_clause` and `else_clause` should be used regardless of whether `statements is `NULL`. 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 testin the `test_parse` file, taking failures from 14 to 13. This fixes `TestParse#test_void_value_in_rhs` and is related to issue ruby#2791.
eileencodes
added a commit
to eileencodes/prism
that referenced
this issue
May 23, 2024
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 ruby#2791.
eileencodes
added a commit
to eileencodes/prism
that referenced
this issue
May 23, 2024
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 ruby#2791.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changes needed
TestAssignmentGen#test_assignment
- (TestAssignment#test_massign_order
- nested multi target indices are off #2370)Pending response
TestM17N#test_regexp_usascii
- (https://bugs.ruby-lang.org/issues/20504)TestRubyLiteral#test_dregexp
- (https://bugs.ruby-lang.org/issues/20504)TestMixedUnicodeEscape#test_basic
- (https://bugs.ruby-lang.org/issues/20504)TestSyntax#test_dedented_heredoc_continued_line
- (https://bugs.ruby-lang.org/issues/20503)TestSyntax#test_duplicated_when
- (https://bugs.ruby-lang.org/issues/20401)TestSyntax#test_keyword_self_reference
- (https://bugs.ruby-lang.org/issues/20478)TestSyntax#test_optional_self_reference
- (https://bugs.ruby-lang.org/issues/20478)TestISeq#test_each_child
- (https://bugs.ruby-lang.org/issues/20479)TestISeq#test_trace_points
- (https://bugs.ruby-lang.org/issues/20479)The text was updated successfully, but these errors were encountered: