From c7de3f653cec55ac5aa9d71b46ccca19430e00d8 Mon Sep 17 00:00:00 2001 From: nobuyo Date: Mon, 12 Jun 2023 13:52:21 +0900 Subject: [PATCH 01/42] Fix formatting for CHAR node when single_quotes plugin is enabled --- lib/syntax_tree/node.rb | 2 +- test/plugin/single_quotes_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/syntax_tree/node.rb b/lib/syntax_tree/node.rb index a2c78677..3c5f93da 100644 --- a/lib/syntax_tree/node.rb +++ b/lib/syntax_tree/node.rb @@ -288,7 +288,7 @@ def format(q) q.text(value) else q.text(q.quote) - q.text(value[1] == "\"" ? "\\\"" : value[1]) + q.text(value[1] == q.quote ? "\\#{q.quote}" : value[1]) q.text(q.quote) end end diff --git a/test/plugin/single_quotes_test.rb b/test/plugin/single_quotes_test.rb index 6ce10448..b1359ac7 100644 --- a/test/plugin/single_quotes_test.rb +++ b/test/plugin/single_quotes_test.rb @@ -8,6 +8,14 @@ def test_empty_string_literal assert_format("''\n", "\"\"") end + def test_character_literal_with_double_quote + assert_format("'\"'\n", "?\"") + end + + def test_character_literal_with_singlee_quote + assert_format("'\\''\n", "?'") + end + def test_string_literal assert_format("'string'\n", "\"string\"") end From 687b3d2232eb8fd663bf59c2675345077f830b0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:45:47 +0000 Subject: [PATCH 02/42] Bump rubocop from 1.56.3 to 1.56.4 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.3 to 1.56.4. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.56.3...v1.56.4) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a9fc60b1..0b40c733 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,7 +23,7 @@ GEM rake (13.0.6) regexp_parser (2.8.1) rexml (3.2.6) - rubocop (1.56.3) + rubocop (1.56.4) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) From 2ad0552d7081a12087e044c64869c0502496635a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:08:55 +0000 Subject: [PATCH 03/42] Bump rubocop from 1.56.4 to 1.57.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.4 to 1.57.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.56.4...v1.57.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0b40c733..f4eaa649 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,21 +14,21 @@ GEM language_server-protocol (3.17.0.3) minitest (5.20.0) parallel (1.23.0) - parser (3.2.2.3) + parser (3.2.2.4) ast (~> 2.4.1) racc prettier_print (1.2.1) racc (1.7.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.1) + regexp_parser (2.8.2) rexml (3.2.6) - rubocop (1.56.4) + rubocop (1.57.0) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) @@ -44,7 +44,7 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) PLATFORMS arm64-darwin-21 From 8a30c348feacaf2fea50f67f13f5219a79f740d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 17:10:21 +0000 Subject: [PATCH 04/42] Bump rubocop from 1.57.0 to 1.57.1 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.57.0 to 1.57.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.57.0...v1.57.1) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f4eaa649..62a11d31 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,7 +23,7 @@ GEM rake (13.0.6) regexp_parser (2.8.2) rexml (3.2.6) - rubocop (1.57.0) + rubocop (1.57.1) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) From 171d0020b2d5123a74eb7decc4b6336e8687afd8 Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Thu, 19 Oct 2023 18:19:21 -0400 Subject: [PATCH 05/42] Mention `write` from the `format` command When trying to figure out how to format a new Ruby project, we were choosing between `@prettier/plugin-ruby`, this project, and Rufo. At first, we thought this project didn't have built-in support for writing to disk at all, so we almost switched to Rufo (or prettier-ruby, despite that library's admonition to use this gem). Only when I said, "no, Kevin wouldn't ship a library like this without a `--write` facility!" did we keep scrolling and find the `write` command. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e1119df..c238620e 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ SyntaxTree::Binary[ ### format -This command will output the formatted version of each of the listed files. Importantly, it will not write that content back to the source files. It is meant to display the formatted version only. +This command will output the formatted version of each of the listed files to stdout. Importantly, it will not write that content back to the source files – for that, you want [`write`](#write). ```sh stree format path/to/file.rb From d0bf2197631157f832804aced66aff98d9346d4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:42:55 +0000 Subject: [PATCH 06/42] Bump rubocop from 1.57.1 to 1.57.2 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.57.1 to 1.57.2. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.57.1...v1.57.2) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 62a11d31..c2f3665e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,6 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.2) - base64 (0.1.1) docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) @@ -23,8 +22,7 @@ GEM rake (13.0.6) regexp_parser (2.8.2) rexml (3.2.6) - rubocop (1.57.1) - base64 (~> 0.1.1) + rubocop (1.57.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -35,7 +33,7 @@ GEM rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) ruby-progressbar (1.13.0) simplecov (0.22.0) From 47a8a95b76c30dc012b0077b0685ea199abc117f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 17:23:15 +0000 Subject: [PATCH 07/42] Bump rake from 13.0.6 to 13.1.0 Bumps [rake](https://github.com/ruby/rake) from 13.0.6 to 13.1.0. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.0.6...v13.1.0) --- updated-dependencies: - dependency-name: rake dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c2f3665e..02679ac8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM prettier_print (1.2.1) racc (1.7.1) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) regexp_parser (2.8.2) rexml (3.2.6) rubocop (1.57.2) From a7cdb6042df68c85b8be34936d8e35df30cd81c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Dec 2023 17:18:05 +0000 Subject: [PATCH 08/42] Bump actions/configure-pages from 3 to 4 Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 3 to 4. - [Release notes](https://github.com/actions/configure-pages/releases) - [Commits](https://github.com/actions/configure-pages/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/configure-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 4bbfc0a2..60f229d0 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Setup Pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: From bb92b915cfc8c4f770b97331661efbee086f5949 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:28:14 +0000 Subject: [PATCH 09/42] Bump actions/deploy-pages from 2 to 4 Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 2 to 4. - [Release notes](https://github.com/actions/deploy-pages/releases) - [Commits](https://github.com/actions/deploy-pages/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/deploy-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 60f229d0..94bee969 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -51,4 +51,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 From adaf133643ef7a7bdeff8503b904c02537a9ceb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 17:02:43 +0000 Subject: [PATCH 10/42] Bump minitest from 5.20.0 to 5.21.1 Bumps [minitest](https://github.com/minitest/minitest) from 5.20.0 to 5.21.1. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.20.0...v5.21.1) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 02679ac8..2d6c2174 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.20.0) + minitest (5.21.1) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From c6624dee611d75084ffb8217ef8ec2e8aa5df15c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:38:24 +0000 Subject: [PATCH 11/42] Bump minitest from 5.21.1 to 5.21.2 Bumps [minitest](https://github.com/minitest/minitest) from 5.21.1 to 5.21.2. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.21.1...v5.21.2) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2d6c2174..d58aae0c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.21.1) + minitest (5.21.2) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From ce3e996379885951fae3805f67e8979c396137e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:17:28 +0000 Subject: [PATCH 12/42] Bump minitest from 5.21.2 to 5.22.0 Bumps [minitest](https://github.com/minitest/minitest) from 5.21.2 to 5.22.0. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.21.2...v5.22.0) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d58aae0c..475cd0b1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.21.2) + minitest (5.22.0) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 24fba6fdc77fe1ce7cec0674d98f8f17d36f1aff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:08:32 +0000 Subject: [PATCH 13/42] Bump minitest from 5.22.0 to 5.22.1 Bumps [minitest](https://github.com/minitest/minitest) from 5.22.0 to 5.22.1. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.22.0...v5.22.1) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 475cd0b1..9a8dd7d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.22.0) + minitest (5.22.1) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From b1e8fd91a130550f9385045294261b18cd3765ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:50:17 +0000 Subject: [PATCH 14/42] Bump minitest from 5.22.1 to 5.22.2 Bumps [minitest](https://github.com/minitest/minitest) from 5.22.1 to 5.22.2. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.22.1...v5.22.2) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a8dd7d7..8fa50a1e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.22.1) + minitest (5.22.2) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From b9d5fd3215a4f63162c5fa790f053033b80eea62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 17:43:58 +0000 Subject: [PATCH 15/42] Bump minitest from 5.22.2 to 5.22.3 Bumps [minitest](https://github.com/minitest/minitest) from 5.22.2 to 5.22.3. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/commits) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8fa50a1e..ca33d6ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.22.2) + minitest (5.22.3) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 8a13b44bca2a92d8b526a8f8a117de4f1af41d38 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:00:21 +0000 Subject: [PATCH 16/42] Bump dependabot/fetch-metadata from 1.6.0 to 1.7.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.6.0...v1.7.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 8ca265e0..67fbe586 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.6.0 + uses: dependabot/fetch-metadata@v1.7.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From ebf1f6d5c9d934c5538132eed708126a4e785846 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:47:53 +0000 Subject: [PATCH 17/42] Bump dependabot/fetch-metadata from 1.7.0 to 2.0.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.7.0 to 2.0.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.7.0...v2.0.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 67fbe586..44908aae 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.7.0 + uses: dependabot/fetch-metadata@v2.0.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From c2e233cc3f9b2e2c71d31ea32e5f795b2f955029 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 17:30:23 +0000 Subject: [PATCH 18/42] Bump actions/configure-pages from 4 to 5 Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 4 to 5. - [Release notes](https://github.com/actions/configure-pages/releases) - [Commits](https://github.com/actions/configure-pages/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/configure-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 94bee969..7ff5f5f1 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Setup Pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@v5 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: From b084dc8ebaec41b13271fd39f82ed6533f0fc347 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:00:36 +0000 Subject: [PATCH 19/42] Bump rake from 13.1.0 to 13.2.0 Bumps [rake](https://github.com/ruby/rake) from 13.1.0 to 13.2.0. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.1.0...v13.2.0) --- updated-dependencies: - dependency-name: rake dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ca33d6ee..e66562e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM prettier_print (1.2.1) racc (1.7.1) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.0) regexp_parser (2.8.2) rexml (3.2.6) rubocop (1.57.2) From 28cc432d942e8edc208b35ea83d22a45e8992059 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:22:15 +0000 Subject: [PATCH 20/42] Bump rake from 13.2.0 to 13.2.1 Bumps [rake](https://github.com/ruby/rake) from 13.2.0 to 13.2.1. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.2.0...v13.2.1) --- updated-dependencies: - dependency-name: rake dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e66562e2..794e25d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM prettier_print (1.2.1) racc (1.7.1) rainbow (3.1.1) - rake (13.2.0) + rake (13.2.1) regexp_parser (2.8.2) rexml (3.2.6) rubocop (1.57.2) From 07c1f38ddb43c5de8ee969c1d8355628cc2b5592 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:07:55 +0000 Subject: [PATCH 21/42] Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.0.0...v2.1.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 44908aae..6efe37ff 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.0.0 + uses: dependabot/fetch-metadata@v2.1.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From 2279e3373a18fe56a72c3801429f4a53768302db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 17:10:10 +0000 Subject: [PATCH 22/42] Bump minitest from 5.22.3 to 5.23.0 Bumps [minitest](https://github.com/minitest/minitest) from 5.22.3 to 5.23.0. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.22.3...v5.23.0) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 794e25d7..baf469d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.22.3) + minitest (5.23.0) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From e507a537f46daa91fd6b32551d9029ad3d2f0ead Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 17:37:05 +0000 Subject: [PATCH 23/42] --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index baf469d8..0931995d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.23.0) + minitest (5.23.1) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 56cd8acdf461966f68a75af90f6c9e2ac55b83a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:41:50 +0000 Subject: [PATCH 24/42] Bump minitest from 5.23.1 to 5.24.0 Bumps [minitest](https://github.com/minitest/minitest) from 5.23.1 to 5.24.0. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.23.1...v5.24.0) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0931995d..3326d05b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.23.1) + minitest (5.24.0) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 13fd57eb9abc530c62c50f66d679736bff368059 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:03:00 +0000 Subject: [PATCH 25/42] Bump minitest from 5.24.0 to 5.24.1 Bumps [minitest](https://github.com/minitest/minitest) from 5.24.0 to 5.24.1. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.24.0...v5.24.1) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3326d05b..94791460 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.24.0) + minitest (5.24.1) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 3f96ef12bc2c08e9c2deb34164544a9874d030bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:54:00 +0000 Subject: [PATCH 26/42] Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.1.0...v2.2.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 6efe37ff..977b53e4 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.1.0 + uses: dependabot/fetch-metadata@v2.2.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From 9084b7a5e7ee9678b6ffd7c03b1d543b07c4632f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 17:30:51 +0000 Subject: [PATCH 27/42] Bump minitest from 5.24.1 to 5.25.0 Bumps [minitest](https://github.com/minitest/minitest) from 5.24.1 to 5.25.0. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.24.1...v5.25.0) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 94791460..cac4d61c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.24.1) + minitest (5.25.0) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 882ac94123dd1ae5303ad3043d32abaabc9fe2ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:56:49 +0000 Subject: [PATCH 28/42] Bump minitest from 5.25.0 to 5.25.1 Bumps [minitest](https://github.com/minitest/minitest) from 5.25.0 to 5.25.1. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.25.0...v5.25.1) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index cac4d61c..def0ba89 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.25.0) + minitest (5.25.1) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 57af9682334f44164b23189efe2de085002570a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:24:27 +0000 Subject: [PATCH 29/42] Bump minitest from 5.25.1 to 5.25.2 Bumps [minitest](https://github.com/minitest/minitest) from 5.25.1 to 5.25.2. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.25.1...v5.25.2) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index def0ba89..fa5cdfe2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.25.1) + minitest (5.25.2) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From c23fcbec4f99d8943842e604a73e2a7152119224 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:57:17 +0000 Subject: [PATCH 30/42] Bump minitest from 5.25.2 to 5.25.4 Bumps [minitest](https://github.com/minitest/minitest) from 5.25.2 to 5.25.4. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.25.2...v5.25.4) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fa5cdfe2..d14291a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.25.2) + minitest (5.25.4) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From 258e52a5a73d6ab563028f863f611028382f42e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 17:57:50 +0000 Subject: [PATCH 31/42] Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.2.0 to 2.3.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.2.0...v2.3.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 977b53e4..295e8b18 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.2.0 + uses: dependabot/fetch-metadata@v2.3.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From 46476ce3cb45b48bfec0801ecddb3ecb7433b387 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Mar 2025 17:20:26 +0000 Subject: [PATCH 32/42] Bump minitest from 5.25.4 to 5.25.5 Bumps [minitest](https://github.com/minitest/minitest) from 5.25.4 to 5.25.5. - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.25.4...v5.25.5) --- updated-dependencies: - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d14291a4..22453392 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM docile (1.4.0) json (2.6.3) language_server-protocol (3.17.0.3) - minitest (5.25.4) + minitest (5.25.5) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) From af1a8325fbb77b73f295a01d9691e5ee43c6726e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 May 2025 17:31:27 +0000 Subject: [PATCH 33/42] Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-version: 2.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 295e8b18..5468e6d0 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.3.0 + uses: dependabot/fetch-metadata@v2.4.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Enable auto-merge for Dependabot PRs From f32655bbb61050d47bc71135fc60f1a9b9833f26 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 17:21:22 +0000 Subject: [PATCH 34/42] Bump rake from 13.2.1 to 13.3.0 Bumps [rake](https://github.com/ruby/rake) from 13.2.1 to 13.3.0. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v13.2.1...v13.3.0) --- updated-dependencies: - dependency-name: rake dependency-version: 13.3.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 22453392..1bf158a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM prettier_print (1.2.1) racc (1.7.1) rainbow (3.1.1) - rake (13.2.1) + rake (13.3.0) regexp_parser (2.8.2) rexml (3.2.6) rubocop (1.57.2) From d0b3eafd8248b15b28c98c3c0cf3b976a26aa5e9 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 10 Jul 2025 12:07:06 -0400 Subject: [PATCH 35/42] Updates * Update fixtures to handle invalid jumps * Update YARV to handle newer instructions * Update whitequark fixtures * Update dependencies and fix rubocop violations --- .github/workflows/main.yml | 3 +- .rubocop.yml | 6 + .ruby-version | 1 - Gemfile | 2 + Gemfile.lock | 46 +- lib/syntax_tree/cli.rb | 2 +- lib/syntax_tree/node.rb | 4 + lib/syntax_tree/parser.rb | 10 +- lib/syntax_tree/pattern.rb | 1 + lib/syntax_tree/yarv/assembler.rb | 4 +- lib/syntax_tree/yarv/calldata.rb | 2 +- lib/syntax_tree/yarv/decompiler.rb | 12 +- lib/syntax_tree/yarv/instruction_sequence.rb | 43 +- lib/syntax_tree/yarv/instructions.rb | 147 ++ tasks/whitequark.rake | 9 +- test/cli_test.rb | 4 +- test/compiler_test.rb | 4 +- test/fixtures/bodystmt.rb | 1 + test/fixtures/break.rb | 64 +- test/fixtures/ifop.rb | 10 +- test/fixtures/next.rb | 100 +- test/fixtures/redo.rb | 6 +- test/fixtures/retry.rb | 10 +- test/fixtures/var_field_rassign.rb | 1 + test/fixtures/yield.rb | 32 +- test/fixtures/yield0.rb | 8 +- test/node_test.rb | 33 +- test/test_helper.rb | 20 +- test/translation/parser.txt | 2146 +++++++++--------- test/translation/parser_test.rb | 158 +- 30 files changed, 1577 insertions(+), 1312 deletions(-) delete mode 100644 .ruby-version diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f811317..468591bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,8 @@ jobs: - '3.0' - '3.1' - '3.2' - - head + - '3.3' + - '3.4' - truffleruby-head name: CI runs-on: ubuntu-latest diff --git a/.rubocop.yml b/.rubocop.yml index 2142296f..1b81a535 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -136,6 +136,9 @@ Style/KeywordParametersOrder: Style/MissingRespondToMissing: Enabled: false +Style/MultipleComparison: + Enabled: false + Style/MutableConstant: Enabled: false @@ -157,6 +160,9 @@ Style/PerlBackrefs: Style/RedundantArrayConstructor: Enabled: false +Style/RedundantParentheses: + Enabled: false + Style/SafeNavigation: Enabled: false diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 944880fa..00000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -3.2.0 diff --git a/Gemfile b/Gemfile index be173b20..b4252fb5 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,5 @@ source "https://rubygems.org" gemspec + +gem "fiddle" diff --git a/Gemfile.lock b/Gemfile.lock index 1bf158a2..b855c712 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,42 +7,47 @@ PATH GEM remote: https://rubygems.org/ specs: - ast (2.4.2) - docile (1.4.0) - json (2.6.3) - language_server-protocol (3.17.0.3) + ast (2.4.3) + docile (1.4.1) + fiddle (1.1.8) + json (2.12.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) minitest (5.25.5) - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.27.0) + parser (3.3.8.0) ast (~> 2.4.1) racc prettier_print (1.2.1) - racc (1.7.1) + prism (1.4.0) + racc (1.8.1) rainbow (3.1.1) rake (13.3.0) - regexp_parser (2.8.2) - rexml (3.2.6) - rubocop (1.57.2) + regexp_parser (2.10.0) + rubocop (1.78.0) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.45.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.45.1) + parser (>= 3.3.7.2) + prism (~> 1.4) ruby-progressbar (1.13.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - unicode-display_width (2.5.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) PLATFORMS arm64-darwin-21 @@ -53,6 +58,7 @@ PLATFORMS DEPENDENCIES bundler + fiddle minitest rake rubocop diff --git a/lib/syntax_tree/cli.rb b/lib/syntax_tree/cli.rb index f2616c87..e0bafce9 100644 --- a/lib/syntax_tree/cli.rb +++ b/lib/syntax_tree/cli.rb @@ -159,7 +159,7 @@ class CTags < Action attr_reader :entries def initialize(options) - super(options) + super @entries = [] end diff --git a/lib/syntax_tree/node.rb b/lib/syntax_tree/node.rb index 3b676552..5a92a5a7 100644 --- a/lib/syntax_tree/node.rb +++ b/lib/syntax_tree/node.rb @@ -11644,6 +11644,10 @@ def pin(parent, pin) elsif value.is_a?(Array) && (index = value.index(self)) parent.public_send(key)[index] = replace break + elsif value.is_a?(Array) && + (index = value.index { |(_k, v)| v == self }) + parent.public_send(key)[index][1] = replace + break end end end diff --git a/lib/syntax_tree/parser.rb b/lib/syntax_tree/parser.rb index 825cd90e..326d3ec7 100644 --- a/lib/syntax_tree/parser.rb +++ b/lib/syntax_tree/parser.rb @@ -670,7 +670,11 @@ def visit(node) visit_methods do def visit_var_ref(node) - node.pin(stack[-2], pins.shift) + if node.start_char > pins.first.start_char + node.pin(stack[-2], pins.shift) + else + super + end end end @@ -1732,13 +1736,13 @@ def on_fcall(value) # :call-seq: # on_field: ( # untyped parent, - # (:"::" | Op | Period) operator + # (:"::" | Op | Period | 73) operator # (Const | Ident) name # ) -> Field def on_field(parent, operator, name) Field.new( parent: parent, - operator: operator, + operator: operator == 73 ? :"::" : operator, name: name, location: parent.location.to(name.location) ) diff --git a/lib/syntax_tree/pattern.rb b/lib/syntax_tree/pattern.rb index ca49c6bf..a5e88bfa 100644 --- a/lib/syntax_tree/pattern.rb +++ b/lib/syntax_tree/pattern.rb @@ -70,6 +70,7 @@ def compile raise CompilationError, query end + raise CompilationError, query if program.nil? compile_node(program.statements.body.first.consequent.pattern) end diff --git a/lib/syntax_tree/yarv/assembler.rb b/lib/syntax_tree/yarv/assembler.rb index b29c252a..a48c58fd 100644 --- a/lib/syntax_tree/yarv/assembler.rb +++ b/lib/syntax_tree/yarv/assembler.rb @@ -408,7 +408,7 @@ def assemble_iseq(iseq, lines) def find_local(iseq, operands) name_string, level_string = operands.split(/,\s*/) name = name_string.to_sym - level = level_string&.to_i || 0 + level = level_string.to_i iseq.local_table.plain(name) iseq.local_table.find(name, level) @@ -455,7 +455,7 @@ def parse_calldata(value) CallData::CALL_ARGS_SIMPLE end - YARV.calldata(message.to_sym, argc_value&.to_i || 0, flags) + YARV.calldata(message.to_sym, argc_value.to_i, flags) end end end diff --git a/lib/syntax_tree/yarv/calldata.rb b/lib/syntax_tree/yarv/calldata.rb index e35992f5..278a3dd9 100644 --- a/lib/syntax_tree/yarv/calldata.rb +++ b/lib/syntax_tree/yarv/calldata.rb @@ -41,7 +41,7 @@ def initialize( end def flag?(mask) - (flags & mask) > 0 + flags.anybits?(mask) end def to_h diff --git a/lib/syntax_tree/yarv/decompiler.rb b/lib/syntax_tree/yarv/decompiler.rb index 4ea99e3a..6a2cddbd 100644 --- a/lib/syntax_tree/yarv/decompiler.rb +++ b/lib/syntax_tree/yarv/decompiler.rb @@ -45,7 +45,7 @@ def node_for(value) when Integer Int(value.to_s) when Symbol - SymbolLiteral(Ident(value.to_s)) + SymbolLiteral(Ident(value.name)) end end @@ -88,10 +88,10 @@ def decompile(iseq) clause << HashLiteral(LBrace("{"), assocs) when GetGlobal - clause << VarRef(GVar(insn.name.to_s)) + clause << VarRef(GVar(insn.name.name)) when GetLocalWC0 local = iseq.local_table.locals[insn.index] - clause << VarRef(Ident(local.name.to_s)) + clause << VarRef(Ident(local.name.name)) when Jump clause << Assign(block_label.field, node_for(insn.label.name)) clause << Next(Args([])) @@ -123,7 +123,7 @@ def decompile(iseq) left, right = clause.pop(2) clause << Binary(left, :"!=", right) when OptSendWithoutBlock - method = insn.calldata.method.to_s + method = insn.calldata.method.name argc = insn.calldata.argc if insn.calldata.flag?(CallData::CALL_FCALL) @@ -182,7 +182,7 @@ def decompile(iseq) when PutSelf clause << VarRef(Kw("self")) when SetGlobal - target = GVar(insn.name.to_s) + target = GVar(insn.name.name) value = clause.pop clause << if value.is_a?(Binary) && VarRef(target) === value.left @@ -256,7 +256,7 @@ def decompile(iseq) def local_name(index, level) current = iseq level.times { current = current.parent_iseq } - current.local_table.locals[index].name.to_s + current.local_table.locals[index].name.name end end end diff --git a/lib/syntax_tree/yarv/instruction_sequence.rb b/lib/syntax_tree/yarv/instruction_sequence.rb index df92799b..4f2e0d9a 100644 --- a/lib/syntax_tree/yarv/instruction_sequence.rb +++ b/lib/syntax_tree/yarv/instruction_sequence.rb @@ -252,19 +252,23 @@ def to_a dumped_options = argument_options.dup dumped_options[:opt].map!(&:name) if dumped_options[:opt] + metadata = { + arg_size: argument_size, + local_size: local_table.size, + stack_max: stack.maximum_size, + node_id: -1, + node_ids: [-1] * insns.length + } + + metadata[:parser] = :prism if RUBY_VERSION >= "3.3" + # Next, return the instruction sequence as an array. [ MAGIC, versions[0], versions[1], 1, - { - arg_size: argument_size, - local_size: local_table.size, - stack_max: stack.maximum_size, - node_id: -1, - node_ids: [-1] * insns.length - }, + metadata, name, file, "", @@ -689,6 +693,10 @@ def concatstrings(number) push(ConcatStrings.new(number)) end + def concattoarray(object) + push(ConcatToArray.new(object)) + end + def defineclass(name, class_iseq, flags) push(DefineClass.new(name, class_iseq, flags)) end @@ -897,6 +905,14 @@ def pop push(Pop.new) end + def pushtoarraykwsplat + push(PushToArrayKwSplat.new) + end + + def putchilledstring(object) + push(PutChilledString.new(object)) + end + def putnil push(PutNil.new) end @@ -1079,6 +1095,8 @@ def self.from(source, options = Compiler::Options.new, parent_iseq = nil) iseq.concatarray when :concatstrings iseq.concatstrings(opnds[0]) + when :concattoarray + iseq.concattoarray(opnds[0]) when :defineclass iseq.defineclass(opnds[0], from(opnds[1], options, iseq), opnds[2]) when :defined @@ -1191,8 +1209,13 @@ def self.from(source, options = Compiler::Options.new, parent_iseq = nil) iseq.newarray(opnds[0]) iseq.send(YARV.calldata(:min)) when :opt_newarray_send + mid = opnds[1] + if RUBY_VERSION >= "3.4" + mid = %i[max min hash pack pack_buffer include?][mid - 1] + end + iseq.newarray(opnds[0]) - iseq.send(CallData.new(opnds[1])) + iseq.send(CallData.new(mid)) when :opt_neq iseq.push( OptNEq.new(CallData.from(opnds[0]), CallData.from(opnds[1])) @@ -1207,6 +1230,10 @@ def self.from(source, options = Compiler::Options.new, parent_iseq = nil) iseq.send(YARV.calldata(:-@)) when :pop iseq.pop + when :pushtoarraykwsplat + iseq.pushtoarraykwsplat + when :putchilledstring + iseq.putchilledstring(opnds[0]) when :putnil iseq.putnil when :putobject diff --git a/lib/syntax_tree/yarv/instructions.rb b/lib/syntax_tree/yarv/instructions.rb index ffeebe65..02188dfe 100644 --- a/lib/syntax_tree/yarv/instructions.rb +++ b/lib/syntax_tree/yarv/instructions.rb @@ -757,6 +757,59 @@ def call(vm) end end + # ### Summary + # + # `concattoarray` pops a single value off the stack and attempts to concat + # it to the Array on top of the stack. If the value is not an Array, it + # will be coerced into one. + # + # ### Usage + # + # ~~~ruby + # [1, *2] + # ~~~ + # + class ConcatToArray < Instruction + attr_reader :object + + def initialize(object) + @object = object + end + + def disasm(fmt) + fmt.instruction("concattoarray", [fmt.object(object)]) + end + + def to_a(_iseq) + [:concattoarray, object] + end + + def deconstruct_keys(_keys) + { object: object } + end + + def ==(other) + other.is_a?(ConcatToArray) && other.object == object + end + + def length + 2 + end + + def pops + 1 + end + + def pushes + 1 + end + + def call(vm) + array, value = vm.pop(2) + vm.push(array.concat(Array(value))) + end + end + # ### Summary # # `defineclass` defines a class. First it pops the superclass off the @@ -4472,6 +4525,52 @@ def side_effects? end end + # ### Summary + # + # `pushtoarraykwsplat` is used to append a hash literal that is being + # splatted onto an array. + # + # ### Usage + # + # ~~~ruby + # ["string", **{ foo: "bar" }] + # ~~~ + # + class PushToArrayKwSplat < Instruction + def disasm(fmt) + fmt.instruction("pushtoarraykwsplat") + end + + def to_a(_iseq) + [:pushtoarraykwsplat] + end + + def deconstruct_keys(_keys) + {} + end + + def ==(other) + other.is_a?(PushToArrayKwSplat) + end + + def length + 2 + end + + def pops + 2 + end + + def pushes + 1 + end + + def call(vm) + array, hash = vm.pop(2) + vm.push(array << hash) + end + end + # ### Summary # # `putnil` pushes a global nil object onto the stack. @@ -4759,6 +4858,54 @@ def call(vm) end end + # ### Summary + # + # `putchilledstring` pushes an unfrozen string literal onto the stack that + # acts like a frozen string. This is a migration path to frozen string + # literals as the default in the future. + # + # ### Usage + # + # ~~~ruby + # "foo" + # ~~~ + # + class PutChilledString < Instruction + attr_reader :object + + def initialize(object) + @object = object + end + + def disasm(fmt) + fmt.instruction("putchilledstring", [fmt.object(object)]) + end + + def to_a(_iseq) + [:putchilledstring, object] + end + + def deconstruct_keys(_keys) + { object: object } + end + + def ==(other) + other.is_a?(PutChilledString) && other.object == object + end + + def length + 2 + end + + def pushes + 1 + end + + def call(vm) + vm.push(object.dup) + end + end + # ### Summary # # `putstring` pushes an unfrozen string literal onto the stack. diff --git a/tasks/whitequark.rake b/tasks/whitequark.rake index 4f7ee650..6e1663aa 100644 --- a/tasks/whitequark.rake +++ b/tasks/whitequark.rake @@ -43,8 +43,13 @@ module ParseHelper # that we do not support. return if (versions & %w[3.1 3.2]).empty? - entry = caller.find { _1.include?("test_parser.rb") } - _, lineno, name = *entry.match(/(\d+):in `(.+)'/) + entry = + caller.find do |call| + call.include?("test_parser.rb") && call.match?(%r{(? "3.3" + require_relative "test_helper" module SyntaxTree diff --git a/test/fixtures/bodystmt.rb b/test/fixtures/bodystmt.rb index 4cbb8f5e..5999fdba 100644 --- a/test/fixtures/bodystmt.rb +++ b/test/fixtures/bodystmt.rb @@ -36,6 +36,7 @@ end % begin +rescue StandardError else # else end % diff --git a/test/fixtures/break.rb b/test/fixtures/break.rb index 519becda..23277f6b 100644 --- a/test/fixtures/break.rb +++ b/test/fixtures/break.rb @@ -1,37 +1,45 @@ % -break +tap { break } % -break foo +tap { break foo } % -break foo, bar +tap { break foo, bar } % -break(foo) +tap { break(foo) } % -break fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo +tap { break fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo } - -break( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) +tap do + break( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end % -break(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) +tap { break(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) } - -break( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) -% -break (foo), bar -% -break( - foo - bar -) -% -break foo.bar :baz do |qux| qux end +tap do + break( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end +% +tap { break (foo), bar } +% +tap do + break( + foo + bar + ) +end +% +tap { break foo.bar :baz do |qux| qux end } - -break( - foo.bar :baz do |qux| - qux - end -) -% -break :foo => "bar" +tap do + break( + foo.bar :baz do |qux| + qux + end + ) +end +% +tap { break :foo => "bar" } diff --git a/test/fixtures/ifop.rb b/test/fixtures/ifop.rb index e56eb987..f7504658 100644 --- a/test/fixtures/ifop.rb +++ b/test/fixtures/ifop.rb @@ -11,8 +11,10 @@ % foo bar ? 1 : 2 % -foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? break : baz +tap { foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? break : baz } - -foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? - break : - baz +tap do + foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? + break : + baz +end diff --git a/test/fixtures/next.rb b/test/fixtures/next.rb index 66e90028..dc159488 100644 --- a/test/fixtures/next.rb +++ b/test/fixtures/next.rb @@ -1,76 +1,82 @@ % -next +tap { next } % -next foo +tap { next foo } % -next foo, bar +tap { next foo, bar } % -next(foo) +tap { next(foo) } % -next fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo +tap { next fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo } - -next( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) +tap do + next( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end % -next(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) +tap { next(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) } - -next( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) -% -next (foo), bar -% -next( - foo - bar -) -% -next(1) +tap do + next( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end +% +tap { next (foo), bar } +% +tap do + next( + foo + bar + ) +end +% +tap { next(1) } - -next 1 +tap { next 1 } % -next(1.0) +tap { next(1.0) } - -next 1.0 +tap { next 1.0 } % -next($a) +tap { next($a) } - -next $a +tap { next $a } % -next(@@a) +tap { next(@@a) } - -next @@a +tap { next @@a } % -next(self) +tap { next(self) } - -next self +tap { next self } % -next(@a) +tap { next(@a) } - -next @a +tap { next @a } % -next(A) +tap { next(A) } - -next A +tap { next A } % -next([]) +tap { next([]) } - -next [] +tap { next [] } % -next([1]) +tap { next([1]) } - -next [1] +tap { next [1] } % -next([1, 2]) +tap { next([1, 2]) } - -next 1, 2 +tap { next 1, 2 } % -next fun foo do end +tap { next fun foo do end } - -next( - fun foo do - end -) -% -next :foo => "bar" +tap do + next( + fun foo do + end + ) +end diff --git a/test/fixtures/redo.rb b/test/fixtures/redo.rb index 8ab087a2..962af3d0 100644 --- a/test/fixtures/redo.rb +++ b/test/fixtures/redo.rb @@ -1,4 +1,6 @@ % -redo +tap { redo } % -redo # comment +tap do + redo # comment +end diff --git a/test/fixtures/retry.rb b/test/fixtures/retry.rb index 2b14d21a..47b6be51 100644 --- a/test/fixtures/retry.rb +++ b/test/fixtures/retry.rb @@ -1,4 +1,10 @@ % -retry +begin +rescue StandardError + retry +end % -retry # comment +begin +rescue StandardError + retry # comment +end diff --git a/test/fixtures/var_field_rassign.rb b/test/fixtures/var_field_rassign.rb index 3e019c5c..aa5ec379 100644 --- a/test/fixtures/var_field_rassign.rb +++ b/test/fixtures/var_field_rassign.rb @@ -1,6 +1,7 @@ % foo in bar % +bar = 1 foo in ^bar % foo in ^@bar diff --git a/test/fixtures/yield.rb b/test/fixtures/yield.rb index f3f023f8..3cf1e5f1 100644 --- a/test/fixtures/yield.rb +++ b/test/fixtures/yield.rb @@ -1,16 +1,30 @@ % -yield foo +def foo + yield foo +end % -yield(foo) +def foo + yield(foo) +end % -yield foo, bar +def foo + yield foo, bar +end % -yield(foo, bar) +def foo + yield(foo, bar) +end % -yield foo # comment +def foo + yield foo # comment +end % -yield(foo) # comment +def foo + yield(foo) # comment +end % -yield( # comment - foo -) +def foo + yield( # comment + foo + ) +end diff --git a/test/fixtures/yield0.rb b/test/fixtures/yield0.rb index a168c4aa..c1833bb5 100644 --- a/test/fixtures/yield0.rb +++ b/test/fixtures/yield0.rb @@ -1,4 +1,8 @@ % -yield +def foo + yield +end % -yield # comment +def foo + yield # comment +end diff --git a/test/node_test.rb b/test/node_test.rb index 19fbeed2..f2706b2c 100644 --- a/test/node_test.rb +++ b/test/node_test.rb @@ -280,7 +280,10 @@ def test_brace_block end def test_break - assert_node(Break, "break value") + at = location(chars: 6..17) + assert_node(Break, "tap { break value }", at: at) do |node| + node.block.bodystmt.body.first + end end def test_call @@ -710,7 +713,10 @@ def test_mrhs_add_star end def test_next - assert_node(Next, "next(value)") + at = location(chars: 6..17) + assert_node(Next, "tap { next(value) }", at: at) do |node| + node.block.bodystmt.body.first + end end def test_op @@ -786,7 +792,9 @@ def test_rational end def test_redo - assert_node(Redo, "redo") + assert_node(Redo, "tap { redo }", at: location(chars: 6..10)) do |node| + node.block.bodystmt.body.first + end end def test_regexp_literal @@ -833,7 +841,10 @@ def test_rest_param end def test_retry - assert_node(Retry, "retry") + at = location(chars: 15..20) + assert_node(Retry, "begin; rescue; retry; end", at: at) do |node| + node.bodystmt.rescue_clause.statements.body.first + end end def test_return @@ -949,8 +960,8 @@ def test_var_field guard_version("3.1.0") do def test_pinned_var_ref - source = "foo in ^bar" - at = location(chars: 7..11) + source = "bar = 1; foo in ^bar" + at = location(chars: 16..20) assert_node(PinnedVarRef, source, at: at, &:pattern) end @@ -1013,11 +1024,17 @@ def test_xstring_heredoc end def test_yield - assert_node(YieldNode, "yield value") + at = location(lines: 2..2, chars: 10..21) + assert_node(YieldNode, "def foo\n yield value\nend\n", at: at) do |node| + node.bodystmt.statements.body.first + end end def test_yield0 - assert_node(YieldNode, "yield") + at = location(lines: 2..2, chars: 10..15) + assert_node(YieldNode, "def foo\n yield\nend\n", at: at) do |node| + node.bodystmt.statements.body.first + end end def test_zsuper diff --git a/test/test_helper.rb b/test/test_helper.rb index 8015be14..787f819d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -106,17 +106,15 @@ def assert_syntax_tree(node) refute_includes(json, "#<") assert_equal(type, JSON.parse(json)["type"]) - if RUBY_ENGINE != "truffleruby" - # Get a match expression from the node, then assert that it can in fact - # match the node. - # rubocop:disable all - assert(eval(<<~RUBY)) - case node - in #{node.construct_keys} - true - end - RUBY - end + # Get a match expression from the node, then assert that it can in fact + # match the node. + # rubocop:disable all + assert(eval(<<~RUBY)) + case node + in #{node.construct_keys} + true + end + RUBY end Minitest::Test.include(self) diff --git a/test/translation/parser.txt b/test/translation/parser.txt index 5e9e8d31..d732cd0d 100644 --- a/test/translation/parser.txt +++ b/test/translation/parser.txt @@ -1,1237 +1,980 @@ -!!! assert_parses_args:2249:0 -def f (foo: 1, bar: 2, **baz, &b); end -!!! assert_parses_args:2249:1 -def f (foo: 1, &b); end -!!! assert_parses_args:2249:2 -def f **baz, &b; end -!!! assert_parses_args:2249:3 -def f *, **; end -!!! assert_parses_args:2249:4 -def f a, o=1, *r, &b; end -!!! assert_parses_args:2249:5 -def f a, o=1, *r, p, &b; end -!!! assert_parses_args:2249:6 -def f a, o=1, &b; end -!!! assert_parses_args:2249:7 -def f a, o=1, p, &b; end -!!! assert_parses_args:2249:8 -def f a, *r, &b; end -!!! assert_parses_args:2249:9 -def f a, *r, p, &b; end -!!! assert_parses_args:2249:10 -def f a, &b; end -!!! assert_parses_args:2249:11 -def f o=1, *r, &b; end -!!! assert_parses_args:2249:12 -def f o=1, *r, p, &b; end -!!! assert_parses_args:2249:13 -def f o=1, &b; end -!!! assert_parses_args:2249:14 -def f o=1, p, &b; end -!!! assert_parses_args:2249:15 -def f *r, &b; end -!!! assert_parses_args:2249:16 -def f *r, p, &b; end -!!! assert_parses_args:2249:17 -def f &b; end -!!! assert_parses_args:2249:18 -def f ; end -!!! assert_parses_args:2249:19 -def f (((a))); end -!!! assert_parses_args:2249:20 -def f ((a, a1)); end -!!! assert_parses_args:2249:21 -def f ((a, *r)); end -!!! assert_parses_args:2249:22 -def f ((a, *r, p)); end -!!! assert_parses_args:2249:23 -def f ((a, *)); end -!!! assert_parses_args:2249:24 -def f ((a, *, p)); end -!!! assert_parses_args:2249:25 -def f ((*r)); end -!!! assert_parses_args:2249:26 -def f ((*r, p)); end -!!! assert_parses_args:2249:27 -def f ((*)); end -!!! assert_parses_args:2249:28 -def f ((*, p)); end -!!! assert_parses_args:2249:29 -def f foo: -; end -!!! assert_parses_args:2249:30 -def f foo: -1 -; end -!!! assert_parses_blockargs:2506:0 -f{ |a| } -!!! assert_parses_blockargs:2506:1 -f{ |a, b,| } -!!! assert_parses_blockargs:2506:2 -f{ |a| } -!!! assert_parses_blockargs:2506:3 -f{ |foo:| } -!!! assert_parses_blockargs:2506:4 -f{ } -!!! assert_parses_blockargs:2506:5 -f{ | | } -!!! assert_parses_blockargs:2506:6 -f{ |;a| } -!!! assert_parses_blockargs:2506:7 -f{ |; -a -| } -!!! assert_parses_blockargs:2506:8 -f{ || } -!!! assert_parses_blockargs:2506:9 -f{ |a| } -!!! assert_parses_blockargs:2506:10 -f{ |a, c| } -!!! assert_parses_blockargs:2506:11 -f{ |a,| } -!!! assert_parses_blockargs:2506:12 -f{ |a, &b| } -!!! assert_parses_blockargs:2506:13 -f{ |a, *s, &b| } -!!! assert_parses_blockargs:2506:14 -f{ |a, *, &b| } -!!! assert_parses_blockargs:2506:15 -f{ |a, *s| } -!!! assert_parses_blockargs:2506:16 -f{ |a, *| } -!!! assert_parses_blockargs:2506:17 -f{ |*s, &b| } -!!! assert_parses_blockargs:2506:18 -f{ |*, &b| } -!!! assert_parses_blockargs:2506:19 -f{ |*s| } -!!! assert_parses_blockargs:2506:20 -f{ |*| } -!!! assert_parses_blockargs:2506:21 -f{ |&b| } -!!! assert_parses_blockargs:2506:22 -f{ |a, o=1, o1=2, *r, &b| } -!!! assert_parses_blockargs:2506:23 -f{ |a, o=1, *r, p, &b| } -!!! assert_parses_blockargs:2506:24 -f{ |a, o=1, &b| } -!!! assert_parses_blockargs:2506:25 -f{ |a, o=1, p, &b| } -!!! assert_parses_blockargs:2506:26 -f{ |a, *r, p, &b| } -!!! assert_parses_blockargs:2506:27 -f{ |o=1, *r, &b| } -!!! assert_parses_blockargs:2506:28 -f{ |o=1, *r, p, &b| } -!!! assert_parses_blockargs:2506:29 -f{ |o=1, &b| } -!!! assert_parses_blockargs:2506:30 -f{ |o=1, p, &b| } -!!! assert_parses_blockargs:2506:31 -f{ |*r, p, &b| } -!!! assert_parses_blockargs:2506:32 -f{ |foo: 1, bar: 2, **baz, &b| } -!!! assert_parses_blockargs:2506:33 -f{ |foo: 1, &b| } -!!! assert_parses_blockargs:2506:34 -f{ |**baz, &b| } -!!! assert_parses_pattern_match:8503:0 -case foo; in self then true; end -!!! assert_parses_pattern_match:8503:1 -case foo; in 1..2 then true; end -!!! assert_parses_pattern_match:8503:2 -case foo; in 1.. then true; end -!!! assert_parses_pattern_match:8503:3 -case foo; in ..2 then true; end -!!! assert_parses_pattern_match:8503:4 -case foo; in 1...2 then true; end -!!! assert_parses_pattern_match:8503:5 -case foo; in 1... then true; end -!!! assert_parses_pattern_match:8503:6 -case foo; in ...2 then true; end -!!! assert_parses_pattern_match:8503:7 -case foo; in [*x, 1 => a, *y] then true; end -!!! assert_parses_pattern_match:8503:8 -case foo; in String(*, 1, *) then true; end -!!! assert_parses_pattern_match:8503:9 -case foo; in Array[*, 1, *] then true; end -!!! assert_parses_pattern_match:8503:10 -case foo; in *, 42, * then true; end -!!! assert_parses_pattern_match:8503:11 -case foo; in x, then nil; end -!!! assert_parses_pattern_match:8503:12 -case foo; in *x then nil; end -!!! assert_parses_pattern_match:8503:13 -case foo; in * then nil; end -!!! assert_parses_pattern_match:8503:14 -case foo; in x, y then nil; end -!!! assert_parses_pattern_match:8503:15 -case foo; in x, y, then nil; end -!!! assert_parses_pattern_match:8503:16 -case foo; in x, *y, z then nil; end -!!! assert_parses_pattern_match:8503:17 -case foo; in *x, y, z then nil; end -!!! assert_parses_pattern_match:8503:18 -case foo; in 1, "a", [], {} then nil; end -!!! assert_parses_pattern_match:8503:19 -case foo; in ->{ 42 } then true; end -!!! assert_parses_pattern_match:8503:20 -case foo; in A(1, 2) then true; end -!!! assert_parses_pattern_match:8503:21 -case foo; in A(x:) then true; end -!!! assert_parses_pattern_match:8503:22 -case foo; in A() then true; end -!!! assert_parses_pattern_match:8503:23 -case foo; in A[1, 2] then true; end -!!! assert_parses_pattern_match:8503:24 -case foo; in A[x:] then true; end -!!! assert_parses_pattern_match:8503:25 -case foo; in A[] then true; end -!!! assert_parses_pattern_match:8503:26 -case foo; in x then x; end -!!! assert_parses_pattern_match:8503:27 -case foo; in {} then true; end -!!! assert_parses_pattern_match:8503:28 -case foo; in a: 1 then true; end -!!! assert_parses_pattern_match:8503:29 -case foo; in { a: 1 } then true; end -!!! assert_parses_pattern_match:8503:30 -case foo; in { a: 1, } then true; end -!!! assert_parses_pattern_match:8503:31 -case foo; in a: then true; end -!!! assert_parses_pattern_match:8503:32 -case foo; in **a then true; end -!!! assert_parses_pattern_match:8503:33 -case foo; in ** then true; end -!!! assert_parses_pattern_match:8503:34 -case foo; in a: 1, b: 2 then true; end -!!! assert_parses_pattern_match:8503:35 -case foo; in a:, b: then true; end -!!! assert_parses_pattern_match:8503:36 -case foo; in a: 1, _a:, ** then true; end -!!! assert_parses_pattern_match:8503:37 -case foo; - in {a: 1 - } - false - ; end -!!! assert_parses_pattern_match:8503:38 -case foo; - in {a: - 2} - false - ; end -!!! assert_parses_pattern_match:8503:39 -case foo; - in {Foo: 42 - } - false - ; end -!!! assert_parses_pattern_match:8503:40 -case foo; - in a: {b:}, c: - p c - ; end -!!! assert_parses_pattern_match:8503:41 -case foo; - in {a: - } - true - ; end -!!! assert_parses_pattern_match:8503:42 -case foo; in A then true; end -!!! assert_parses_pattern_match:8503:43 -case foo; in A::B then true; end -!!! assert_parses_pattern_match:8503:44 -case foo; in ::A then true; end -!!! assert_parses_pattern_match:8503:45 -case foo; in [x] then nil; end -!!! assert_parses_pattern_match:8503:46 -case foo; in [x,] then nil; end -!!! assert_parses_pattern_match:8503:47 -case foo; in [x, y] then true; end -!!! assert_parses_pattern_match:8503:48 -case foo; in [x, y,] then true; end -!!! assert_parses_pattern_match:8503:49 -case foo; in [x, y, *] then true; end -!!! assert_parses_pattern_match:8503:50 -case foo; in [x, y, *z] then true; end -!!! assert_parses_pattern_match:8503:51 -case foo; in [x, *y, z] then true; end -!!! assert_parses_pattern_match:8503:52 -case foo; in [x, *, y] then true; end -!!! assert_parses_pattern_match:8503:53 -case foo; in [*x, y] then true; end -!!! assert_parses_pattern_match:8503:54 -case foo; in [*, x] then true; end -!!! assert_parses_pattern_match:8503:55 -case foo; in (1) then true; end -!!! assert_parses_pattern_match:8503:56 -case foo; in x if true; nil; end -!!! assert_parses_pattern_match:8503:57 -case foo; in x unless true; nil; end -!!! assert_parses_pattern_match:8503:58 -case foo; in 1; end -!!! assert_parses_pattern_match:8503:59 -case foo; in ^foo then nil; end -!!! assert_parses_pattern_match:8503:60 -case foo; in "a": then true; end -!!! assert_parses_pattern_match:8503:61 -case foo; in "#{ 'a' }": then true; end -!!! assert_parses_pattern_match:8503:62 -case foo; in "#{ %q{a} }": then true; end -!!! assert_parses_pattern_match:8503:63 -case foo; in "#{ %Q{a} }": then true; end -!!! assert_parses_pattern_match:8503:64 -case foo; in "a": 1 then true; end -!!! assert_parses_pattern_match:8503:65 -case foo; in "#{ 'a' }": 1 then true; end -!!! assert_parses_pattern_match:8503:66 -case foo; in "#{ %q{a} }": 1 then true; end -!!! assert_parses_pattern_match:8503:67 -case foo; in "#{ %Q{a} }": 1 then true; end -!!! assert_parses_pattern_match:8503:68 -case foo; in ^(42) then nil; end -!!! assert_parses_pattern_match:8503:69 -case foo; in { foo: ^(42) } then nil; end -!!! assert_parses_pattern_match:8503:70 -case foo; in ^(0+0) then nil; end -!!! assert_parses_pattern_match:8503:71 -case foo; in ^@a; end -!!! assert_parses_pattern_match:8503:72 -case foo; in ^@@TestPatternMatching; end -!!! assert_parses_pattern_match:8503:73 -case foo; in ^$TestPatternMatching; end -!!! assert_parses_pattern_match:8503:74 -case foo; in ^(1 -); end -!!! assert_parses_pattern_match:8503:75 -case foo; in 1 | 2 then true; end -!!! assert_parses_pattern_match:8503:76 -case foo; in 1 => a then true; end -!!! assert_parses_pattern_match:8503:77 -case foo; in **nil then true; end -!!! block in test_endless_comparison_method:10392:0 -def ===(other) = do_something -!!! block in test_endless_comparison_method:10392:1 -def ==(other) = do_something -!!! block in test_endless_comparison_method:10392:2 -def !=(other) = do_something -!!! block in test_endless_comparison_method:10392:3 -def <=(other) = do_something -!!! block in test_endless_comparison_method:10392:4 -def >=(other) = do_something -!!! block in test_endless_comparison_method:10392:5 -def !=(other) = do_something -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:0 -'a\ -b' -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:1 -<<-'HERE' -a\ -b -HERE -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:2 -%q{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:3 -"a\ -b" -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:4 -<<-"HERE" -a\ -b -HERE -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:5 -%{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:6 -%Q{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:7 -%w{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:8 -%W{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:9 -%i{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:10 -%I{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:11 -:'a\ -b' -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:12 -%s{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:13 -:"a\ -b" -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:14 -/a\ -b/ -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:15 -%r{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:16 -%x{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:17 -`a\ -b` -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:18 -<<-`HERE` -a\ -b -HERE -!!! block in test_ruby_bug_11873_a:6017:0 -a b{c d}, :e do end -!!! block in test_ruby_bug_11873_a:6017:1 -a b{c d}, 1 do end -!!! block in test_ruby_bug_11873_a:6017:2 -a b{c d}, 1.0 do end -!!! block in test_ruby_bug_11873_a:6017:3 -a b{c d}, 1.0r do end -!!! block in test_ruby_bug_11873_a:6017:4 -a b{c d}, 1.0i do end -!!! block in test_ruby_bug_11873_a:6022:0 -a b{c(d)}, :e do end -!!! block in test_ruby_bug_11873_a:6022:1 -a b{c(d)}, 1 do end -!!! block in test_ruby_bug_11873_a:6022:2 -a b{c(d)}, 1.0 do end -!!! block in test_ruby_bug_11873_a:6022:3 -a b{c(d)}, 1.0r do end -!!! block in test_ruby_bug_11873_a:6022:4 -a b{c(d)}, 1.0i do end -!!! block in test_ruby_bug_11873_a:6036:0 -a b(c d), :e do end -!!! block in test_ruby_bug_11873_a:6036:1 -a b(c d), 1 do end -!!! block in test_ruby_bug_11873_a:6036:2 -a b(c d), 1.0 do end -!!! block in test_ruby_bug_11873_a:6036:3 -a b(c d), 1.0r do end -!!! block in test_ruby_bug_11873_a:6036:4 -a b(c d), 1.0i do end -!!! block in test_ruby_bug_11873_a:6041:0 -a b(c(d)), :e do end -!!! block in test_ruby_bug_11873_a:6041:1 -a b(c(d)), 1 do end -!!! block in test_ruby_bug_11873_a:6041:2 -a b(c(d)), 1.0 do end -!!! block in test_ruby_bug_11873_a:6041:3 -a b(c(d)), 1.0r do end -!!! block in test_ruby_bug_11873_a:6041:4 -a b(c(d)), 1.0i do end -!!! test___ENCODING__:1037 +!!! test___ENCODING__:1051 __ENCODING__ -!!! test___ENCODING___legacy_:1046 +!!! test___ENCODING___legacy_:1060 __ENCODING__ -!!! test_alias:2020 +!!! test_alias:2034 alias :foo bar -!!! test_alias_gvar:2032 +!!! test_alias_gvar:2046 alias $a $b -!!! test_alias_gvar:2037 +!!! test_alias_gvar:2051 alias $a $+ -!!! test_ambiuous_quoted_label_in_ternary_operator:7204 +!!! test_ambiuous_quoted_label_in_ternary_operator:7389 a ? b & '': nil -!!! test_and:4447 +!!! test_and:4507 foo and bar -!!! test_and:4453 +!!! test_and:4513 foo && bar -!!! test_and_asgn:1748 +!!! test_and_asgn:1762 foo.a &&= 1 -!!! test_and_asgn:1758 +!!! test_and_asgn:1772 foo[0, 1] &&= 2 -!!! test_and_or_masgn:4475 +!!! test_and_or_masgn:4535 foo && (a, b = bar) -!!! test_and_or_masgn:4484 +!!! test_and_or_masgn:4544 foo || (a, b = bar) -!!! test_anonymous_blockarg:10861 +!!! test_anonymous_blockarg:11205 def foo(&); bar(&); end -!!! test_arg:2055 +!!! test_arg:2069 def f(foo); end -!!! test_arg:2066 +!!! test_arg:2080 def f(foo, bar); end -!!! test_arg_duplicate_ignored:2958 -def foo(_, _); end +!!! test_arg_combinations:2272 +def f a, o=1, *r, &b; end +!!! test_arg_combinations:2281 +def f a, o=1, *r, p, &b; end +!!! test_arg_combinations:2292 +def f a, o=1, &b; end +!!! test_arg_combinations:2300 +def f a, o=1, p, &b; end +!!! test_arg_combinations:2310 +def f a, *r, &b; end +!!! test_arg_combinations:2318 +def f a, *r, p, &b; end +!!! test_arg_combinations:2328 +def f a, &b; end +!!! test_arg_combinations:2335 +def f o=1, *r, &b; end +!!! test_arg_combinations:2343 +def f o=1, *r, p, &b; end +!!! test_arg_combinations:2353 +def f o=1, &b; end +!!! test_arg_combinations:2360 +def f o=1, p, &b; end +!!! test_arg_combinations:2369 +def f *r, &b; end +!!! test_arg_combinations:2376 +def f *r, p, &b; end +!!! test_arg_combinations:2385 +def f &b; end +!!! test_arg_combinations:2391 +def f ; end !!! test_arg_duplicate_ignored:2972 +def foo(_, _); end +!!! test_arg_duplicate_ignored:2986 def foo(_a, _a); end -!!! test_arg_label:3012 +!!! test_arg_label:3026 def foo() a:b end -!!! test_arg_label:3019 +!!! test_arg_label:3033 def foo a:b end -!!! test_arg_label:3026 +!!! test_arg_label:3040 f { || a:b } -!!! test_arg_scope:2238 +!!! test_arg_scope:2252 lambda{|;a|a} -!!! test_args_args_assocs:4077 +!!! test_args_args_assocs:4137 fun(foo, :foo => 1) -!!! test_args_args_assocs:4083 +!!! test_args_args_assocs:4143 fun(foo, :foo => 1, &baz) -!!! test_args_args_assocs_comma:4092 +!!! test_args_args_assocs_comma:4152 foo[bar, :baz => 1,] -!!! test_args_args_comma:3941 +!!! test_args_args_comma:4001 foo[bar,] -!!! test_args_args_star:3908 +!!! test_args_args_star:3968 fun(foo, *bar) -!!! test_args_args_star:3913 +!!! test_args_args_star:3973 fun(foo, *bar, &baz) -!!! test_args_assocs:4001 +!!! test_args_assocs:4061 fun(:foo => 1) -!!! test_args_assocs:4006 +!!! test_args_assocs:4066 fun(:foo => 1, &baz) -!!! test_args_assocs:4012 +!!! test_args_assocs:4072 self[:bar => 1] -!!! test_args_assocs:4021 +!!! test_args_assocs:4081 self.[]= foo, :a => 1 -!!! test_args_assocs:4031 +!!! test_args_assocs:4091 yield(:foo => 42) -!!! test_args_assocs:4039 +!!! test_args_assocs:4099 super(:foo => 42) -!!! test_args_assocs_comma:4068 +!!! test_args_assocs_comma:4128 foo[:baz => 1,] -!!! test_args_assocs_legacy:3951 +!!! test_args_assocs_legacy:4011 fun(:foo => 1) -!!! test_args_assocs_legacy:3956 +!!! test_args_assocs_legacy:4016 fun(:foo => 1, &baz) -!!! test_args_assocs_legacy:3962 +!!! test_args_assocs_legacy:4022 self[:bar => 1] -!!! test_args_assocs_legacy:3971 +!!! test_args_assocs_legacy:4031 self.[]= foo, :a => 1 -!!! test_args_assocs_legacy:3981 +!!! test_args_assocs_legacy:4041 yield(:foo => 42) -!!! test_args_assocs_legacy:3989 +!!! test_args_assocs_legacy:4049 super(:foo => 42) -!!! test_args_block_pass:3934 +!!! test_args_block_pass:3994 fun(&bar) -!!! test_args_cmd:3901 +!!! test_args_cmd:3961 fun(f bar) -!!! test_args_star:3921 +!!! test_args_star:3981 fun(*bar) -!!! test_args_star:3926 +!!! test_args_star:3986 fun(*bar, &baz) -!!! test_array_assocs:629 +!!! test_array_assocs:643 [ 1 => 2 ] -!!! test_array_assocs:637 +!!! test_array_assocs:651 [ 1, 2 => 3 ] -!!! test_array_plain:589 +!!! test_array_plain:603 [1, 2] -!!! test_array_splat:598 +!!! test_array_splat:612 [1, *foo, 2] -!!! test_array_splat:611 +!!! test_array_splat:625 [1, *foo] -!!! test_array_splat:622 +!!! test_array_splat:636 [*foo] -!!! test_array_symbols:695 +!!! test_array_symbols:709 %i[foo bar] -!!! test_array_symbols_empty:732 +!!! test_array_symbols_empty:746 %i[] -!!! test_array_symbols_empty:740 +!!! test_array_symbols_empty:754 %I() -!!! test_array_symbols_interp:706 +!!! test_array_symbols_interp:720 %I[foo #{bar}] -!!! test_array_symbols_interp:721 +!!! test_array_symbols_interp:735 %I[foo#{bar}] -!!! test_array_words:647 +!!! test_array_words:661 %w[foo bar] -!!! test_array_words_empty:682 +!!! test_array_words_empty:696 %w[] -!!! test_array_words_empty:689 +!!! test_array_words_empty:703 %W() -!!! test_array_words_interp:657 -%W[foo #{bar}] !!! test_array_words_interp:671 +%W[foo #{bar}] +!!! test_array_words_interp:685 %W[foo #{bar}foo#@baz] -!!! test_asgn_cmd:1126 +!!! test_asgn_cmd:1140 foo = m foo -!!! test_asgn_cmd:1130 +!!! test_asgn_cmd:1144 foo = bar = m foo -!!! test_asgn_mrhs:1449 +!!! test_asgn_mrhs:1463 foo = bar, 1 -!!! test_asgn_mrhs:1456 +!!! test_asgn_mrhs:1470 foo = *bar -!!! test_asgn_mrhs:1461 +!!! test_asgn_mrhs:1475 foo = baz, *bar -!!! test_back_ref:995 +!!! test_back_ref:1009 $+ -!!! test_bang:3434 +!!! test_bang:3448 !foo -!!! test_bang_cmd:3448 +!!! test_bang_cmd:3462 !m foo -!!! test_begin_cmdarg:5526 +!!! test_begin_cmdarg:5658 p begin 1.times do 1 end end -!!! test_beginless_erange_after_newline:935 +!!! test_beginless_erange_after_newline:949 foo ...100 -!!! test_beginless_irange_after_newline:923 +!!! test_beginless_irange_after_newline:937 foo ..100 -!!! test_beginless_range:903 +!!! test_beginless_range:917 ..100 -!!! test_beginless_range:912 +!!! test_beginless_range:926 ...100 -!!! test_blockarg:2187 +!!! test_block_arg_combinations:2531 +f{ } +!!! test_block_arg_combinations:2537 +f{ | | } +!!! test_block_arg_combinations:2541 +f{ |;a| } +!!! test_block_arg_combinations:2546 +f{ |; +a +| } +!!! test_block_arg_combinations:2552 +f{ || } +!!! test_block_arg_combinations:2561 +f{ |a| } +!!! test_block_arg_combinations:2571 +f{ |a, c| } +!!! test_block_arg_combinations:2580 +f{ |a,| } +!!! test_block_arg_combinations:2585 +f{ |a, &b| } +!!! test_block_arg_combinations:2599 +f{ |a, *s, &b| } +!!! test_block_arg_combinations:2610 +f{ |a, *, &b| } +!!! test_block_arg_combinations:2621 +f{ |a, *s| } +!!! test_block_arg_combinations:2631 +f{ |a, *| } +!!! test_block_arg_combinations:2640 +f{ |*s, &b| } +!!! test_block_arg_combinations:2651 +f{ |*, &b| } +!!! test_block_arg_combinations:2662 +f{ |*s| } +!!! test_block_arg_combinations:2672 +f{ |*| } +!!! test_block_arg_combinations:2678 +f{ |&b| } +!!! test_block_arg_combinations:2689 +f{ |a, o=1, o1=2, *r, &b| } +!!! test_block_arg_combinations:2700 +f{ |a, o=1, *r, p, &b| } +!!! test_block_arg_combinations:2711 +f{ |a, o=1, &b| } +!!! test_block_arg_combinations:2720 +f{ |a, o=1, p, &b| } +!!! test_block_arg_combinations:2730 +f{ |a, *r, p, &b| } +!!! test_block_arg_combinations:2740 +f{ |o=1, *r, &b| } +!!! test_block_arg_combinations:2749 +f{ |o=1, *r, p, &b| } +!!! test_block_arg_combinations:2759 +f{ |o=1, &b| } +!!! test_block_arg_combinations:2767 +f{ |o=1, p, &b| } +!!! test_block_arg_combinations:2776 +f{ |*r, p, &b| } +!!! test_block_kwarg:2867 +f{ |foo:| } +!!! test_block_kwarg_combinations:2840 +f{ |foo: 1, bar: 2, **baz, &b| } +!!! test_block_kwarg_combinations:2850 +f{ |foo: 1, &b| } +!!! test_block_kwarg_combinations:2858 +f{ |**baz, &b| } +!!! test_blockarg:2201 def f(&block); end -!!! test_break:5037 +!!! test_break:5169 break(foo) -!!! test_break:5051 +!!! test_break:5183 break foo -!!! test_break:5057 +!!! test_break:5189 break() -!!! test_break:5064 +!!! test_break:5196 break -!!! test_break_block:5072 +!!! test_break_block:5204 break fun foo do end -!!! test_bug_435:7067 +!!! test_bug_435:7252 "#{-> foo {}}" -!!! test_bug_447:7046 +!!! test_bug_447:7231 m [] do end -!!! test_bug_447:7055 +!!! test_bug_447:7240 m [], 1 do end -!!! test_bug_452:7080 +!!! test_bug_452:7265 td (1_500).toString(); td.num do; end -!!! test_bug_466:7096 +!!! test_bug_466:7281 foo "#{(1+1).to_i}" do; end -!!! test_bug_473:7113 +!!! test_bug_473:7298 m "#{[]}" -!!! test_bug_480:7124 +!!! test_bug_480:7309 m "#{}#{()}" -!!! test_bug_481:7136 +!!! test_bug_481:7321 m def x(); end; 1.tap do end -!!! test_bug_ascii_8bit_in_literal:5880 +!!! test_bug_ascii_8bit_in_literal:6031 # coding:utf-8 "\xD0\xBF\xD1\x80\xD0\xBE\xD0\xB2\xD0\xB5\xD1\x80\xD0\xBA\xD0\xB0" -!!! test_bug_cmd_string_lookahead:5752 +!!! test_bug_cmd_string_lookahead:5903 desc "foo" do end -!!! test_bug_cmdarg:5549 +!!! test_bug_cmdarg:5681 assert dogs -!!! test_bug_cmdarg:5554 +!!! test_bug_cmdarg:5686 assert do: true -!!! test_bug_cmdarg:5562 +!!! test_bug_cmdarg:5694 f x: -> do meth do end end -!!! test_bug_def_no_paren_eql_begin:5799 +!!! test_bug_def_no_paren_eql_begin:5950 def foo =begin =end end -!!! test_bug_do_block_in_call_args:5762 +!!! test_bug_do_block_in_call_args:5913 bar def foo; self.each do end end -!!! test_bug_do_block_in_cmdarg:5777 +!!! test_bug_do_block_in_cmdarg:5928 tap (proc do end) -!!! test_bug_do_block_in_hash_brace:6569 +!!! test_bug_do_block_in_hash_brace:6720 p :foo, {a: proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6587 +!!! test_bug_do_block_in_hash_brace:6738 p :foo, {:a => proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6605 +!!! test_bug_do_block_in_hash_brace:6756 p :foo, {"a": proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6623 +!!! test_bug_do_block_in_hash_brace:6774 p :foo, {proc do end => proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6643 +!!! test_bug_do_block_in_hash_brace:6794 p :foo, {** proc do end, b: proc do end} -!!! test_bug_heredoc_do:5835 +!!! test_bug_heredoc_do:5986 f <<-TABLE do TABLE end -!!! test_bug_interp_single:5789 +!!! test_bug_interp_single:5940 "#{1}" -!!! test_bug_interp_single:5793 +!!! test_bug_interp_single:5944 %W"#{1}" -!!! test_bug_lambda_leakage:6550 +!!! test_bug_lambda_leakage:6701 ->(scope) {}; scope -!!! test_bug_regex_verification:6563 +!!! test_bug_regex_verification:6714 /#)/x -!!! test_bug_rescue_empty_else:5813 +!!! test_bug_rescue_empty_else:5964 begin; rescue LoadError; else; end -!!! test_bug_while_not_parens_do:5805 +!!! test_bug_while_not_parens_do:5956 while not (true) do end -!!! test_case_cond:4844 +!!! test_case_cond:4976 case; when foo; 'foo'; end -!!! test_case_cond_else:4857 +!!! test_case_cond_else:4989 case; when foo; 'foo'; else 'bar'; end -!!! test_case_expr:4816 +!!! test_case_expr:4948 case foo; when 'bar'; bar; end -!!! test_case_expr_else:4830 +!!! test_case_expr_else:4962 case foo; when 'bar'; bar; else baz; end -!!! test_casgn_scoped:1192 +!!! test_casgn_scoped:1206 Bar::Foo = 10 -!!! test_casgn_toplevel:1181 +!!! test_casgn_toplevel:1195 ::Foo = 10 -!!! test_casgn_unscoped:1203 +!!! test_casgn_unscoped:1217 Foo = 10 -!!! test_character:248 +!!! test_character:250 ?a -!!! test_class:1827 +!!! test_class:1841 class Foo; end -!!! test_class:1837 +!!! test_class:1851 class Foo end -!!! test_class_definition_in_while_cond:6870 +!!! test_class_definition_in_while_cond:7055 while class Foo; tap do end; end; break; end -!!! test_class_definition_in_while_cond:6882 +!!! test_class_definition_in_while_cond:7067 while class Foo a = tap do end; end; break; end -!!! test_class_definition_in_while_cond:6895 +!!! test_class_definition_in_while_cond:7080 while class << self; tap do end; end; break; end -!!! test_class_definition_in_while_cond:6907 +!!! test_class_definition_in_while_cond:7092 while class << self; a = tap do end; end; break; end -!!! test_class_super:1848 +!!! test_class_super:1862 class Foo < Bar; end -!!! test_class_super_label:1860 +!!! test_class_super_label:1874 class Foo < a:b; end -!!! test_comments_before_leading_dot__27:7750 +!!! test_comments_before_leading_dot__27:7941 a # # .foo -!!! test_comments_before_leading_dot__27:7757 +!!! test_comments_before_leading_dot__27:7948 a # # .foo -!!! test_comments_before_leading_dot__27:7764 +!!! test_comments_before_leading_dot__27:7955 a # # &.foo -!!! test_comments_before_leading_dot__27:7771 +!!! test_comments_before_leading_dot__27:7962 a # # &.foo -!!! test_complex:156 +!!! test_complex:158 42i -!!! test_complex:162 +!!! test_complex:164 42ri -!!! test_complex:168 +!!! test_complex:170 42.1i -!!! test_complex:174 +!!! test_complex:176 42.1ri -!!! test_cond_begin:4686 +!!! test_cond_begin:4746 if (bar); foo; end -!!! test_cond_begin_masgn:4695 +!!! test_cond_begin_masgn:4755 if (bar; a, b = foo); end -!!! test_cond_eflipflop:4758 +!!! test_cond_eflipflop:4854 if foo...bar; end -!!! test_cond_eflipflop:4772 +!!! test_cond_eflipflop:4884 !(foo...bar) -!!! test_cond_iflipflop:4735 +!!! test_cond_eflipflop_with_beginless_range:4903 +if ...bar; end +!!! test_cond_eflipflop_with_endless_range:4893 +if foo...; end +!!! test_cond_iflipflop:4795 if foo..bar; end -!!! test_cond_iflipflop:4749 +!!! test_cond_iflipflop:4825 !(foo..bar) -!!! test_cond_match_current_line:4781 +!!! test_cond_iflipflop_with_beginless_range:4844 +if ..bar; end +!!! test_cond_iflipflop_with_endless_range:4834 +if foo..; end +!!! test_cond_match_current_line:4913 if /wat/; end -!!! test_cond_match_current_line:4801 +!!! test_cond_match_current_line:4933 !/wat/ -!!! test_const_op_asgn:1536 +!!! test_const_op_asgn:1550 A += 1 -!!! test_const_op_asgn:1542 +!!! test_const_op_asgn:1556 ::A += 1 -!!! test_const_op_asgn:1550 +!!! test_const_op_asgn:1564 B::A += 1 -!!! test_const_op_asgn:1558 +!!! test_const_op_asgn:1572 def x; self::A ||= 1; end -!!! test_const_op_asgn:1567 +!!! test_const_op_asgn:1581 def x; ::A ||= 1; end -!!! test_const_scoped:1020 +!!! test_const_scoped:1034 Bar::Foo -!!! test_const_toplevel:1011 +!!! test_const_toplevel:1025 ::Foo -!!! test_const_unscoped:1029 +!!! test_const_unscoped:1043 Foo -!!! test_control_meta_escape_chars_in_regexp__since_31:10686 +!!! test_control_meta_escape_chars_in_regexp__since_31:11030 /\c\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10692 +!!! test_control_meta_escape_chars_in_regexp__since_31:11036 /\c\M-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10698 +!!! test_control_meta_escape_chars_in_regexp__since_31:11042 /\C-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10704 +!!! test_control_meta_escape_chars_in_regexp__since_31:11048 /\C-\M-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10710 +!!! test_control_meta_escape_chars_in_regexp__since_31:11054 /\M-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10716 +!!! test_control_meta_escape_chars_in_regexp__since_31:11060 /\M-\C-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10722 +!!! test_control_meta_escape_chars_in_regexp__since_31:11066 /\M-\c\xFF/ -!!! test_cpath:1807 +!!! test_cpath:1821 module ::Foo; end -!!! test_cpath:1813 +!!! test_cpath:1827 module Bar::Foo; end -!!! test_cvar:973 +!!! test_cvar:987 @@foo -!!! test_cvasgn:1106 +!!! test_cvasgn:1120 @@var = 10 -!!! test_dedenting_heredoc:297 +!!! test_dedenting_heredoc:299 p <<~E E -!!! test_dedenting_heredoc:304 +!!! test_dedenting_heredoc:306 p <<~E E -!!! test_dedenting_heredoc:311 +!!! test_dedenting_heredoc:313 p <<~E x E -!!! test_dedenting_heredoc:318 +!!! test_dedenting_heredoc:320 p <<~E ð E -!!! test_dedenting_heredoc:325 +!!! test_dedenting_heredoc:327 p <<~E x y E -!!! test_dedenting_heredoc:334 +!!! test_dedenting_heredoc:336 p <<~E x y E -!!! test_dedenting_heredoc:343 +!!! test_dedenting_heredoc:345 p <<~E x y E -!!! test_dedenting_heredoc:352 +!!! test_dedenting_heredoc:354 p <<~E x y E -!!! test_dedenting_heredoc:361 +!!! test_dedenting_heredoc:363 p <<~E x y E -!!! test_dedenting_heredoc:370 +!!! test_dedenting_heredoc:372 p <<~E x y E -!!! test_dedenting_heredoc:380 +!!! test_dedenting_heredoc:382 p <<~E x y E -!!! test_dedenting_heredoc:390 +!!! test_dedenting_heredoc:392 p <<~E x \ y E -!!! test_dedenting_heredoc:399 +!!! test_dedenting_heredoc:401 p <<~E x \ y E -!!! test_dedenting_heredoc:408 +!!! test_dedenting_heredoc:410 p <<~"E" x #{foo} E -!!! test_dedenting_heredoc:419 +!!! test_dedenting_heredoc:421 p <<~`E` x #{foo} E -!!! test_dedenting_heredoc:430 +!!! test_dedenting_heredoc:432 p <<~"E" x #{" y"} E -!!! test_dedenting_interpolating_heredoc_fake_line_continuation:459 +!!! test_dedenting_interpolating_heredoc_fake_line_continuation:461 <<~'FOO' baz\\ qux FOO -!!! test_dedenting_non_interpolating_heredoc_line_continuation:451 +!!! test_dedenting_non_interpolating_heredoc_line_continuation:453 <<~'FOO' baz\ qux FOO -!!! test_def:1899 +!!! test_def:1913 def foo; end -!!! test_def:1907 +!!! test_def:1921 def String; end -!!! test_def:1911 +!!! test_def:1925 def String=; end -!!! test_def:1915 +!!! test_def:1929 def until; end -!!! test_def:1919 +!!! test_def:1933 def BEGIN; end -!!! test_def:1923 +!!! test_def:1937 def END; end -!!! test_defined:1058 +!!! test_defined:1072 defined? foo -!!! test_defined:1064 +!!! test_defined:1078 defined?(foo) -!!! test_defined:1072 +!!! test_defined:1086 defined? @foo -!!! test_defs:1929 +!!! test_defs:1943 def self.foo; end -!!! test_defs:1937 +!!! test_defs:1951 def self::foo; end -!!! test_defs:1945 +!!! test_defs:1959 def (foo).foo; end -!!! test_defs:1949 +!!! test_defs:1963 def String.foo; end -!!! test_defs:1954 +!!! test_defs:1968 def String::foo; end -!!! test_empty_stmt:60 -!!! test_endless_method:9786 +!!! test_emit_arg_inside_procarg0_legacy:2807 +f{ |a| } +!!! test_empty_stmt:62 +!!! test_endless_comparison_method:10736:0 +def ===(other) = do_something +!!! test_endless_comparison_method:10736:1 +def ==(other) = do_something +!!! test_endless_comparison_method:10736:2 +def !=(other) = do_something +!!! test_endless_comparison_method:10736:3 +def <=(other) = do_something +!!! test_endless_comparison_method:10736:4 +def >=(other) = do_something +!!! test_endless_comparison_method:10736:5 +def !=(other) = do_something +!!! test_endless_method:10085 def foo() = 42 -!!! test_endless_method:9798 +!!! test_endless_method:10097 def inc(x) = x + 1 -!!! test_endless_method:9811 +!!! test_endless_method:10110 def obj.foo() = 42 -!!! test_endless_method:9823 +!!! test_endless_method:10122 def obj.inc(x) = x + 1 -!!! test_endless_method_command_syntax:9880 +!!! test_endless_method_command_syntax:10179 def foo = puts "Hello" -!!! test_endless_method_command_syntax:9892 +!!! test_endless_method_command_syntax:10191 def foo() = puts "Hello" -!!! test_endless_method_command_syntax:9904 +!!! test_endless_method_command_syntax:10203 def foo(x) = puts x -!!! test_endless_method_command_syntax:9917 +!!! test_endless_method_command_syntax:10216 def obj.foo = puts "Hello" -!!! test_endless_method_command_syntax:9931 +!!! test_endless_method_command_syntax:10230 def obj.foo() = puts "Hello" -!!! test_endless_method_command_syntax:9945 +!!! test_endless_method_command_syntax:10244 def rescued(x) = raise "to be caught" rescue "instance #{x}" -!!! test_endless_method_command_syntax:9964 +!!! test_endless_method_command_syntax:10263 def self.rescued(x) = raise "to be caught" rescue "class #{x}" -!!! test_endless_method_command_syntax:9985 +!!! test_endless_method_command_syntax:10284 def obj.foo(x) = puts x -!!! test_endless_method_forwarded_args_legacy:9840 +!!! test_endless_method_forwarded_args_legacy:10139 def foo(...) = bar(...) -!!! test_endless_method_with_rescue_mod:9855 +!!! test_endless_method_with_rescue_mod:10154 def m() = 1 rescue 2 -!!! test_endless_method_with_rescue_mod:9866 +!!! test_endless_method_with_rescue_mod:10165 def self.m() = 1 rescue 2 -!!! test_endless_method_without_args:10404 +!!! test_endless_method_without_args:10748 def foo = 42 -!!! test_endless_method_without_args:10412 +!!! test_endless_method_without_args:10756 def foo = 42 rescue nil -!!! test_endless_method_without_args:10423 +!!! test_endless_method_without_args:10767 def self.foo = 42 -!!! test_endless_method_without_args:10432 +!!! test_endless_method_without_args:10776 def self.foo = 42 rescue nil -!!! test_ensure:5261 +!!! test_ensure:5393 begin; meth; ensure; bar; end -!!! test_ensure_empty:5274 +!!! test_ensure_empty:5406 begin ensure end -!!! test_false:96 +!!! test_false:98 false -!!! test_float:129 +!!! test_find_pattern:10447 +case foo; in [*x, 1 => a, *y] then true; end +!!! test_find_pattern:10467 +case foo; in String(*, 1, *) then true; end +!!! test_find_pattern:10481 +case foo; in Array[*, 1, *] then true; end +!!! test_find_pattern:10495 +case foo; in *, 42, * then true; end +!!! test_float:131 1.33 -!!! test_float:134 +!!! test_float:136 -1.33 -!!! test_for:5002 +!!! test_for:5134 for a in foo do p a; end -!!! test_for:5014 +!!! test_for:5146 for a in foo; p a; end -!!! test_for_mlhs:5023 +!!! test_for_mlhs:5155 for a, b in foo; p a, b; end -!!! test_forward_arg:7899 +!!! test_forward_arg:8090 def foo(...); bar(...); end -!!! test_forward_arg_with_open_args:10745 +!!! test_forward_arg_with_open_args:11089 def foo ... end -!!! test_forward_arg_with_open_args:10752 +!!! test_forward_arg_with_open_args:11096 def foo a, b = 1, ... end -!!! test_forward_arg_with_open_args:10770 +!!! test_forward_arg_with_open_args:11114 def foo(a, ...) bar(...) end -!!! test_forward_arg_with_open_args:10781 +!!! test_forward_arg_with_open_args:11125 def foo a, ... bar(...) end -!!! test_forward_arg_with_open_args:10792 +!!! test_forward_arg_with_open_args:11136 def foo b = 1, ... bar(...) end -!!! test_forward_arg_with_open_args:10804 +!!! test_forward_arg_with_open_args:11148 def foo ...; bar(...); end -!!! test_forward_arg_with_open_args:10814 +!!! test_forward_arg_with_open_args:11158 def foo a, ...; bar(...); end -!!! test_forward_arg_with_open_args:10825 +!!! test_forward_arg_with_open_args:11169 def foo b = 1, ...; bar(...); end -!!! test_forward_arg_with_open_args:10837 +!!! test_forward_arg_with_open_args:11181 (def foo ... bar(...) end) -!!! test_forward_arg_with_open_args:10848 +!!! test_forward_arg_with_open_args:11192 (def foo ...; bar(...); end) -!!! test_forward_args_legacy:7863 +!!! test_forward_args_legacy:8054 def foo(...); bar(...); end -!!! test_forward_args_legacy:7875 +!!! test_forward_args_legacy:8066 def foo(...); super(...); end -!!! test_forward_args_legacy:7887 +!!! test_forward_args_legacy:8078 def foo(...); end -!!! test_forwarded_argument_with_kwrestarg:10962 +!!! test_forwarded_argument_with_kwrestarg:11332 def foo(argument, **); bar(argument, **); end -!!! test_forwarded_argument_with_restarg:10923 +!!! test_forwarded_argument_with_restarg:11267 def foo(argument, *); bar(argument, *); end -!!! test_forwarded_kwrestarg:10943 +!!! test_forwarded_kwrestarg:11287 def foo(**); bar(**); end -!!! test_forwarded_restarg:10905 +!!! test_forwarded_kwrestarg_with_additional_kwarg:11306 +def foo(**); bar(**, from_foo: true); end +!!! test_forwarded_restarg:11249 def foo(*); bar(*); end -!!! test_gvar:980 +!!! test_gvar:994 $foo -!!! test_gvasgn:1116 +!!! test_gvasgn:1130 $var = 10 -!!! test_hash_empty:750 +!!! test_hash_empty:764 { } -!!! test_hash_hashrocket:759 +!!! test_hash_hashrocket:773 { 1 => 2 } -!!! test_hash_hashrocket:768 +!!! test_hash_hashrocket:782 { 1 => 2, :foo => "bar" } -!!! test_hash_kwsplat:821 +!!! test_hash_kwsplat:835 { foo: 2, **bar } -!!! test_hash_label:776 +!!! test_hash_label:790 { foo: 2 } -!!! test_hash_label_end:789 +!!! test_hash_label_end:803 { 'foo': 2 } -!!! test_hash_label_end:802 +!!! test_hash_label_end:816 { 'foo': 2, 'bar': {}} -!!! test_hash_label_end:810 +!!! test_hash_label_end:824 f(a ? "a":1) -!!! test_hash_pair_value_omission:10040 +!!! test_hash_pair_value_omission:10339 {a:, b:} -!!! test_hash_pair_value_omission:10054 +!!! test_hash_pair_value_omission:10353 {puts:} -!!! test_hash_pair_value_omission:10065 +!!! test_hash_pair_value_omission:10364 +foo = 1; {foo:} +!!! test_hash_pair_value_omission:10376 +_foo = 1; {_foo:} +!!! test_hash_pair_value_omission:10388 {BAR:} -!!! test_heredoc:263 +!!! test_heredoc:265 <(**nil) {} -!!! test_kwoptarg:2124 +!!! test_kwoptarg:2138 def f(foo: 1); end -!!! test_kwrestarg_named:2135 +!!! test_kwoptarg_with_kwrestarg_and_forwarded_args:11482 +def f(a: nil, **); b(**) end +!!! test_kwrestarg_named:2149 def f(**foo); end -!!! test_kwrestarg_unnamed:2146 +!!! test_kwrestarg_unnamed:2160 def f(**); end -!!! test_lbrace_arg_after_command_args:7235 +!!! test_lbrace_arg_after_command_args:7420 let (:a) { m do; end } -!!! test_lparenarg_after_lvar__since_25:6679 +!!! test_lparenarg_after_lvar__since_25:6830 meth (-1.3).abs -!!! test_lparenarg_after_lvar__since_25:6688 +!!! test_lparenarg_after_lvar__since_25:6839 foo (-1.3).abs -!!! test_lvar:959 +!!! test_lvar:973 foo -!!! test_lvar_injecting_match:3778 +!!! test_lvar_injecting_match:3819 /(?bar)/ =~ 'bar'; match -!!! test_lvasgn:1084 +!!! test_lvasgn:1098 var = 10; var -!!! test_masgn:1247 +!!! test_marg_combinations:2454 +def f (((a))); end +!!! test_marg_combinations:2460 +def f ((a, a1)); end +!!! test_marg_combinations:2465 +def f ((a, *r)); end +!!! test_marg_combinations:2470 +def f ((a, *r, p)); end +!!! test_marg_combinations:2475 +def f ((a, *)); end +!!! test_marg_combinations:2480 +def f ((a, *, p)); end +!!! test_marg_combinations:2485 +def f ((*r)); end +!!! test_marg_combinations:2490 +def f ((*r, p)); end +!!! test_marg_combinations:2495 +def f ((*)); end +!!! test_marg_combinations:2500 +def f ((*, p)); end +!!! test_masgn:1261 foo, bar = 1, 2 -!!! test_masgn:1258 +!!! test_masgn:1272 (foo, bar) = 1, 2 -!!! test_masgn:1268 +!!! test_masgn:1282 foo, bar, baz = 1, 2 -!!! test_masgn_attr:1390 +!!! test_masgn_attr:1404 self.a, self[1, 2] = foo -!!! test_masgn_attr:1403 +!!! test_masgn_attr:1417 self::a, foo = foo -!!! test_masgn_attr:1411 +!!! test_masgn_attr:1425 self.A, foo = foo -!!! test_masgn_cmd:1439 +!!! test_masgn_cmd:1453 foo, bar = m foo -!!! test_masgn_const:1421 +!!! test_masgn_const:1435 self::A, foo = foo -!!! test_masgn_const:1429 +!!! test_masgn_const:1443 ::A, foo = foo -!!! test_masgn_nested:1365 -a, (b, c) = foo !!! test_masgn_nested:1379 +a, (b, c) = foo +!!! test_masgn_nested:1393 ((b, )) = foo -!!! test_masgn_splat:1279 +!!! test_masgn_splat:1293 @foo, @@bar = *foo -!!! test_masgn_splat:1288 +!!! test_masgn_splat:1302 a, b = *foo, bar -!!! test_masgn_splat:1296 +!!! test_masgn_splat:1310 a, *b = bar -!!! test_masgn_splat:1302 +!!! test_masgn_splat:1316 a, *b, c = bar -!!! test_masgn_splat:1313 +!!! test_masgn_splat:1327 a, * = bar -!!! test_masgn_splat:1319 +!!! test_masgn_splat:1333 a, *, c = bar -!!! test_masgn_splat:1330 +!!! test_masgn_splat:1344 *b = bar -!!! test_masgn_splat:1336 +!!! test_masgn_splat:1350 *b, c = bar -!!! test_masgn_splat:1346 +!!! test_masgn_splat:1360 * = bar -!!! test_masgn_splat:1352 +!!! test_masgn_splat:1366 *, c, d = bar -!!! test_method_definition_in_while_cond:6816 +!!! test_method_definition_in_while_cond:7001 while def foo; tap do end; end; break; end -!!! test_method_definition_in_while_cond:6828 +!!! test_method_definition_in_while_cond:7013 while def self.foo; tap do end; end; break; end -!!! test_method_definition_in_while_cond:6841 +!!! test_method_definition_in_while_cond:7026 while def foo a = tap do end; end; break; end -!!! test_method_definition_in_while_cond:6854 +!!! test_method_definition_in_while_cond:7039 while def self.foo a = tap do end; end; break; end -!!! test_module:1789 +!!! test_module:1803 module Foo; end -!!! test_multiple_pattern_matches:11086 +!!! test_multiple_args_with_trailing_comma:2786 +f{ |a, b,| } +!!! test_multiple_pattern_matches:11456 {a: 0} => a: {a: 0} => a: -!!! test_multiple_pattern_matches:11102 +!!! test_multiple_pattern_matches:11472 {a: 0} in a: {a: 0} in a: -!!! test_newline_in_hash_argument:11035 +!!! test_newline_in_hash_argument:11405 obj.set foo: 1 -!!! test_newline_in_hash_argument:11046 +!!! test_newline_in_hash_argument:11416 obj.set "foo": 1 -!!! test_newline_in_hash_argument:11057 +!!! test_newline_in_hash_argument:11427 case foo in a: 0 @@ -1240,585 +983,870 @@ in "b": 0 true end -!!! test_next:5131 +!!! test_next:5263 next(foo) -!!! test_next:5145 +!!! test_next:5277 next foo -!!! test_next:5151 +!!! test_next:5283 next() -!!! test_next:5158 +!!! test_next:5290 next -!!! test_next_block:5166 +!!! test_next_block:5298 next fun foo do end -!!! test_nil:66 +!!! test_nil:68 nil -!!! test_nil_expression:73 +!!! test_nil_expression:75 () -!!! test_nil_expression:80 +!!! test_nil_expression:82 begin end -!!! test_non_lvar_injecting_match:3793 +!!! test_non_lvar_injecting_match:3853 /#{1}(?bar)/ =~ 'bar' -!!! test_not:3462 +!!! test_not:3476 not foo -!!! test_not:3468 +!!! test_not:3482 not(foo) -!!! test_not:3474 +!!! test_not:3488 not() -!!! test_not_cmd:3488 +!!! test_not_cmd:3502 not m foo -!!! test_not_masgn__24:4672 +!!! test_not_masgn__24:4732 !(a, b = foo) -!!! test_nth_ref:1002 +!!! test_nth_ref:1016 $10 -!!! test_numbered_args_after_27:7358 +!!! test_numbered_args_after_27:7543 m { _1 + _9 } -!!! test_numbered_args_after_27:7373 +!!! test_numbered_args_after_27:7558 m do _1 + _9 end -!!! test_numbered_args_after_27:7390 +!!! test_numbered_args_after_27:7575 -> { _1 + _9} -!!! test_numbered_args_after_27:7405 +!!! test_numbered_args_after_27:7590 -> do _1 + _9 end -!!! test_numparam_outside_block:7512 +!!! test_numparam_outside_block:7697 class A; _1; end -!!! test_numparam_outside_block:7520 +!!! test_numparam_outside_block:7705 module A; _1; end -!!! test_numparam_outside_block:7528 +!!! test_numparam_outside_block:7713 class << foo; _1; end -!!! test_numparam_outside_block:7536 +!!! test_numparam_outside_block:7721 def self.m; _1; end -!!! test_numparam_outside_block:7545 +!!! test_numparam_outside_block:7730 _1 -!!! test_op_asgn:1606 +!!! test_numparam_ruby_bug_19025:10696 +p { [_1 **2] } +!!! test_op_asgn:1620 foo.a += 1 -!!! test_op_asgn:1616 +!!! test_op_asgn:1630 foo::a += 1 -!!! test_op_asgn:1622 +!!! test_op_asgn:1636 foo.A += 1 -!!! test_op_asgn_cmd:1630 +!!! test_op_asgn_cmd:1644 foo.a += m foo -!!! test_op_asgn_cmd:1636 +!!! test_op_asgn_cmd:1650 foo::a += m foo -!!! test_op_asgn_cmd:1642 +!!! test_op_asgn_cmd:1656 foo.A += m foo -!!! test_op_asgn_cmd:1654 +!!! test_op_asgn_cmd:1668 foo::A += m foo -!!! test_op_asgn_index:1664 +!!! test_op_asgn_index:1678 foo[0, 1] += 2 -!!! test_op_asgn_index_cmd:1678 +!!! test_op_asgn_index_cmd:1692 foo[0, 1] += m foo -!!! test_optarg:2074 +!!! test_optarg:2088 def f foo = 1; end -!!! test_optarg:2084 +!!! test_optarg:2098 def f(foo=1, bar=2); end -!!! test_or:4461 +!!! test_or:4521 foo or bar -!!! test_or:4467 +!!! test_or:4527 foo || bar -!!! test_or_asgn:1724 +!!! test_or_asgn:1738 foo.a ||= 1 -!!! test_or_asgn:1734 +!!! test_or_asgn:1748 foo[0, 1] ||= 2 -!!! test_parser_bug_272:6528 +!!! test_parser_bug_272:6679 a @b do |c|;end -!!! test_parser_bug_490:7151 +!!! test_parser_bug_490:7336 def m; class << self; class C; end; end; end -!!! test_parser_bug_490:7162 +!!! test_parser_bug_490:7347 def m; class << self; module M; end; end; end -!!! test_parser_bug_490:7173 +!!! test_parser_bug_490:7358 def m; class << self; A = nil; end; end -!!! test_parser_bug_507:7265 +!!! test_parser_bug_507:7450 m = -> *args do end -!!! test_parser_bug_518:7277 +!!! test_parser_bug_518:7462 class A < B end -!!! test_parser_bug_525:7287 +!!! test_parser_bug_525:7472 m1 :k => m2 do; m3() do end; end -!!! test_parser_bug_604:7737 +!!! test_parser_bug_604:7928 m a + b do end -!!! test_parser_bug_640:443 +!!! test_parser_bug_640:445 <<~FOO baz\ qux FOO -!!! test_parser_bug_645:9774 +!!! test_parser_bug_645:10073 -> (arg={}) {} -!!! test_parser_bug_830:10630 +!!! test_parser_bug_830:10974 /\(/ -!!! test_parser_drops_truncated_parts_of_squiggly_heredoc:10446 +!!! test_parser_bug_989:11684 + <<-HERE + content + HERE +!!! test_parser_drops_truncated_parts_of_squiggly_heredoc:10790 <<~HERE #{} HERE -!!! test_pattern_matching__FILE__LINE_literals:9473 +!!! test_parser_slash_slash_n_escaping_in_literals:7512:0 +'a\ +b' +!!! test_parser_slash_slash_n_escaping_in_literals:7512:1 +<<-'HERE' +a\ +b +HERE +!!! test_parser_slash_slash_n_escaping_in_literals:7512:2 +%q{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:3 +"a\ +b" +!!! test_parser_slash_slash_n_escaping_in_literals:7512:4 +<<-"HERE" +a\ +b +HERE +!!! test_parser_slash_slash_n_escaping_in_literals:7512:5 +%{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:6 +%Q{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:7 +%w{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:8 +%W{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:9 +%i{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:10 +%I{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:11 +:'a\ +b' +!!! test_parser_slash_slash_n_escaping_in_literals:7512:12 +%s{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:13 +:"a\ +b" +!!! test_parser_slash_slash_n_escaping_in_literals:7512:14 +/a\ +b/ +!!! test_parser_slash_slash_n_escaping_in_literals:7512:15 +%r{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:16 +%x{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:17 +`a\ +b` +!!! test_parser_slash_slash_n_escaping_in_literals:7512:18 +<<-`HERE` +a\ +b +HERE +!!! test_pattern_matching__FILE__LINE_literals:9760 case [__FILE__, __LINE__ + 1, __ENCODING__] in [__FILE__, __LINE__, __ENCODING__] end -!!! test_pattern_matching_blank_else:9390 +!!! test_pattern_matching_blank_else:9627 case 1; in 2; 3; else; end -!!! test_pattern_matching_else:9376 +!!! test_pattern_matching_const_pattern:9490 +case foo; in A(1, 2) then true; end +!!! test_pattern_matching_const_pattern:9507 +case foo; in A(x:) then true; end +!!! test_pattern_matching_const_pattern:9523 +case foo; in A() then true; end +!!! test_pattern_matching_const_pattern:9538 +case foo; in A[1, 2] then true; end +!!! test_pattern_matching_const_pattern:9555 +case foo; in A[x:] then true; end +!!! test_pattern_matching_const_pattern:9571 +case foo; in A[] then true; end +!!! test_pattern_matching_constants:9456 +case foo; in A then true; end +!!! test_pattern_matching_constants:9466 +case foo; in A::B then true; end +!!! test_pattern_matching_constants:9477 +case foo; in ::A then true; end +!!! test_pattern_matching_else:9613 case 1; in 2; 3; else; 4; end -!!! test_pattern_matching_single_line:9540 +!!! test_pattern_matching_explicit_array_match:8891 +case foo; in [x] then nil; end +!!! test_pattern_matching_explicit_array_match:8903 +case foo; in [x,] then nil; end +!!! test_pattern_matching_explicit_array_match:8915 +case foo; in [x, y] then true; end +!!! test_pattern_matching_explicit_array_match:8928 +case foo; in [x, y,] then true; end +!!! test_pattern_matching_explicit_array_match:8941 +case foo; in [x, y, *] then true; end +!!! test_pattern_matching_explicit_array_match:8955 +case foo; in [x, y, *z] then true; end +!!! test_pattern_matching_explicit_array_match:8969 +case foo; in [x, *y, z] then true; end +!!! test_pattern_matching_explicit_array_match:8983 +case foo; in [x, *, y] then true; end +!!! test_pattern_matching_explicit_array_match:8997 +case foo; in [*x, y] then true; end +!!! test_pattern_matching_explicit_array_match:9010 +case foo; in [*, x] then true; end +!!! test_pattern_matching_expr_in_paren:9443 +case foo; in (1) then true; end +!!! test_pattern_matching_hash:9025 +case foo; in {} then true; end +!!! test_pattern_matching_hash:9034 +case foo; in a: 1 then true; end +!!! test_pattern_matching_hash:9044 +case foo; in { a: 1 } then true; end +!!! test_pattern_matching_hash:9056 +case foo; in { a: 1, } then true; end +!!! test_pattern_matching_hash:9068 +case foo; in a: then true; end +!!! test_pattern_matching_hash:9080 +case foo; in **a then true; end +!!! test_pattern_matching_hash:9094 +case foo; in ** then true; end +!!! test_pattern_matching_hash:9106 +case foo; in a: 1, b: 2 then true; end +!!! test_pattern_matching_hash:9117 +case foo; in a:, b: then true; end +!!! test_pattern_matching_hash:9128 +case foo; in a: 1, _a:, ** then true; end +!!! test_pattern_matching_hash:9140 +case foo; + in {a: 1 + } + false + ; end +!!! test_pattern_matching_hash:9156 +case foo; + in {a: + 2} + false + ; end +!!! test_pattern_matching_hash:9171 +case foo; + in {Foo: 42 + } + false + ; end +!!! test_pattern_matching_hash:9186 +case foo; + in a: {b:}, c: + p c + ; end +!!! test_pattern_matching_hash:9203 +case foo; + in {a: + } + true + ; end +!!! test_pattern_matching_hash_with_string_keys:9242 +case foo; in "a": then true; end +!!! test_pattern_matching_hash_with_string_keys:9253 +case foo; in "#{ 'a' }": then true; end +!!! test_pattern_matching_hash_with_string_keys:9264 +case foo; in "#{ %q{a} }": then true; end +!!! test_pattern_matching_hash_with_string_keys:9275 +case foo; in "#{ %Q{a} }": then true; end +!!! test_pattern_matching_hash_with_string_keys:9288 +case foo; in "a": 1 then true; end +!!! test_pattern_matching_hash_with_string_keys:9297 +case foo; in "#{ 'a' }": 1 then true; end +!!! test_pattern_matching_hash_with_string_keys:9308 +case foo; in "#{ %q{a} }": 1 then true; end +!!! test_pattern_matching_hash_with_string_keys:9319 +case foo; in "#{ %Q{a} }": 1 then true; end +!!! test_pattern_matching_if_unless_modifiers:8753 +case foo; in x if true; nil; end +!!! test_pattern_matching_if_unless_modifiers:8767 +case foo; in x unless true; nil; end +!!! test_pattern_matching_implicit_array_match:8796 +case foo; in x, then nil; end +!!! test_pattern_matching_implicit_array_match:8806 +case foo; in *x then nil; end +!!! test_pattern_matching_implicit_array_match:8819 +case foo; in * then nil; end +!!! test_pattern_matching_implicit_array_match:8830 +case foo; in x, y then nil; end +!!! test_pattern_matching_implicit_array_match:8841 +case foo; in x, y, then nil; end +!!! test_pattern_matching_implicit_array_match:8852 +case foo; in x, *y, z then nil; end +!!! test_pattern_matching_implicit_array_match:8864 +case foo; in *x, y, z then nil; end +!!! test_pattern_matching_implicit_array_match:8876 +case foo; in 1, "a", [], {} then nil; end +!!! test_pattern_matching_keyword_variable:9370 +case foo; in self then true; end +!!! test_pattern_matching_lambda:9380 +case foo; in ->{ 42 } then true; end +!!! test_pattern_matching_match_alt:9587 +case foo; in 1 | 2 then true; end +!!! test_pattern_matching_match_as:9599 +case foo; in 1 => a then true; end +!!! test_pattern_matching_nil_pattern:9783 +case foo; in **nil then true; end +!!! test_pattern_matching_no_body:8745 +case foo; in 1; end +!!! test_pattern_matching_numbered_parameter:9654 +1.then { 1 in ^_1 } +!!! test_pattern_matching_pin_variable:8783 +case foo; in ^foo then nil; end +!!! test_pattern_matching_ranges:9393 +case foo; in 1..2 then true; end +!!! test_pattern_matching_ranges:9401 +case foo; in 1.. then true; end +!!! test_pattern_matching_ranges:9409 +case foo; in ..2 then true; end +!!! test_pattern_matching_ranges:9417 +case foo; in 1...2 then true; end +!!! test_pattern_matching_ranges:9425 +case foo; in 1... then true; end +!!! test_pattern_matching_ranges:9433 +case foo; in ...2 then true; end +!!! test_pattern_matching_single_line:9827 1 => [a]; a -!!! test_pattern_matching_single_line:9552 +!!! test_pattern_matching_single_line:9839 1 in [a]; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9566 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9853 [1, 2] => a, b; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9581 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9868 {a: 1} => a:; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9596 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9883 [1, 2] in a, b; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9611 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9898 {a: 1} in a:; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9626 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9913 {key: :value} in key: value; value -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9643 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9930 {key: :value} => key: value; value -!!! test_postexe:5486 +!!! test_pattern_matching_single_match:8730 +case foo; in x then x; end +!!! test_pin_expr:10800 +case foo; in ^(42) then nil; end +!!! test_pin_expr:10814 +case foo; in { foo: ^(42) } then nil; end +!!! test_pin_expr:10831 +case foo; in ^(0+0) then nil; end +!!! test_pin_expr:10847 +case foo; in ^@a; end +!!! test_pin_expr:10856 +case foo; in ^@@TestPatternMatching; end +!!! test_pin_expr:10865 +case foo; in ^$TestPatternMatching; end +!!! test_pin_expr:10874 +case foo; in ^(1 +); end +!!! test_postexe:5618 END { 1 } -!!! test_preexe:5467 +!!! test_preexe:5599 BEGIN { 1 } -!!! test_procarg0:2803 +!!! test_procarg0:2817 m { |foo| } -!!! test_procarg0:2812 +!!! test_procarg0:2826 m { |(foo, bar)| } -!!! test_range_endless:869 +!!! test_procarg0_legacy:2796 +f{ |a| } +!!! test_range_endless:883 1.. -!!! test_range_endless:877 +!!! test_range_endless:891 1... -!!! test_range_exclusive:861 +!!! test_range_exclusive:875 1...2 -!!! test_range_inclusive:853 +!!! test_range_inclusive:867 1..2 -!!! test_rational:142 +!!! test_rational:144 42r -!!! test_rational:148 +!!! test_rational:150 42.1r -!!! test_redo:5178 +!!! test_redo:5310 redo -!!! test_regex_interp:551 +!!! test_regex_interp:553 /foo#{bar}baz/ -!!! test_regex_plain:541 +!!! test_regex_plain:543 /source/im -!!! test_resbody_list:5398 +!!! test_resbody_list:5530 begin; meth; rescue Exception; bar; end -!!! test_resbody_list_mrhs:5411 +!!! test_resbody_list_mrhs:5543 begin; meth; rescue Exception, foo; bar; end -!!! test_resbody_list_var:5444 +!!! test_resbody_list_var:5576 begin; meth; rescue foo => ex; bar; end -!!! test_resbody_var:5426 +!!! test_resbody_var:5558 begin; meth; rescue => ex; bar; end -!!! test_resbody_var:5434 +!!! test_resbody_var:5566 begin; meth; rescue => @ex; bar; end -!!! test_rescue:5188 +!!! test_rescue:5320 begin; meth; rescue; foo; end -!!! test_rescue_else:5203 +!!! test_rescue_else:5335 begin; meth; rescue; foo; else; bar; end -!!! test_rescue_else_ensure:5302 +!!! test_rescue_else_ensure:5434 begin; meth; rescue; baz; else foo; ensure; bar end -!!! test_rescue_ensure:5286 +!!! test_rescue_ensure:5418 begin; meth; rescue; baz; ensure; bar; end -!!! test_rescue_in_lambda_block:6928 +!!! test_rescue_in_lambda_block:7113 -> do rescue; end -!!! test_rescue_mod:5319 +!!! test_rescue_mod:5451 meth rescue bar -!!! test_rescue_mod_asgn:5331 +!!! test_rescue_mod_asgn:5463 foo = meth rescue bar -!!! test_rescue_mod_masgn:5345 +!!! test_rescue_mod_masgn:5477 foo, bar = meth rescue [1, 2] -!!! test_rescue_mod_op_assign:5365 +!!! test_rescue_mod_op_assign:5497 foo += meth rescue bar -!!! test_rescue_without_begin_end:5381 +!!! test_rescue_without_begin_end:5513 meth do; foo; rescue; bar; end -!!! test_restarg_named:2094 +!!! test_restarg_named:2108 def f(*foo); end -!!! test_restarg_unnamed:2104 +!!! test_restarg_unnamed:2118 def f(*); end -!!! test_retry:5457 +!!! test_retry:5589 retry -!!! test_return:5084 +!!! test_return:5216 return(foo) -!!! test_return:5098 +!!! test_return:5230 return foo -!!! test_return:5104 +!!! test_return:5236 return() -!!! test_return:5111 +!!! test_return:5243 return -!!! test_return_block:5119 +!!! test_return_block:5251 return fun foo do end -!!! test_ruby_bug_10279:5905 +!!! test_ruby_bug_10279:6056 {a: if true then 42 end} -!!! test_ruby_bug_10653:5915 +!!! test_ruby_bug_10653:6066 true ? 1.tap do |n| p n end : 0 -!!! test_ruby_bug_10653:5945 +!!! test_ruby_bug_10653:6096 false ? raise {} : tap {} -!!! test_ruby_bug_10653:5958 +!!! test_ruby_bug_10653:6109 false ? raise do end : tap do end -!!! test_ruby_bug_11107:5973 +!!! test_ruby_bug_11107:6124 p ->() do a() do end end -!!! test_ruby_bug_11380:5985 +!!! test_ruby_bug_11380:6136 p -> { :hello }, a: 1 do end -!!! test_ruby_bug_11873:6353 +!!! test_ruby_bug_11873:6504 a b{c d}, "x" do end -!!! test_ruby_bug_11873:6367 +!!! test_ruby_bug_11873:6518 a b(c d), "x" do end -!!! test_ruby_bug_11873:6380 +!!! test_ruby_bug_11873:6531 a b{c(d)}, "x" do end -!!! test_ruby_bug_11873:6394 +!!! test_ruby_bug_11873:6545 a b(c(d)), "x" do end -!!! test_ruby_bug_11873:6407 +!!! test_ruby_bug_11873:6558 a b{c d}, /x/ do end -!!! test_ruby_bug_11873:6421 +!!! test_ruby_bug_11873:6572 a b(c d), /x/ do end -!!! test_ruby_bug_11873:6434 +!!! test_ruby_bug_11873:6585 a b{c(d)}, /x/ do end -!!! test_ruby_bug_11873:6448 +!!! test_ruby_bug_11873:6599 a b(c(d)), /x/ do end -!!! test_ruby_bug_11873:6461 +!!! test_ruby_bug_11873:6612 a b{c d}, /x/m do end -!!! test_ruby_bug_11873:6475 +!!! test_ruby_bug_11873:6626 a b(c d), /x/m do end -!!! test_ruby_bug_11873:6488 +!!! test_ruby_bug_11873:6639 a b{c(d)}, /x/m do end -!!! test_ruby_bug_11873:6502 +!!! test_ruby_bug_11873:6653 a b(c(d)), /x/m do end -!!! test_ruby_bug_11873_b:6050 +!!! test_ruby_bug_11873_a:6168:0 +a b{c d}, :e do end +!!! test_ruby_bug_11873_a:6168:1 +a b{c d}, 1 do end +!!! test_ruby_bug_11873_a:6168:2 +a b{c d}, 1.0 do end +!!! test_ruby_bug_11873_a:6168:3 +a b{c d}, 1.0r do end +!!! test_ruby_bug_11873_a:6168:4 +a b{c d}, 1.0i do end +!!! test_ruby_bug_11873_a:6173:0 +a b{c(d)}, :e do end +!!! test_ruby_bug_11873_a:6173:1 +a b{c(d)}, 1 do end +!!! test_ruby_bug_11873_a:6173:2 +a b{c(d)}, 1.0 do end +!!! test_ruby_bug_11873_a:6173:3 +a b{c(d)}, 1.0r do end +!!! test_ruby_bug_11873_a:6173:4 +a b{c(d)}, 1.0i do end +!!! test_ruby_bug_11873_a:6187:0 +a b(c d), :e do end +!!! test_ruby_bug_11873_a:6187:1 +a b(c d), 1 do end +!!! test_ruby_bug_11873_a:6187:2 +a b(c d), 1.0 do end +!!! test_ruby_bug_11873_a:6187:3 +a b(c d), 1.0r do end +!!! test_ruby_bug_11873_a:6187:4 +a b(c d), 1.0i do end +!!! test_ruby_bug_11873_a:6192:0 +a b(c(d)), :e do end +!!! test_ruby_bug_11873_a:6192:1 +a b(c(d)), 1 do end +!!! test_ruby_bug_11873_a:6192:2 +a b(c(d)), 1.0 do end +!!! test_ruby_bug_11873_a:6192:3 +a b(c(d)), 1.0r do end +!!! test_ruby_bug_11873_a:6192:4 +a b(c(d)), 1.0i do end +!!! test_ruby_bug_11873_b:6201 p p{p(p);p p}, tap do end -!!! test_ruby_bug_11989:6069 +!!! test_ruby_bug_11989:6220 p <<~"E" x\n y E -!!! test_ruby_bug_11990:6078 +!!! test_ruby_bug_11990:6229 p <<~E " y" x E -!!! test_ruby_bug_12073:6089 +!!! test_ruby_bug_12073:6240 a = 1; a b: 1 -!!! test_ruby_bug_12073:6102 +!!! test_ruby_bug_12073:6253 def foo raise; raise A::B, ''; end -!!! test_ruby_bug_12402:6116 +!!! test_ruby_bug_12402:6267 foo = raise(bar) rescue nil -!!! test_ruby_bug_12402:6127 +!!! test_ruby_bug_12402:6278 foo += raise(bar) rescue nil -!!! test_ruby_bug_12402:6139 +!!! test_ruby_bug_12402:6290 foo[0] += raise(bar) rescue nil -!!! test_ruby_bug_12402:6153 +!!! test_ruby_bug_12402:6304 foo.m += raise(bar) rescue nil -!!! test_ruby_bug_12402:6166 +!!! test_ruby_bug_12402:6317 foo::m += raise(bar) rescue nil -!!! test_ruby_bug_12402:6179 +!!! test_ruby_bug_12402:6330 foo.C += raise(bar) rescue nil -!!! test_ruby_bug_12402:6192 +!!! test_ruby_bug_12402:6343 foo::C ||= raise(bar) rescue nil -!!! test_ruby_bug_12402:6205 +!!! test_ruby_bug_12402:6356 foo = raise bar rescue nil -!!! test_ruby_bug_12402:6216 +!!! test_ruby_bug_12402:6367 foo += raise bar rescue nil -!!! test_ruby_bug_12402:6228 +!!! test_ruby_bug_12402:6379 foo[0] += raise bar rescue nil -!!! test_ruby_bug_12402:6242 +!!! test_ruby_bug_12402:6393 foo.m += raise bar rescue nil -!!! test_ruby_bug_12402:6255 +!!! test_ruby_bug_12402:6406 foo::m += raise bar rescue nil -!!! test_ruby_bug_12402:6268 +!!! test_ruby_bug_12402:6419 foo.C += raise bar rescue nil -!!! test_ruby_bug_12402:6281 +!!! test_ruby_bug_12402:6432 foo::C ||= raise bar rescue nil -!!! test_ruby_bug_12669:6296 +!!! test_ruby_bug_12669:6447 a = b = raise :x -!!! test_ruby_bug_12669:6305 +!!! test_ruby_bug_12669:6456 a += b = raise :x -!!! test_ruby_bug_12669:6314 +!!! test_ruby_bug_12669:6465 a = b += raise :x -!!! test_ruby_bug_12669:6323 +!!! test_ruby_bug_12669:6474 a += b += raise :x -!!! test_ruby_bug_12686:6334 +!!! test_ruby_bug_12686:6485 f (g rescue nil) -!!! test_ruby_bug_13547:7018 +!!! test_ruby_bug_13547:7203 meth[] {} -!!! test_ruby_bug_14690:7250 +!!! test_ruby_bug_14690:7435 let () { m(a) do; end } -!!! test_ruby_bug_15789:7622 +!!! test_ruby_bug_15789:7807 m ->(a = ->{_1}) {a} -!!! test_ruby_bug_15789:7636 +!!! test_ruby_bug_15789:7821 m ->(a: ->{_1}) {a} -!!! test_ruby_bug_9669:5889 +!!! test_ruby_bug_9669:6040 def a b: return end -!!! test_ruby_bug_9669:5895 +!!! test_ruby_bug_9669:6046 o = { a: 1 } -!!! test_sclass:1884 +!!! test_sclass:1898 class << foo; nil; end -!!! test_self:952 +!!! test_self:966 self -!!! test_send_attr_asgn:3528 +!!! test_send_attr_asgn:3542 foo.a = 1 -!!! test_send_attr_asgn:3536 +!!! test_send_attr_asgn:3550 foo::a = 1 -!!! test_send_attr_asgn:3544 +!!! test_send_attr_asgn:3558 foo.A = 1 -!!! test_send_attr_asgn:3552 +!!! test_send_attr_asgn:3566 foo::A = 1 -!!! test_send_attr_asgn_conditional:3751 +!!! test_send_attr_asgn_conditional:3792 a&.b = 1 -!!! test_send_binary_op:3308 +!!! test_send_binary_op:3322 foo + 1 -!!! test_send_binary_op:3314 +!!! test_send_binary_op:3328 foo - 1 -!!! test_send_binary_op:3318 +!!! test_send_binary_op:3332 foo * 1 -!!! test_send_binary_op:3322 +!!! test_send_binary_op:3336 foo / 1 -!!! test_send_binary_op:3326 +!!! test_send_binary_op:3340 foo % 1 -!!! test_send_binary_op:3330 +!!! test_send_binary_op:3344 foo ** 1 -!!! test_send_binary_op:3334 +!!! test_send_binary_op:3348 foo | 1 -!!! test_send_binary_op:3338 +!!! test_send_binary_op:3352 foo ^ 1 -!!! test_send_binary_op:3342 +!!! test_send_binary_op:3356 foo & 1 -!!! test_send_binary_op:3346 +!!! test_send_binary_op:3360 foo <=> 1 -!!! test_send_binary_op:3350 +!!! test_send_binary_op:3364 foo < 1 -!!! test_send_binary_op:3354 +!!! test_send_binary_op:3368 foo <= 1 -!!! test_send_binary_op:3358 +!!! test_send_binary_op:3372 foo > 1 -!!! test_send_binary_op:3362 +!!! test_send_binary_op:3376 foo >= 1 -!!! test_send_binary_op:3366 +!!! test_send_binary_op:3380 foo == 1 -!!! test_send_binary_op:3376 +!!! test_send_binary_op:3390 foo != 1 -!!! test_send_binary_op:3382 +!!! test_send_binary_op:3396 foo === 1 -!!! test_send_binary_op:3386 +!!! test_send_binary_op:3400 foo =~ 1 -!!! test_send_binary_op:3396 +!!! test_send_binary_op:3410 foo !~ 1 -!!! test_send_binary_op:3402 +!!! test_send_binary_op:3416 foo << 1 -!!! test_send_binary_op:3406 +!!! test_send_binary_op:3420 foo >> 1 -!!! test_send_block_chain_cmd:3201 +!!! test_send_block_chain_cmd:3215 meth 1 do end.fun bar -!!! test_send_block_chain_cmd:3212 +!!! test_send_block_chain_cmd:3226 meth 1 do end.fun(bar) -!!! test_send_block_chain_cmd:3225 +!!! test_send_block_chain_cmd:3239 meth 1 do end::fun bar -!!! test_send_block_chain_cmd:3236 +!!! test_send_block_chain_cmd:3250 meth 1 do end::fun(bar) -!!! test_send_block_chain_cmd:3249 +!!! test_send_block_chain_cmd:3263 meth 1 do end.fun bar do end -!!! test_send_block_chain_cmd:3261 +!!! test_send_block_chain_cmd:3275 meth 1 do end.fun(bar) {} -!!! test_send_block_chain_cmd:3273 +!!! test_send_block_chain_cmd:3287 meth 1 do end.fun {} -!!! test_send_block_conditional:3759 +!!! test_send_block_conditional:3800 foo&.bar {} -!!! test_send_call:3721 +!!! test_send_call:3762 foo.(1) -!!! test_send_call:3731 +!!! test_send_call:3772 foo::(1) -!!! test_send_conditional:3743 +!!! test_send_conditional:3784 a&.b -!!! test_send_index:3562 +!!! test_send_index:3576 foo[1, 2] -!!! test_send_index_asgn:3591 +!!! test_send_index_asgn:3605 foo[1, 2] = 3 -!!! test_send_index_asgn_legacy:3603 +!!! test_send_index_asgn_kwarg:3629 +foo[:kw => arg] = 3 +!!! test_send_index_asgn_kwarg_legacy:3642 +foo[:kw => arg] = 3 +!!! test_send_index_asgn_legacy:3617 foo[1, 2] = 3 -!!! test_send_index_cmd:3584 +!!! test_send_index_cmd:3598 foo[m bar] -!!! test_send_index_legacy:3573 +!!! test_send_index_legacy:3587 foo[1, 2] -!!! test_send_lambda:3615 +!!! test_send_lambda:3656 ->{ } -!!! test_send_lambda:3625 +!!! test_send_lambda:3666 -> * { } -!!! test_send_lambda:3636 +!!! test_send_lambda:3677 -> do end -!!! test_send_lambda_args:3648 +!!! test_send_lambda_args:3689 ->(a) { } -!!! test_send_lambda_args:3662 +!!! test_send_lambda_args:3703 -> (a) { } -!!! test_send_lambda_args_noparen:3686 +!!! test_send_lambda_args_noparen:3727 -> a: 1 { } -!!! test_send_lambda_args_noparen:3695 +!!! test_send_lambda_args_noparen:3736 -> a: { } -!!! test_send_lambda_args_shadow:3673 +!!! test_send_lambda_args_shadow:3714 ->(a; foo, bar) { } -!!! test_send_lambda_legacy:3707 +!!! test_send_lambda_legacy:3748 ->{ } -!!! test_send_op_asgn_conditional:3770 +!!! test_send_op_asgn_conditional:3811 a&.b &&= 1 -!!! test_send_plain:3105 +!!! test_send_plain:3119 foo.fun -!!! test_send_plain:3112 +!!! test_send_plain:3126 foo::fun -!!! test_send_plain:3119 +!!! test_send_plain:3133 foo::Fun() -!!! test_send_plain_cmd:3128 +!!! test_send_plain_cmd:3142 foo.fun bar -!!! test_send_plain_cmd:3135 +!!! test_send_plain_cmd:3149 foo::fun bar -!!! test_send_plain_cmd:3142 +!!! test_send_plain_cmd:3156 foo::Fun bar -!!! test_send_self:3044 +!!! test_send_self:3058 fun -!!! test_send_self:3050 +!!! test_send_self:3064 fun! -!!! test_send_self:3056 +!!! test_send_self:3070 fun(1) -!!! test_send_self_block:3066 +!!! test_send_self_block:3080 fun { } -!!! test_send_self_block:3070 +!!! test_send_self_block:3084 fun() { } -!!! test_send_self_block:3074 +!!! test_send_self_block:3088 fun(1) { } -!!! test_send_self_block:3078 +!!! test_send_self_block:3092 fun do end -!!! test_send_unary_op:3412 +!!! test_send_unary_op:3426 -foo -!!! test_send_unary_op:3418 +!!! test_send_unary_op:3432 +foo -!!! test_send_unary_op:3422 +!!! test_send_unary_op:3436 ~foo -!!! test_slash_newline_in_heredocs:7186 +!!! test_slash_newline_in_heredocs:7371 <<~E 1 \ 2 3 E -!!! test_slash_newline_in_heredocs:7194 +!!! test_slash_newline_in_heredocs:7379 <<-E 1 \ 2 3 E -!!! test_space_args_arg:4132 +!!! test_space_args_arg:4192 fun (1) -!!! test_space_args_arg_block:4146 +!!! test_space_args_arg_block:4206 fun (1) {} -!!! test_space_args_arg_block:4160 +!!! test_space_args_arg_block:4220 foo.fun (1) {} -!!! test_space_args_arg_block:4176 +!!! test_space_args_arg_block:4236 foo::fun (1) {} -!!! test_space_args_arg_call:4198 +!!! test_space_args_arg_call:4258 fun (1).to_i -!!! test_space_args_arg_newline:4138 +!!! test_space_args_arg_newline:4198 fun (1 ) -!!! test_space_args_block:4430 +!!! test_space_args_block:4490 fun () {} -!!! test_space_args_cmd:4125 +!!! test_space_args_cmd:4185 fun (f bar) -!!! test_string___FILE__:241 +!!! test_string___FILE__:243 __FILE__ -!!! test_string_concat:226 +!!! test_string_concat:228 "foo#@a" "bar" -!!! test_string_dvar:215 +!!! test_string_dvar:217 "#@a #@@a #$a" -!!! test_string_interp:200 +!!! test_string_interp:202 "foo#{bar}baz" -!!! test_string_plain:184 +!!! test_string_plain:186 'foobar' -!!! test_string_plain:191 +!!! test_string_plain:193 %q(foobar) -!!! test_super:3807 +!!! test_super:3867 super(foo) -!!! test_super:3815 +!!! test_super:3875 super foo -!!! test_super:3821 +!!! test_super:3881 super() -!!! test_super_block:3839 +!!! test_super_block:3899 super foo, bar do end -!!! test_super_block:3845 +!!! test_super_block:3905 super do end -!!! test_symbol_interp:484 +!!! test_symbol_interp:486 :"foo#{bar}baz" -!!! test_symbol_plain:469 +!!! test_symbol_plain:471 :foo -!!! test_symbol_plain:475 +!!! test_symbol_plain:477 :'foo' -!!! test_ternary:4605 +!!! test_ternary:4665 foo ? 1 : 2 -!!! test_ternary_ambiguous_symbol:4614 +!!! test_ternary_ambiguous_symbol:4674 t=1;(foo)?t:T -!!! test_trailing_forward_arg:8022 +!!! test_trailing_forward_arg:8237 def foo(a, b, ...); bar(a, 42, ...); end -!!! test_true:89 +!!! test_true:91 true -!!! test_unary_num_pow_precedence:3505 +!!! test_unary_num_pow_precedence:3519 +2.0 ** 10 -!!! test_unary_num_pow_precedence:3512 +!!! test_unary_num_pow_precedence:3526 -2 ** 10 -!!! test_unary_num_pow_precedence:3519 +!!! test_unary_num_pow_precedence:3533 -2.0 ** 10 -!!! test_undef:2003 +!!! test_undef:2017 undef foo, :bar, :"foo#{1}" -!!! test_unless:4529 +!!! test_unless:4589 unless foo then bar; end -!!! test_unless:4537 +!!! test_unless:4597 unless foo; bar; end -!!! test_unless_else:4573 +!!! test_unless_else:4633 unless foo then bar; else baz; end -!!! test_unless_else:4582 +!!! test_unless_else:4642 unless foo; bar; else baz; end -!!! test_unless_mod:4546 +!!! test_unless_mod:4606 bar unless foo -!!! test_until:4948 +!!! test_until:5080 until foo do meth end -!!! test_until:4955 +!!! test_until:5087 until foo; meth end -!!! test_until_mod:4963 +!!! test_until_mod:5095 meth until foo -!!! test_until_post:4978 +!!! test_until_post:5110 begin meth end until foo -!!! test_var_and_asgn:1714 +!!! test_var_and_asgn:1728 a &&= 1 -!!! test_var_op_asgn:1498 +!!! test_var_op_asgn:1512 a += 1 -!!! test_var_op_asgn:1504 +!!! test_var_op_asgn:1518 @a |= 1 -!!! test_var_op_asgn:1510 +!!! test_var_op_asgn:1524 @@var |= 10 -!!! test_var_op_asgn:1514 +!!! test_var_op_asgn:1528 def a; @@var |= 10; end -!!! test_var_op_asgn_cmd:1521 +!!! test_var_op_asgn_cmd:1535 foo += m foo -!!! test_var_or_asgn:1706 +!!! test_var_or_asgn:1720 a ||= 1 -!!! test_when_multi:4895 +!!! test_when_multi:5027 case foo; when 'bar', 'baz'; bar; end -!!! test_when_splat:4904 +!!! test_when_splat:5036 case foo; when 1, *baz; bar; when *foo; end -!!! test_when_then:4883 +!!! test_when_then:5015 case foo; when 'bar' then bar; end -!!! test_while:4924 +!!! test_while:5056 while foo do meth end -!!! test_while:4932 +!!! test_while:5064 while foo; meth end -!!! test_while_mod:4941 +!!! test_while_mod:5073 meth while foo -!!! test_while_post:4970 +!!! test_while_post:5102 begin meth end while foo -!!! test_xstring_interp:524 +!!! test_xstring_interp:526 `foo#{bar}baz` -!!! test_xstring_plain:515 +!!! test_xstring_plain:517 `foobar` -!!! test_yield:3855 +!!! test_yield:3915 yield(foo) -!!! test_yield:3863 +!!! test_yield:3923 yield foo -!!! test_yield:3869 +!!! test_yield:3929 yield() -!!! test_yield:3877 +!!! test_yield:3937 yield -!!! test_zsuper:3831 +!!! test_zsuper:3891 super diff --git a/test/translation/parser_test.rb b/test/translation/parser_test.rb index 1df98f47..dd88322e 100644 --- a/test/translation/parser_test.rb +++ b/test/translation/parser_test.rb @@ -8,109 +8,83 @@ module SyntaxTree module Translation class ParserTest < Minitest::Test - known_failures = [ - # I think this may be a bug in the parser gem's precedence calculation. - # Unary plus appears to be parsed as part of the number literal in - # CRuby, but parser is parsing it as a separate operator. - "test_unary_num_pow_precedence:3505", - - # Not much to be done about this. Basically, regular expressions with - # named capture groups that use the =~ operator inject local variables - # into the current scope. In the parser gem, it detects this and changes - # future references to that name to be a local variable instead of a - # potential method call. CRuby does not do this. - "test_lvar_injecting_match:3778", - - # This is failing because CRuby is not marking values captured in hash - # patterns as local variables, while the parser gem is. - "test_pattern_matching_hash:8971", - - # This is not actually allowed in the CRuby parser but the parser gem - # thinks it is allowed. - "test_pattern_matching_hash_with_string_keys:9016", - "test_pattern_matching_hash_with_string_keys:9027", - "test_pattern_matching_hash_with_string_keys:9038", - "test_pattern_matching_hash_with_string_keys:9060", - "test_pattern_matching_hash_with_string_keys:9071", - "test_pattern_matching_hash_with_string_keys:9082", - - # This happens with pattern matching where you're matching a literal - # value inside parentheses, which doesn't really do anything. Ripper - # doesn't capture that this value is inside a parentheses, so it's hard - # to translate properly. - "test_pattern_matching_expr_in_paren:9206", - - # These are also failing because of CRuby not marking values captured in - # hash patterns as local variables. - "test_pattern_matching_single_line_allowed_omission_of_parentheses:*", - - # I'm not even sure what this is testing, because the code is invalid in - # CRuby. - "test_control_meta_escape_chars_in_regexp__since_31:*", - ] - - todo_failures = [ - "test_dedenting_heredoc:334", - "test_dedenting_heredoc:390", - "test_dedenting_heredoc:399", - "test_slash_newline_in_heredocs:7194", - "test_parser_slash_slash_n_escaping_in_literals:*", - "test_forwarded_restarg:*", - "test_forwarded_kwrestarg:*", - "test_forwarded_argument_with_restarg:*", - "test_forwarded_argument_with_kwrestarg:*" + skips = %w[ + test_args_assocs_legacy:4041 + test_args_assocs:4091 + test_args_assocs:4091 + test_break_block:5204 + test_break:5169 + test_break:5183 + test_break:5189 + test_break:5196 + test_control_meta_escape_chars_in_regexp__since_31:* + test_dedenting_heredoc:336 + test_dedenting_heredoc:392 + test_dedenting_heredoc:401 + test_forwarded_argument_with_kwrestarg:11332 + test_forwarded_argument_with_restarg:11267 + test_forwarded_kwrestarg_with_additional_kwarg:11306 + test_forwarded_kwrestarg:11287 + test_forwarded_restarg:11249 + test_hash_pair_value_omission:10364 + test_hash_pair_value_omission:10376 + test_if_while_after_class__since_32:11374 + test_if_while_after_class__since_32:11384 + test_kwoptarg_with_kwrestarg_and_forwarded_args:11482 + test_lvar_injecting_match:3819 + test_newline_in_hash_argument:11427 + test_next_block:5298 + test_next:5263 + test_next:5277 + test_next:5283 + test_next:5290 + test_next:5290 + test_parser_slash_slash_n_escaping_in_literals:* + test_pattern_matching_explicit_array_match:8903 + test_pattern_matching_explicit_array_match:8928 + test_pattern_matching_expr_in_paren:9443 + test_pattern_matching_hash_with_string_keys:* + test_pattern_matching_hash_with_string_keys:9264 + test_pattern_matching_hash:9186 + test_pattern_matching_implicit_array_match:8796 + test_pattern_matching_implicit_array_match:8841 + test_pattern_matching_numbered_parameter:9654 + test_pattern_matching_single_line_allowed_omission_of_parentheses:9868 + test_pattern_matching_single_line_allowed_omission_of_parentheses:9898 + test_redo:5310 + test_retry:5589 + test_send_index_asgn_kwarg_legacy:3642 + test_send_index_asgn_kwarg_legacy:3642 + test_send_index_asgn_kwarg:3629 + test_send_index_asgn_kwarg:3629 + test_slash_newline_in_heredocs:7379 + test_unary_num_pow_precedence:3519 + test_yield:3915 + test_yield:3923 + test_yield:3929 + test_yield:3937 ] - current_version = RUBY_VERSION.split(".")[0..1].join(".") - - if current_version <= "2.7" - # I'm not sure why this is failing on 2.7.0, but we'll turn it off for - # now until we have more time to investigate. - todo_failures.push( + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.1.0") + skips.push( + "test_endless_method_forwarded_args_legacy:10139", + "test_forward_arg_with_open_args:11114", + "test_forward_arg:8090", + "test_forward_args_legacy:8054", + "test_forward_args_legacy:8066", + "test_forward_args_legacy:8078", "test_pattern_matching_hash:*", - "test_pattern_matching_single_line:9552" + "test_pattern_matching_single_line:9839", + "test_trailing_forward_arg:8237" ) end - - if current_version <= "3.0" - # In < 3.0, there are some changes to the way the parser gem handles - # forwarded args. We should eventually support this, but for now we're - # going to mark them as todo. - todo_failures.push( - "test_forward_arg:*", - "test_forward_args_legacy:*", - "test_endless_method_forwarded_args_legacy:*", - "test_trailing_forward_arg:*", - "test_forward_arg_with_open_args:10770", - ) - end - - if current_version == "3.1" - # This test actually fails on 3.1.0, even though it's marked as being - # since 3.1. So we're going to skip this test on 3.1, but leave it in - # for other versions. - known_failures.push( - "test_multiple_pattern_matches:11086", - "test_multiple_pattern_matches:11102" - ) - end - - if current_version < "3.2" || RUBY_ENGINE == "truffleruby" - known_failures.push( - "test_if_while_after_class__since_32:11004", - "test_if_while_after_class__since_32:11014", - "test_newline_in_hash_argument:11057" - ) - end - - all_failures = known_failures + todo_failures File .foreach(File.expand_path("parser.txt", __dir__), chomp: true) .slice_before { |line| line.start_with?("!!!") } .each do |(prefix, *lines)| name = prefix[4..] - next if all_failures.any? { |pattern| File.fnmatch?(pattern, name) } + next if skips.any? { |skip| File.fnmatch?(skip, name) } define_method(name) { assert_parses("#{lines.join("\n")}\n") } end From 4aad240678c4805d98b9cc33064a51ff7d3b51d9 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 10 Jul 2025 17:30:39 -0400 Subject: [PATCH 36/42] Fix up GH pages workflow --- .github/workflows/gh-pages.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 7ff5f5f1..7e4925df 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -5,8 +5,8 @@ on: branches: - main - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: @@ -39,7 +39,7 @@ jobs: rdoc --main README.md --op _site --exclude={Gemfile,Rakefile,"coverage/*","vendor/*","bin/*","test/*","tmp/*"} cp -r doc _site/doc - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-pages-artifact@v3 # Deployment job deploy: From 384408459970a56130810259ed52efe8790516a8 Mon Sep 17 00:00:00 2001 From: Nic Pillinger Date: Mon, 10 Feb 2025 15:36:30 +0000 Subject: [PATCH 37/42] pass ignore files options to language server --- lib/syntax_tree/cli.rb | 5 ++++- lib/syntax_tree/language_server.rb | 10 ++++++++-- test/language_server_test.rb | 23 +++++++++++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/lib/syntax_tree/cli.rb b/lib/syntax_tree/cli.rb index e0bafce9..205dba28 100644 --- a/lib/syntax_tree/cli.rb +++ b/lib/syntax_tree/cli.rb @@ -593,7 +593,10 @@ def run(argv) when "j", "json" Json.new(options) when "lsp" - LanguageServer.new(print_width: options.print_width).run + LanguageServer.new( + print_width: options.print_width, + ignore_files: options.ignore_files + ).run return 0 when "m", "match" Match.new(options) diff --git a/lib/syntax_tree/language_server.rb b/lib/syntax_tree/language_server.rb index 6ec81030..aaa64e9a 100644 --- a/lib/syntax_tree/language_server.rb +++ b/lib/syntax_tree/language_server.rb @@ -217,11 +217,13 @@ def self.[](value) def initialize( input: $stdin, output: $stdout, - print_width: DEFAULT_PRINT_WIDTH + print_width: DEFAULT_PRINT_WIDTH, + ignore_files: [] ) @input = input.binmode @output = output.binmode @print_width = print_width + @ignore_files = ignore_files end # rubocop:disable Layout/LineLength @@ -255,8 +257,12 @@ def run store.delete(request.dig(:params, :textDocument, :uri)) when Request[method: "textDocument/formatting", id: :any, params: { textDocument: { uri: :any } }] uri = request.dig(:params, :textDocument, :uri) + filepath = uri.split("///").last + ignore = @ignore_files.any? do |glob| + File.fnmatch(glob, filepath) + end contents = store[uri] - write(id: request[:id], result: contents ? format(contents, uri.split(".").last) : nil) + write(id: request[:id], result: contents && !ignore ? format(contents, uri.split(".").last) : nil) when Request[method: "textDocument/inlayHint", id: :any, params: { textDocument: { uri: :any } }] uri = request.dig(:params, :textDocument, :uri) contents = store[uri] diff --git a/test/language_server_test.rb b/test/language_server_test.rb index f5a6ca57..54455c95 100644 --- a/test/language_server_test.rb +++ b/test/language_server_test.rb @@ -151,6 +151,24 @@ def test_formatting assert_equal("class Bar\nend\n", responses.dig(1, :result, 0, :newText)) end + def test_formatting_ignore + responses = run_server([ + Initialize.new(1), + TextDocumentDidOpen.new("file:///path/to/file.rb", "class Foo; end"), + TextDocumentFormatting.new(2, "file:///path/to/file.rb"), + Shutdown.new(3) + ], ignore_files: ["path/**/*.rb"]) + + shape = LanguageServer::Request[[ + { id: 1, result: { capabilities: Hash } }, + { id: 2, result: :any }, + { id: 3, result: {} } + ]] + + assert_operator(shape, :===, responses) + assert_nil(responses.dig(1, :result)) + end + def test_formatting_failure responses = run_server([ Initialize.new(1), @@ -322,14 +340,15 @@ def read(content) end end - def run_server(messages, print_width: DEFAULT_PRINT_WIDTH) + def run_server(messages, print_width: DEFAULT_PRINT_WIDTH, ignore_files: []) input = StringIO.new(messages.map { |message| write(message) }.join) output = StringIO.new LanguageServer.new( input: input, output: output, - print_width: print_width + print_width: print_width, + ignore_files: ignore_files ).run read(output.tap(&:rewind)) From 76dc51e036aec83d02cd1e04e279489f79ad92a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Szcz=C4=99=C5=9Bniak-Szlagowski?= Date: Fri, 19 Jul 2024 00:40:02 +0900 Subject: [PATCH 38/42] Format non-Ruby STDIN/script content too --- lib/syntax_tree/cli.rb | 31 +++++++++++++++++++++++++------ test/cli_test.rb | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/lib/syntax_tree/cli.rb b/lib/syntax_tree/cli.rb index 205dba28..0baaef3d 100644 --- a/lib/syntax_tree/cli.rb +++ b/lib/syntax_tree/cli.rb @@ -63,12 +63,13 @@ def writable? class ScriptItem attr_reader :source - def initialize(source) + def initialize(source, extension) @source = source + @extension = extension end def handler - HANDLERS[".rb"] + HANDLERS[@extension] end def filepath @@ -82,8 +83,12 @@ def writable? # An item of work that correspond to the content passed in via stdin. class STDINItem + def initialize(extension) + @extension = extension + end + def handler - HANDLERS[".rb"] + HANDLERS[@extension] end def filepath @@ -457,7 +462,10 @@ def run(item) The maximum line width to use when formatting. -e SCRIPT - Parse an inline Ruby string. + Parse an inline string. + + --extension=EXTENSION + A file extension matching the content passed in via STDIN or -e. Defaults to 'rb' HELP # This represents all of the options that can be passed to the CLI. It is @@ -468,6 +476,7 @@ class Options :plugins, :print_width, :scripts, + :extension, :target_ruby_version def initialize @@ -475,6 +484,7 @@ def initialize @plugins = [] @print_width = DEFAULT_PRINT_WIDTH @scripts = [] + @extension = ".rb" @target_ruby_version = DEFAULT_RUBY_VERSION end @@ -523,6 +533,13 @@ def parser # it and add it to the list of scripts to run. opts.on("-e SCRIPT") { |script| @scripts << script } + # If there is a extension specified, then parse it and use it for + # STDIN and scripts. + opts.on("--extension=EXTENSION") do |extension| + # Both ".rb" and "rb" are going to work + @extension = ".#{extension.delete_prefix(".")}" + end + # If there is a target ruby version specified on the command line, # parse that out and use it when formatting. opts.on("--target-ruby-version=VERSION") do |version| @@ -633,9 +650,11 @@ def run(argv) end end - options.scripts.each { |script| queue << ScriptItem.new(script) } + options.scripts.each do |script| + queue << ScriptItem.new(script, options.extension) + end else - queue << STDINItem.new + queue << STDINItem.new(options.extension) end # At the end, we're going to return whether or not this worker ever diff --git a/test/cli_test.rb b/test/cli_test.rb index 20f7e0ce..200cd8d7 100644 --- a/test/cli_test.rb +++ b/test/cli_test.rb @@ -10,6 +10,10 @@ def parse(source) source * 2 end + def format(source, _print_width, **) + "Formatted #{source}" + end + def read(filepath) File.read(filepath) end @@ -202,6 +206,28 @@ def test_multiple_inline_scripts assert_equal(["1 + 1", "2 + 2"], stdio.split("\n").sort) end + def test_format_script_with_custom_handler + SyntaxTree.register_handler(".test", TestHandler.new) + stdio, = + capture_io do + SyntaxTree::CLI.run(%w[format --extension=test -e ]) + end + assert_equal("Formatted \n", stdio) + ensure + SyntaxTree::HANDLERS.delete(".test") + end + + def test_format_stdin_with_custom_handler + SyntaxTree.register_handler(".test", TestHandler.new) + stdin = $stdin + $stdin = StringIO.new("") + stdio, = capture_io { SyntaxTree::CLI.run(%w[format --extension=test]) } + assert_equal("Formatted \n", stdio) + ensure + $stdin = stdin + SyntaxTree::HANDLERS.delete(".test") + end + def test_generic_error SyntaxTree.stub(:format, ->(*) { raise }) do result = run_cli("format") From c86b6926ab7bbf47740f36abe62a9698dcc96a5e Mon Sep 17 00:00:00 2001 From: Bradley Buda Date: Thu, 4 Apr 2024 21:18:07 -0700 Subject: [PATCH 39/42] Assoc uses Identity formatter if any value is nil The existing assoc formatter has logic to identify the case where a value is nil (in a Ruby-3.1 style hash) and preserve the existing formatting. For example: `{ first:, "second" => "value" }` is correctly left as-is. However, this logic only worked if the first assoc in the container had the nil value - if a later assoc had a nil value, the Identity formatter might not be chosen which could cause the formatter to generate invalid Ruby code. As an example, this code: `{ "first" => "value", second: }` would be turned into `{ "first" => "value", :second => }`. This patch pulls the nil value check up to the top of `HashKeyFormatter.for` to ensure it takes precendence over any other formatting selections. The fixtures have been updated to cover both cases (nil value in first position, nil value in last position). Fixes #446 --- lib/syntax_tree/node.rb | 83 ++++++++++++++++++++++++----------------- test/fixtures/assoc.rb | 4 ++ 2 files changed, 53 insertions(+), 34 deletions(-) diff --git a/lib/syntax_tree/node.rb b/lib/syntax_tree/node.rb index 5a92a5a7..4d148f35 100644 --- a/lib/syntax_tree/node.rb +++ b/lib/syntax_tree/node.rb @@ -1783,45 +1783,60 @@ def format_key(q, key) end end - def self.for(container) - container.assocs.each do |assoc| - if assoc.is_a?(AssocSplat) - # Splat nodes do not impact the formatting choice. - elsif assoc.value.nil? - # If the value is nil, then it has been omitted. In this case we have - # to match the existing formatting because standardizing would - # potentially break the code. For example: - # - # { first:, "second" => "value" } - # - return Identity.new - else - # Otherwise, we need to check the type of the key. If it's a label or - # dynamic symbol, we can use labels. If it's a symbol literal then it - # needs to match a certain pattern to be used as a label. If it's - # anything else, then we need to use hash rockets. - case assoc.key - when Label, DynaSymbol - # Here labels can be used. - when SymbolLiteral - # When attempting to convert a hash rocket into a hash label, - # you need to take care because only certain patterns are - # allowed. Ruby source says that they have to match keyword - # arguments to methods, but don't specify what that is. After - # some experimentation, it looks like it's: - value = assoc.key.value.value - - if !value.match?(/^[_A-Za-z]/) || value.end_with?("=") - return Rockets.new - end + class << self + def for(container) + (assocs = container.assocs).each_with_index do |assoc, index| + if assoc.is_a?(AssocSplat) + # Splat nodes do not impact the formatting choice. + elsif assoc.value.nil? + # If the value is nil, then it has been omitted. In this case we + # have to match the existing formatting because standardizing would + # potentially break the code. For example: + # + # { first:, "second" => "value" } + # + return Identity.new else - # If the value is anything else, we have to use hash rockets. - return Rockets.new + # Otherwise, we need to check the type of the key. If it's a label + # or dynamic symbol, we can use labels. If it's a symbol literal + # then it needs to match a certain pattern to be used as a label. If + # it's anything else, then we need to use hash rockets. + case assoc.key + when Label, DynaSymbol + # Here labels can be used. + when SymbolLiteral + # When attempting to convert a hash rocket into a hash label, + # you need to take care because only certain patterns are + # allowed. Ruby source says that they have to match keyword + # arguments to methods, but don't specify what that is. After + # some experimentation, it looks like it's: + value = assoc.key.value.value + + if !value.match?(/^[_A-Za-z]/) || value.end_with?("=") + if omitted_value?(assocs[(index + 1)..]) + return Identity.new + else + return Rockets.new + end + end + else + if omitted_value?(assocs[(index + 1)..]) + return Identity.new + else + return Rockets.new + end + end end end + + Labels.new end - Labels.new + private + + def omitted_value?(assocs) + assocs.any? { |assoc| !assoc.is_a?(AssocSplat) && assoc.value.nil? } + end end end diff --git a/test/fixtures/assoc.rb b/test/fixtures/assoc.rb index 0fc60e6f..83a4887a 100644 --- a/test/fixtures/assoc.rb +++ b/test/fixtures/assoc.rb @@ -48,3 +48,7 @@ { "foo #{bar}": "baz" } % { "foo=": "baz" } +% # >= 3.1.0 +{ bar => 1, baz: } +% # >= 3.1.0 +{ baz:, bar => 1 } From e1ef9ac3531312b80fb93c290753570b3066504e Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 11 Jul 2025 11:24:03 -0400 Subject: [PATCH 40/42] Track compile errors Fixes #481 --- lib/syntax_tree/parser.rb | 1 + test/parser_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/syntax_tree/parser.rb b/lib/syntax_tree/parser.rb index 326d3ec7..ace077ee 100644 --- a/lib/syntax_tree/parser.rb +++ b/lib/syntax_tree/parser.rb @@ -2871,6 +2871,7 @@ def on_parse_error(error, *) alias on_assign_error on_parse_error alias on_class_name_error on_parse_error alias on_param_error on_parse_error + alias compile_error on_parse_error # :call-seq: # on_period: (String value) -> Period diff --git a/test/parser_test.rb b/test/parser_test.rb index 7ac07381..169d5b46 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -33,7 +33,7 @@ def test_parses_ripper_methods def test_errors_on_missing_token_with_location error = assert_raises(Parser::ParseError) { SyntaxTree.parse("f+\"foo") } - assert_equal(2, error.column) + assert_equal(3, error.column) end def test_errors_on_missing_end_with_location @@ -45,7 +45,7 @@ def test_errors_on_missing_regexp_ending error = assert_raises(Parser::ParseError) { SyntaxTree.parse("a =~ /foo") } - assert_equal(5, error.column) + assert_equal(6, error.column) end def test_errors_on_missing_token_without_location From 5fbd4171d73c9d258882374e97c135563f22da69 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 15 Jul 2025 10:59:58 -0400 Subject: [PATCH 41/42] Add config option to CLI Fixes #478 --- lib/syntax_tree/cli.rb | 49 +++++++++++++++++++++++++++++++++++------- test/cli_test.rb | 46 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 10 deletions(-) diff --git a/lib/syntax_tree/cli.rb b/lib/syntax_tree/cli.rb index 0baaef3d..e3bac8f1 100644 --- a/lib/syntax_tree/cli.rb +++ b/lib/syntax_tree/cli.rb @@ -455,17 +455,26 @@ def run(item) #{Color.bold("stree write [--plugins=...] [--print-width=NUMBER] [-e SCRIPT] FILE")} Read, format, and write back the source of the given files + --ignore-files=... + A glob pattern to ignore files when processing. This can be specified + multiple times to ignore multiple patterns. + --plugins=... A comma-separated list of plugins to load. - --print-width=NUMBER + --print-width=... The maximum line width to use when formatting. - -e SCRIPT + -e ... Parse an inline string. - --extension=EXTENSION - A file extension matching the content passed in via STDIN or -e. Defaults to 'rb' + --extension=... + A file extension matching the content passed in via STDIN or -e. + Defaults to '.rb'. + + --config=... + Path to a configuration file. Defaults to .streerc in the current + working directory. HELP # This represents all of the options that can be passed to the CLI. It is @@ -563,8 +572,16 @@ class ConfigFile attr_reader :filepath - def initialize - @filepath = File.join(Dir.pwd, FILENAME) + def initialize(filepath = nil) + if filepath + if File.readable?(filepath) + @filepath = filepath + else + raise ArgumentError, "Invalid configuration file: #{filepath}" + end + else + @filepath = File.join(Dir.pwd, FILENAME) + end end def exists? @@ -582,8 +599,24 @@ class << self def run(argv) name, *arguments = argv - config_file = ConfigFile.new - arguments.unshift(*config_file.arguments) + # First, we need to check if there's a --config option specified + # so we can use the custom config file path. + config_filepath = nil + arguments.each_with_index do |arg, index| + if arg.start_with?("--config=") + config_filepath = arg.split("=", 2)[1] + arguments.delete_at(index) + break + elsif arg == "--config" && arguments[index + 1] + config_filepath = arguments[index + 1] + arguments.delete_at(index + 1) + arguments.delete_at(index) + break + end + end + + config_file = ConfigFile.new(config_filepath) + arguments = config_file.arguments.concat(arguments) options = Options.new options.parse(arguments) diff --git a/test/cli_test.rb b/test/cli_test.rb index 200cd8d7..a0d6001d 100644 --- a/test/cli_test.rb +++ b/test/cli_test.rb @@ -308,6 +308,48 @@ def test_plugin_args_with_config_file end end + def test_config_file_custom_path + with_plugin_directory do |directory| + plugin = directory.plugin("puts 'Custom config!'") + config = <<~TXT + --print-width=80 + --plugins=#{plugin} + TXT + + filepath = File.join(Dir.tmpdir, "#{SecureRandom.hex}.streerc") + with_config_file(config, filepath) do + contents = "#{"a" * 30} + #{"b" * 30}\n" + result = run_cli("format", "--config=#{filepath}", contents: contents) + + assert_equal("Custom config!\n#{contents}", result.stdio) + end + end + end + + def test_config_file_custom_path_space_separated + with_plugin_directory do |directory| + plugin = directory.plugin("puts 'Custom config space!'") + config = <<~TXT + --print-width=80 + --plugins=#{plugin} + TXT + + filepath = File.join(Dir.tmpdir, "#{SecureRandom.hex}.streerc") + with_config_file(config, filepath) do + contents = "#{"a" * 30} + #{"b" * 30}\n" + result = run_cli("format", "--config", filepath, contents: contents) + + assert_equal("Custom config space!\n#{contents}", result.stdio) + end + end + end + + def test_config_file_nonexistent_path + assert_raises(ArgumentError) do + run_cli("format", "--config=/nonexistent/path.streerc") + end + end + Result = Struct.new(:status, :stdio, :stderr, keyword_init: true) private @@ -342,8 +384,8 @@ def run_cli(command, *args, contents: :default) tempfile.unlink end - def with_config_file(contents) - filepath = File.join(Dir.pwd, SyntaxTree::CLI::ConfigFile::FILENAME) + def with_config_file(contents, filepath = nil) + filepath ||= File.join(Dir.pwd, SyntaxTree::CLI::ConfigFile::FILENAME) File.write(filepath, contents) yield From 4c9fca1d28880beee1d06ad26360fbba77e24ffe Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Wed, 16 Jul 2025 20:37:31 -0400 Subject: [PATCH 42/42] Bump to version 6.3.0 --- CHANGELOG.md | 14 ++++++++++++++ Gemfile.lock | 2 +- lib/syntax_tree/version.rb | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1beac42f..4ad42fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [6.3.0] - 2025-07-16 + +### Added + +- The `--extension` command line option has been added to the CLI to specify what type of content is coming from stdin. +- The `--config` command line option has been added to the CLI to specify the path to the configuration file. + +### Changed + +- Fix formatting of character literals when single quotes is enabled. +- Pass ignore files option to the language server. +- Hash keys should remain unchanged when there are any omitted values in the hash. +- We now properly handle compilation errors in the parser. + ## [6.2.0] - 2023-09-20 ### Added diff --git a/Gemfile.lock b/Gemfile.lock index b855c712..9b8cbe16 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - syntax_tree (6.2.0) + syntax_tree (6.3.0) prettier_print (>= 1.2.0) GEM diff --git a/lib/syntax_tree/version.rb b/lib/syntax_tree/version.rb index 51599f77..9e80fa7b 100644 --- a/lib/syntax_tree/version.rb +++ b/lib/syntax_tree/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SyntaxTree - VERSION = "6.2.0" + VERSION = "6.3.0" end pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy