Skip to content

Commit

Permalink
[Ruby 3.0] Reject ->... and ->(...) using the same error (#4367)
Browse files Browse the repository at this point in the history
* Import whitequark tests for the latest Ruby 3.0 parser changes

* [Ruby 3.0] Reject ->... and ->(...) with the same error
  • Loading branch information
vinistock committed Jul 15, 2021
1 parent b8f4ccb commit 5df4c8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion third_party/parser/cc/lexer.rl
Expand Up @@ -2332,7 +2332,11 @@ void lexer::set_state_expr_value() {
if (version >= ruby_version::RUBY_27) {
emit(token_type::tBDOT3, ident, ts, te);
} else {
emit(token_type::tDOT3, ident, ts, te);
if (!lambda_stack.empty() && lambda_stack.top() == paren_nest) {
emit(token_type::tDOT3, ident, ts, te);
} else {
emit(token_type::tBDOT3, ident, ts, te);
}
}

fnext expr_beg; fbreak;
Expand Down
4 changes: 2 additions & 2 deletions tools/scripts/import_whitequark.sh
Expand Up @@ -14,8 +14,8 @@
set -euo pipefail
set -x

REF=b69e8e595b804fd8e70ee1b90fc6dee81e183126
TARGET_RUBY_VERSION="2.7"
REF=49ed4dddfb1bf44d579fda001862149f4b9f7970
TARGET_RUBY_VERSION="3.0"

SCRIPT=$(realpath "$0")
ROOT="$(cd "$(dirname "$SCRIPT")/../.."; pwd)"
Expand Down

0 comments on commit 5df4c8b

Please sign in to comment.