diff --git a/.github/workflows/auto_assign.yml b/.github/workflows/auto_assign.yml deleted file mode 100644 index f59f6c7639..0000000000 --- a/.github/workflows/auto_assign.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Auto assign - -on: - issues: - types: [opened] - -jobs: - auto_assign: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - name: Checkout - - - name: Randomly assign reviewers to community issues - uses: actions/github-script@v7 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - script: | - const fullTeam = [ - "andyw8", - "dirceu", - "paracycle", - "vinistock", - "rafaelfranca", - "Morriar", - "st0012", - "egiurleo", - "KaanOzkan" - ]; - const author = "${{ github.event.issue.user.login }}"; - const issue = await github.rest.issues.get({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: ${{ github.event.issue.number }} - }); - const hasNonVSCodeLabel = issue.data.labels.some(label => label.name === 'non-vscode'); - - if (!fullTeam.includes(author) && !hasNonVSCodeLabel) { - const dxReviewers = [ - "andyw8", - "vinistock", - "st0012", - ]; - const assignee = dxReviewers[Math.floor(Math.random() * dxReviewers.length)]; - - await github.rest.issues.addAssignees({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: ${{ github.event.issue.number }}, - assignees: [assignee] - }); - } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8af71be742..c280f6a376 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,22 @@ name: CI on: [push, pull_request] jobs: + spelling: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + env: + DISABLE_V8_COMPILE_CACHE: "1" + uses: actions/setup-node@v4 + with: + node-version: "20.9" + + - name: Run cspell + run: | + yarn global add cspell + cspell lint_ruby: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5cadc79c3b..a513a6339e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,9 @@ jobs: name: Checkout - uses: actions/setup-node@v4 - name: Use Node.js 18.x + name: Use Node.js + env: + DISABLE_V8_COMPILE_CACHE: "1" with: node-version: "20.9" cache: "yarn" diff --git a/.rubocop.yml b/.rubocop.yml index 6575a465f6..2ba910dcb6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -43,6 +43,7 @@ Sorbet/TrueSigil: - "lib/ruby_indexer/test/**/*.rb" - "lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb" - "lib/ruby_lsp/load_sorbet.rb" + - "lib/ruby_lsp/scripts/compose_bundle.rb" Exclude: - "**/*.rake" - "lib/**/*.rb" @@ -58,3 +59,30 @@ Sorbet/StrictSigil: - "lib/ruby-lsp.rb" - "lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb" - "lib/ruby_lsp/load_sorbet.rb" + - "lib/ruby_lsp/scripts/compose_bundle.rb" + +Layout/ClassStructure: + Enabled: true + Exclude: + - "test/**/*" + ExpectedOrder: + - module_inclusion + - constants + - public_attribute_macros + - public_class_methods # does not recognize `class << self` + - initializer + - public_methods + - protected_attribute_macros + - protected_methods + - private_attribute_macros + - private_delegate + - private_methods + Categories: + attribute_macros: + - attr_accessor + - attr_reader + - attr_writer + module_inclusion: + - include + - prepend + - extend diff --git a/.vscode/settings.json b/.vscode/settings.json index 0e76c4d786..999c48e92c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,35 +14,5 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, - }, - "cSpell.languageSettings": [ - { - "languageId": "*", - "locale": "en", - "dictionaries": [ - "wordsEn" - ] - }, - { - "languageId": "*", - "locale": "en-US", - "dictionaries": [ - "wordsEn" - ] - }, - { - "languageId": "*", - "dictionaries": [ - "companies", - "softwareTerms", - "misc" - ] - }, - { - "languageId": "ruby", - "dictionaries": [ - "ruby" - ] - } - ], + } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a654cc214..92ba4f30d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,235 +1,3 @@ # CONTRIBUTING -This repository contains three sub-projects: - -- the **language server** (`ruby-lsp`), which exists at the top level of the repository. Most features are implemented here since everything implemented in the server is available to all editors -- the **VS Code extension**, which exists under the `vscode` directory. Any custom VS Code features are implemented here -- the **documentation** website, which exists under the `jekyll` directory. All user facing documentation for both the Ruby LSP and the Rails addon is contained here - -This contributing guide is split by each component. - -## Initial setup - -To start contributing to the Ruby LSP, ensure that all dependencies are installed as follows: - -- `bundle install` on the top level will install Ruby dependencies -- `bundle install` in the `jekyll` directory will install documentation dependencies -- `yarn install` in the `vscode` directory will install Node.js dependencies for the VS Code extension - -## Contributing to the server - -This is the structure of the `ruby-lsp` gem: - -- `lib/ruby_indexer`: the code indexer to extract declarations from the workspace -- `lib/ruby_lsp/*.rb`: foundational pieces of the language server, such as workers, queues, handling requests and so on -- `lib/ruby_lsp/requests`: request implementation. These match one to one with the [language server specification](https://microsoft.github.io/language-server-protocol/specification) -- `lib/ruby_lsp/listeners`: Prism dispatcher listeners. Most of the server's infrastructure relies on a listener pattern to maximize performance while traversing ASTs. Note that a single request may depend on more than one listener - -When adding or changing an existing feature, first identify which request is responsible for it in the -[specification](https://microsoft.github.io/language-server-protocol/specification). Then identify which file in the -server implements that request and start thinking about the implementation. - -> [!NOTE] -> -> When using VS Code, open the `lsp.code-workspace` file instead of just opening the regular folder. It contains -> configurations for working with the sub projects side by side effectively - -### Debugging - -#### Live debugging the server - -It is possible to live debug the development instance of the language server that is currently running when using VS -Code: - -1. `CMD/CTRL + SHIFT + P` to open the command palette -2. Search for `Debug the Ruby LSP server`. This command will restart the server in debug mode, allowing you to connect -with a debugger. Note that the debug mode applies only until the editor is closed or Ruby LSP restarts -3. After the server has launched in debug mode, attach the debugger by going in `Run and debug`, selecting the `Attach to existing server` task and clicking run -4. You should now be able to put breakpoints in the UI and triggering requests will stop at those breakpoints - -Caveat: since you are debugging the language server instance that is currently running in your own editor, features will -not be available if the execution is currently suspended at a breakpoint. - -#### Understanding Prism ASTs - -The Ruby LSP uses Prism to parse and understand Ruby code. When working on a feature, it's very common to need to -inspect the structure of the Prism AST for a given code snippet, so that you can understand why a request is being -triggered a certain way. - -If you're using VS Code, you can use the [show syntax tree -command](https://shopify.github.io/ruby-lsp/#show-syntax-tree) to inspect the structure of an AST for an entire document -or selection. - -For other editors, using our IRB configurations is the easiest way of achieving the same: - -1. `bundle exec irb` to launch IRB with our configurations. It will require all libraries for you -2. Then parse the Ruby code you'd like to understand better and start inspecting - -```ruby -source = <<~RUBY - class Foo - def bar - end - end -RUBY - -ast = Prism.parse(source).value -``` - -Check the [Prism documentation](https://ruby.github.io/prism/) for more related information. - -#### Tracing LSP requests and responses - -In VS Code, you can verify what's happening in the server by enabling tracing, which allows for different levels of -logging. - -```jsonc -{ - // Your JSON settings - // - // - `off`: no tracing - // - `messages`: display requests and responses notifications - // - `verbose`: display each request and response as JSON - "ruby lsp.trace.server": "messages" -} -``` - -#### Manually testing a change - -After you made a change or added a new feature, you can verify it in the editor by restarting the language server. In VS -Code, this can be achieved by running the command `Ruby LSP: restart`, which will reboot the server and pick up your -changes. - -For other editors, you must manually restart the language server to pick up the latest changes. - -#### Debugging tests - -In VS Code, we recommend: - -1. Setting breakpoints in the UI -2. Opening the test that will hit that breakpoint -3. Clicking the `debug` code lens button on top of examples - -Alternatively (and for other editors), adding a `binding.b` statement in the code and executing the test in the terminal -will also allow you to debug the code. - -### Writing tests - -There are two types of tests in the Ruby LSP. The first type is likely familiar: standard Minitest files with a bunch of -examples inside using the method declaration syntax. - -The second type of test is our fixture/expectation framework. Adding a new fixture under `test/fixtures` will -automatically make the framework run all requests against that fixture. By default, the framework only checks that the -features don't crash when running against the fixture. This is useful for ensuring that critical requests don't break -when using less common Ruby syntax. - -To go beyond checking if the requests break for a fixture, you can add an expectation to `test/expectations/NAME_OF_THE_REQUEST`, which allows you to assert the expected response for a request and fixture combination. - -For example, if we have a `test/fixtures/foo.rb`, then adding a `test/expectations/semantic_highlighting/foo.exp.json` will make the framework verify that when running semantic highlighting in the `foo.rb` fixture, the `foo.exp.json` response is expected. - -Check existing fixture and expectation combinations for examples. - -#### When to use each type of test - -The fixture/expectation framework is intended to be used mostly by full document requests (language server features that -are computed for the entire file every time). - -Requests and features that are position specific or that operate under a different mechanism should just use regular Minitest tests. - -#### Running the test suite - -There are multiple ways to execute tests available. - -```shell -# Run the entire test suite -bundle exec rake - -# Run only indexing tests -bundle exec rake test:indexer - -# Run only language server tests (excluding indexing) -bundle exec rake test - -# Using the custom test framework to run a specific fixture example -# bin/test test/requests/the_request_you_want_to_run_test.rb name_of_fixture -bin/test test/requests/diagnostics_expectations_test.rb def_bad_formatting -``` - -Additionally, we use RuboCop for linting and Sorbet for type checking. - -```shell -# Run linting -bundle exec rubocop - -# Run type checking -bundle exec srb tc -``` - -## Contributing to the VS Code extension - -Before starting on this section, ensure that [dependencies are installed](#initial-setup). - -In addition to what's described here, the [VS Code extension API documentation](https://code.visualstudio.com/api) is a -great place to gather more context about how extensions interact with the editor. - -The VS Code extension currently has the following main parts: - -- Version manager integrations for Ruby environment activation -- A [ruby/debug](https://github.com/ruby/debug) client implementation -- A [test controller](https://code.visualstudio.com/docs/editor/testing) implementation -- A [Copilot chat participant](https://code.visualstudio.com/api/extension-guides/chat) -- A dependencies tree implementation -- The LSP client -- A workspace abstraction to represent each active workspace in the editor - -### Testing changes - -We try to ensure thorough testing as much as possible. However, some tests are difficult to write, in particular those -that interact with VS Code widgets. - -For example, if running the test displays a dialog, the test has no easy way of clicking a button on it to continue -execution. For these situations we use `sinon` to stub expected invocations and responses. - -Note: `client.test.ts` is an integration style test that boots the development version of the `ruby-lsp` gem and runs -requests against it. - -#### Running tests - -The easiest way to run tests is by selecting the `Extension tests` task in `Run and debug` and clicking run. That will -run all tests and the results will appear in VS Code's debug console. - -Alternatively, you can also run the tests through the terminal, which will download a test VS Code version inside the -repository and run tests against it. You can avoid the download by running the tests through the launch task. - -Note: it is not possible to run a single test file or example. - -### Live debugging - -It is possible to live debug the development version of the extension. Detailed information can be found in the [VS Code -extension documentation]((https://code.visualstudio.com/api)), but this section includes a short description. - -Live debugging involves two VS Code windows. The first one is where you will be modifying the code and the second window -will be where the development version of the extension is going to be running. You want to change the code in the first -window, reload and verify the changes in the second window. - -1. Start by launching the extension debugging with the `Run extension` task in the `Run and debug` panel. This will open the second VS Code window where the development version of the extension is running -2. Make the desired changes in the first original VS Code window -3. Click the reload button in the [debug toolbar](https://code.visualstudio.com/Docs/editor/debugging#_user-interface) to load your recent changes into the second VS Code window -4. Perform the actions to verify your changes in the second window - -If you wish to perform step by step debugging, all you have to do is add breakpoints through the UI in the first window -where you are modifying the code - not in the second window where the development version of the extension is running. - -## Contributing to documentation - -The Ruby LSP uses [Jekyll](https://jekyllrb.com/) to generate the documentation, whose source lives under the `/jekyll` -folder. Before making any changes, ensure you [performed initial setup](#initial-setup). - -After that, follow these steps to make and verify your changes: - -1. Make the desired changes -2. Launch jekyll in development -```shell -bundle exec jekyll serve -``` -3. Verify your changes locally by visiting http://localhost:4000/ruby-lsp +See https://shopify.github.io/ruby-lsp/contributing diff --git a/Gemfile.lock b/Gemfile.lock index ffecd6b177..ddfa0979f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ PATH remote: . specs: - ruby-lsp (0.19.1) + ruby-lsp (0.21.3) language_server-protocol (~> 3.17.0) - prism (>= 1.1, < 2.0) + prism (>= 1.2, < 2.0) rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) @@ -19,7 +19,7 @@ GEM docile (1.4.1) erubi (1.13.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.7.2) @@ -39,18 +39,18 @@ GEM ast (~> 2.4.1) racc prettier_print (1.2.1) - prism (1.1.0) + prism (1.2.0) psych (5.1.2) stringio racc (1.8.1) rainbow (3.1.1) rake (13.2.1) - rbi (0.2.0) + rbi (0.2.1) prism (~> 1.0) sorbet-runtime (>= 0.5.9204) - rbs (3.6.0) + rbs (3.6.1) logger - rdoc (6.6.3.1) + rdoc (6.7.0) psych (>= 4.0.0) regexp_parser (2.9.2) reline (0.5.10) @@ -67,8 +67,8 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.32.3) parser (>= 3.3.1.0) - rubocop-md (1.2.2) - rubocop (>= 1.0) + rubocop-md (1.2.3) + rubocop (>= 1.45) rubocop-minitest (0.35.1) rubocop (>= 1.61, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) @@ -86,15 +86,15 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - sorbet (0.5.11577) - sorbet-static (= 0.5.11577) - sorbet-runtime (0.5.11577) - sorbet-static (0.5.11577-universal-darwin) - sorbet-static (0.5.11577-x86_64-linux) - sorbet-static-and-runtime (0.5.11577) - sorbet (= 0.5.11577) - sorbet-runtime (= 0.5.11577) - spoom (1.4.2) + sorbet (0.5.11597) + sorbet-static (= 0.5.11597) + sorbet-runtime (0.5.11597) + sorbet-static (0.5.11597-universal-darwin) + sorbet-static (0.5.11597-x86_64-linux) + sorbet-static-and-runtime (0.5.11597) + sorbet (= 0.5.11597) + sorbet-runtime (= 0.5.11597) + spoom (1.5.0) erubi (>= 1.10.0) prism (>= 0.28.0) sorbet-static-and-runtime (>= 0.5.10187) @@ -102,7 +102,7 @@ GEM stringio (3.1.1) syntax_tree (6.2.0) prettier_print (>= 1.2.0) - tapioca (0.16.2) + tapioca (0.16.3) bundler (>= 2.2.25) netrc (>= 0.11.0) parallel (>= 1.21.0) @@ -112,7 +112,7 @@ GEM thor (>= 1.2.0) yard-sorbet thor (1.3.2) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) yard (0.9.37) yard-sorbet (0.9.0) sorbet-runtime diff --git a/README.md b/README.md index 8d7d48a7ae..837eb8b466 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Shopif be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](CODE_OF_CONDUCT.md) code of conduct. -If you wish to contribute, see [CONTRIBUTING](CONTRIBUTING.md) for development instructions and check out our pinned -[roadmap issue](https://github.com/Shopify/ruby-lsp/issues) for a list of tasks to get started. +If you wish to contribute, see [Contributing](https://shopify.github.io/ruby-lsp/contributing.html) for development instructions and check out our +[Design and roadmap](https://shopify.github.io/ruby-lsp/design-and-roadmap.html) for a list of tasks to get started. ## License diff --git a/VERSION b/VERSION index 41915c7994..16eb94e711 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.19.1 +0.21.3 diff --git a/cspell.jsonc b/cspell.jsonc new file mode 100644 index 0000000000..848205644b --- /dev/null +++ b/cspell.jsonc @@ -0,0 +1,37 @@ +{ + "version": "0.2", + "dictionaryDefinitions": [ + { + "name": "project-words", + "path": "./project-words", + "addWords": true + } + ], + // cspell recognizes 'addon' as valid but we want to enforce 'add-on', but not within code + "words": [ + "!addon" + ], + "ignoreRegExpList": [ + "\\.addon", + "addon\\.", + "\\(addon\\)", + "@addon", + "_addon", + "addon\\w+", + "addon_", + "addon\"", + "addon =", + "$\\s+addon^", + "\\|addon\\|", + "addon$" // could have false positives but unlikely + ], + "language": "en", + "files": ["**/*.rb", "**/*.md", "**/*.markdown"], + "ignorePaths": [ + "**/node_modules/**", + "vendor/**", + "coverage/**", + "test/fixtures/", + ], + "dictionaries": ["ruby", "en_US", "shell", "file-types", "project-words", "companies", "softwareTerms", "misc"] + } diff --git a/exe/ruby-lsp b/exe/ruby-lsp index 0b745a1403..431a9024b9 100755 --- a/exe/ruby-lsp +++ b/exe/ruby-lsp @@ -33,6 +33,10 @@ parser = OptionParser.new do |opts| options[:doctor] = true end + opts.on("--use-launcher", "[EXPERIMENTAL] Use launcher mechanism to handle missing dependencies gracefully") do + options[:launcher] = true + end + opts.on("-h", "--help", "Print this help") do puts opts.help puts @@ -54,6 +58,17 @@ end # using `BUNDLE_GEMFILE=.ruby-lsp/Gemfile bundle exec ruby-lsp` so that we have access to the gems that are a part of # the application's bundle if ENV["BUNDLE_GEMFILE"].nil? + # Substitute the current process by the launcher. RubyGems activates all dependencies of a gem's executable eagerly, + # but we can't have that happen because we want to invoke Bundler.setup ourselves with the composed bundle and avoid + # duplicate spec activation errors. Replacing the process with the launcher executable will clear the activated specs, + # which gives us the opportunity to control which specs are activated and enter degraded mode if any gems failed to + # install rather than failing to boot the server completely + if options[:launcher] + command = +File.expand_path("ruby-lsp-launcher", __dir__) + command << " --debug" if options[:debug] + exit exec(command) + end + require_relative "../lib/ruby_lsp/setup_bundler" begin @@ -63,12 +78,18 @@ if ENV["BUNDLE_GEMFILE"].nil? exit(78) end - exit exec(env, "bundle exec ruby-lsp #{original_args.join(" ")}") -end + base_bundle = if env["BUNDLER_VERSION"] + "bundle _#{env["BUNDLER_VERSION"]}_" + else + "bundle" + end -require "ruby_lsp/load_sorbet" + exit exec(env, "#{base_bundle} exec ruby-lsp #{original_args.join(" ")}".strip) +end $LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) + +require "ruby_lsp/load_sorbet" require "ruby_lsp/internal" T::Utils.run_all_sig_blocks diff --git a/exe/ruby-lsp-launcher b/exe/ruby-lsp-launcher new file mode 100755 index 0000000000..44b915421e --- /dev/null +++ b/exe/ruby-lsp-launcher @@ -0,0 +1,127 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# !!!!!!! +# No gems can be required in this file until we invoke bundler setup except inside the forked process that sets up the +# composed bundle +# !!!!!!! + +setup_error = nil + +# Read the initialize request before even starting the server. We need to do this to figure out the workspace URI. +# Editors are not required to spawn the language server process on the same directory as the workspace URI, so we need +# to ensure that we're setting up the bundle in the right place +$stdin.binmode +headers = $stdin.gets("\r\n\r\n") +content_length = headers[/Content-Length: (\d+)/i, 1].to_i +raw_initialize = $stdin.read(content_length) + +# Compose the Ruby LSP bundle in a forked process so that we can require gems without polluting the main process +# `$LOAD_PATH` and `Gem.loaded_specs`. Windows doesn't support forking, so we need a separate path to support it +pid = if Gem.win_platform? + # Since we can't fork on Windows and spawn won't carry over the existing load paths, we need to explicitly pass that + # down to the child process or else requiring gems during composing the bundle will fail + load_path = $LOAD_PATH.flat_map do |path| + ["-I", File.expand_path(path)] + end + + Process.spawn( + Gem.ruby, + *load_path, + File.expand_path("../lib/ruby_lsp/scripts/compose_bundle_windows.rb", __dir__), + raw_initialize, + ) +else + fork do + require_relative "../lib/ruby_lsp/scripts/compose_bundle" + compose(raw_initialize) + end +end + +begin + # Wait until the composed Bundle is finished + Process.wait(pid) +rescue Errno::ECHILD + # In theory, the child process can finish before we even get to the wait call, but that is not an error +end + +begin + bundle_env_path = File.join(".ruby-lsp", "bundle_env") + # We can't require `bundler/setup` because that file prematurely exits the process if setup fails. However, we can't + # simply require bundler either because the version required might conflict with the one locked in the composed + # bundle. We need the composed bundle sub-process to inform us of the locked Bundler version, so that we can then + # activate the right spec and require the exact Bundler version required by the app + if File.exist?(bundle_env_path) + env = File.readlines(bundle_env_path).to_h { |line| line.chomp.split("=", 2) } + ENV.merge!(env) + + if env["BUNDLER_VERSION"] + Gem::Specification.find_by_name("bundler", env["BUNDLER_VERSION"]).activate + end + + require "bundler" + Bundler.ui.level = :silent + Bundler.setup + $stderr.puts("Composed Bundle set up successfully") + end +rescue StandardError => e + # If installing gems failed for any reason, we don't want to exit the process prematurely. We can still provide most + # features in a degraded mode. We simply save the error so that we can report to the user that certain gems might be + # missing, but we respect the LSP life cycle + setup_error = e + $stderr.puts("Failed to set up composed Bundle\n#{e.full_message}") + + # If Bundler.setup fails, we need to restore the original $LOAD_PATH so that we can still require the Ruby LSP server + # in degraded mode + $LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) +ensure + require "fileutils" + FileUtils.rm(bundle_env_path) if File.exist?(bundle_env_path) +end + +error_path = File.join(".ruby-lsp", "install_error") + +install_error = if File.exist?(error_path) + Marshal.load(File.read(error_path)) +end + +# Now that the bundle is set up, we can begin actually launching the server. Note that `Bundler.setup` will have already +# configured the load path using the version of the Ruby LSP present in the composed bundle. Do not push any Ruby LSP +# paths into the load path manually or we may end up requiring the wrong version of the gem +require "ruby_lsp/load_sorbet" +require "ruby_lsp/internal" + +T::Utils.run_all_sig_blocks + +if ARGV.include?("--debug") + if ["x64-mingw-ucrt", "x64-mingw32"].include?(RUBY_PLATFORM) + $stderr.puts "Debugging is not supported on Windows" + else + begin + ENV.delete("RUBY_DEBUG_IRB_CONSOLE") + require "debug/open_nonstop" + rescue LoadError + $stderr.puts("You need to install the debug gem to use the --debug flag") + end + end +end + +# Ensure all output goes out stderr by default to allow puts/p/pp to work without specifying output device. +$> = $stderr + +initialize_request = JSON.parse(raw_initialize, symbolize_names: true) if raw_initialize + +begin + RubyLsp::Server.new( + install_error: install_error, + setup_error: setup_error, + initialize_request: initialize_request, + ).start +rescue ArgumentError + # If the launcher is booting an outdated version of the server, then the initializer doesn't accept a keyword splat + # and we already read the initialize request from the stdin pipe. In this case, we need to process the initialize + # request manually and then start the main loop + server = RubyLsp::Server.new + server.process_message(initialize_request) + server.start +end diff --git a/jekyll/Gemfile.lock b/jekyll/Gemfile.lock index b54d8ed26e..d6a6fb2a28 100644 --- a/jekyll/Gemfile.lock +++ b/jekyll/Gemfile.lock @@ -90,7 +90,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rexml (3.3.7) + rexml (3.3.9) rouge (4.4.0) safe_yaml (1.0.5) sass-embedded (1.79.1) diff --git a/jekyll/add-ons.markdown b/jekyll/add-ons.markdown index 853eaa28af..c9f7dd9961 100644 --- a/jekyll/add-ons.markdown +++ b/jekyll/add-ons.markdown @@ -43,7 +43,7 @@ The performance of automatic requests is critical for responsiveness as they are - Avoid duplicate work where possible. If something can be computed once and memoized, like configurations, do it - Do not mutate LSP state directly. Add-ons sometimes have access to important state such as document objects, which should never be mutated directly, but instead through the mechanisms provided by the LSP specification - like text edits -- Do not overnotify users. It's generally annoying and diverts attention from the current task +- Do not over-notify users. It's generally annoying and diverts attention from the current task - Show the right context at the right time. When adding visual features, think about **when** the information is relevant for users to avoid polluting the editor @@ -271,16 +271,14 @@ end This is how you could write an enhancement to teach the Ruby LSP to understand that DSL: ```ruby -class MyIndexingEnhancement - include RubyLsp::Enhancement - +class MyIndexingEnhancement < RubyIndexer::Enhancement # This on call node handler is invoked any time during indexing when we find a method call. It can be used to insert # more entries into the index depending on the conditions - def on_call_node(index, owner, node, file_path) + def on_call_node_enter(owner, node, file_path, code_units_cache) return unless owner # Get the ancestors of the current class - ancestors = index.linearized_ancestors_of(owner.name) + ancestors = @index.linearized_ancestors_of(owner.name) # Return early unless the method call is the one we want to handle and the class invoking the DSL inherits from # our library's parent class @@ -304,15 +302,19 @@ class MyIndexingEnhancement location, # The Prism node location where the DSL call was found location, # The Prism node location for the DSL name location. May or not be the same nil, # The documentation for this DSL call. This should always be `nil` to ensure lazy fetching of docs - index.configuration.encoding, # The negotiated encoding. This should always be `indexing.configuration.encoding` + @index.configuration.encoding, # The negotiated encoding. This should always be `indexing.configuration.encoding` signatures, # All signatures for this method (every way it can be invoked) Entry::Visibility::PUBLIC, # The method's visibility owner, # The method's owner. This is almost always going to be the same owner received ) # Push the new entry to the index - index.add(new_entry) + @index.add(new_entry) end + + # This method is invoked when the parser has finished processing the method call node. + # It can be used to perform cleanups like popping a stack...etc. + def on_call_node_leave(owner, node, file_path, code_units_cache); end end ``` @@ -324,7 +326,7 @@ module RubyLsp class Addon < ::RubyLsp::Addon def activate(global_state, message_queue) # Register the enhancement as part of the indexing process - @index.register_enhancement(MyIndexingEnhancement.new) + @index.register_enhancement(MyIndexingEnhancement.new(@index)) end def deactivate diff --git a/jekyll/contributing.markdown b/jekyll/contributing.markdown new file mode 100644 index 0000000000..3cbaa717f9 --- /dev/null +++ b/jekyll/contributing.markdown @@ -0,0 +1,248 @@ +--- +layout: default +title: Contributing +nav_order: 50 +--- + +# Contributing + +The [ruby-lsp repository](https://github.com/Shopify/ruby-lsp) contains three sub-projects: + +- the **language server** (`ruby-lsp`), which exists at the top level of the repository. Most features are implemented here since everything implemented in the server is available to all editors +- the **VS Code extension**, which exists under the `vscode` directory. Any custom VS Code features are implemented here +- the **documentation** website, which exists under the `jekyll` directory. All user facing documentation for both the Ruby LSP and the Rails add-on is contained here + +This contributing guide is split by each component. + +## Initial setup + +To start contributing to the Ruby LSP, ensure that all dependencies are installed as follows: + +- `bundle install` on the top level will install Ruby dependencies +- `bundle install` in the `jekyll` directory will install documentation dependencies +- `yarn install` in the `vscode` directory will install Node.js dependencies for the VS Code extension + +## Contributing to the server + +This is the structure of the `ruby-lsp` gem: + +- `lib/ruby_indexer`: the code indexer to extract declarations from the workspace +- `lib/ruby_lsp/*.rb`: foundational pieces of the language server, such as workers, queues, handling requests and so on +- `lib/ruby_lsp/requests`: request implementation. These match one to one with the [language server specification](https://microsoft.github.io/language-server-protocol/specification) +- `lib/ruby_lsp/listeners`: Prism dispatcher listeners. Most of the server's infrastructure relies on a listener pattern to maximize performance while traversing ASTs. Note that a single request may depend on more than one listener + +When adding or changing an existing feature, first identify which request is responsible for it in the +[specification](https://microsoft.github.io/language-server-protocol/specification). Then identify which file in the +server implements that request and start thinking about the implementation. + +{: .note } +When using VS Code, open the `lsp.code-workspace` file instead of just opening the regular folder. It contains +configurations for working with the sub projects side by side effectively + +### Debugging + +#### Live debugging the server + +It is possible to live debug the development instance of the language server that is currently running when using VS +Code: + +1. `CMD/CTRL + SHIFT + P` to open the command palette +2. Search for `Debug the Ruby LSP server`. This command will restart the server in debug mode, allowing you to connect +with a debugger. Note that the debug mode applies only until the editor is closed or Ruby LSP restarts +3. After the server has launched in debug mode, attach the debugger by going in `Run and debug`, selecting the `Attach to existing server` task and clicking run +4. You should now be able to put breakpoints in the UI and triggering requests will stop at those breakpoints + +Caveat: since you are debugging the language server instance that is currently running in your own editor, features will +not be available if the execution is currently suspended at a breakpoint. + +#### Understanding Prism ASTs + +The Ruby LSP uses Prism to parse and understand Ruby code. When working on a feature, it's very common to need to +inspect the structure of the Prism AST for a given code snippet, so that you can understand why a request is being +triggered a certain way. + +If you're using VS Code, you can use the [show syntax tree +command](https://shopify.github.io/ruby-lsp/#show-syntax-tree) to inspect the structure of an AST for an entire document +or selection. + +For other editors, using our IRB configurations is the easiest way of achieving the same: + +1. `bundle exec irb` to launch IRB with our configurations. It will require all libraries for you +2. Then parse the Ruby code you'd like to understand better and start inspecting + +```ruby +source = <<~RUBY + class Foo + def bar + end + end +RUBY + +ast = Prism.parse(source).value +``` + +Check the [Prism documentation](https://ruby.github.io/prism/) for more related information. + +#### Tracing LSP requests and responses + +In VS Code, you can verify what's happening in the server by enabling tracing, which allows for different levels of +logging. + +```jsonc +{ + // Your JSON settings + // + // - `off`: no tracing + // - `messages`: display requests and responses notifications + // - `verbose`: display each request and response as JSON + "ruby lsp.trace.server": "messages" +} +``` + +#### Manually testing a change + +After you made a change or added a new feature, you can verify it in the editor by restarting the language server. In VS +Code, this can be achieved by running the command `Ruby LSP: restart`, which will reboot the server and pick up your +changes. + +For other editors, you must manually restart the language server to pick up the latest changes. + +#### Debugging tests + +In VS Code, we recommend: + +1. Setting breakpoints in the UI +2. Opening the test that will hit that breakpoint +3. Clicking the `debug` code lens button on top of examples + +Alternatively (and for other editors), adding a `binding.b` statement in the code and executing the test in the terminal +will also allow you to debug the code. + +### Writing tests + +There are two types of tests in the Ruby LSP. The first type is likely familiar: standard Minitest files with a bunch of +examples inside using the method declaration syntax. + +The second type of test is our fixture/expectation framework. Adding a new fixture under `test/fixtures` will +automatically make the framework run all requests against that fixture. By default, the framework only checks that the +features don't crash when running against the fixture. This is useful for ensuring that critical requests don't break +when using less common Ruby syntax. + +To go beyond checking if the requests break for a fixture, you can add an expectation to `test/expectations/NAME_OF_THE_REQUEST`, which allows you to assert the expected response for a request and fixture combination. + +For example, if we have a `test/fixtures/foo.rb`, then adding a `test/expectations/semantic_highlighting/foo.exp.json` will make the framework verify that when running semantic highlighting in the `foo.rb` fixture, the `foo.exp.json` response is expected. + +Check existing fixture and expectation combinations for examples. + +#### When to use each type of test + +The fixture/expectation framework is intended to be used mostly by full document requests (language server features that +are computed for the entire file every time). + +Requests and features that are position specific or that operate under a different mechanism should just use regular Minitest tests. + +#### Running the test suite + +There are multiple ways to execute tests available. + +```shell +# Run the entire test suite +bundle exec rake + +# Run only indexing tests +bundle exec rake test:indexer + +# Run only language server tests (excluding indexing) +bundle exec rake test + +# Using the custom test framework to run a specific fixture example +# bin/test test/requests/the_request_you_want_to_run_test.rb name_of_fixture +bin/test test/requests/diagnostics_expectations_test.rb def_bad_formatting +``` + +Additionally, we use RuboCop for linting and Sorbet for type checking. + +```shell +# Run linting +bundle exec rubocop + +# Run type checking +bundle exec srb tc +``` + +## Contributing to the VS Code extension + +Before starting on this section, ensure that [dependencies are installed](#initial-setup). + +In addition to what's described here, the [VS Code extension API documentation](https://code.visualstudio.com/api) is a +great place to gather more context about how extensions interact with the editor. + +The VS Code extension currently has the following main parts: + +- Version manager integrations for Ruby environment activation +- A [ruby/debug](https://github.com/ruby/debug) client implementation +- A [test controller](https://code.visualstudio.com/docs/editor/testing) implementation +- A [Copilot chat participant](https://code.visualstudio.com/api/extension-guides/chat) +- A dependencies tree implementation +- The LSP client +- A workspace abstraction to represent each active workspace in the editor + +### Testing changes + +{: .note } +Open the `lsp.code-workspace` file instead of just opening the regular folder. It contains +contains the configuration needed for using 'Run and debug' as described below. + +We try to ensure thorough testing as much as possible. However, some tests are difficult to write, in particular those +that interact with VS Code widgets. + +For example, if running the test displays a dialog, the test has no easy way of clicking a button on it to continue +execution. For these situations we use `sinon` to stub expected invocations and responses. + +Note: `client.test.ts` is an integration style test that boots the development version of the `ruby-lsp` gem and runs +requests against it. + +#### Running tests + +The easiest way to run tests is by selecting the `Extension tests` task in `Run and debug` and clicking run. That will +run all tests and the results will appear in VS Code's debug console. + +Alternatively, you can also run the tests through the terminal, which will download a test VS Code version inside the +repository and run tests against it. You can avoid the download by running the tests through the launch task. + +Note: it is not possible to run a single test file or example. + +### Live debugging + +It is possible to live debug the development version of the extension. Detailed information can be found in the [VS Code +extension documentation]((https://code.visualstudio.com/api)), but this section includes a short description. + +Live debugging involves two VS Code windows. The first one is where you will be modifying the code and the second window +will be where the development version of the extension is going to be running. You want to change the code in the first +window, reload and verify the changes in the second window. + +1. Start by launching the extension debugging with the `Run extension` task in the `Run and debug` panel. This will open the second VS Code window where the development version of the extension is running +2. Make the desired changes in the first original VS Code window +3. Click the reload button in the [debug toolbar](https://code.visualstudio.com/Docs/editor/debugging#_user-interface) to load your recent changes into the second VS Code window +4. Perform the actions to verify your changes in the second window + +If you wish to perform step by step debugging, all you have to do is add breakpoints through the UI in the first window +where you are modifying the code - not in the second window where the development version of the extension is running. + +## Contributing to documentation + +The Ruby LSP uses [Jekyll](https://jekyllrb.com/) to generate the documentation, whose source lives under the `/jekyll` +folder. Before making any changes, ensure you [performed initial setup](#initial-setup). + +After that, follow these steps to make and verify your changes: + +1. Make the desired changes +2. Launch jekyll in development +```shell +bundle exec jekyll serve +``` +3. Verify your changes locally by visiting [http://localhost:4000/ruby-lsp](http://localhost:4000/ruby-lsp) + +## Contributing to the Ruby LSP Rails add-on + +See [https://github.com/Shopify/ruby-lsp-rails/blob/main/CONTRIBUTING.md](https://github.com/Shopify/ruby-lsp-rails/blob/main/CONTRIBUTING.md) diff --git a/jekyll/editors.markdown b/jekyll/editors.markdown index 6ebf828426..da3aa5ffcf 100644 --- a/jekyll/editors.markdown +++ b/jekyll/editors.markdown @@ -97,13 +97,13 @@ configuration languages (JSON, Lua, ELisp, etc.). new H2 header in this file containing the instructions. --> - [Emacs LSP Mode](https://emacs-lsp.github.io/lsp-mode/page/lsp-ruby-lsp/) -- [Emacs Eglot](#Emacs-Eglot) -- [Neovim LSP](#Neovim) +- [Emacs Eglot](#emacs-eglot) +- [Neovim LSP](#neovim) - [LazyVim LSP](#lazyvim-lsp) - [Sublime Text LSP](#sublime-text-lsp) - [Zed](#zed) -- [RubyMine](#RubyMine) -- [Kate](#Kate) +- [RubyMine](#rubymine) +- [Kate](#kate) ## Emacs Eglot diff --git a/jekyll/index.markdown b/jekyll/index.markdown index 1ac195ff5f..0096d0ea4b 100644 --- a/jekyll/index.markdown +++ b/jekyll/index.markdown @@ -378,11 +378,11 @@ pathname.a ``` We do not recommend renaming methods, instance variables or local variables for the sole purpose of getting better -accuracy - readibility should always come first. For example: +accuracy - readability should always come first. For example: ```ruby # It would not be a good idea to name every string "string" for the sake of getting better accuracy. -# Using descriptive names will outweight the benefits of the more accurate editor experience +# Using descriptive names will outweigh the benefits of the more accurate editor experience # don't string = something.other_thing diff --git a/lib/core_ext/uri.rb b/lib/core_ext/uri.rb index 42ddb1ef81..3741803fd6 100644 --- a/lib/core_ext/uri.rb +++ b/lib/core_ext/uri.rb @@ -3,6 +3,8 @@ module URI class Generic + extend T::Sig + # Avoid a deprecation warning with Ruby 3.4 where the default parser was changed to RFC3986. # This condition must remain even after support for 3.4 has been dropped for users that have # `uri` in their lockfile, decoupling it from the ruby version. @@ -27,8 +29,6 @@ def from_path(path:, fragment: nil, scheme: "file") end end - extend T::Sig - sig { returns(T.nilable(String)) } def to_standardized_path parsed_path = path diff --git a/lib/ruby_indexer/lib/ruby_indexer/configuration.rb b/lib/ruby_indexer/lib/ruby_indexer/configuration.rb index e3c4c9b77c..fe4e6c43b0 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/configuration.rb @@ -28,7 +28,17 @@ def initialize @encoding = T.let(Encoding::UTF_8, Encoding) @excluded_gems = T.let(initial_excluded_gems, T::Array[String]) @included_gems = T.let([], T::Array[String]) - @excluded_patterns = T.let([File.join("**", "*_test.rb"), File.join("tmp", "**", "*")], T::Array[String]) + + @excluded_patterns = T.let( + [ + File.join("**", "*_test.rb"), + File.join("node_modules", "**", "*"), + File.join("spec", "**", "*"), + File.join("test", "**", "*"), + File.join("tmp", "**", "*"), + ], + T::Array[String], + ) path = Bundler.settings["path"] if path @@ -56,6 +66,21 @@ def initialize ) end + sig { returns(String) } + def merged_excluded_file_pattern + # This regex looks for @excluded_patterns that follow the format of "something/**/*", where + # "something" is one or more non-"/" + # + # Returns "/path/to/workspace/{tmp,node_modules}/**/*" + @excluded_patterns + .filter_map do |pattern| + next if File.absolute_path?(pattern) + + pattern.match(%r{\A([^/]+)/\*\*/\*\z})&.captures&.first + end + .then { |dirs| File.join(@workspace_path, "{#{dirs.join(",")}}/**/*") } + end + sig { returns(T::Array[IndexablePath]) } def indexables excluded_gems = @excluded_gems - @included_gems @@ -64,21 +89,47 @@ def indexables # NOTE: indexing the patterns (both included and excluded) needs to happen before indexing gems, otherwise we risk # having duplicates if BUNDLE_PATH is set to a folder inside the project structure + flags = File::FNM_PATHNAME | File::FNM_EXTGLOB + + # In order to speed up indexing, only traverse into top-level directories that are not entirely excluded. + # For example, if "tmp/**/*" is excluded, we don't need to traverse into "tmp" at all. However, if + # "vendor/bundle/**/*" is excluded, we will traverse all of "vendor" and `reject!` out all "vendor/bundle" entries + # later. + excluded_pattern = merged_excluded_file_pattern + included_paths = Dir.glob(File.join(@workspace_path, "*/"), flags) + .filter_map do |included_path| + next if File.fnmatch?(excluded_pattern, included_path, flags) + + relative_path = included_path + .delete_prefix(@workspace_path) + .tap { |path| path.delete_prefix!("/") } + + [included_path, relative_path] + end + + indexables = T.let([], T::Array[IndexablePath]) + # Add user specified patterns - indexables = @included_patterns.flat_map do |pattern| + @included_patterns.each do |pattern| load_path_entry = T.let(nil, T.nilable(String)) - Dir.glob(File.join(@workspace_path, pattern), File::FNM_PATHNAME | File::FNM_EXTGLOB).map! do |path| - path = File.expand_path(path) - # All entries for the same pattern match the same $LOAD_PATH entry. Since searching the $LOAD_PATH for every - # entry is expensive, we memoize it until we find a path that doesn't belong to that $LOAD_PATH. This happens - # on repositories that define multiple gems, like Rails. All frameworks are defined inside the current - # workspace directory, but each one of them belongs to a different $LOAD_PATH entry - if load_path_entry.nil? || !path.start_with?(load_path_entry) - load_path_entry = $LOAD_PATH.find { |load_path| path.start_with?(load_path) } - end + included_paths.each do |included_path, relative_path| + relative_pattern = pattern.delete_prefix(File.join(relative_path, "/")) + + next unless pattern.start_with?("**") || pattern.start_with?(relative_path) - IndexablePath.new(load_path_entry, path) + Dir.glob(File.join(included_path, relative_pattern), flags).each do |path| + path = File.expand_path(path) + # All entries for the same pattern match the same $LOAD_PATH entry. Since searching the $LOAD_PATH for every + # entry is expensive, we memoize it until we find a path that doesn't belong to that $LOAD_PATH. This + # happens on repositories that define multiple gems, like Rails. All frameworks are defined inside the + # current workspace directory, but each one of them belongs to a different $LOAD_PATH entry + if load_path_entry.nil? || !path.start_with?(load_path_entry) + load_path_entry = $LOAD_PATH.find { |load_path| path.start_with?(load_path) } + end + + indexables << IndexablePath.new(load_path_entry, path) + end end end diff --git a/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb b/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb index 66a962cadb..b29bdd7dbd 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb @@ -33,6 +33,10 @@ def initialize(index, dispatcher, parse_result, file_path, collect_comments: fal T::Hash[Integer, Prism::Comment], ) @inside_def = T.let(false, T::Boolean) + @code_units_cache = T.let( + parse_result.code_units_cache(@index.configuration.encoding), + T.any(T.proc.params(arg0: Integer).returns(Integer), Prism::CodeUnitsCache), + ) # The nesting stack we're currently inside. Used to determine the fully qualified name of constants, but only # stored by unresolved aliases which need the original nesting to be lazily resolved @@ -65,6 +69,11 @@ def initialize(index, dispatcher, parse_result, file_path, collect_comments: fal :on_constant_or_write_node_enter, :on_constant_and_write_node_enter, :on_constant_operator_write_node_enter, + :on_global_variable_and_write_node_enter, + :on_global_variable_operator_write_node_enter, + :on_global_variable_or_write_node_enter, + :on_global_variable_target_node_enter, + :on_global_variable_write_node_enter, :on_instance_variable_write_node_enter, :on_instance_variable_and_write_node_enter, :on_instance_variable_operator_write_node_enter, @@ -106,10 +115,9 @@ def on_class_node_enter(node) entry = Entry::Class.new( nesting, @file_path, - node.location, - constant_path.location, + Location.from_prism_location(node.location, @code_units_cache), + Location.from_prism_location(constant_path.location, @code_units_cache), comments, - @index.configuration.encoding, parent_class, ) @@ -136,10 +144,9 @@ def on_module_node_enter(node) entry = Entry::Module.new( actual_nesting(name), @file_path, - node.location, - constant_path.location, + Location.from_prism_location(node.location, @code_units_cache), + Location.from_prism_location(constant_path.location, @code_units_cache), comments, - @index.configuration.encoding, ) @owner_stack << entry @@ -170,19 +177,17 @@ def on_singleton_class_node_enter(node) if existing_entries entry = T.must(existing_entries.first) entry.update_singleton_information( - node.location, - expression.location, + Location.from_prism_location(node.location, @code_units_cache), + Location.from_prism_location(expression.location, @code_units_cache), collect_comments(node), - @index.configuration.encoding, ) else entry = Entry::SingletonClass.new( real_nesting, @file_path, - node.location, - expression.location, + Location.from_prism_location(node.location, @code_units_cache), + Location.from_prism_location(expression.location, @code_units_cache), collect_comments(node), - @index.configuration.encoding, nil, ) @index.add(entry, skip_prefix_tree: true) @@ -307,12 +312,16 @@ def on_call_node_enter(node) @visibility_stack.push(Entry::Visibility::PROTECTED) when :private @visibility_stack.push(Entry::Visibility::PRIVATE) + when :module_function + handle_module_function(node) end @enhancements.each do |enhancement| - enhancement.on_call_node(@index, @owner_stack.last, node, @file_path) + enhancement.on_call_node_enter(@owner_stack.last, node, @file_path, @code_units_cache) rescue StandardError => e - @indexing_errors << "Indexing error in #{@file_path} with '#{enhancement.class.name}' enhancement: #{e.message}" + @indexing_errors << <<~MSG + Indexing error in #{@file_path} with '#{enhancement.class.name}' on call node enter enhancement: #{e.message} + MSG end end @@ -327,6 +336,14 @@ def on_call_node_leave(node) @visibility_stack.pop end end + + @enhancements.each do |enhancement| + enhancement.on_call_node_leave(@owner_stack.last, node, @file_path, @code_units_cache) + rescue StandardError => e + @indexing_errors << <<~MSG + Indexing error in #{@file_path} with '#{enhancement.class.name}' on call node leave enhancement: #{e.message} + MSG + end end sig { params(node: Prism::DefNode).void } @@ -340,10 +357,9 @@ def on_def_node_enter(node) @index.add(Entry::Method.new( method_name, @file_path, - node.location, - node.name_loc, + Location.from_prism_location(node.location, @code_units_cache), + Location.from_prism_location(node.name_loc, @code_units_cache), comments, - @index.configuration.encoding, [Entry::Signature.new(list_params(node.parameters))], current_visibility, @owner_stack.last, @@ -357,10 +373,9 @@ def on_def_node_enter(node) @index.add(Entry::Method.new( method_name, @file_path, - node.location, - node.name_loc, + Location.from_prism_location(node.location, @code_units_cache), + Location.from_prism_location(node.name_loc, @code_units_cache), comments, - @index.configuration.encoding, [Entry::Signature.new(list_params(node.parameters))], current_visibility, singleton, @@ -382,6 +397,31 @@ def on_def_node_leave(node) end end + sig { params(node: Prism::GlobalVariableAndWriteNode).void } + def on_global_variable_and_write_node_enter(node) + handle_global_variable(node, node.name_loc) + end + + sig { params(node: Prism::GlobalVariableOperatorWriteNode).void } + def on_global_variable_operator_write_node_enter(node) + handle_global_variable(node, node.name_loc) + end + + sig { params(node: Prism::GlobalVariableOrWriteNode).void } + def on_global_variable_or_write_node_enter(node) + handle_global_variable(node, node.name_loc) + end + + sig { params(node: Prism::GlobalVariableTargetNode).void } + def on_global_variable_target_node_enter(node) + handle_global_variable(node, node.location) + end + + sig { params(node: Prism::GlobalVariableWriteNode).void } + def on_global_variable_write_node_enter(node) + handle_global_variable(node, node.name_loc) + end + sig { params(node: Prism::InstanceVariableWriteNode).void } def on_instance_variable_write_node_enter(node) handle_instance_variable(node, node.name_loc) @@ -417,15 +457,38 @@ def on_alias_method_node_enter(node) node.old_name.slice, @owner_stack.last, @file_path, - node.new_name.location, + Location.from_prism_location(node.new_name.location, @code_units_cache), comments, - @index.configuration.encoding, ), ) end private + sig do + params( + node: T.any( + Prism::GlobalVariableAndWriteNode, + Prism::GlobalVariableOperatorWriteNode, + Prism::GlobalVariableOrWriteNode, + Prism::GlobalVariableTargetNode, + Prism::GlobalVariableWriteNode, + ), + loc: Prism::Location, + ).void + end + def handle_global_variable(node, loc) + name = node.name.to_s + comments = collect_comments(node) + + @index.add(Entry::GlobalVariable.new( + name, + @file_path, + Location.from_prism_location(loc, @code_units_cache), + comments, + )) + end + sig do params( node: T.any( @@ -453,9 +516,8 @@ def handle_instance_variable(node, loc) @index.add(Entry::InstanceVariable.new( name, @file_path, - loc, + Location.from_prism_location(loc, @code_units_cache), collect_comments(node), - @index.configuration.encoding, owner, )) end @@ -518,9 +580,8 @@ def handle_alias_method(node) old_name_value, @owner_stack.last, @file_path, - new_name.location, + Location.from_prism_location(new_name.location, @code_units_cache), comments, - @index.configuration.encoding, ), ) end @@ -555,9 +616,8 @@ def add_constant(node, name, value = nil) @stack.dup, name, @file_path, - node.location, + Location.from_prism_location(node.location, @code_units_cache), comments, - @index.configuration.encoding, ) when Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode @@ -569,9 +629,8 @@ def add_constant(node, name, value = nil) @stack.dup, name, @file_path, - node.location, + Location.from_prism_location(node.location, @code_units_cache), comments, - @index.configuration.encoding, ) when Prism::ConstantPathWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode, Prism::ConstantPathAndWriteNode @@ -581,12 +640,16 @@ def add_constant(node, name, value = nil) @stack.dup, name, @file_path, - node.location, + Location.from_prism_location(node.location, @code_units_cache), comments, - @index.configuration.encoding, ) else - Entry::Constant.new(name, @file_path, node.location, comments, @index.configuration.encoding) + Entry::Constant.new( + name, + @file_path, + Location.from_prism_location(node.location, @code_units_cache), + comments, + ) end, ) end @@ -652,9 +715,8 @@ def handle_attribute(node, reader:, writer:) @index.add(Entry::Accessor.new( name, @file_path, - loc, + Location.from_prism_location(loc, @code_units_cache), comments, - @index.configuration.encoding, current_visibility, @owner_stack.last, )) @@ -665,9 +727,8 @@ def handle_attribute(node, reader:, writer:) @index.add(Entry::Accessor.new( "#{name}=", @file_path, - loc, + Location.from_prism_location(loc, @code_units_cache), comments, - @index.configuration.encoding, current_visibility, @owner_stack.last, )) @@ -702,6 +763,48 @@ def handle_module_operation(node, operation) end end + sig { params(node: Prism::CallNode).void } + def handle_module_function(node) + arguments_node = node.arguments + return unless arguments_node + + owner_name = @owner_stack.last&.name + return unless owner_name + + arguments_node.arguments.each do |argument| + method_name = case argument + when Prism::StringNode + argument.content + when Prism::SymbolNode + argument.value + end + next unless method_name + + entries = @index.resolve_method(method_name, owner_name) + next unless entries + + entries.each do |entry| + entry_owner_name = entry.owner&.name + next unless entry_owner_name + + entry.visibility = Entry::Visibility::PRIVATE + + singleton = @index.existing_or_new_singleton_class(entry_owner_name) + location = Location.from_prism_location(argument.location, @code_units_cache) + @index.add(Entry::Method.new( + method_name, + @file_path, + location, + location, + collect_comments(node)&.concat(entry.comments), + entry.signatures, + Entry::Visibility::PUBLIC, + singleton, + )) + end + end + end + sig { returns(Entry::Visibility) } def current_visibility T.must(@visibility_stack.last) diff --git a/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb b/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb index fc06c8db13..a654b87e86 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb @@ -2,25 +2,44 @@ # frozen_string_literal: true module RubyIndexer - module Enhancement + class Enhancement extend T::Sig extend T::Helpers - interface! + abstract! - requires_ancestor { Object } + sig { params(index: Index).void } + def initialize(index) + @index = index + end # The `on_extend` indexing enhancement is invoked whenever an extend is encountered in the code. It can be used to # register for an included callback, similar to what `ActiveSupport::Concern` does in order to auto-extend the # `ClassMethods` modules sig do - abstract.params( - index: Index, + overridable.params( + owner: T.nilable(Entry::Namespace), + node: Prism::CallNode, + file_path: String, + code_units_cache: T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + ), + ).void + end + def on_call_node_enter(owner, node, file_path, code_units_cache); end + + sig do + overridable.params( owner: T.nilable(Entry::Namespace), node: Prism::CallNode, file_path: String, + code_units_cache: T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + ), ).void end - def on_call_node(index, owner, node, file_path); end + def on_call_node_leave(owner, node, file_path, code_units_cache); end end end diff --git a/lib/ruby_indexer/lib/ruby_indexer/entry.rb b/lib/ruby_indexer/lib/ruby_indexer/entry.rb index 5f68b46bb7..ce19c17fa3 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/entry.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/entry.rb @@ -31,30 +31,16 @@ class Visibility < T::Enum params( name: String, file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), + location: Location, comments: T.nilable(String), - encoding: Encoding, ).void end - def initialize(name, file_path, location, comments, encoding) + def initialize(name, file_path, location, comments) @name = name @file_path = file_path @comments = comments @visibility = T.let(Visibility::PUBLIC, Visibility) - - @location = T.let( - if location.is_a?(Prism::Location) - Location.new( - location.start_line, - location.end_line, - location.start_code_units_column(encoding), - location.end_code_units_column(encoding), - ) - else - location - end, - RubyIndexer::Location, - ) + @location = location end sig { returns(T::Boolean) } @@ -152,32 +138,19 @@ class Namespace < Entry params( nesting: T::Array[String], file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), - name_location: T.any(Prism::Location, Location), + location: Location, + name_location: Location, comments: T.nilable(String), - encoding: Encoding, ).void end - def initialize(nesting, file_path, location, name_location, comments, encoding) # rubocop:disable Metrics/ParameterLists + def initialize(nesting, file_path, location, name_location, comments) @name = T.let(nesting.join("::"), String) # The original nesting where this namespace was discovered @nesting = nesting - super(@name, file_path, location, comments, encoding) - - @name_location = T.let( - if name_location.is_a?(Prism::Location) - Location.new( - name_location.start_line, - name_location.end_line, - name_location.start_code_units_column(encoding), - name_location.end_code_units_column(encoding), - ) - else - name_location - end, - RubyIndexer::Location, - ) + super(@name, file_path, location, comments) + + @name_location = name_location end sig { returns(T::Array[String]) } @@ -214,15 +187,14 @@ class Class < Namespace params( nesting: T::Array[String], file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), - name_location: T.any(Prism::Location, Location), + location: Location, + name_location: Location, comments: T.nilable(String), - encoding: Encoding, parent_class: T.nilable(String), ).void end - def initialize(nesting, file_path, location, name_location, comments, encoding, parent_class) # rubocop:disable Metrics/ParameterLists - super(nesting, file_path, location, name_location, comments, encoding) + def initialize(nesting, file_path, location, name_location, comments, parent_class) # rubocop:disable Metrics/ParameterLists + super(nesting, file_path, location, name_location, comments) @parent_class = parent_class end @@ -237,26 +209,14 @@ class SingletonClass < Class sig do params( - location: Prism::Location, - name_location: Prism::Location, + location: Location, + name_location: Location, comments: T.nilable(String), - encoding: Encoding, ).void end - def update_singleton_information(location, name_location, comments, encoding) - # Create a new RubyIndexer::Location object from the Prism location - @location = Location.new( - location.start_line, - location.end_line, - location.start_code_units_column(encoding), - location.end_code_units_column(encoding), - ) - @name_location = Location.new( - name_location.start_line, - name_location.end_line, - name_location.start_code_units_column(encoding), - name_location.end_code_units_column(encoding), - ) + def update_singleton_information(location, name_location, comments) + @location = location + @name_location = name_location (@comments ||= +"") << comments if comments end end @@ -373,15 +333,14 @@ class Member < Entry params( name: String, file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), + location: Location, comments: T.nilable(String), - encoding: Encoding, visibility: Visibility, owner: T.nilable(Entry::Namespace), ).void end - def initialize(name, file_path, location, comments, encoding, visibility, owner) # rubocop:disable Metrics/ParameterLists - super(name, file_path, location, comments, encoding) + def initialize(name, file_path, location, comments, visibility, owner) # rubocop:disable Metrics/ParameterLists + super(name, file_path, location, comments) @visibility = visibility @owner = owner end @@ -441,31 +400,18 @@ class Method < Member params( name: String, file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), - name_location: T.any(Prism::Location, Location), + location: Location, + name_location: Location, comments: T.nilable(String), - encoding: Encoding, signatures: T::Array[Signature], visibility: Visibility, owner: T.nilable(Entry::Namespace), ).void end - def initialize(name, file_path, location, name_location, comments, encoding, signatures, visibility, owner) # rubocop:disable Metrics/ParameterLists - super(name, file_path, location, comments, encoding, visibility, owner) + def initialize(name, file_path, location, name_location, comments, signatures, visibility, owner) # rubocop:disable Metrics/ParameterLists + super(name, file_path, location, comments, visibility, owner) @signatures = signatures - @name_location = T.let( - if name_location.is_a?(Prism::Location) - Location.new( - name_location.start_line, - name_location.end_line, - name_location.start_code_units_column(encoding), - name_location.end_code_units_column(encoding), - ) - else - name_location - end, - RubyIndexer::Location, - ) + @name_location = name_location end end @@ -494,13 +440,12 @@ class UnresolvedConstantAlias < Entry nesting: T::Array[String], name: String, file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), + location: Location, comments: T.nilable(String), - encoding: Encoding, ).void end - def initialize(target, nesting, name, file_path, location, comments, encoding) # rubocop:disable Metrics/ParameterLists - super(name, file_path, location, comments, encoding) + def initialize(target, nesting, name, file_path, location, comments) # rubocop:disable Metrics/ParameterLists + super(name, file_path, location, comments) @target = target @nesting = nesting @@ -514,14 +459,13 @@ class ConstantAlias < Entry sig { returns(String) } attr_reader :target - sig { params(target: String, unresolved_alias: UnresolvedConstantAlias, encoding: Encoding).void } - def initialize(target, unresolved_alias, encoding) + sig { params(target: String, unresolved_alias: UnresolvedConstantAlias).void } + def initialize(target, unresolved_alias) super( unresolved_alias.name, unresolved_alias.file_path, unresolved_alias.location, unresolved_alias.comments, - encoding ) @visibility = unresolved_alias.visibility @@ -541,14 +485,13 @@ class InstanceVariable < Entry params( name: String, file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), + location: Location, comments: T.nilable(String), - encoding: Encoding, owner: T.nilable(Entry::Namespace), ).void end - def initialize(name, file_path, location, comments, encoding, owner) # rubocop:disable Metrics/ParameterLists - super(name, file_path, location, comments, encoding) + def initialize(name, file_path, location, comments, owner) + super(name, file_path, location, comments) @owner = owner end end @@ -571,13 +514,12 @@ class UnresolvedMethodAlias < Entry old_name: String, owner: T.nilable(Entry::Namespace), file_path: String, - location: T.any(Prism::Location, RubyIndexer::Location), + location: Location, comments: T.nilable(String), - encoding: Encoding, ).void end - def initialize(new_name, old_name, owner, file_path, location, comments, encoding) # rubocop:disable Metrics/ParameterLists - super(new_name, file_path, location, comments, encoding) + def initialize(new_name, old_name, owner, file_path, location, comments) # rubocop:disable Metrics/ParameterLists + super(new_name, file_path, location, comments) @new_name = new_name @old_name = old_name @@ -596,9 +538,9 @@ class MethodAlias < Entry attr_reader :owner sig do - params(target: T.any(Member, MethodAlias), unresolved_alias: UnresolvedMethodAlias, encoding: Encoding).void + params(target: T.any(Member, MethodAlias), unresolved_alias: UnresolvedMethodAlias).void end - def initialize(target, unresolved_alias, encoding) + def initialize(target, unresolved_alias) full_comments = +"Alias for #{target.name}\n" full_comments << "#{unresolved_alias.comments}\n" full_comments << target.comments @@ -608,7 +550,6 @@ def initialize(target, unresolved_alias, encoding) unresolved_alias.file_path, unresolved_alias.location, full_comments, - encoding ) @target = target @@ -705,7 +646,7 @@ def matches?(arguments) (positionals.empty? && forwarding_arguments.any?) || ( # Check if positional arguments match. This includes required, optional, rest arguments. We also need to - # verify if there's a trailing forwading argument, like `def foo(a, ...); end` + # verify if there's a trailing forwarding argument, like `def foo(a, ...); end` positional_arguments_match?(positionals, forwarding_arguments, keyword_args, min_pos, max_pos) && # If the positional arguments match, we move on to checking keyword, optional keyword and keyword rest # arguments. If there's a forward argument, then it will always match. If the method accepts a keyword rest diff --git a/lib/ruby_indexer/lib/ruby_indexer/index.rb b/lib/ruby_indexer/lib/ruby_indexer/index.rb index bd4e41f91f..7effc5b77f 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/index.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/index.rb @@ -665,7 +665,6 @@ def existing_or_new_singleton_class(name) attached_ancestor.location, attached_ancestor.name_location, nil, - @configuration.encoding, nil, ) add(singleton, skip_prefix_tree: true) @@ -785,7 +784,7 @@ def linearize_superclass( # rubocop:disable Metrics/ParameterLists singleton_levels ) # Find the first class entry that has a parent class. Notice that if the developer makes a mistake and inherits - # from two diffent classes in different files, we simply ignore it + # from two different classes in different files, we simply ignore it superclass = T.cast( if singleton_levels > 0 self[attached_class_name]&.find { |n| n.is_a?(Entry::Class) && n.parent_class } @@ -859,7 +858,7 @@ def resolve_alias(entry, seen_names) return entry unless target target_name = T.must(target.first).name - resolved_alias = Entry::ConstantAlias.new(target_name, entry, @configuration.encoding) + resolved_alias = Entry::ConstantAlias.new(target_name, entry) # Replace the UnresolvedAlias by a resolved one so that we don't have to do this again later original_entries = T.must(@entries[alias_name]) @@ -975,35 +974,29 @@ def inherited_constant_completion_candidates(name, nesting) [] end - # Removes redudancy from a constant reference's full name. For example, if we find a reference to `A::B::Foo` inside - # of the ["A", "B"] nesting, then we should not concatenate the nesting with the name or else we'll end up with - # `A::B::A::B::Foo`. This method will remove any redundant parts from the final name based on the reference and the - # nesting + # Removes redundancy from a constant reference's full name. For example, if we find a reference to `A::B::Foo` + # inside of the ["A", "B"] nesting, then we should not concatenate the nesting with the name or else we'll end up + # with `A::B::A::B::Foo`. This method will remove any redundant parts from the final name based on the reference and + # the nesting sig { params(name: String, nesting: T::Array[String]).returns(String) } def build_non_redundant_full_name(name, nesting) + # If there's no nesting, then we can just return the name as is return name if nesting.empty? - namespace = nesting.join("::") - # If the name is not qualified, we can just concatenate the nesting and the name - return "#{namespace}::#{name}" unless name.include?("::") + return "#{nesting.join("::")}::#{name}" unless name.include?("::") name_parts = name.split("::") + first_redundant_part = nesting.index(name_parts[0]) - # Find the first part of the name that is not in the nesting - index = name_parts.index { |part| !nesting.include?(part) } + # If there are no redundant parts between the name and the nesting, then the full name is both combined + return "#{nesting.join("::")}::#{name}" unless first_redundant_part - if index.nil? - # All parts of the nesting are redundant because they are already present in the name. We can return the name - # directly - name - elsif index == 0 - # No parts of the nesting are in the name, we can concatenate the namespace and the name - "#{namespace}::#{name}" - else - # The name includes some parts of the nesting. We need to remove the redundant parts - "#{namespace}::#{T.must(name_parts[index..-1]).join("::")}" - end + # Otherwise, push all of the leading parts of the nesting that aren't redundant into the name. For example, if we + # have a reference to `Foo::Bar` inside the `[Namespace, Foo]` nesting, then only the `Foo` part is redundant, but + # we still need to include the `Namespace` part + T.unsafe(name_parts).unshift(*nesting[0...first_redundant_part]) + name_parts.join("::") end sig do @@ -1050,7 +1043,7 @@ def resolve_method_alias(entry, receiver_name, seen_names) target_method_entries = resolve_method(entry.old_name, receiver_name, seen_names) return entry unless target_method_entries - resolved_alias = Entry::MethodAlias.new(T.must(target_method_entries.first), entry, @configuration.encoding) + resolved_alias = Entry::MethodAlias.new(T.must(target_method_entries.first), entry) original_entries = T.must(@entries[new_name]) original_entries.delete(entry) original_entries << resolved_alias diff --git a/lib/ruby_indexer/lib/ruby_indexer/location.rb b/lib/ruby_indexer/lib/ruby_indexer/location.rb index 5b83662273..08c9553b94 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/location.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/location.rb @@ -5,6 +5,28 @@ module RubyIndexer class Location extend T::Sig + class << self + extend T::Sig + + sig do + params( + prism_location: Prism::Location, + code_units_cache: T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + ), + ).returns(T.attached_class) + end + def from_prism_location(prism_location, code_units_cache) + new( + prism_location.start_line, + prism_location.end_line, + prism_location.cached_start_code_units_column(code_units_cache), + prism_location.cached_end_code_units_column(code_units_cache), + ) + end + end + sig { returns(Integer) } attr_reader :start_line, :end_line, :start_column, :end_column diff --git a/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb b/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb index 4c7f2acd29..a20586e9ad 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb @@ -61,9 +61,9 @@ def handle_class_or_module_declaration(declaration, pathname) comments = comments_to_string(declaration) entry = if declaration.is_a?(RBS::AST::Declarations::Class) parent_class = declaration.super_class&.name&.name&.to_s - Entry::Class.new(nesting, file_path, location, location, comments, @index.configuration.encoding, parent_class) + Entry::Class.new(nesting, file_path, location, location, comments, parent_class) else - Entry::Module.new(nesting, file_path, location, location, comments, @index.configuration.encoding) + Entry::Module.new(nesting, file_path, location, location, comments) end add_declaration_mixins_to_entry(declaration, entry) @index.add(entry) @@ -136,7 +136,6 @@ def handle_method(member, owner) location, location, comments, - @index.configuration.encoding, signatures, visibility, real_owner, @@ -269,7 +268,6 @@ def handle_constant(declaration, nesting, file_path) file_path, to_ruby_indexer_location(declaration.location), comments_to_string(declaration), - @index.configuration.encoding, )) end @@ -279,14 +277,12 @@ def handle_global_variable(declaration, pathname) file_path = pathname.to_s location = to_ruby_indexer_location(declaration.location) comments = comments_to_string(declaration) - encoding = @index.configuration.encoding @index.add(Entry::GlobalVariable.new( name, file_path, location, comments, - encoding, )) end @@ -302,7 +298,6 @@ def handle_signature_alias(member, owner_entry) file_path, to_ruby_indexer_location(member.location), comments, - @index.configuration.encoding, ) @index.add(entry) diff --git a/lib/ruby_indexer/test/classes_and_modules_test.rb b/lib/ruby_indexer/test/classes_and_modules_test.rb index 6f688d4a2d..61351d4ac5 100644 --- a/lib/ruby_indexer/test/classes_and_modules_test.rb +++ b/lib/ruby_indexer/test/classes_and_modules_test.rb @@ -72,7 +72,7 @@ class self::Bar assert_entry("self::Bar", Entry::Class, "/fake/path/foo.rb:0-0:1-3") end - def test_dynamically_namespaced_class_doesnt_affect_other_classes + def test_dynamically_namespaced_class_does_not_affect_other_classes index(<<~RUBY) class Foo class self::Bar @@ -143,7 +143,7 @@ module self::Bar assert_entry("self::Bar", Entry::Module, "/fake/path/foo.rb:0-0:1-3") end - def test_dynamically_namespaced_module_doesnt_affect_other_modules + def test_dynamically_namespaced_module_does_not_affect_other_modules index(<<~RUBY) module Foo class self::Bar diff --git a/lib/ruby_indexer/test/enhancements_test.rb b/lib/ruby_indexer/test/enhancements_test.rb index 0a30c6fa3a..029bf81b8d 100644 --- a/lib/ruby_indexer/test/enhancements_test.rb +++ b/lib/ruby_indexer/test/enhancements_test.rb @@ -6,17 +6,15 @@ module RubyIndexer class EnhancementTest < TestCase def test_enhancing_indexing_included_hook - enhancement_class = Class.new do - include Enhancement - - def on_call_node(index, owner, node, file_path) + enhancement_class = Class.new(Enhancement) do + def on_call_node_enter(owner, node, file_path, code_units_cache) return unless owner return unless node.name == :extend arguments = node.arguments&.arguments return unless arguments - location = node.location + location = Location.from_prism_location(node.location, code_units_cache) arguments.each do |node| next unless node.is_a?(Prism::ConstantReadNode) || node.is_a?(Prism::ConstantPathNode) @@ -24,7 +22,7 @@ def on_call_node(index, owner, node, file_path) module_name = node.full_name next unless module_name == "ActiveSupport::Concern" - index.register_included_hook(owner.name) do |index, base| + @index.register_included_hook(owner.name) do |index, base| class_methods_name = "#{owner.name}::ClassMethods" if index.indexed?(class_methods_name) @@ -33,13 +31,12 @@ def on_call_node(index, owner, node, file_path) end end - index.add(Entry::Method.new( + @index.add(Entry::Method.new( "new_method", file_path, location, location, nil, - index.configuration.encoding, [Entry::Signature.new([Entry::RequiredParameter.new(name: :a)])], Entry::Visibility::PUBLIC, owner, @@ -51,7 +48,7 @@ def on_call_node(index, owner, node, file_path) end end - @index.register_enhancement(enhancement_class.new) + @index.register_enhancement(enhancement_class.new(@index)) index(<<~RUBY) module ActiveSupport module Concern @@ -99,10 +96,8 @@ class User < ActiveRecord::Base end def test_enhancing_indexing_configuration_dsl - enhancement_class = Class.new do - include Enhancement - - def on_call_node(index, owner, node, file_path) + enhancement_class = Class.new(Enhancement) do + def on_call_node_enter(owner, node, file_path, code_units_cache) return unless owner name = node.name @@ -114,15 +109,14 @@ def on_call_node(index, owner, node, file_path) association_name = arguments.first return unless association_name.is_a?(Prism::SymbolNode) - location = association_name.location + location = Location.from_prism_location(association_name.location, code_units_cache) - index.add(Entry::Method.new( + @index.add(Entry::Method.new( T.must(association_name.value), file_path, location, location, nil, - index.configuration.encoding, [], Entry::Visibility::PUBLIC, owner, @@ -130,7 +124,7 @@ def on_call_node(index, owner, node, file_path) end end - @index.register_enhancement(enhancement_class.new) + @index.register_enhancement(enhancement_class.new(@index)) index(<<~RUBY) module ActiveSupport module Concern @@ -162,11 +156,44 @@ class User < ActiveRecord::Base assert_entry("posts", Entry::Method, "/fake/path/foo.rb:23-11:23-17") end - def test_error_handling_in_enhancement - enhancement_class = Class.new do - include Enhancement + def test_error_handling_in_on_call_node_enter_enhancement + enhancement_class = Class.new(Enhancement) do + def on_call_node_enter(owner, node, file_path, code_units_cache) + raise "Error" + end + + class << self + def name + "TestEnhancement" + end + end + end + + @index.register_enhancement(enhancement_class.new(@index)) + + _stdout, stderr = capture_io do + index(<<~RUBY) + module ActiveSupport + module Concern + def self.extended(base) + base.class_eval("def new_method(a); end") + end + end + end + RUBY + end + + assert_match( + %r{Indexing error in /fake/path/foo\.rb with 'TestEnhancement' on call node enter enhancement}, + stderr, + ) + # The module should still be indexed + assert_entry("ActiveSupport::Concern", Entry::Module, "/fake/path/foo.rb:1-2:5-5") + end - def on_call_node(index, owner, node, file_path) + def test_error_handling_in_on_call_node_leave_enhancement + enhancement_class = Class.new(Enhancement) do + def on_call_node_leave(owner, node, file_path, code_units_cache) raise "Error" end @@ -177,7 +204,7 @@ def name end end - @index.register_enhancement(enhancement_class.new) + @index.register_enhancement(enhancement_class.new(@index)) _stdout, stderr = capture_io do index(<<~RUBY) @@ -191,7 +218,10 @@ def self.extended(base) RUBY end - assert_match(%r{Indexing error in /fake/path/foo\.rb with 'TestEnhancement' enhancement}, stderr) + assert_match( + %r{Indexing error in /fake/path/foo\.rb with 'TestEnhancement' on call node leave enhancement}, + stderr, + ) # The module should still be indexed assert_entry("ActiveSupport::Concern", Entry::Module, "/fake/path/foo.rb:1-2:5-5") end diff --git a/lib/ruby_indexer/test/global_variable_test.rb b/lib/ruby_indexer/test/global_variable_test.rb new file mode 100644 index 0000000000..a4fa5e9a8a --- /dev/null +++ b/lib/ruby_indexer/test/global_variable_test.rb @@ -0,0 +1,49 @@ +# typed: true +# frozen_string_literal: true + +require_relative "test_case" + +module RubyIndexer + class GlobalVariableTest < TestCase + def test_global_variable_and_write + index(<<~RUBY) + $foo &&= 1 + RUBY + + assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4") + end + + def test_global_variable_operator_write + index(<<~RUBY) + $foo += 1 + RUBY + + assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4") + end + + def test_global_variable_or_write + index(<<~RUBY) + $foo ||= 1 + RUBY + + assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4") + end + + def test_global_variable_target_node + index(<<~RUBY) + $foo, $bar = 1 + RUBY + + assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4") + assert_entry("$bar", Entry::GlobalVariable, "/fake/path/foo.rb:0-6:0-10") + end + + def test_global_variable_write + index(<<~RUBY) + $foo = 1 + RUBY + + assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4") + end + end +end diff --git a/lib/ruby_indexer/test/index_test.rb b/lib/ruby_indexer/test/index_test.rb index 90cd404245..c83d3b0e64 100644 --- a/lib/ruby_indexer/test/index_test.rb +++ b/lib/ruby_indexer/test/index_test.rb @@ -904,7 +904,7 @@ class Bar assert_equal(14, entry.location.start_line) end - def test_resolving_inherited_alised_namespace + def test_resolving_inherited_aliased_namespace index(<<~RUBY) module Bar TARGET = 123 @@ -1490,7 +1490,7 @@ class Foo assert_kind_of(Entry::UnresolvedMethodAlias, entry) end - def test_unresolable_method_aliases + def test_unresolvable_method_aliases index(<<~RUBY) class Foo alias bar baz @@ -1934,5 +1934,94 @@ module Namespace real_namespace = @index.follow_aliased_namespace("Namespace::Second") assert_equal("First::Second", real_namespace) end + + def test_resolving_alias_to_non_existing_namespace + index(<<~RUBY) + module Namespace + class Foo + module InnerNamespace + Constants = Namespace::Foo::Constants + end + end + end + RUBY + + entry = @index.resolve("Constants", ["Namespace", "Foo", "InnerNamespace"])&.first + assert_instance_of(Entry::UnresolvedConstantAlias, entry) + + entry = @index.resolve("Namespace::Foo::Constants", ["Namespace", "Foo", "InnerNamespace"])&.first + assert_nil(entry) + end + + def test_resolving_alias_to_existing_constant_from_inner_namespace + index(<<~RUBY) + module Parent + CONST = 123 + end + + module First + module Namespace + class Foo + include Parent + + module InnerNamespace + Constants = Namespace::Foo::CONST + end + end + end + end + RUBY + + entry = @index.resolve("Namespace::Foo::CONST", ["First", "Namespace", "Foo", "InnerNamespace"])&.first + assert_equal("Parent::CONST", entry.name) + assert_instance_of(Entry::Constant, entry) + end + + def test_build_non_redundant_name + assert_equal( + "Namespace::Foo::Constants", + @index.send( + :build_non_redundant_full_name, + "Namespace::Foo::Constants", + ["Namespace", "Foo", "InnerNamespace"], + ), + ) + + assert_equal( + "Namespace::Foo::Constants", + @index.send( + :build_non_redundant_full_name, + "Namespace::Foo::Constants", + ["Namespace", "Foo"], + ), + ) + + assert_equal( + "Namespace::Foo::Constants", + @index.send( + :build_non_redundant_full_name, + "Foo::Constants", + ["Namespace", "Foo"], + ), + ) + + assert_equal( + "Bar::Namespace::Foo::Constants", + @index.send( + :build_non_redundant_full_name, + "Namespace::Foo::Constants", + ["Bar"], + ), + ) + + assert_equal( + "First::Namespace::Foo::Constants", + @index.send( + :build_non_redundant_full_name, + "Namespace::Foo::Constants", + ["First", "Namespace", "Foo", "InnerNamespace"], + ), + ) + end end end diff --git a/lib/ruby_indexer/test/instance_variables_test.rb b/lib/ruby_indexer/test/instance_variables_test.rb index 2422bd1197..044e19159a 100644 --- a/lib/ruby_indexer/test/instance_variables_test.rb +++ b/lib/ruby_indexer/test/instance_variables_test.rb @@ -209,7 +209,7 @@ def something.bar end RUBY - # If the surrounding method is beind defined on any dynamic value that isn't `self`, then we attribute the + # If the surrounding method is being defined on any dynamic value that isn't `self`, then we attribute the # instance variable to the wrong owner since there's no way to understand that statically entry = T.must(@index["@a"]&.first) owner = T.must(entry.owner) diff --git a/lib/ruby_indexer/test/method_test.rb b/lib/ruby_indexer/test/method_test.rb index ca9bb1282a..809980e18a 100644 --- a/lib/ruby_indexer/test/method_test.rb +++ b/lib/ruby_indexer/test/method_test.rb @@ -123,6 +123,32 @@ def baz; end assert_entry("baz", Entry::Method, "/fake/path/foo.rb:9-2:9-14", visibility: Entry::Visibility::PRIVATE) end + def test_visibility_tracking_with_module_function + index(<<~RUBY) + module Test + def foo; end + def bar; end + module_function :foo, "bar" + end + RUBY + + ["foo", "bar"].each do |keyword| + entries = T.must(@index[keyword]) + # should receive two entries because module_function creates a singleton method + # for the Test module and a private method for classes include the Test module + assert_equal(entries.size, 2) + first_entry, second_entry = *entries + # The first entry points to the location of the module_function call + assert_equal("Test", first_entry.owner.name) + assert_instance_of(Entry::Module, first_entry.owner) + assert_equal(Entry::Visibility::PRIVATE, first_entry.visibility) + # The second entry points to the public singleton method + assert_equal("Test::", second_entry.owner.name) + assert_instance_of(Entry::SingletonClass, second_entry.owner) + assert_equal(Entry::Visibility::PUBLIC, second_entry.visibility) + end + end + def test_method_with_parameters index(<<~RUBY) class Foo diff --git a/lib/ruby_indexer/test/rbs_indexer_test.rb b/lib/ruby_indexer/test/rbs_indexer_test.rb index 8c2a99ed7b..368c9bff50 100644 --- a/lib/ruby_indexer/test/rbs_indexer_test.rb +++ b/lib/ruby_indexer/test/rbs_indexer_test.rb @@ -100,7 +100,7 @@ def test_attaches_correct_owner_to_singleton_methods end def test_location_and_name_location_are_the_same - # NOTE: RBS does not store the name location for classes, modules or methods. This behaviour is not exactly what + # NOTE: RBS does not store the name location for classes, modules or methods. This behavior is not exactly what # we would like, but for now we assign the same location to both entries = @index["Array"] diff --git a/lib/ruby_lsp/addon.rb b/lib/ruby_lsp/addon.rb index d9ec2a84bd..c64df7dba6 100644 --- a/lib/ruby_lsp/addon.rb +++ b/lib/ruby_lsp/addon.rb @@ -46,7 +46,7 @@ class << self sig { returns(T::Array[T.class_of(Addon)]) } attr_reader :addon_classes - # Automatically track and instantiate addon classes + # Automatically track and instantiate add-on classes sig { params(child_class: T.class_of(Addon)).void } def inherited(child_class) addon_classes << child_class @@ -82,7 +82,7 @@ def load_addons(global_state, outgoing_queue, include_project_addons: true) e end - # Instantiate all discovered addon classes + # Instantiate all discovered add-on classes self.addons = addon_classes.map(&:new) self.file_watcher_addons = addons.select { |addon| addon.respond_to?(:workspace_did_change_watched_files) } @@ -194,6 +194,13 @@ def name; end sig { abstract.returns(String) } def version; end + # Handle a response from a window/showMessageRequest request. Add-ons must include the addon_name as part of the + # original request so that the response is delegated to the correct add-on and must override this method to handle + # the response + # https://microsoft.github.io/language-server-protocol/specification#window_showMessageRequest + sig { overridable.params(title: String).void } + def handle_window_show_message_response(title); end + # Creates a new CodeLens listener. This method is invoked on every CodeLens request sig do overridable.params( diff --git a/lib/ruby_lsp/base_server.rb b/lib/ruby_lsp/base_server.rb index 6922f04383..2dfdaae499 100644 --- a/lib/ruby_lsp/base_server.rb +++ b/lib/ruby_lsp/base_server.rb @@ -8,9 +8,11 @@ class BaseServer abstract! - sig { params(test_mode: T::Boolean).void } - def initialize(test_mode: false) - @test_mode = T.let(test_mode, T::Boolean) + sig { params(options: T.untyped).void } + def initialize(**options) + @test_mode = T.let(options[:test_mode], T.nilable(T::Boolean)) + @setup_error = T.let(options[:setup_error], T.nilable(StandardError)) + @install_error = T.let(options[:install_error], T.nilable(StandardError)) @writer = T.let(Transport::Stdio::Writer.new, Transport::Stdio::Writer) @reader = T.let(Transport::Stdio::Reader.new, Transport::Stdio::Reader) @incoming_queue = T.let(Thread::Queue.new, Thread::Queue) @@ -22,7 +24,7 @@ def initialize(test_mode: false) @store = T.let(Store.new, Store) @outgoing_dispatcher = T.let( Thread.new do - unless test_mode + unless @test_mode while (message = @outgoing_queue.pop) @mutex.synchronize { @writer.write(message.to_hash) } end @@ -33,6 +35,11 @@ def initialize(test_mode: false) @global_state = T.let(GlobalState.new, GlobalState) Thread.main.priority = 1 + + # We read the initialize request in `exe/ruby-lsp` to be able to determine the workspace URI where Bundler should + # be set up + initialize_request = options[:initialize_request] + process_message(initialize_request) if initialize_request end sig { void } @@ -59,7 +66,9 @@ def start # If the client supports request delegation and we're working with an ERB document and there was # something to parse, then we have to maintain the client updated about the virtual state of the host # language source - if document.parse! && @global_state.supports_request_delegation && document.is_a?(ERBDocument) + if document.parse! && @global_state.client_capabilities.supports_request_delegation && + document.is_a?(ERBDocument) + send_message( Notification.new( method: "delegate/textDocument/virtualState", diff --git a/lib/ruby_lsp/client_capabilities.rb b/lib/ruby_lsp/client_capabilities.rb new file mode 100644 index 0000000000..adce616b1c --- /dev/null +++ b/lib/ruby_lsp/client_capabilities.rb @@ -0,0 +1,67 @@ +# typed: strict +# frozen_string_literal: true + +module RubyLsp + # This class stores all client capabilities that the Ruby LSP and its add-ons depend on to ensure that we're + # not enabling functionality unsupported by the editor connecting to the server + class ClientCapabilities + extend T::Sig + + sig { returns(T::Boolean) } + attr_reader :supports_watching_files, + :supports_request_delegation, + :window_show_message_supports_extra_properties, + :supports_progress + + sig { void } + def initialize + # The editor supports watching files. This requires two capabilities: dynamic registration and relative pattern + # support + @supports_watching_files = T.let(false, T::Boolean) + + # The editor supports request delegation. This is an experimental capability since request delegation has not been + # standardized into the LSP spec yet + @supports_request_delegation = T.let(false, T::Boolean) + + # The editor supports extra arbitrary properties for `window/showMessageRequest`. Necessary for add-ons to show + # dialogs with user interactions + @window_show_message_supports_extra_properties = T.let(false, T::Boolean) + + # Which resource operations the editor supports, like renaming files + @supported_resource_operations = T.let([], T::Array[String]) + + # The editor supports displaying progress requests + @supports_progress = T.let(false, T::Boolean) + end + + sig { params(capabilities: T::Hash[Symbol, T.untyped]).void } + def apply_client_capabilities(capabilities) + workspace_capabilities = capabilities[:workspace] || {} + + file_watching_caps = workspace_capabilities[:didChangeWatchedFiles] + if file_watching_caps&.dig(:dynamicRegistration) && file_watching_caps&.dig(:relativePatternSupport) + @supports_watching_files = true + end + + @supports_request_delegation = capabilities.dig(:experimental, :requestDelegation) || false + supported_resource_operations = workspace_capabilities.dig(:workspaceEdit, :resourceOperations) + @supported_resource_operations = supported_resource_operations if supported_resource_operations + + supports_additional_properties = capabilities.dig( + :window, + :showMessage, + :messageActionItem, + :additionalPropertiesSupport, + ) + @window_show_message_supports_extra_properties = supports_additional_properties || false + + progress = capabilities.dig(:window, :workDoneProgress) + @supports_progress = progress if progress + end + + sig { returns(T::Boolean) } + def supports_rename? + @supported_resource_operations.include?("rename") + end + end +end diff --git a/lib/ruby_lsp/document.rb b/lib/ruby_lsp/document.rb index 878179c527..503f8eeb87 100644 --- a/lib/ruby_lsp/document.rb +++ b/lib/ruby_lsp/document.rb @@ -63,7 +63,7 @@ def ==(other) sig { abstract.returns(LanguageId) } def language_id; end - # TODO: remove this method once all nonpositional requests have been migrated to the listener pattern + # TODO: remove this method once all non-positional requests have been migrated to the listener pattern sig do type_parameters(:T) .params( diff --git a/lib/ruby_lsp/erb_document.rb b/lib/ruby_lsp/erb_document.rb index 58c1d74339..468f0d5d64 100644 --- a/lib/ruby_lsp/erb_document.rb +++ b/lib/ruby_lsp/erb_document.rb @@ -6,10 +6,18 @@ class ERBDocument < Document extend T::Sig extend T::Generic + ParseResultType = type_member { { fixed: Prism::ParseResult } } + sig { returns(String) } attr_reader :host_language_source - ParseResultType = type_member { { fixed: Prism::ParseResult } } + sig do + returns(T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + )) + end + attr_reader :code_units_cache sig { params(source: String, version: Integer, uri: URI::Generic, encoding: Encoding).void } def initialize(source:, version:, uri:, encoding: Encoding::UTF_8) @@ -17,6 +25,10 @@ def initialize(source:, version:, uri:, encoding: Encoding::UTF_8) # overrides this with the proper virtual host language source @host_language_source = T.let("", String) super + @code_units_cache = T.let(@parse_result.code_units_cache(@encoding), T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + )) end sig { override.returns(T::Boolean) } @@ -30,6 +42,7 @@ def parse! # Use partial script to avoid syntax errors in ERB files where keywords may be used without the full context in # which they will be evaluated @parse_result = Prism.parse(scanner.ruby, partial_script: true) + @code_units_cache = @parse_result.code_units_cache(@encoding) true end @@ -53,8 +66,8 @@ def locate_node(position, node_types: []) RubyDocument.locate( @parse_result.value, create_scanner.find_char_position(position), + code_units_cache: @code_units_cache, node_types: node_types, - encoding: @encoding, ) end diff --git a/lib/ruby_lsp/global_state.rb b/lib/ruby_lsp/global_state.rb index 2478dbe801..fb6c2cab2c 100644 --- a/lib/ruby_lsp/global_state.rb +++ b/lib/ruby_lsp/global_state.rb @@ -21,14 +21,14 @@ class GlobalState attr_reader :encoding sig { returns(T::Boolean) } - attr_reader :supports_watching_files, :experimental_features, :supports_request_delegation - - sig { returns(T::Array[String]) } - attr_reader :supported_resource_operations + attr_reader :experimental_features, :top_level_bundle sig { returns(TypeInferrer) } attr_reader :type_inferrer + sig { returns(ClientCapabilities) } + attr_reader :client_capabilities + sig { void } def initialize @workspace_uri = T.let(URI::Generic.from_path(path: Dir.pwd), URI::Generic) @@ -40,12 +40,20 @@ def initialize @has_type_checker = T.let(true, T::Boolean) @index = T.let(RubyIndexer::Index.new, RubyIndexer::Index) @supported_formatters = T.let({}, T::Hash[String, Requests::Support::Formatter]) - @supports_watching_files = T.let(false, T::Boolean) @experimental_features = T.let(false, T::Boolean) @type_inferrer = T.let(TypeInferrer.new(@index), TypeInferrer) @addon_settings = T.let({}, T::Hash[String, T.untyped]) - @supports_request_delegation = T.let(false, T::Boolean) - @supported_resource_operations = T.let([], T::Array[String]) + @top_level_bundle = T.let( + begin + Bundler.with_original_env { Bundler.default_gemfile } + true + rescue Bundler::GemfileNotFound, Bundler::GitError + false + end, + T::Boolean, + ) + @client_capabilities = T.let(ClientCapabilities.new, ClientCapabilities) + @enabled_feature_flags = T.let({}, T::Hash[Symbol, T::Boolean]) end sig { params(addon_name: String).returns(T.nilable(T::Hash[Symbol, T.untyped])) } @@ -123,12 +131,8 @@ def apply_options(options) end @index.configuration.encoding = @encoding - file_watching_caps = options.dig(:capabilities, :workspace, :didChangeWatchedFiles) - if file_watching_caps&.dig(:dynamicRegistration) && file_watching_caps&.dig(:relativePatternSupport) - @supports_watching_files = true - end - @experimental_features = options.dig(:initializationOptions, :experimentalFeaturesEnabled) || false + @client_capabilities.apply_client_capabilities(options[:capabilities]) if options[:capabilities] addon_settings = options.dig(:initializationOptions, :addonSettings) if addon_settings @@ -136,13 +140,17 @@ def apply_options(options) @addon_settings.merge!(addon_settings) end - @supports_request_delegation = options.dig(:capabilities, :experimental, :requestDelegation) || false - supported_resource_operations = options.dig(:capabilities, :workspace, :workspaceEdit, :resourceOperations) - @supported_resource_operations = supported_resource_operations if supported_resource_operations + enabled_flags = options.dig(:initializationOptions, :enabledFeatureFlags) + @enabled_feature_flags = enabled_flags if enabled_flags notifications end + sig { params(flag: Symbol).returns(T.nilable(T::Boolean)) } + def enabled_feature?(flag) + @enabled_feature_flags[flag] + end + sig { returns(String) } def workspace_path T.must(@workspace_uri.to_standardized_path) @@ -160,6 +168,11 @@ def encoding_name end end + sig { returns(T::Boolean) } + def supports_watching_files + @client_capabilities.supports_watching_files + end + private sig { params(direct_dependencies: T::Array[String], all_dependencies: T::Array[String]).returns(String) } @@ -231,14 +244,16 @@ def dot_rubocop_yml_present sig { returns(T::Array[String]) } def gather_direct_dependencies Bundler.with_original_env { Bundler.default_gemfile } - Bundler.locked_gems.dependencies.keys + gemspec_dependencies + + dependencies = Bundler.locked_gems&.dependencies&.keys || [] + dependencies + gemspec_dependencies rescue Bundler::GemfileNotFound [] end sig { returns(T::Array[String]) } def gemspec_dependencies - Bundler.locked_gems.sources + (Bundler.locked_gems&.sources || []) .grep(Bundler::Source::Gemspec) .flat_map { _1.gemspec&.dependencies&.map(&:name) } end @@ -246,7 +261,7 @@ def gemspec_dependencies sig { returns(T::Array[String]) } def gather_direct_and_indirect_dependencies Bundler.with_original_env { Bundler.default_gemfile } - Bundler.locked_gems.specs.map(&:name) + Bundler.locked_gems&.specs&.map(&:name) || [] rescue Bundler::GemfileNotFound [] end diff --git a/lib/ruby_lsp/internal.rb b/lib/ruby_lsp/internal.rb index bcf595723e..78823fcfe0 100644 --- a/lib/ruby_lsp/internal.rb +++ b/lib/ruby_lsp/internal.rb @@ -12,6 +12,7 @@ require "bundler" Bundler.ui.level = :silent +require "json" require "uri" require "cgi" require "set" @@ -28,6 +29,7 @@ require "ruby_lsp/utils" require "ruby_lsp/static_docs" require "ruby_lsp/scope" +require "ruby_lsp/client_capabilities" require "ruby_lsp/global_state" require "ruby_lsp/server" require "ruby_lsp/type_inferrer" diff --git a/lib/ruby_lsp/listeners/completion.rb b/lib/ruby_lsp/listeners/completion.rb index 5c379267f7..ea4c71fe24 100644 --- a/lib/ruby_lsp/listeners/completion.rb +++ b/lib/ruby_lsp/listeners/completion.rb @@ -85,6 +85,12 @@ def initialize( # rubocop:disable Metrics/ParameterLists :on_constant_path_node_enter, :on_constant_read_node_enter, :on_call_node_enter, + :on_global_variable_and_write_node_enter, + :on_global_variable_operator_write_node_enter, + :on_global_variable_or_write_node_enter, + :on_global_variable_read_node_enter, + :on_global_variable_target_node_enter, + :on_global_variable_write_node_enter, :on_instance_variable_read_node_enter, :on_instance_variable_write_node_enter, :on_instance_variable_and_write_node_enter, @@ -180,6 +186,36 @@ def on_call_node_enter(node) end end + sig { params(node: Prism::GlobalVariableAndWriteNode).void } + def on_global_variable_and_write_node_enter(node) + handle_global_variable_completion(node.name.to_s, node.name_loc) + end + + sig { params(node: Prism::GlobalVariableOperatorWriteNode).void } + def on_global_variable_operator_write_node_enter(node) + handle_global_variable_completion(node.name.to_s, node.name_loc) + end + + sig { params(node: Prism::GlobalVariableOrWriteNode).void } + def on_global_variable_or_write_node_enter(node) + handle_global_variable_completion(node.name.to_s, node.name_loc) + end + + sig { params(node: Prism::GlobalVariableReadNode).void } + def on_global_variable_read_node_enter(node) + handle_global_variable_completion(node.name.to_s, node.location) + end + + sig { params(node: Prism::GlobalVariableTargetNode).void } + def on_global_variable_target_node_enter(node) + handle_global_variable_completion(node.name.to_s, node.location) + end + + sig { params(node: Prism::GlobalVariableWriteNode).void } + def on_global_variable_write_node_enter(node) + handle_global_variable_completion(node.name.to_s, node.name_loc) + end + sig { params(node: Prism::InstanceVariableReadNode).void } def on_instance_variable_read_node_enter(node) handle_instance_variable_completion(node.name.to_s, node.location) @@ -267,6 +303,29 @@ def constant_path_completion(name, range) end end + sig { params(name: String, location: Prism::Location).void } + def handle_global_variable_completion(name, location) + candidates = @index.prefix_search(name) + + return if candidates.none? + + range = range_from_location(location) + + candidates.flatten.uniq(&:name).each do |entry| + entry_name = entry.name + + @response_builder << Interface::CompletionItem.new( + label: entry_name, + filter_text: entry_name, + label_details: Interface::CompletionItemLabelDetails.new( + description: entry.file_name, + ), + text_edit: Interface::TextEdit.new(range: range, new_text: entry_name), + kind: Constant::CompletionItemKind::VARIABLE, + ) + end + end + sig { params(name: String, location: Prism::Location).void } def handle_instance_variable_completion(name, location) # Sorbet enforces that all instance variables be declared on typed strict or higher, which means it will be able @@ -381,8 +440,11 @@ def complete_methods(node, name) return unless range guessed_type = type.is_a?(TypeInferrer::GuessedType) && type.name + external_references = @node_context.fully_qualified_name != type.name @index.method_completion_candidates(method_name, type.name).each do |entry| + next if entry.visibility != RubyIndexer::Entry::Visibility::PUBLIC && external_references + entry_name = entry.name owner_name = entry.owner&.name diff --git a/lib/ruby_lsp/listeners/definition.rb b/lib/ruby_lsp/listeners/definition.rb index fce061e38d..6413cdabe0 100644 --- a/lib/ruby_lsp/listeners/definition.rb +++ b/lib/ruby_lsp/listeners/definition.rb @@ -39,6 +39,12 @@ def initialize(response_builder, global_state, language_id, uri, node_context, d :on_block_argument_node_enter, :on_constant_read_node_enter, :on_constant_path_node_enter, + :on_global_variable_and_write_node_enter, + :on_global_variable_operator_write_node_enter, + :on_global_variable_or_write_node_enter, + :on_global_variable_read_node_enter, + :on_global_variable_target_node_enter, + :on_global_variable_write_node_enter, :on_instance_variable_read_node_enter, :on_instance_variable_write_node_enter, :on_instance_variable_and_write_node_enter, @@ -120,6 +126,36 @@ def on_constant_read_node_enter(node) find_in_index(name) end + sig { params(node: Prism::GlobalVariableAndWriteNode).void } + def on_global_variable_and_write_node_enter(node) + handle_global_variable_definition(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableOperatorWriteNode).void } + def on_global_variable_operator_write_node_enter(node) + handle_global_variable_definition(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableOrWriteNode).void } + def on_global_variable_or_write_node_enter(node) + handle_global_variable_definition(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableReadNode).void } + def on_global_variable_read_node_enter(node) + handle_global_variable_definition(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableTargetNode).void } + def on_global_variable_target_node_enter(node) + handle_global_variable_definition(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableWriteNode).void } + def on_global_variable_write_node_enter(node) + handle_global_variable_definition(node.name.to_s) + end + sig { params(node: Prism::InstanceVariableReadNode).void } def on_instance_variable_read_node_enter(node) handle_instance_variable_definition(node.name.to_s) @@ -177,6 +213,25 @@ def handle_super_node_definition ) end + sig { params(name: String).void } + def handle_global_variable_definition(name) + entries = @index[name] + + return unless entries + + entries.each do |entry| + location = entry.location + + @response_builder << Interface::Location.new( + uri: URI::Generic.from_path(path: entry.file_path).to_s, + range: Interface::Range.new( + start: Interface::Position.new(line: location.start_line - 1, character: location.start_column), + end: Interface::Position.new(line: location.end_line - 1, character: location.end_column), + ), + ) + end + end + sig { params(name: String).void } def handle_instance_variable_definition(name) # Sorbet enforces that all instance variables be declared on typed strict or higher, which means it will be able diff --git a/lib/ruby_lsp/listeners/document_highlight.rb b/lib/ruby_lsp/listeners/document_highlight.rb index 3757bb743e..551de5dffc 100644 --- a/lib/ruby_lsp/listeners/document_highlight.rb +++ b/lib/ruby_lsp/listeners/document_highlight.rb @@ -92,14 +92,15 @@ class DocumentHighlight target: T.nilable(Prism::Node), parent: T.nilable(Prism::Node), dispatcher: Prism::Dispatcher, + position: T::Hash[Symbol, T.untyped], ).void end - def initialize(response_builder, target, parent, dispatcher) + def initialize(response_builder, target, parent, dispatcher, position) @response_builder = response_builder return unless target && parent - highlight_target = + highlight_target, highlight_target_value = case target when Prism::GlobalVariableReadNode, Prism::GlobalVariableAndWriteNode, Prism::GlobalVariableOperatorWriteNode, Prism::GlobalVariableOrWriteNode, Prism::GlobalVariableTargetNode, Prism::GlobalVariableWriteNode, @@ -116,13 +117,17 @@ def initialize(response_builder, target, parent, dispatcher) Prism::CallNode, Prism::BlockParameterNode, Prism::RequiredKeywordParameterNode, Prism::RequiredKeywordParameterNode, Prism::KeywordRestParameterNode, Prism::OptionalParameterNode, Prism::RequiredParameterNode, Prism::RestParameterNode + [target, node_value(target)] + when Prism::ModuleNode, Prism::ClassNode, Prism::SingletonClassNode, Prism::DefNode, Prism::CaseNode, + Prism::WhileNode, Prism::UntilNode, Prism::ForNode, Prism::IfNode, Prism::UnlessNode target end @target = T.let(highlight_target, T.nilable(Prism::Node)) - @target_value = T.let(node_value(highlight_target), T.nilable(String)) + @target_value = T.let(highlight_target_value, T.nilable(String)) + @target_position = position - if @target && @target_value + if @target dispatcher.register( self, :on_call_node_enter, @@ -172,6 +177,13 @@ def initialize(response_builder, target, parent, dispatcher) :on_global_variable_or_write_node_enter, :on_global_variable_and_write_node_enter, :on_global_variable_operator_write_node_enter, + :on_singleton_class_node_enter, + :on_case_node_enter, + :on_while_node_enter, + :on_until_node_enter, + :on_for_node_enter, + :on_if_node_enter, + :on_unless_node_enter, ) end end @@ -189,6 +201,8 @@ def on_call_node_enter(node) sig { params(node: Prism::DefNode).void } def on_def_node_enter(node) + add_matching_end_highlights(node.def_keyword_loc, node.end_keyword_loc) if @target.is_a?(Prism::DefNode) + return unless matches?(node, [Prism::CallNode, Prism::DefNode]) add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc) @@ -252,6 +266,8 @@ def on_required_parameter_node_enter(node) sig { params(node: Prism::ClassNode).void } def on_class_node_enter(node) + add_matching_end_highlights(node.class_keyword_loc, node.end_keyword_loc) if @target.is_a?(Prism::ClassNode) + return unless matches?(node, CONSTANT_NODES + CONSTANT_PATH_NODES + [Prism::ClassNode]) add_highlight(Constant::DocumentHighlightKind::WRITE, node.constant_path.location) @@ -259,6 +275,8 @@ def on_class_node_enter(node) sig { params(node: Prism::ModuleNode).void } def on_module_node_enter(node) + add_matching_end_highlights(node.module_keyword_loc, node.end_keyword_loc) if @target.is_a?(Prism::ModuleNode) + return unless matches?(node, CONSTANT_NODES + CONSTANT_PATH_NODES + [Prism::ModuleNode]) add_highlight(Constant::DocumentHighlightKind::WRITE, node.constant_path.location) @@ -511,6 +529,55 @@ def on_global_variable_operator_write_node_enter(node) add_highlight(Constant::DocumentHighlightKind::WRITE, node.name_loc) end + sig { params(node: Prism::SingletonClassNode).void } + def on_singleton_class_node_enter(node) + return unless @target.is_a?(Prism::SingletonClassNode) + + add_matching_end_highlights(node.class_keyword_loc, node.end_keyword_loc) + end + + sig { params(node: Prism::CaseNode).void } + def on_case_node_enter(node) + return unless @target.is_a?(Prism::CaseNode) + + add_matching_end_highlights(node.case_keyword_loc, node.end_keyword_loc) + end + + sig { params(node: Prism::WhileNode).void } + def on_while_node_enter(node) + return unless @target.is_a?(Prism::WhileNode) + + add_matching_end_highlights(node.keyword_loc, node.closing_loc) + end + + sig { params(node: Prism::UntilNode).void } + def on_until_node_enter(node) + return unless @target.is_a?(Prism::UntilNode) + + add_matching_end_highlights(node.keyword_loc, node.closing_loc) + end + + sig { params(node: Prism::ForNode).void } + def on_for_node_enter(node) + return unless @target.is_a?(Prism::ForNode) + + add_matching_end_highlights(node.for_keyword_loc, node.end_keyword_loc) + end + + sig { params(node: Prism::IfNode).void } + def on_if_node_enter(node) + return unless @target.is_a?(Prism::IfNode) + + add_matching_end_highlights(node.if_keyword_loc, node.end_keyword_loc) + end + + sig { params(node: Prism::UnlessNode).void } + def on_unless_node_enter(node) + return unless @target.is_a?(Prism::UnlessNode) + + add_matching_end_highlights(node.keyword_loc, node.end_keyword_loc) + end + private sig { params(node: Prism::Node, classes: T::Array[T.class_of(Prism::Node)]).returns(T.nilable(T::Boolean)) } @@ -550,6 +617,26 @@ def node_value(node) node.constant_path.slice end end + + sig { params(keyword_loc: T.nilable(Prism::Location), end_loc: T.nilable(Prism::Location)).void } + def add_matching_end_highlights(keyword_loc, end_loc) + return unless keyword_loc && end_loc && end_loc.length.positive? + return unless covers_target_position?(keyword_loc) || covers_target_position?(end_loc) + + add_highlight(Constant::DocumentHighlightKind::TEXT, keyword_loc) + add_highlight(Constant::DocumentHighlightKind::TEXT, end_loc) + end + + sig { params(location: Prism::Location).returns(T::Boolean) } + def covers_target_position?(location) + start_line = location.start_line - 1 + end_line = location.end_line - 1 + start_covered = start_line < @target_position[:line] || + (start_line == @target_position[:line] && location.start_column <= @target_position[:character]) + end_covered = end_line > @target_position[:line] || + (end_line == @target_position[:line] && location.end_column >= @target_position[:character]) + start_covered && end_covered + end end end end diff --git a/lib/ruby_lsp/listeners/folding_ranges.rb b/lib/ruby_lsp/listeners/folding_ranges.rb index 546a45db3e..bc3c49b1c2 100644 --- a/lib/ruby_lsp/listeners/folding_ranges.rb +++ b/lib/ruby_lsp/listeners/folding_ranges.rb @@ -239,10 +239,10 @@ def add_statements_range(node) statements = node.statements return unless statements - body = statements.body - return if body.empty? + statement = statements.body.last + return unless statement - add_lines_range(node.location.start_line, body.last.location.end_line) + add_lines_range(node.location.start_line, statement.location.end_line) end sig { params(node: Prism::Node).void } diff --git a/lib/ruby_lsp/listeners/hover.rb b/lib/ruby_lsp/listeners/hover.rb index ecfda3a7ee..5d1220f579 100644 --- a/lib/ruby_lsp/listeners/hover.rb +++ b/lib/ruby_lsp/listeners/hover.rb @@ -13,6 +13,12 @@ class Hover Prism::ConstantReadNode, Prism::ConstantWriteNode, Prism::ConstantPathNode, + Prism::GlobalVariableAndWriteNode, + Prism::GlobalVariableOperatorWriteNode, + Prism::GlobalVariableOrWriteNode, + Prism::GlobalVariableReadNode, + Prism::GlobalVariableTargetNode, + Prism::GlobalVariableWriteNode, Prism::InstanceVariableReadNode, Prism::InstanceVariableAndWriteNode, Prism::InstanceVariableOperatorWriteNode, @@ -62,6 +68,12 @@ def initialize(response_builder, global_state, uri, node_context, dispatcher, so :on_constant_write_node_enter, :on_constant_path_node_enter, :on_call_node_enter, + :on_global_variable_and_write_node_enter, + :on_global_variable_operator_write_node_enter, + :on_global_variable_or_write_node_enter, + :on_global_variable_read_node_enter, + :on_global_variable_target_node_enter, + :on_global_variable_write_node_enter, :on_instance_variable_read_node_enter, :on_instance_variable_write_node_enter, :on_instance_variable_and_write_node_enter, @@ -128,6 +140,36 @@ def on_call_node_enter(node) handle_method_hover(message) end + sig { params(node: Prism::GlobalVariableAndWriteNode).void } + def on_global_variable_and_write_node_enter(node) + handle_global_variable_hover(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableOperatorWriteNode).void } + def on_global_variable_operator_write_node_enter(node) + handle_global_variable_hover(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableOrWriteNode).void } + def on_global_variable_or_write_node_enter(node) + handle_global_variable_hover(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableReadNode).void } + def on_global_variable_read_node_enter(node) + handle_global_variable_hover(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableTargetNode).void } + def on_global_variable_target_node_enter(node) + handle_global_variable_hover(node.name.to_s) + end + + sig { params(node: Prism::GlobalVariableWriteNode).void } + def on_global_variable_write_node_enter(node) + handle_global_variable_hover(node.name.to_s) + end + sig { params(node: Prism::InstanceVariableReadNode).void } def on_instance_variable_read_node_enter(node) handle_instance_variable_hover(node.name.to_s) @@ -265,6 +307,16 @@ def handle_instance_variable_hover(name) # If by any chance we haven't indexed the owner, then there's no way to find the right declaration end + sig { params(name: String).void } + def handle_global_variable_hover(name) + entries = @index[name] + return unless entries + + categorized_markdown_from_index_entries(name, entries).each do |category, content| + @response_builder.push(content, category: category) + end + end + sig { params(name: String, location: Prism::Location).void } def generate_hover(name, location) entries = @index.resolve(name, @node_context.nesting) diff --git a/lib/ruby_lsp/requests/code_action_resolve.rb b/lib/ruby_lsp/requests/code_action_resolve.rb index 9d7a342e22..78b545db1a 100644 --- a/lib/ruby_lsp/requests/code_action_resolve.rb +++ b/lib/ruby_lsp/requests/code_action_resolve.rb @@ -99,7 +99,13 @@ def refactor_variable # Find the closest statements node, so that we place the refactor in a valid position node_context = RubyDocument - .locate(@document.parse_result.value, start_index, node_types: [Prism::StatementsNode, Prism::BlockNode]) + .locate(@document.parse_result.value, + start_index, + node_types: [ + Prism::StatementsNode, + Prism::BlockNode, + ], + code_units_cache: @document.code_units_cache) closest_statements = node_context.node parent_statements = node_context.parent @@ -115,7 +121,7 @@ def refactor_variable return Error::InvalidTargetRange if closest_node.is_a?(Prism::MissingNode) closest_node_loc = closest_node.location - # If the parent expression is a single line block, then we have to extract it inside of the oneline block + # If the parent expression is a single line block, then we have to extract it inside of the one-line block if parent_statements.is_a?(Prism::BlockNode) && parent_statements.location.start_line == parent_statements.location.end_line @@ -196,7 +202,7 @@ def refactor_method @document.parse_result.value, start_index, node_types: [Prism::DefNode], - encoding: @global_state.encoding, + code_units_cache: @document.code_units_cache, ) closest_node = node_context.node return Error::InvalidTargetRange unless closest_node diff --git a/lib/ruby_lsp/requests/completion.rb b/lib/ruby_lsp/requests/completion.rb index 632c7ac302..5ed77c0dff 100644 --- a/lib/ruby_lsp/requests/completion.rb +++ b/lib/ruby_lsp/requests/completion.rb @@ -17,7 +17,7 @@ class << self def provider Interface::CompletionOptions.new( resolve_provider: true, - trigger_characters: ["/", "\"", "'", ":", "@", ".", "=", "<"], + trigger_characters: ["/", "\"", "'", ":", "@", ".", "=", "<", "$"], completion_item: { labelDetailsSupport: true, }, @@ -50,6 +50,12 @@ def initialize(document, global_state, params, sorbet_level, dispatcher) Prism::CallNode, Prism::ConstantReadNode, Prism::ConstantPathNode, + Prism::GlobalVariableAndWriteNode, + Prism::GlobalVariableOperatorWriteNode, + Prism::GlobalVariableOrWriteNode, + Prism::GlobalVariableReadNode, + Prism::GlobalVariableTargetNode, + Prism::GlobalVariableWriteNode, Prism::InstanceVariableReadNode, Prism::InstanceVariableAndWriteNode, Prism::InstanceVariableOperatorWriteNode, @@ -57,7 +63,7 @@ def initialize(document, global_state, params, sorbet_level, dispatcher) Prism::InstanceVariableTargetNode, Prism::InstanceVariableWriteNode, ], - encoding: global_state.encoding, + code_units_cache: document.code_units_cache, ) @response_builder = T.let( ResponseBuilders::CollectionResponseBuilder[Interface::CompletionItem].new, diff --git a/lib/ruby_lsp/requests/completion_resolve.rb b/lib/ruby_lsp/requests/completion_resolve.rb index f8248bd7e7..39589443fa 100644 --- a/lib/ruby_lsp/requests/completion_resolve.rb +++ b/lib/ruby_lsp/requests/completion_resolve.rb @@ -34,7 +34,7 @@ def perform # Based on the spec https://microsoft.github.io/language-server-protocol/specification#textDocument_completion, # a completion resolve request must always return the original completion item without modifying ANY fields - # other than detail and documentation (NOT labelDetails). If we modify anything, the completion behaviour might + # other than detail and documentation (NOT labelDetails). If we modify anything, the completion behavior might # be broken. # # For example, forgetting to return the `insertText` included in the original item will make the editor use the diff --git a/lib/ruby_lsp/requests/definition.rb b/lib/ruby_lsp/requests/definition.rb index 71d3a61b15..8305f0ec63 100644 --- a/lib/ruby_lsp/requests/definition.rb +++ b/lib/ruby_lsp/requests/definition.rb @@ -12,12 +12,6 @@ class Definition < Request extend T::Sig extend T::Generic - SPECIAL_METHOD_CALLS = [ - :require, - :require_relative, - :autoload, - ].freeze - sig do params( document: T.any(RubyDocument, ERBDocument), @@ -46,6 +40,12 @@ def initialize(document, global_state, position, dispatcher, sorbet_level) Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::BlockArgumentNode, + Prism::GlobalVariableAndWriteNode, + Prism::GlobalVariableOperatorWriteNode, + Prism::GlobalVariableOrWriteNode, + Prism::GlobalVariableReadNode, + Prism::GlobalVariableTargetNode, + Prism::GlobalVariableWriteNode, Prism::InstanceVariableReadNode, Prism::InstanceVariableAndWriteNode, Prism::InstanceVariableOperatorWriteNode, @@ -57,7 +57,7 @@ def initialize(document, global_state, position, dispatcher, sorbet_level) Prism::SuperNode, Prism::ForwardingSuperNode, ], - encoding: global_state.encoding, + code_units_cache: document.code_units_cache, ) target = node_context.node @@ -71,11 +71,7 @@ def initialize(document, global_state, position, dispatcher, sorbet_level) parent, position, ) - elsif target.is_a?(Prism::CallNode) && !SPECIAL_METHOD_CALLS.include?(target.message) && !covers_position?( - target.message_loc, position - ) - # If the target is a method call, we need to ensure that the requested position is exactly on top of the - # method identifier. Otherwise, we risk showing definitions for unrelated things + elsif position_outside_target?(position, target) target = nil # For methods with block arguments using symbol-to-proc elsif target.is_a?(Prism::SymbolNode) && parent.is_a?(Prism::BlockArgumentNode) @@ -106,6 +102,26 @@ def perform @dispatcher.dispatch_once(@target) if @target @response_builder.response end + + private + + sig { params(position: T::Hash[Symbol, T.untyped], target: T.nilable(Prism::Node)).returns(T::Boolean) } + def position_outside_target?(position, target) + case target + when Prism::GlobalVariableAndWriteNode, + Prism::GlobalVariableOperatorWriteNode, + Prism::GlobalVariableOrWriteNode, + Prism::GlobalVariableWriteNode, + Prism::InstanceVariableAndWriteNode, + Prism::InstanceVariableOperatorWriteNode, + Prism::InstanceVariableOrWriteNode, + Prism::InstanceVariableWriteNode + + !covers_position?(target.name_loc, position) + else + false + end + end end end end diff --git a/lib/ruby_lsp/requests/document_highlight.rb b/lib/ruby_lsp/requests/document_highlight.rb index 0639054c6e..e2d7dcb33f 100644 --- a/lib/ruby_lsp/requests/document_highlight.rb +++ b/lib/ruby_lsp/requests/document_highlight.rb @@ -28,13 +28,23 @@ def initialize(global_state, document, position, dispatcher) char_position = document.create_scanner.find_char_position(position) delegate_request_if_needed!(global_state, document, char_position) - node_context = RubyDocument.locate(document.parse_result.value, char_position, encoding: global_state.encoding) + node_context = RubyDocument.locate( + document.parse_result.value, + char_position, + code_units_cache: document.code_units_cache, + ) @response_builder = T.let( ResponseBuilders::CollectionResponseBuilder[Interface::DocumentHighlight].new, ResponseBuilders::CollectionResponseBuilder[Interface::DocumentHighlight], ) - Listeners::DocumentHighlight.new(@response_builder, node_context.node, node_context.parent, dispatcher) + Listeners::DocumentHighlight.new( + @response_builder, + node_context.node, + node_context.parent, + dispatcher, + position, + ) end sig { override.returns(T::Array[Interface::DocumentHighlight]) } diff --git a/lib/ruby_lsp/requests/document_symbol.rb b/lib/ruby_lsp/requests/document_symbol.rb index 48a882beef..da597df276 100644 --- a/lib/ruby_lsp/requests/document_symbol.rb +++ b/lib/ruby_lsp/requests/document_symbol.rb @@ -10,7 +10,8 @@ module Requests # informs the editor of all the important symbols, such as classes, variables, and methods, defined in a file. With # this information, the editor can populate breadcrumbs, file outline and allow for fuzzy symbol searches. # - # In VS Code, fuzzy symbol search can be accessed by opening the command palette and inserting an `@` symbol. + # In VS Code, symbol search known as 'Go To Symbol in Editor' and can be accessed with Ctrl/Cmd-Shift-O, + # or by opening the command palette and inserting an `@` symbol. class DocumentSymbol < Request extend T::Sig diff --git a/lib/ruby_lsp/requests/hover.rb b/lib/ruby_lsp/requests/hover.rb index c298c91873..06fe522f9a 100644 --- a/lib/ruby_lsp/requests/hover.rb +++ b/lib/ruby_lsp/requests/hover.rb @@ -41,22 +41,18 @@ def initialize(document, global_state, position, dispatcher, sorbet_level) document.parse_result.value, char_position, node_types: Listeners::Hover::ALLOWED_TARGETS, - encoding: global_state.encoding, + code_units_cache: document.code_units_cache, ) target = node_context.node parent = node_context.parent - if (Listeners::Hover::ALLOWED_TARGETS.include?(parent.class) && - !Listeners::Hover::ALLOWED_TARGETS.include?(target.class)) || - (parent.is_a?(Prism::ConstantPathNode) && target.is_a?(Prism::ConstantReadNode)) + if should_refine_target?(parent, target) target = determine_target( T.must(target), T.must(parent), position, ) - elsif target.is_a?(Prism::CallNode) && target.name != :require && target.name != :require_relative && - !covers_position?(target.message_loc, position) - + elsif position_outside_target?(position, target) target = nil end @@ -89,6 +85,28 @@ def perform ), ) end + + private + + sig { params(parent: T.nilable(Prism::Node), target: T.nilable(Prism::Node)).returns(T::Boolean) } + def should_refine_target?(parent, target) + (Listeners::Hover::ALLOWED_TARGETS.include?(parent.class) && + !Listeners::Hover::ALLOWED_TARGETS.include?(target.class)) || + (parent.is_a?(Prism::ConstantPathNode) && target.is_a?(Prism::ConstantReadNode)) + end + + sig { params(position: T::Hash[Symbol, T.untyped], target: T.nilable(Prism::Node)).returns(T::Boolean) } + def position_outside_target?(position, target) + case target + when Prism::GlobalVariableAndWriteNode, + Prism::GlobalVariableOperatorWriteNode, + Prism::GlobalVariableOrWriteNode, + Prism::GlobalVariableWriteNode + !covers_position?(target.name_loc, position) + else + false + end + end end end end diff --git a/lib/ruby_lsp/requests/range_formatting.rb b/lib/ruby_lsp/requests/range_formatting.rb index 63705d4f83..74935dcc0c 100644 --- a/lib/ruby_lsp/requests/range_formatting.rb +++ b/lib/ruby_lsp/requests/range_formatting.rb @@ -34,16 +34,18 @@ def perform ) return unless formatted_text + code_units_cache = @document.code_units_cache + [ Interface::TextEdit.new( range: Interface::Range.new( start: Interface::Position.new( line: location.start_line - 1, - character: location.start_code_units_column(@document.encoding), + character: location.cached_start_code_units_column(code_units_cache), ), end: Interface::Position.new( line: location.end_line - 1, - character: location.end_code_units_column(@document.encoding), + character: location.cached_end_code_units_column(code_units_cache), ), ), new_text: formatted_text.strip, diff --git a/lib/ruby_lsp/requests/references.rb b/lib/ruby_lsp/requests/references.rb index 8ace4d2cd9..bd7694f37a 100644 --- a/lib/ruby_lsp/requests/references.rb +++ b/lib/ruby_lsp/requests/references.rb @@ -42,7 +42,7 @@ def perform Prism::CallNode, Prism::DefNode, ], - encoding: @global_state.encoding, + code_units_cache: @document.code_units_cache, ) target = node_context.node parent = node_context.parent @@ -78,6 +78,8 @@ def perform parse_result = Prism.parse_file(path) collect_references(reference_target, parse_result, uri) + rescue Errno::EISDIR, Errno::ENOENT + # If `path` is a directory, just ignore it and continue. If the file doesn't exist, then we also ignore it. end @store.each do |_uri, document| diff --git a/lib/ruby_lsp/requests/rename.rb b/lib/ruby_lsp/requests/rename.rb index b150935a53..2de118ea48 100644 --- a/lib/ruby_lsp/requests/rename.rb +++ b/lib/ruby_lsp/requests/rename.rb @@ -37,7 +37,7 @@ def perform @document.parse_result.value, char_position, node_types: [Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::ConstantPathTargetNode], - encoding: @global_state.encoding, + code_units_cache: @document.code_units_cache, ) target = node_context.node parent = node_context.parent @@ -72,7 +72,7 @@ def perform # If the client doesn't support resource operations, such as renaming files, then we can only return the basic # text changes - unless @global_state.supported_resource_operations.include?("rename") + unless @global_state.client_capabilities.supports_rename? return Interface::WorkspaceEdit.new(changes: changes) end @@ -147,6 +147,8 @@ def collect_text_edits(target, name) parse_result = Prism.parse_file(path) edits = collect_changes(target, parse_result, name, uri) changes[uri.to_s] = edits unless edits.empty? + rescue Errno::EISDIR, Errno::ENOENT + # If `path` is a directory, just ignore it and continue. If the file doesn't exist, then we also ignore it. end @store.each do |uri, document| diff --git a/lib/ruby_lsp/requests/request.rb b/lib/ruby_lsp/requests/request.rb index c205b31966..1cdf98ee92 100644 --- a/lib/ruby_lsp/requests/request.rb +++ b/lib/ruby_lsp/requests/request.rb @@ -26,7 +26,7 @@ def perform; end ).void end def delegate_request_if_needed!(global_state, document, char_position) - if global_state.supports_request_delegation && + if global_state.client_capabilities.supports_request_delegation && document.is_a?(ERBDocument) && document.inside_host_language?(char_position) raise DelegateRequestError diff --git a/lib/ruby_lsp/requests/semantic_highlighting.rb b/lib/ruby_lsp/requests/semantic_highlighting.rb index 041b37336f..a3923fdad0 100644 --- a/lib/ruby_lsp/requests/semantic_highlighting.rb +++ b/lib/ruby_lsp/requests/semantic_highlighting.rb @@ -101,7 +101,7 @@ def initialize(global_state, dispatcher, document, previous_result_id, range: ni @range = range @result_id = T.let(SemanticHighlighting.next_result_id.to_s, String) @response_builder = T.let( - ResponseBuilders::SemanticHighlighting.new(global_state.encoding), + ResponseBuilders::SemanticHighlighting.new(document.code_units_cache), ResponseBuilders::SemanticHighlighting, ) Listeners::SemanticHighlighting.new(dispatcher, @response_builder) diff --git a/lib/ruby_lsp/requests/signature_help.rb b/lib/ruby_lsp/requests/signature_help.rb index f5451b71c9..ce8709d882 100644 --- a/lib/ruby_lsp/requests/signature_help.rb +++ b/lib/ruby_lsp/requests/signature_help.rb @@ -43,7 +43,7 @@ def initialize(document, global_state, position, context, dispatcher, sorbet_lev document.parse_result.value, char_position, node_types: [Prism::CallNode], - encoding: global_state.encoding, + code_units_cache: document.code_units_cache, ) target = adjust_for_nested_target(node_context.node, node_context.parent, position) diff --git a/lib/ruby_lsp/requests/support/common.rb b/lib/ruby_lsp/requests/support/common.rb index d875536e7d..05b6f64291 100644 --- a/lib/ruby_lsp/requests/support/common.rb +++ b/lib/ruby_lsp/requests/support/common.rb @@ -159,7 +159,7 @@ def constant_name(node) def namespace_constant_name(node) path = node.constant_path case path - when Prism::ConstantPathNode, Prism::ConstantReadNode, Prism::ConstantPathTargetNode + when Prism::ConstantPathNode, Prism::ConstantReadNode constant_name(path) end end diff --git a/lib/ruby_lsp/requests/support/rubocop_runner.rb b/lib/ruby_lsp/requests/support/rubocop_runner.rb index 40f164b6b5..238e933b3d 100644 --- a/lib/ruby_lsp/requests/support/rubocop_runner.rb +++ b/lib/ruby_lsp/requests/support/rubocop_runner.rb @@ -1,16 +1,26 @@ # typed: strict # frozen_string_literal: true +# If there's no top level Gemfile, don't load RuboCop from a global installation +begin + Bundler.with_original_env { Bundler.default_gemfile } +rescue Bundler::GemfileNotFound + return +end + +# Ensure that RuboCop is available begin require "rubocop" rescue LoadError return end +# Ensure that RuboCop is at least version 1.4.0 begin gem("rubocop", ">= 1.4.0") rescue LoadError - raise StandardError, "Incompatible RuboCop version. Ruby LSP requires >= 1.4.0" + $stderr.puts "Incompatible RuboCop version. Ruby LSP requires >= 1.4.0" + return end if RuboCop.const_defined?(:LSP) # This condition will be removed when requiring RuboCop >= 1.61. @@ -47,12 +57,6 @@ class RuboCopRunner < RuboCop::Runner class ConfigurationError < StandardError; end - sig { returns(T::Array[RuboCop::Cop::Offense]) } - attr_reader :offenses - - sig { returns(::RuboCop::Config) } - attr_reader :config_for_working_directory - DEFAULT_ARGS = T.let( [ "--stderr", # Print any output to stderr so that our stdout does not get polluted @@ -63,6 +67,12 @@ class ConfigurationError < StandardError; end T::Array[String], ) + sig { returns(T::Array[RuboCop::Cop::Offense]) } + attr_reader :offenses + + sig { returns(::RuboCop::Config) } + attr_reader :config_for_working_directory + begin RuboCop::Options.new.parse(["--raise-cop-error"]) DEFAULT_ARGS << "--raise-cop-error" diff --git a/lib/ruby_lsp/response_builders/document_symbol.rb b/lib/ruby_lsp/response_builders/document_symbol.rb index 00a1354b66..167dca70e0 100644 --- a/lib/ruby_lsp/response_builders/document_symbol.rb +++ b/lib/ruby_lsp/response_builders/document_symbol.rb @@ -4,6 +4,8 @@ module RubyLsp module ResponseBuilders class DocumentSymbol < ResponseBuilder + extend T::Sig + ResponseType = type_member { { fixed: T::Array[Interface::DocumentSymbol] } } class SymbolHierarchyRoot @@ -18,8 +20,6 @@ def initialize end end - extend T::Sig - sig { void } def initialize super diff --git a/lib/ruby_lsp/response_builders/hover.rb b/lib/ruby_lsp/response_builders/hover.rb index d2809f0555..8b03fe13aa 100644 --- a/lib/ruby_lsp/response_builders/hover.rb +++ b/lib/ruby_lsp/response_builders/hover.rb @@ -4,11 +4,11 @@ module RubyLsp module ResponseBuilders class Hover < ResponseBuilder - ResponseType = type_member { { fixed: String } } - extend T::Sig extend T::Generic + ResponseType = type_member { { fixed: String } } + sig { void } def initialize super diff --git a/lib/ruby_lsp/response_builders/semantic_highlighting.rb b/lib/ruby_lsp/response_builders/semantic_highlighting.rb index c7354464be..dd631ba043 100644 --- a/lib/ruby_lsp/response_builders/semantic_highlighting.rb +++ b/lib/ruby_lsp/response_builders/semantic_highlighting.rb @@ -6,6 +6,8 @@ module ResponseBuilders class SemanticHighlighting < ResponseBuilder class UndefinedTokenType < StandardError; end + extend T::Sig + TOKEN_TYPES = T.let( { namespace: 0, @@ -51,25 +53,29 @@ class UndefinedTokenType < StandardError; end T::Hash[Symbol, Integer], ) - extend T::Sig - ResponseType = type_member { { fixed: Interface::SemanticTokens } } - sig { params(encoding: Encoding).void } - def initialize(encoding) + sig do + params(code_units_cache: T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + )).void + end + def initialize(code_units_cache) super() - @encoding = encoding + @code_units_cache = code_units_cache @stack = T.let([], T::Array[SemanticToken]) end sig { params(location: Prism::Location, type: Symbol, modifiers: T::Array[Symbol]).void } def add_token(location, type, modifiers = []) - length = location.end_code_units_offset(@encoding) - location.start_code_units_offset(@encoding) + end_code_unit = location.cached_end_code_units_offset(@code_units_cache) + length = end_code_unit - location.cached_start_code_units_offset(@code_units_cache) modifiers_indices = modifiers.filter_map { |modifier| TOKEN_MODIFIERS[modifier] } @stack.push( SemanticToken.new( start_line: location.start_line, - start_code_unit_column: location.start_code_units_column(@encoding), + start_code_unit_column: location.cached_start_code_units_column(@code_units_cache), length: length, type: T.must(TOKEN_TYPES[type]), modifier: modifiers_indices, @@ -83,7 +89,7 @@ def last_token_matches?(location) return false unless token token.start_line == location.start_line && - token.start_code_unit_column == location.start_code_units_column(@encoding) + token.start_code_unit_column == location.cached_start_code_units_column(@code_units_cache) end sig { returns(T.nilable(SemanticToken)) } diff --git a/lib/ruby_lsp/response_builders/signature_help.rb b/lib/ruby_lsp/response_builders/signature_help.rb index b1f9d0775c..f6cdbf9de4 100644 --- a/lib/ruby_lsp/response_builders/signature_help.rb +++ b/lib/ruby_lsp/response_builders/signature_help.rb @@ -4,10 +4,10 @@ module RubyLsp module ResponseBuilders class SignatureHelp < ResponseBuilder - ResponseType = type_member { { fixed: T.nilable(Interface::SignatureHelp) } } - extend T::Sig + ResponseType = type_member { { fixed: T.nilable(Interface::SignatureHelp) } } + sig { void } def initialize super diff --git a/lib/ruby_lsp/ruby_document.rb b/lib/ruby_lsp/ruby_document.rb index 5bddb1ae87..4cde7e6568 100644 --- a/lib/ruby_lsp/ruby_document.rb +++ b/lib/ruby_lsp/ruby_document.rb @@ -25,11 +25,14 @@ class << self params( node: Prism::Node, char_position: Integer, + code_units_cache: T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + ), node_types: T::Array[T.class_of(Prism::Node)], - encoding: Encoding, ).returns(NodeContext) end - def locate(node, char_position, node_types: [], encoding: Encoding::UTF_8) + def locate(node, char_position, code_units_cache:, node_types: []) queue = T.let(node.child_nodes.compact, T::Array[T.nilable(Prism::Node)]) closest = node parent = T.let(nil, T.nilable(Prism::Node)) @@ -62,8 +65,8 @@ def locate(node, char_position, node_types: [], encoding: Encoding::UTF_8) # Skip if the current node doesn't cover the desired position loc = candidate.location - loc_start_offset = loc.start_code_units_offset(encoding) - loc_end_offset = loc.end_code_units_offset(encoding) + loc_start_offset = loc.cached_start_code_units_offset(code_units_cache) + loc_end_offset = loc.cached_end_code_units_offset(code_units_cache) next unless (loc_start_offset...loc_end_offset).cover?(char_position) # If the node's start character is already past the position, then we should've found the closest node @@ -74,7 +77,7 @@ def locate(node, char_position, node_types: [], encoding: Encoding::UTF_8) # and need to pop the stack previous_level = nesting_nodes.last if previous_level && - (loc_start_offset > previous_level.location.end_code_units_offset(encoding)) + (loc_start_offset > previous_level.location.cached_end_code_units_offset(code_units_cache)) nesting_nodes.pop end @@ -89,10 +92,10 @@ def locate(node, char_position, node_types: [], encoding: Encoding::UTF_8) if candidate.is_a?(Prism::CallNode) arg_loc = candidate.arguments&.location blk_loc = candidate.block&.location - if (arg_loc && (arg_loc.start_code_units_offset(encoding)... - arg_loc.end_code_units_offset(encoding)).cover?(char_position)) || - (blk_loc && (blk_loc.start_code_units_offset(encoding)... - blk_loc.end_code_units_offset(encoding)).cover?(char_position)) + if (arg_loc && (arg_loc.cached_start_code_units_offset(code_units_cache)... + arg_loc.cached_end_code_units_offset(code_units_cache)).cover?(char_position)) || + (blk_loc && (blk_loc.cached_start_code_units_offset(code_units_cache)... + blk_loc.cached_end_code_units_offset(code_units_cache)).cover?(char_position)) call_node = candidate end end @@ -102,8 +105,8 @@ def locate(node, char_position, node_types: [], encoding: Encoding::UTF_8) # If the current node is narrower than or equal to the previous closest node, then it is more precise closest_loc = closest.location - closest_node_start_offset = closest_loc.start_code_units_offset(encoding) - closest_node_end_offset = closest_loc.end_code_units_offset(encoding) + closest_node_start_offset = closest_loc.cached_start_code_units_offset(code_units_cache) + closest_node_end_offset = closest_loc.cached_end_code_units_offset(code_units_cache) if loc_end_offset - loc_start_offset <= closest_node_end_offset - closest_node_start_offset parent = closest closest = candidate @@ -131,12 +134,30 @@ def locate(node, char_position, node_types: [], encoding: Encoding::UTF_8) end end + sig do + returns(T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + )) + end + attr_reader :code_units_cache + + sig { params(source: String, version: Integer, uri: URI::Generic, encoding: Encoding).void } + def initialize(source:, version:, uri:, encoding: Encoding::UTF_8) + super + @code_units_cache = T.let(@parse_result.code_units_cache(@encoding), T.any( + T.proc.params(arg0: Integer).returns(Integer), + Prism::CodeUnitsCache, + )) + end + sig { override.returns(T::Boolean) } def parse! return false unless @needs_parsing @needs_parsing = false @parse_result = Prism.parse(@source) + @code_units_cache = @parse_result.code_units_cache(@encoding) true end @@ -214,8 +235,8 @@ def locate_node(position, node_types: []) RubyDocument.locate( @parse_result.value, create_scanner.find_char_position(position), + code_units_cache: @code_units_cache, node_types: node_types, - encoding: @encoding, ) end end diff --git a/lib/ruby_lsp/scripts/compose_bundle.rb b/lib/ruby_lsp/scripts/compose_bundle.rb new file mode 100644 index 0000000000..ef58b16ef8 --- /dev/null +++ b/lib/ruby_lsp/scripts/compose_bundle.rb @@ -0,0 +1,20 @@ +# typed: true +# frozen_string_literal: true + +def compose(raw_initialize) + require_relative "../setup_bundler" + require "json" + require "uri" + require_relative "../../core_ext/uri" + + initialize_request = JSON.parse(raw_initialize, symbolize_names: true) + workspace_uri = initialize_request.dig(:params, :workspaceFolders, 0, :uri) + workspace_path = workspace_uri && URI(workspace_uri).to_standardized_path + workspace_path ||= Dir.pwd + + env = RubyLsp::SetupBundler.new(workspace_path, launcher: true).setup! + File.write( + File.join(".ruby-lsp", "bundle_env"), + env.map { |k, v| "#{k}=#{v}" }.join("\n"), + ) +end diff --git a/lib/ruby_lsp/scripts/compose_bundle_windows.rb b/lib/ruby_lsp/scripts/compose_bundle_windows.rb new file mode 100644 index 0000000000..3bdc94115a --- /dev/null +++ b/lib/ruby_lsp/scripts/compose_bundle_windows.rb @@ -0,0 +1,8 @@ +# typed: strict +# frozen_string_literal: true + +require_relative "compose_bundle" + +# When this is invoked on Windows, we pass the raw initialize as an argument to this script. On other platforms, we +# invoke the compose method from inside a forked process +compose(ARGV.first) diff --git a/lib/ruby_lsp/server.rb b/lib/ruby_lsp/server.rb index 3bf01022a0..83eaf2a058 100644 --- a/lib/ruby_lsp/server.rb +++ b/lib/ruby_lsp/server.rb @@ -106,6 +106,8 @@ def process_message(message) ) when "$/cancelRequest" @mutex.synchronize { @cancelled_requests << message[:params][:id] } + when nil + process_response(message) if message[:result] end rescue DelegateRequestError send_message(Error.new(id: message[:id], code: DelegateRequestError::CODE, message: "DELEGATE_REQUEST")) @@ -138,8 +140,22 @@ def process_message(message) send_log_message("Error processing #{message[:method]}: #{e.full_message}", type: Constant::MessageType::ERROR) end + # Process responses to requests that were sent to the client + sig { params(message: T::Hash[Symbol, T.untyped]).void } + def process_response(message) + case message.dig(:result, :method) + when "window/showMessageRequest" + window_show_message_request(message) + end + end + sig { params(include_project_addons: T::Boolean).void } def load_addons(include_project_addons: true) + # If invoking Bundler.setup failed, then the load path will not be configured properly and trying to load add-ons + # with Gem.find_files will find every single version installed of an add-on, leading to requiring several + # different versions of the same files. We cannot load add-ons if Bundler.setup failed + return if @setup_error + errors = Addon.load_addons(@global_state, @outgoing_queue, include_project_addons: include_project_addons) if errors.any? @@ -181,8 +197,6 @@ def run_initialize(message) client_name = options.dig(:clientInfo, :name) @store.client_name = client_name if client_name - progress = options.dig(:capabilities, :window, :workDoneProgress) - @store.supports_progress = progress.nil? ? true : progress configured_features = options.dig(:initializationOptions, :enabledFeatures) configured_hints = options.dig(:initializationOptions, :featuresConfiguration, :inlayHint) @@ -254,12 +268,13 @@ def run_initialize(message) version: VERSION, }, formatter: @global_state.formatter, + degraded_mode: !!(@install_error || @setup_error), } send_message(Result.new(id: message[:id], response: response)) # Not every client supports dynamic registration or file watching - if global_state.supports_watching_files + if @global_state.client_capabilities.supports_watching_files send_message( Request.new( id: @current_request_id, @@ -290,6 +305,24 @@ def run_initialize(message) begin_progress("indexing-progress", "Ruby LSP: indexing files") global_state_notifications.each { |notification| send_message(notification) } + + if @setup_error + send_message(Notification.telemetry( + type: "error", + errorMessage: @setup_error.message, + errorClass: @setup_error.class, + stack: @setup_error.backtrace&.join("\n"), + )) + end + + if @install_error + send_message(Notification.telemetry( + type: "error", + errorMessage: @install_error.message, + errorClass: @install_error.class, + stack: @install_error.backtrace&.join("\n"), + )) + end end sig { void } @@ -297,20 +330,22 @@ def run_initialized load_addons RubyVM::YJIT.enable if defined?(RubyVM::YJIT.enable) - if defined?(Requests::Support::RuboCopFormatter) - begin - @global_state.register_formatter("rubocop", Requests::Support::RuboCopFormatter.new) - rescue RuboCop::Error => e - # The user may have provided unknown config switches in .rubocop or - # is trying to load a non-existant config file. - send_message(Notification.window_show_message( - "RuboCop configuration error: #{e.message}. Formatting will not be available.", - type: Constant::MessageType::ERROR, - )) + unless @setup_error + if defined?(Requests::Support::RuboCopFormatter) + begin + @global_state.register_formatter("rubocop", Requests::Support::RuboCopFormatter.new) + rescue RuboCop::Error => e + # The user may have provided unknown config switches in .rubocop or + # is trying to load a non-existent config file. + send_message(Notification.window_show_message( + "RuboCop configuration error: #{e.message}. Formatting will not be available.", + type: Constant::MessageType::ERROR, + )) + end + end + if defined?(Requests::Support::SyntaxTreeFormatter) + @global_state.register_formatter("syntax_tree", Requests::Support::SyntaxTreeFormatter.new) end - end - if defined?(Requests::Support::SyntaxTreeFormatter) - @global_state.register_formatter("syntax_tree", Requests::Support::SyntaxTreeFormatter.new) end perform_initial_indexing @@ -1017,7 +1052,7 @@ def type_hierarchy_subtypes(message) sig { params(message: T::Hash[Symbol, T.untyped]).void } def workspace_dependencies(message) - response = begin + response = if @global_state.top_level_bundle Bundler.with_original_env do definition = Bundler.definition dep_keys = definition.locked_deps.keys.to_set @@ -1031,7 +1066,7 @@ def workspace_dependencies(message) } end end - rescue Bundler::GemfileNotFound + else [] end @@ -1077,7 +1112,7 @@ def perform_initial_indexing sig { params(id: String, title: String, percentage: Integer).void } def begin_progress(id, title, percentage: 0) - return unless @store.supports_progress + return unless @global_state.client_capabilities.supports_progress send_message(Request.new( id: @current_request_id, @@ -1085,52 +1120,21 @@ def begin_progress(id, title, percentage: 0) params: Interface::WorkDoneProgressCreateParams.new(token: id), )) - send_message(Notification.new( - method: "$/progress", - params: Interface::ProgressParams.new( - token: id, - value: Interface::WorkDoneProgressBegin.new( - kind: "begin", - title: title, - percentage: percentage, - message: "#{percentage}% completed", - ), - ), - )) + send_message(Notification.progress_begin(id, title, percentage: percentage, message: "#{percentage}% completed")) end sig { params(id: String, percentage: Integer).void } def progress(id, percentage) - return unless @store.supports_progress + return unless @global_state.client_capabilities.supports_progress - send_message( - Notification.new( - method: "$/progress", - params: Interface::ProgressParams.new( - token: id, - value: Interface::WorkDoneProgressReport.new( - kind: "report", - percentage: percentage, - message: "#{percentage}% completed", - ), - ), - ), - ) + send_message(Notification.progress_report(id, percentage: percentage, message: "#{percentage}% completed")) end sig { params(id: String).void } def end_progress(id) - return unless @store.supports_progress + return unless @global_state.client_capabilities.supports_progress - send_message( - Notification.new( - method: "$/progress", - params: Interface::ProgressParams.new( - token: id, - value: Interface::WorkDoneProgressEnd.new(kind: "end"), - ), - ), - ) + send_message(Notification.progress_end(id)) rescue ClosedQueueError # If the server was killed and the message queue is already closed, there's no way to end the progress # notification @@ -1138,6 +1142,7 @@ def end_progress(id) sig { void } def check_formatter_is_available + return if @setup_error # Warn of an unavailable `formatter` setting, e.g. `rubocop` on a project which doesn't have RuboCop. # Syntax Tree will always be available via Ruby LSP so we don't need to check for it. return unless @global_state.formatter == "rubocop" @@ -1194,5 +1199,17 @@ def process_indexing_configuration(indexing_options) # The index expects snake case configurations, but VS Code standardizes on camel case settings configuration.apply_config(indexing_options.transform_keys { |key| key.to_s.gsub(/([A-Z])/, "_\\1").downcase }) end + + sig { params(message: T::Hash[Symbol, T.untyped]).void } + def window_show_message_request(message) + result = message[:result] + return unless result + + addon_name = result[:addon_name] + addon = Addon.addons.find { |addon| addon.name == addon_name } + return unless addon + + addon.handle_window_show_message_response(result[:title]) + end end end diff --git a/lib/ruby_lsp/setup_bundler.rb b/lib/ruby_lsp/setup_bundler.rb index 4af480055a..769dfe7578 100644 --- a/lib/ruby_lsp/setup_bundler.rb +++ b/lib/ruby_lsp/setup_bundler.rb @@ -3,10 +3,14 @@ require "sorbet-runtime" require "bundler" +require "bundler/cli" +require "bundler/cli/install" +require "bundler/cli/update" require "fileutils" require "pathname" require "digest" require "time" +require "uri" # This file is a script that will configure a custom bundle for the Ruby LSP. The custom bundle allows developers to use # the Ruby LSP without including the gem in their application's Gemfile while at the same time giving us access to the @@ -27,6 +31,8 @@ class BundleInstallFailure < StandardError; end def initialize(project_path, **options) @project_path = project_path @branch = T.let(options[:branch], T.nilable(String)) + @launcher = T.let(options[:launcher], T.nilable(T::Boolean)) + patch_thor_to_print_progress_to_stderr! if @launcher # Regular bundle paths @gemfile = T.let( @@ -47,8 +53,11 @@ def initialize(project_path, **options) @custom_lockfile = T.let(@custom_dir + (@lockfile&.basename || "Gemfile.lock"), Pathname) @lockfile_hash_path = T.let(@custom_dir + "main_lockfile_hash", Pathname) @last_updated_path = T.let(@custom_dir + "last_updated", Pathname) + @error_path = T.let(@custom_dir + "install_error", Pathname) - @dependencies = T.let(load_dependencies, T::Hash[String, T.untyped]) + dependencies, bundler_version = load_dependencies + @dependencies = T.let(dependencies, T::Hash[String, T.untyped]) + @bundler_version = T.let(bundler_version, T.nilable(Gem::Version)) @rails_app = T.let(rails_app?, T::Boolean) @retry = T.let(false, T::Boolean) end @@ -57,7 +66,12 @@ def initialize(project_path, **options) # used for running the server sig { returns(T::Hash[String, String]) } def setup! - raise BundleNotLocked if @gemfile&.exist? && !@lockfile&.exist? + raise BundleNotLocked if !@launcher && @gemfile&.exist? && !@lockfile&.exist? + + # Automatically create and ignore the .ruby-lsp folder for users + @custom_dir.mkpath unless @custom_dir.exist? + ignore_file = @custom_dir + ".gitignore" + ignore_file.write("*") unless ignore_file.exist? # Do not set up a custom bundle if LSP dependencies are already in the Gemfile if @dependencies["ruby-lsp"] && @@ -67,19 +81,9 @@ def setup! "Ruby LSP> Skipping custom bundle setup since LSP dependencies are already in #{@gemfile}", ) - # If the user decided to add `ruby-lsp` and `debug` (and potentially `ruby-lsp-rails`) to their Gemfile after - # having already run the Ruby LSP, then we need to remove the `.ruby-lsp` folder, otherwise we will run `bundle - # install` for the top level and try to execute the Ruby LSP using the custom bundle, which will fail since the - # gems are not installed there - @custom_dir.rmtree if @custom_dir.exist? return run_bundle_install end - # Automatically create and ignore the .ruby-lsp folder for users - @custom_dir.mkpath unless @custom_dir.exist? - ignore_file = @custom_dir + ".gitignore" - ignore_file.write("*") unless ignore_file.exist? - write_custom_gemfile unless @gemfile&.exist? && @lockfile&.exist? @@ -109,17 +113,19 @@ def setup! def custom_bundle_dependencies @custom_bundle_dependencies ||= T.let( begin + original_bundle_gemfile = ENV["BUNDLE_GEMFILE"] + if @custom_lockfile.exist? ENV["BUNDLE_GEMFILE"] = @custom_gemfile.to_s Bundler::LockfileParser.new(@custom_lockfile.read).dependencies else {} end + ensure + ENV["BUNDLE_GEMFILE"] = original_bundle_gemfile end, T.nilable(T::Hash[String, T.untyped]), ) - ensure - ENV.delete("BUNDLE_GEMFILE") end sig { void } @@ -132,7 +138,7 @@ def write_custom_gemfile # If there's a top level Gemfile, we want to evaluate from the custom bundle. We get the source from the top level # Gemfile, so if there isn't one we need to add a default source - if @gemfile&.exist? + if @gemfile&.exist? && @lockfile&.exist? parts << "eval_gemfile(File.expand_path(\"../#{@gemfile_name}\", __dir__))" else parts.unshift('source "https://rubygems.org"') @@ -156,14 +162,15 @@ def write_custom_gemfile @custom_gemfile.write(content) unless @custom_gemfile.exist? && @custom_gemfile.read == content end - sig { returns(T::Hash[String, T.untyped]) } + sig { returns([T::Hash[String, T.untyped], T.nilable(Gem::Version)]) } def load_dependencies - return {} unless @lockfile&.exist? + return [{}, nil] unless @lockfile&.exist? # We need to parse the Gemfile.lock manually here. If we try to do `bundler/setup` to use something more # convenient, we may end up with issues when the globally installed `ruby-lsp` version mismatches the one included # in the `Gemfile` - dependencies = Bundler::LockfileParser.new(@lockfile.read).dependencies + lockfile_parser = Bundler::LockfileParser.new(@lockfile.read) + dependencies = lockfile_parser.dependencies # When working on a gem, the `ruby-lsp` might be listed as a dependency in the gemspec. We need to make sure we # check those as well or else we may get version mismatch errors. Notice that bundler allows more than one @@ -172,7 +179,7 @@ def load_dependencies dependencies.merge!(Bundler.load_gemspec(path).dependencies.to_h { |dep| [dep.name, dep] }) end - dependencies + [dependencies, lockfile_parser.bundler_version] end sig { params(bundle_gemfile: T.nilable(Pathname)).returns(T::Hash[String, String]) } @@ -188,6 +195,54 @@ def run_bundle_install(bundle_gemfile = @gemfile) env["BUNDLE_PATH"] = File.expand_path(env["BUNDLE_PATH"], @project_path) end + return run_bundle_install_through_command(env) unless @launcher + + # This same check happens conditionally when running through the command. For invoking the CLI directly, it's + # important that we ensure the Bundler version is set to avoid restarts + if @bundler_version + env["BUNDLER_VERSION"] = @bundler_version.to_s + install_bundler_if_needed + end + + begin + run_bundle_install_directly(env) + # If no error occurred, then clear previous errors + @error_path.delete if @error_path.exist? + $stderr.puts("Ruby LSP> Composed bundle installation complete") + rescue => e + # Write the error object to a file so that we can read it from the parent process + @error_path.write(Marshal.dump(e)) + end + + env + end + + sig { params(env: T::Hash[String, String]).returns(T::Hash[String, String]) } + def run_bundle_install_directly(env) + RubyVM::YJIT.enable if defined?(RubyVM::YJIT.enable) + T.unsafe(ENV).merge!(env) + + unless should_bundle_update? + Bundler::CLI::Install.new({}).run + correct_relative_remote_paths if @custom_lockfile.exist? + return env + end + + # Try to auto upgrade the gems we depend on, unless they are in the Gemfile as that would result in undesired + # source control changes + gems = ["ruby-lsp", "debug", "prism"].reject { |dep| @dependencies[dep] } + gems << "ruby-lsp-rails" if @rails_app && !@dependencies["ruby-lsp-rails"] + + Bundler::CLI::Update.new({ conservative: true }, gems).run + correct_relative_remote_paths if @custom_lockfile.exist? + @last_updated_path.write(Time.now.iso8601) + env + end + + sig { params(env: T::Hash[String, String]).returns(T::Hash[String, String]) } + def run_bundle_install_through_command(env) + base_bundle = base_bundle_command(env) + # If `ruby-lsp` and `debug` (and potentially `ruby-lsp-rails`) are already in the Gemfile, then we shouldn't try # to upgrade them or else we'll produce undesired source control changes. If the custom bundle was just created # and any of `ruby-lsp`, `ruby-lsp-rails` or `debug` weren't a part of the Gemfile, then we need to run `bundle @@ -196,13 +251,13 @@ def run_bundle_install(bundle_gemfile = @gemfile) # When not updating, we run `(bundle check || bundle install)` # When updating, we run `((bundle check && bundle update ruby-lsp debug) || bundle install)` - command = +"(bundle check" + command = +"(#{base_bundle} check" if should_bundle_update? # If any of `ruby-lsp`, `ruby-lsp-rails` or `debug` are not in the Gemfile, try to update them to the latest # version command.prepend("(") - command << " && bundle update " + command << " && #{base_bundle} update " command << "ruby-lsp " unless @dependencies["ruby-lsp"] command << "debug " unless @dependencies["debug"] command << "ruby-lsp-rails " if @rails_app && !@dependencies["ruby-lsp-rails"] @@ -212,7 +267,7 @@ def run_bundle_install(bundle_gemfile = @gemfile) @last_updated_path.write(Time.now.iso8601) end - command << " || bundle install) " + command << " || #{base_bundle} install) " # Redirect stdout to stderr to prevent going into an infinite loop. The extension might confuse stdout output with # responses @@ -225,7 +280,7 @@ def run_bundle_install(bundle_gemfile = @gemfile) # Try to run the bundle install or update command. If that fails, it normally means that the custom lockfile is in # a bad state that no longer reflects the top level one. In that case, we can remove the whole directory, try # another time and give up if it fails again - if !system(env, command) && !@retry && @custom_dir.exist? + if !system(env, command) && !@retry && @custom_gemfile.exist? @retry = true @custom_dir.rmtree $stderr.puts("Ruby LSP> Running bundle install failed. Trying to re-generate the custom bundle from scratch") @@ -259,6 +314,15 @@ def bundler_settings_as_env end end + sig { void } + def install_bundler_if_needed + # Try to find the bundler version specified in the lockfile in installed gems. If not found, install it + requirement = Gem::Requirement.new(@bundler_version.to_s) + return if Gem::Specification.any? { |s| s.name == "bundler" && requirement =~ s.version } + + Gem.install("bundler", @bundler_version.to_s) + end + sig { returns(T::Boolean) } def should_bundle_update? # If `ruby-lsp`, `ruby-lsp-rails` and `debug` are in the Gemfile, then we shouldn't try to upgrade them or else it @@ -290,11 +354,14 @@ def correct_relative_remote_paths # We should only apply the correction if the remote is a relative path. It might also be a URI, like # `https://rubygems.org` or an absolute path, in which case we shouldn't do anything - if path&.start_with?(".") + if path && !URI(path).scheme "remote: #{File.expand_path(path, T.must(@gemfile).dirname)}" else match end + rescue URI::InvalidURIError, URI::InvalidComponentError + # If the path raises an invalid error, it might be a git ssh path, which indeed isn't a URI + match end @custom_lockfile.write(content) @@ -309,5 +376,49 @@ def rails_app? /class .* < (::)?Rails::Application/.match?(application_contents) end + + # Returns the base bundle command we should use for this project, which will be: + # - `bundle` if there's no locked Bundler version and no `bin/bundle` binstub in the $PATH + # - `bundle __` if there's a locked Bundler version + # - `bin/bundle` if there's a `bin/bundle` binstub in the $PATH + sig { params(env: T::Hash[String, String]).returns(String) } + def base_bundle_command(env) + path_parts = if Gem.win_platform? + ENV["Path"] || ENV["PATH"] || ENV["path"] || "" + else + ENV["PATH"] || "" + end.split(File::PATH_SEPARATOR) + + bin_dir = File.expand_path("bin", @project_path) + bundle_binstub = File.join(@project_path, "bin", "bundle") + + if File.exist?(bundle_binstub) && path_parts.any? { |path| File.expand_path(path, @project_path) == bin_dir } + return bundle_binstub + end + + if @bundler_version + env["BUNDLER_VERSION"] = @bundler_version.to_s + install_bundler_if_needed + return "bundle _#{@bundler_version}_" + end + + "bundle" + end + + sig { void } + def patch_thor_to_print_progress_to_stderr! + return unless defined?(Bundler::Thor::Shell::Basic) + + Bundler::Thor::Shell::Basic.prepend(Module.new do + extend T::Sig + + sig { returns(IO) } + def stdout + $stderr + end + end) + + Bundler.ui.level = :info + end end end diff --git a/lib/ruby_lsp/store.rb b/lib/ruby_lsp/store.rb index 4de87f2f15..2bcd3389b0 100644 --- a/lib/ruby_lsp/store.rb +++ b/lib/ruby_lsp/store.rb @@ -7,9 +7,6 @@ class Store class NonExistingDocumentError < StandardError; end - sig { returns(T::Boolean) } - attr_accessor :supports_progress - sig { returns(T::Hash[Symbol, RequestConfig]) } attr_accessor :features_configuration @@ -19,7 +16,6 @@ class NonExistingDocumentError < StandardError; end sig { void } def initialize @state = T.let({}, T::Hash[String, Document[T.untyped]]) - @supports_progress = T.let(true, T::Boolean) @features_configuration = T.let( { inlayHint: RequestConfig.new({ diff --git a/lib/ruby_lsp/type_inferrer.rb b/lib/ruby_lsp/type_inferrer.rb index e7256860d7..cd1af202c8 100644 --- a/lib/ruby_lsp/type_inferrer.rb +++ b/lib/ruby_lsp/type_inferrer.rb @@ -93,7 +93,7 @@ def infer_receiver_for_call_node(node, node_context) raw_receiver = if receiver.is_a?(Prism::CallNode) receiver.message else - receiver&.slice + receiver.slice end if raw_receiver diff --git a/lib/ruby_lsp/utils.rb b/lib/ruby_lsp/utils.rb index 630c8b1682..4942d603ac 100644 --- a/lib/ruby_lsp/utils.rb +++ b/lib/ruby_lsp/utils.rb @@ -79,6 +79,69 @@ def window_log_message(message, type: Constant::MessageType::LOG) params: Interface::LogMessageParams.new(type: type, message: message), ) end + + sig { params(data: T::Hash[Symbol, T.untyped]).returns(Notification) } + def telemetry(data) + new( + method: "telemetry/event", + params: data, + ) + end + + sig do + params( + id: String, + title: String, + percentage: T.nilable(Integer), + message: T.nilable(String), + ).returns(Notification) + end + def progress_begin(id, title, percentage: nil, message: nil) + new( + method: "$/progress", + params: Interface::ProgressParams.new( + token: id, + value: Interface::WorkDoneProgressBegin.new( + kind: "begin", + title: title, + percentage: percentage, + message: message, + ), + ), + ) + end + + sig do + params( + id: String, + percentage: T.nilable(Integer), + message: T.nilable(String), + ).returns(Notification) + end + def progress_report(id, percentage: nil, message: nil) + new( + method: "$/progress", + params: Interface::ProgressParams.new( + token: id, + value: Interface::WorkDoneProgressReport.new( + kind: "report", + percentage: percentage, + message: message, + ), + ), + ) + end + + sig { params(id: String).returns(Notification) } + def progress_end(id) + Notification.new( + method: "$/progress", + params: Interface::ProgressParams.new( + token: id, + value: Interface::WorkDoneProgressEnd.new(kind: "end"), + ), + ) + end end extend T::Sig diff --git a/lsp.code-workspace b/lsp.code-workspace index 000897796c..ecf4a8ed48 100644 --- a/lsp.code-workspace +++ b/lsp.code-workspace @@ -24,7 +24,7 @@ ], }, "typescript.tsc.autoDetect": "off", - "github.copilot.chat.experimental.codeGeneration.instructions": [ + "github.copilot.chat.codeGeneration.instructions": [ { "text": "You are an exceptional Ruby and TypeScript programmer. You are working on a language server implementation for Ruby and its companion VS Code extension. Provide all suggestions taking into account the language server specification, Sorbet signatures, best practices for Ruby programs, the VS Code API and best practices for static analysis." } diff --git a/project-words b/project-words new file mode 100644 index 0000000000..5f182c0976 --- /dev/null +++ b/project-words @@ -0,0 +1,93 @@ +activestorage +autocorrect +autoloaded +autorun +bigdecimal +bindir +binmode +binread +Bizt +Bizw +bufnr +binstub +bytesize +byteslice +codepoint +codepoints +concats +copen +Corge +dont +eglot +Eglot +eruby +exitstatus +EXTGLOB +FIXEDENCODING +Floo +fnmatch +fooo +gemname +hostedtoolcache +importmap +indexables +ipairs +Itest +ivar +Jaro +Kaigi +klass +kwargs +linearization +linearizes +linearizing +lockfiles +lspconfig +Lstart +metaprogramming +mkpath +multibyte +nargs +nodoc +noreturn +nvim +popen +qtlzwssomeking +quickfixes +quxx +quux +qorge +rdbg +realpath +reparsing +requireds +rhtml +rindex +rjson +rmtree +rubyfmt +rubylibdir +rubylibprefix +setqflist +shadowenv +shellwords +snode +somethi +spoom +Spoom +streerc +stringio +strscan +subexpression +supertypes +suppo +unaliased +unindexed +unparser +unresolve +Vinicius +Winkler +XQRK +yarp +YARP +YJIT diff --git a/ruby-lsp.gemspec b/ruby-lsp.gemspec index 7e70cb564c..41bca9acef 100644 --- a/ruby-lsp.gemspec +++ b/ruby-lsp.gemspec @@ -15,11 +15,12 @@ Gem::Specification.new do |s| s.files = Dir.glob("lib/**/*.rb") + ["README.md", "VERSION", "LICENSE.txt"] + Dir.glob("static_docs/**/*.md") s.bindir = "exe" - s.executables = ["ruby-lsp", "ruby-lsp-check"] + s.executables = ["ruby-lsp", "ruby-lsp-check", "ruby-lsp-launcher"] s.require_paths = ["lib"] + # Dependencies must be kept in sync with the checks in the extension side on workspace.ts s.add_dependency("language_server-protocol", "~> 3.17.0") - s.add_dependency("prism", ">= 1.1", "< 2.0") + s.add_dependency("prism", ">= 1.2", "< 2.0") s.add_dependency("rbs", ">= 3", "< 4") s.add_dependency("sorbet-runtime", ">= 0.5.10782") diff --git a/sorbet/rbi/gems/docile@1.4.0.rbi b/sorbet/rbi/gems/docile@1.4.1.rbi similarity index 100% rename from sorbet/rbi/gems/docile@1.4.0.rbi rename to sorbet/rbi/gems/docile@1.4.1.rbi diff --git a/sorbet/rbi/gems/logger@1.6.0.rbi b/sorbet/rbi/gems/logger@1.6.1.rbi similarity index 94% rename from sorbet/rbi/gems/logger@1.6.0.rbi rename to sorbet/rbi/gems/logger@1.6.1.rbi index 0723d96aa2..4e9ceacc7e 100644 --- a/sorbet/rbi/gems/logger@1.6.0.rbi +++ b/sorbet/rbi/gems/logger@1.6.1.rbi @@ -400,11 +400,14 @@ class Logger # - +shift_period_suffix+: sets the format for the filename suffix # for periodic log file rotation; default is '%Y%m%d'. # See {Periodic Rotation}[rdoc-ref:Logger@Periodic+Rotation]. + # - +reraise_write_errors+: An array of exception classes, which will + # be reraised if there is an error when writing to the log device. + # The default is to swallow all exceptions raised. # # @return [Logger] a new instance of Logger # - # source://logger//lib/logger.rb#578 - def initialize(logdev, shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), level: T.unsafe(nil), progname: T.unsafe(nil), formatter: T.unsafe(nil), datetime_format: T.unsafe(nil), binmode: T.unsafe(nil), shift_period_suffix: T.unsafe(nil)); end + # source://logger//lib/logger.rb#581 + def initialize(logdev, shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), level: T.unsafe(nil), progname: T.unsafe(nil), formatter: T.unsafe(nil), datetime_format: T.unsafe(nil), binmode: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), reraise_write_errors: T.unsafe(nil)); end # Writes the given +msg+ to the log with no formatting; # returns the number of characters written, @@ -417,7 +420,7 @@ class Logger # # My message. # - # source://logger//lib/logger.rb#684 + # source://logger//lib/logger.rb#689 def <<(msg); end # Creates a log entry, which may or may not be written to the log, @@ -447,7 +450,7 @@ class Logger # - #fatal. # - #unknown. # - # source://logger//lib/logger.rb#651 + # source://logger//lib/logger.rb#656 def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end # Closes the logger; returns +nil+: @@ -458,7 +461,7 @@ class Logger # # Related: Logger#reopen. # - # source://logger//lib/logger.rb#731 + # source://logger//lib/logger.rb#736 def close; end # Returns the date-time format; see #datetime_format=. @@ -479,7 +482,7 @@ class Logger # Equivalent to calling #add with severity Logger::DEBUG. # - # source://logger//lib/logger.rb#690 + # source://logger//lib/logger.rb#695 def debug(progname = T.unsafe(nil), &block); end # Sets the log level to Logger::DEBUG. @@ -499,7 +502,7 @@ class Logger # Equivalent to calling #add with severity Logger::ERROR. # - # source://logger//lib/logger.rb#708 + # source://logger//lib/logger.rb#713 def error(progname = T.unsafe(nil), &block); end # Sets the log level to Logger::ERROR. @@ -519,7 +522,7 @@ class Logger # Equivalent to calling #add with severity Logger::FATAL. # - # source://logger//lib/logger.rb#714 + # source://logger//lib/logger.rb#719 def fatal(progname = T.unsafe(nil), &block); end # Sets the log level to Logger::FATAL. @@ -607,7 +610,7 @@ class Logger # Equivalent to calling #add with severity Logger::INFO. # - # source://logger//lib/logger.rb#696 + # source://logger//lib/logger.rb#701 def info(progname = T.unsafe(nil), &block); end # Sets the log level to Logger::INFO. @@ -672,7 +675,7 @@ class Logger # - #fatal. # - #unknown. # - # source://logger//lib/logger.rb#651 + # source://logger//lib/logger.rb#656 def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end # Program name to include in log messages. @@ -708,7 +711,7 @@ class Logger # # "E, [2022-05-12T14:21:27.596726 #22428] ERROR -- : one\n", # # "E, [2022-05-12T14:23:05.847241 #22428] ERROR -- : three\n"] # - # source://logger//lib/logger.rb#619 + # source://logger//lib/logger.rb#624 def reopen(logdev = T.unsafe(nil)); end # Logging severity threshold (e.g. Logger::INFO). @@ -733,12 +736,12 @@ class Logger # Equivalent to calling #add with severity Logger::UNKNOWN. # - # source://logger//lib/logger.rb#720 + # source://logger//lib/logger.rb#725 def unknown(progname = T.unsafe(nil), &block); end # Equivalent to calling #add with severity Logger::WARN. # - # source://logger//lib/logger.rb#702 + # source://logger//lib/logger.rb#707 def warn(progname = T.unsafe(nil), &block); end # Sets the log level to Logger::WARN. @@ -767,11 +770,16 @@ class Logger private - # source://logger//lib/logger.rb#744 + # source://logger//lib/logger.rb#754 def format_message(severity, datetime, progname, msg); end - # source://logger//lib/logger.rb#740 + # source://logger//lib/logger.rb#745 def format_severity(severity); end + + # Guarantee the existence of this ivar even when subclasses don't call the superclass constructor. + # + # source://logger//lib/logger.rb#750 + def level_override; end end # Default formatter for log messages. @@ -823,9 +831,9 @@ class Logger::LogDevice # @return [LogDevice] a new instance of LogDevice # # source://logger//lib/logger/log_device.rb#14 - def initialize(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil)); end + def initialize(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil), reraise_write_errors: T.unsafe(nil)); end - # source://logger//lib/logger/log_device.rb#52 + # source://logger//lib/logger/log_device.rb#59 def close; end # Returns the value of attribute dev. @@ -838,36 +846,36 @@ class Logger::LogDevice # source://logger//lib/logger/log_device.rb#11 def filename; end - # source://logger//lib/logger/log_device.rb#62 + # source://logger//lib/logger/log_device.rb#69 def reopen(log = T.unsafe(nil)); end - # source://logger//lib/logger/log_device.rb#31 + # source://logger//lib/logger/log_device.rb#32 def write(message); end private - # source://logger//lib/logger/log_device.rb#119 + # source://logger//lib/logger/log_device.rb#126 def add_log_header(file); end - # source://logger//lib/logger/log_device.rb#125 + # source://logger//lib/logger/log_device.rb#132 def check_shift_log; end - # source://logger//lib/logger/log_device.rb#103 + # source://logger//lib/logger/log_device.rb#110 def create_logfile(filename); end - # source://logger//lib/logger/log_device.rb#145 + # source://logger//lib/logger/log_device.rb#152 def lock_shift_log; end - # source://logger//lib/logger/log_device.rb#95 + # source://logger//lib/logger/log_device.rb#102 def open_logfile(filename); end - # source://logger//lib/logger/log_device.rb#79 + # source://logger//lib/logger/log_device.rb#86 def set_dev(log); end - # source://logger//lib/logger/log_device.rb#176 + # source://logger//lib/logger/log_device.rb#183 def shift_log_age; end - # source://logger//lib/logger/log_device.rb#188 + # source://logger//lib/logger/log_device.rb#195 def shift_log_period(period_end); end end @@ -895,7 +903,7 @@ Logger::Period::SiD = T.let(T.unsafe(nil), Integer) # \Severity label for logging (max 5 chars). # -# source://logger//lib/logger.rb#738 +# source://logger//lib/logger.rb#743 Logger::SEV_LABEL = T.let(T.unsafe(nil), Array) # Logging severity. diff --git a/sorbet/rbi/gems/mocha@2.3.0.rbi b/sorbet/rbi/gems/mocha@2.4.5.rbi similarity index 99% rename from sorbet/rbi/gems/mocha@2.3.0.rbi rename to sorbet/rbi/gems/mocha@2.4.5.rbi index de37e63da2..cae7768f54 100644 --- a/sorbet/rbi/gems/mocha@2.3.0.rbi +++ b/sorbet/rbi/gems/mocha@2.4.5.rbi @@ -5,7 +5,7 @@ # Please instead update this file by running `bin/tapioca gem mocha`. -# source://mocha//lib/mocha/inspect.rb#45 +# source://mocha//lib/mocha/inspect.rb#56 class Array include ::Enumerable include ::Mocha::Inspect::ArrayMethods @@ -15,23 +15,16 @@ class Class < ::Module include ::Mocha::ClassMethods end -# source://mocha//lib/mocha/inspect.rb#57 +# source://mocha//lib/mocha/inspect.rb#68 class Date include ::Comparable include ::Mocha::Inspect::DateMethods end -# @private -# -# source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#22 +# source://mocha//lib/mocha/inspect.rb#60 class Hash include ::Enumerable include ::Mocha::Inspect::HashMethods - - # @private - # - # source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#24 - def to_matcher(expectation = T.unsafe(nil)); end end class Minitest::Test < ::Minitest::Runnable @@ -1726,9 +1719,9 @@ module Mocha::Inspect::ArrayMethods def mocha_inspect(wrapped = T.unsafe(nil)); end end -# source://mocha//lib/mocha/inspect.rb#33 +# source://mocha//lib/mocha/inspect.rb#44 module Mocha::Inspect::DateMethods - # source://mocha//lib/mocha/inspect.rb#34 + # source://mocha//lib/mocha/inspect.rb#45 def mocha_inspect; end end @@ -1744,9 +1737,9 @@ module Mocha::Inspect::ObjectMethods def mocha_inspect; end end -# source://mocha//lib/mocha/inspect.rb#27 +# source://mocha//lib/mocha/inspect.rb#38 module Mocha::Inspect::TimeMethods - # source://mocha//lib/mocha/inspect.rb#28 + # source://mocha//lib/mocha/inspect.rb#39 def mocha_inspect; end end @@ -3168,14 +3161,9 @@ class Mocha::ParameterMatchers::Base # @return [AllOf] parameter matcher. # @see Expectation#with # - # source://mocha//lib/mocha/parameter_matchers/base.rb#30 + # source://mocha//lib/mocha/parameter_matchers/base.rb#25 def &(other); end - # @private - # - # source://mocha//lib/mocha/parameter_matchers/base.rb#6 - def to_matcher(_expectation = T.unsafe(nil)); end - # A shorthand way of combining two matchers when at least one must match. # # Returns a new +AnyOf+ parameter matcher combining two matchers using a logical OR. @@ -3200,7 +3188,7 @@ class Mocha::ParameterMatchers::Base # @return [AnyOf] parameter matcher. # @see Expectation#with # - # source://mocha//lib/mocha/parameter_matchers/base.rb#60 + # source://mocha//lib/mocha/parameter_matchers/base.rb#55 def |(other); end end @@ -3263,17 +3251,17 @@ class Mocha::ParameterMatchers::HasEntries < ::Mocha::ParameterMatchers::Base # @return [HasEntries] a new instance of HasEntries # # source://mocha//lib/mocha/parameter_matchers/has_entries.rb#33 - def initialize(entries); end + def initialize(entries, exact: T.unsafe(nil)); end # @private # @return [Boolean] # - # source://mocha//lib/mocha/parameter_matchers/has_entries.rb#38 + # source://mocha//lib/mocha/parameter_matchers/has_entries.rb#39 def matches?(available_parameters); end # @private # - # source://mocha//lib/mocha/parameter_matchers/has_entries.rb#45 + # source://mocha//lib/mocha/parameter_matchers/has_entries.rb#50 def mocha_inspect; end end @@ -3390,12 +3378,12 @@ end # @private # -# source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#7 +# source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#8 module Mocha::ParameterMatchers::InstanceMethods # @private # - # source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#9 - def to_matcher(_expectation = T.unsafe(nil)); end + # source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#10 + def to_matcher(expectation: T.unsafe(nil), top_level: T.unsafe(nil)); end end # Parameter matcher which matches when actual parameter is an instance of the specified class. @@ -3510,43 +3498,43 @@ end # @private # -# source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#8 +# source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#9 class Mocha::ParameterMatchers::PositionalOrKeywordHash < ::Mocha::ParameterMatchers::Base # @return [PositionalOrKeywordHash] a new instance of PositionalOrKeywordHash # - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#9 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#10 def initialize(value, expectation); end # @return [Boolean] # - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#14 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#15 def matches?(available_parameters); end - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#28 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#29 def mocha_inspect; end private - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#42 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#43 def deprecation_warning(actual, expected); end - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#58 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#59 def expectation_definition; end - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#34 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#35 def extract_parameter(available_parameters); end - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#50 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#51 def hash_type(hash); end # @return [Boolean] # - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#54 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#55 def ruby2_keywords_hash?(hash); end # @return [Boolean] # - # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#38 + # source://mocha//lib/mocha/parameter_matchers/positional_or_keyword_hash.rb#39 def same_type_of_hash?(actual, expected); end end @@ -3955,7 +3943,7 @@ end # @private # -# source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#17 +# source://mocha//lib/mocha/parameter_matchers/instance_methods.rb#24 class Object < ::BasicObject include ::Kernel include ::PP::ObjectMixin @@ -3964,7 +3952,7 @@ class Object < ::BasicObject include ::Mocha::ObjectMethods end -# source://mocha//lib/mocha/inspect.rb#53 +# source://mocha//lib/mocha/inspect.rb#64 class Time include ::Comparable include ::Mocha::Inspect::TimeMethods diff --git a/sorbet/rbi/gems/parser@3.3.4.2.rbi b/sorbet/rbi/gems/parser@3.3.5.0.rbi similarity index 100% rename from sorbet/rbi/gems/parser@3.3.4.2.rbi rename to sorbet/rbi/gems/parser@3.3.5.0.rbi diff --git a/sorbet/rbi/gems/prism@1.1.0.rbi b/sorbet/rbi/gems/prism@1.2.0.rbi similarity index 86% rename from sorbet/rbi/gems/prism@1.1.0.rbi rename to sorbet/rbi/gems/prism@1.2.0.rbi index d9f16542b5..c6c606d9da 100644 --- a/sorbet/rbi/gems/prism@1.1.0.rbi +++ b/sorbet/rbi/gems/prism@1.2.0.rbi @@ -137,28 +137,44 @@ end # Specialized version of Prism::Source for source code that includes ASCII # characters only. This class is used to apply performance optimizations that -# cannot be applied to sources that include multibyte characters. Sources that -# include multibyte characters are represented by the Prism::Source class. +# cannot be applied to sources that include multibyte characters. # -# source://prism//lib/prism/parse_result.rb#135 +# In the extremely rare case that a source includes multi-byte characters but +# is marked as binary because of a magic encoding comment and it cannot be +# eagerly converted to UTF-8, this class will be used as well. This is because +# at that point we will treat everything as single-byte characters. +# +# source://prism//lib/prism/parse_result.rb#236 class Prism::ASCIISource < ::Prism::Source # Return the column number in characters for the given byte offset. # - # source://prism//lib/prism/parse_result.rb#142 + # source://prism//lib/prism/parse_result.rb#243 sig { params(byte_offset: Integer).returns(Integer) } def character_column(byte_offset); end # Return the character offset for the given byte offset. # - # source://prism//lib/prism/parse_result.rb#137 + # source://prism//lib/prism/parse_result.rb#238 sig { params(byte_offset: Integer).returns(Integer) } def character_offset(byte_offset); end + # Returns a cache that is the identity function in order to maintain the + # same interface. We can do this because code units are always equivalent to + # byte offsets for ASCII-only sources. + # + # source://prism//lib/prism/parse_result.rb#260 + sig do + params( + encoding: Encoding + ).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) + end + def code_units_cache(encoding); end + # Specialized version of `code_units_column` that does not depend on # `code_units_offset`, which is a more expensive operation. This is # essentially the same as `Prism::Source#column`. # - # source://prism//lib/prism/parse_result.rb#159 + # source://prism//lib/prism/parse_result.rb#267 sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } def code_units_column(byte_offset, encoding); end @@ -169,7 +185,7 @@ class Prism::ASCIISource < ::Prism::Source # concept of code units that differs from the number of characters in other # encodings, it is not captured here. # - # source://prism//lib/prism/parse_result.rb#152 + # source://prism//lib/prism/parse_result.rb#253 sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } def code_units_offset(byte_offset, encoding); end end @@ -186,6 +202,17 @@ class Prism::AliasGlobalVariableNode < ::Prism::Node # @return [AliasGlobalVariableNode] a new instance of AliasGlobalVariableNode # # source://prism//lib/prism/node.rb#229 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode), + old_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::SymbolNode, Prism::MissingNode), + keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, new_name, old_name, keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -197,37 +224,53 @@ class Prism::AliasGlobalVariableNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#240 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#245 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#255 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#250 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, ?old_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | SymbolNode | MissingNode, ?keyword_loc: Location) -> AliasGlobalVariableNode # # source://prism//lib/prism/node.rb#260 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode), + old_name: T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::SymbolNode, Prism::MissingNode), + keyword_loc: Prism::Location + ).returns(Prism::AliasGlobalVariableNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#245 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, new_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode, old_name: GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | SymbolNode | MissingNode, keyword_loc: Location } # # source://prism//lib/prism/node.rb#268 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -242,6 +285,7 @@ class Prism::AliasGlobalVariableNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#295 + sig { returns(String) } def keyword; end # The location of the `alias` keyword. @@ -250,6 +294,7 @@ class Prism::AliasGlobalVariableNode < ::Prism::Node # ^^^^^ # # source://prism//lib/prism/node.rb#288 + sig { returns(Prism::Location) } def keyword_loc; end # Represents the new name of the global variable that can be used after aliasing. @@ -258,6 +303,7 @@ class Prism::AliasGlobalVariableNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#276 + sig { returns(T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)) } def new_name; end # Represents the old name of the global variable that can be used before aliasing. @@ -266,6 +312,9 @@ class Prism::AliasGlobalVariableNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#282 + sig do + returns(T.any(Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::SymbolNode, Prism::MissingNode)) + end def old_name; end # Return a symbol representation of this node type. See `Node#type`. @@ -294,6 +343,17 @@ class Prism::AliasMethodNode < ::Prism::Node # @return [AliasMethodNode] a new instance of AliasMethodNode # # source://prism//lib/prism/node.rb#330 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode), + old_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::GlobalVariableReadNode, Prism::MissingNode), + keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, new_name, old_name, keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -305,37 +365,53 @@ class Prism::AliasMethodNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#341 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#346 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#356 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#351 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: SymbolNode | InterpolatedSymbolNode, ?old_name: SymbolNode | InterpolatedSymbolNode | GlobalVariableReadNode | MissingNode, ?keyword_loc: Location) -> AliasMethodNode # # source://prism//lib/prism/node.rb#361 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + new_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode), + old_name: T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::GlobalVariableReadNode, Prism::MissingNode), + keyword_loc: Prism::Location + ).returns(Prism::AliasMethodNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), new_name: T.unsafe(nil), old_name: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#346 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, new_name: SymbolNode | InterpolatedSymbolNode, old_name: SymbolNode | InterpolatedSymbolNode | GlobalVariableReadNode | MissingNode, keyword_loc: Location } # # source://prism//lib/prism/node.rb#369 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -350,11 +426,13 @@ class Prism::AliasMethodNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#405 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#398 + sig { returns(Prism::Location) } def keyword_loc; end # Represents the new name of the method that will be aliased. @@ -369,6 +447,7 @@ class Prism::AliasMethodNode < ::Prism::Node # ^^^^^^^^^ # # source://prism//lib/prism/node.rb#383 + sig { returns(T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)) } def new_name; end # Represents the old name of the method that will be aliased. @@ -383,6 +462,9 @@ class Prism::AliasMethodNode < ::Prism::Node # ^^^^^^^^^ # # source://prism//lib/prism/node.rb#395 + sig do + returns(T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode, Prism::GlobalVariableReadNode, Prism::MissingNode)) + end def old_name; end # Return a symbol representation of this node type. See `Node#type`. @@ -411,6 +493,17 @@ class Prism::AlternationPatternNode < ::Prism::Node # @return [AlternationPatternNode] a new instance of AlternationPatternNode # # source://prism//lib/prism/node.rb#440 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -422,37 +515,53 @@ class Prism::AlternationPatternNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#451 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#456 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#466 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#461 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AlternationPatternNode # # source://prism//lib/prism/node.rb#471 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::AlternationPatternNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#456 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node, right: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#479 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -470,11 +579,13 @@ class Prism::AlternationPatternNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#487 + sig { returns(Prism::Node) } def left; end # def operator: () -> String # # source://prism//lib/prism/node.rb#506 + sig { returns(String) } def operator; end # Represents the alternation operator location. @@ -483,6 +594,7 @@ class Prism::AlternationPatternNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#499 + sig { returns(Prism::Location) } def operator_loc; end # Represents the right side of the expression. @@ -491,6 +603,7 @@ class Prism::AlternationPatternNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#493 + sig { returns(Prism::Node) } def right; end # Return a symbol representation of this node type. See `Node#type`. @@ -519,6 +632,17 @@ class Prism::AndNode < ::Prism::Node # @return [AndNode] a new instance of AndNode # # source://prism//lib/prism/node.rb#541 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -530,37 +654,53 @@ class Prism::AndNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#552 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#557 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#567 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#562 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AndNode # # source://prism//lib/prism/node.rb#572 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::AndNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#557 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node, right: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#580 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -581,11 +721,13 @@ class Prism::AndNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#591 + sig { returns(Prism::Node) } def left; end # def operator: () -> String # # source://prism//lib/prism/node.rb#613 + sig { returns(String) } def operator; end # The location of the `and` keyword or the `&&` operator. @@ -594,6 +736,7 @@ class Prism::AndNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#606 + sig { returns(Prism::Location) } def operator_loc; end # Represents the right side of the expression. @@ -605,6 +748,7 @@ class Prism::AndNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#600 + sig { returns(Prism::Node) } def right; end # Return a symbol representation of this node type. See `Node#type`. @@ -987,6 +1131,20 @@ class Prism::ArrayPatternNode < ::Prism::Node # @return [ArrayPatternNode] a new instance of ArrayPatternNode # # source://prism//lib/prism/node.rb#890 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + requireds: T::Array[Prism::Node], + rest: T.nilable(Prism::Node), + posts: T::Array[Prism::Node], + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, constant, requireds, rest, posts, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -998,52 +1156,74 @@ class Prism::ArrayPatternNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#904 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#909 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # # source://prism//lib/prism/node.rb#985 + sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # # source://prism//lib/prism/node.rb#967 + sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#924 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#914 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader constant: ConstantReadNode | ConstantPathNode | nil # # source://prism//lib/prism/node.rb#942 + sig { returns(T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode))) } def constant; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: ConstantReadNode | ConstantPathNode | nil, ?requireds: Array[Prism::node], ?rest: Prism::node?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode # # source://prism//lib/prism/node.rb#929 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + requireds: T::Array[Prism::Node], + rest: T.nilable(Prism::Node), + posts: T::Array[Prism::Node], + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::ArrayPatternNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), requireds: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#909 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, constant: ConstantReadNode | ConstantPathNode | nil, requireds: Array[Prism::node], rest: Prism::node?, posts: Array[Prism::node], opening_loc: Location?, closing_loc: Location? } # # source://prism//lib/prism/node.rb#937 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -1058,26 +1238,31 @@ class Prism::ArrayPatternNode < ::Prism::Node # def opening: () -> String? # # source://prism//lib/prism/node.rb#980 + sig { returns(T.nilable(String)) } def opening; end # attr_reader opening_loc: Location? # # source://prism//lib/prism/node.rb#954 + sig { returns(T.nilable(Prism::Location)) } def opening_loc; end # attr_reader posts: Array[Prism::node] # # source://prism//lib/prism/node.rb#951 + sig { returns(T::Array[Prism::Node]) } def posts; end # attr_reader requireds: Array[Prism::node] # # source://prism//lib/prism/node.rb#945 + sig { returns(T::Array[Prism::Node]) } def requireds; end # attr_reader rest: Prism::node? # # source://prism//lib/prism/node.rb#948 + sig { returns(T.nilable(Prism::Node)) } def rest; end # Return a symbol representation of this node type. See `Node#type`. @@ -1106,6 +1291,17 @@ class Prism::AssocNode < ::Prism::Node # @return [AssocNode] a new instance of AssocNode # # source://prism//lib/prism/node.rb#1025 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + key: Prism::Node, + value: Prism::Node, + operator_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, key, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -1117,37 +1313,53 @@ class Prism::AssocNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1036 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1041 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1051 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1046 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?) -> AssocNode # # source://prism//lib/prism/node.rb#1056 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + key: Prism::Node, + value: Prism::Node, + operator_loc: T.nilable(Prism::Location) + ).returns(Prism::AssocNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), key: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1041 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, key: Prism::node, value: Prism::node, operator_loc: Location? } # # source://prism//lib/prism/node.rb#1064 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -1171,11 +1383,13 @@ class Prism::AssocNode < ::Prism::Node # ^^^^^^^^^^ # # source://prism//lib/prism/node.rb#1078 + sig { returns(Prism::Node) } def key; end # def operator: () -> String? # # source://prism//lib/prism/node.rb#1106 + sig { returns(T.nilable(String)) } def operator; end # The location of the `=>` operator, if present. @@ -1184,6 +1398,7 @@ class Prism::AssocNode < ::Prism::Node # ^^ # # source://prism//lib/prism/node.rb#1093 + sig { returns(T.nilable(Prism::Location)) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -1201,6 +1416,7 @@ class Prism::AssocNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#1087 + sig { returns(Prism::Node) } def value; end class << self @@ -1223,6 +1439,16 @@ class Prism::AssocSplatNode < ::Prism::Node # @return [AssocSplatNode] a new instance of AssocSplatNode # # source://prism//lib/prism/node.rb#1141 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -1234,37 +1460,52 @@ class Prism::AssocSplatNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1151 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1156 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1168 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1161 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node?, ?operator_loc: Location) -> AssocSplatNode # # source://prism//lib/prism/node.rb#1173 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).returns(Prism::AssocSplatNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1156 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node?, operator_loc: Location } # # source://prism//lib/prism/node.rb#1181 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -1279,6 +1520,7 @@ class Prism::AssocSplatNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#1202 + sig { returns(String) } def operator; end # The location of the `**` operator. @@ -1287,6 +1529,7 @@ class Prism::AssocSplatNode < ::Prism::Node # ^^ # # source://prism//lib/prism/node.rb#1195 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -1301,6 +1544,7 @@ class Prism::AssocSplatNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#1189 + sig { returns(T.nilable(Prism::Node)) } def value; end class << self @@ -1328,6 +1572,7 @@ class Prism::BackReferenceReadNode < ::Prism::Node # @return [BackReferenceReadNode] a new instance of BackReferenceReadNode # # source://prism//lib/prism/node.rb#1236 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -1339,37 +1584,51 @@ class Prism::BackReferenceReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1245 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1250 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1260 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1255 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BackReferenceReadNode # # source://prism//lib/prism/node.rb#1265 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::BackReferenceReadNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1250 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#1273 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -1388,6 +1647,7 @@ class Prism::BackReferenceReadNode < ::Prism::Node # $+ # name `:$+` # # source://prism//lib/prism/node.rb#1282 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -1445,6 +1705,20 @@ class Prism::BeginNode < ::Prism::Node # @return [BeginNode] a new instance of BeginNode # # source://prism//lib/prism/node.rb#1315 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + begin_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + rescue_clause: T.nilable(Prism::RescueNode), + else_clause: T.nilable(Prism::ElseNode), + ensure_clause: T.nilable(Prism::EnsureNode), + end_keyword_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -1456,67 +1730,92 @@ class Prism::BeginNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1329 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def begin_keyword: () -> String? # # source://prism//lib/prism/node.rb#1405 + sig { returns(T.nilable(String)) } def begin_keyword; end # attr_reader begin_keyword_loc: Location? # # source://prism//lib/prism/node.rb#1367 + sig { returns(T.nilable(Prism::Location)) } def begin_keyword_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1334 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1349 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1339 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode # # source://prism//lib/prism/node.rb#1354 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + begin_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + rescue_clause: T.nilable(Prism::RescueNode), + else_clause: T.nilable(Prism::ElseNode), + ensure_clause: T.nilable(Prism::EnsureNode), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::BeginNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), begin_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), rescue_clause: T.unsafe(nil), else_clause: T.unsafe(nil), ensure_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1334 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, begin_keyword_loc: Location?, statements: StatementsNode?, rescue_clause: RescueNode?, else_clause: ElseNode?, ensure_clause: EnsureNode?, end_keyword_loc: Location? } # # source://prism//lib/prism/node.rb#1362 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader else_clause: ElseNode? # # source://prism//lib/prism/node.rb#1386 + sig { returns(T.nilable(Prism::ElseNode)) } def else_clause; end # def end_keyword: () -> String? # # source://prism//lib/prism/node.rb#1410 + sig { returns(T.nilable(String)) } def end_keyword; end # attr_reader end_keyword_loc: Location? # # source://prism//lib/prism/node.rb#1392 + sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end # attr_reader ensure_clause: EnsureNode? # # source://prism//lib/prism/node.rb#1389 + sig { returns(T.nilable(Prism::EnsureNode)) } def ensure_clause; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -1534,11 +1833,13 @@ class Prism::BeginNode < ::Prism::Node # attr_reader rescue_clause: RescueNode? # # source://prism//lib/prism/node.rb#1383 + sig { returns(T.nilable(Prism::RescueNode)) } def rescue_clause; end # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#1380 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -1567,6 +1868,16 @@ class Prism::BlockArgumentNode < ::Prism::Node # @return [BlockArgumentNode] a new instance of BlockArgumentNode # # source://prism//lib/prism/node.rb#1448 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, expression, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -1578,42 +1889,58 @@ class Prism::BlockArgumentNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1458 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1463 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1475 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1468 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node?, ?operator_loc: Location) -> BlockArgumentNode # # source://prism//lib/prism/node.rb#1480 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: T.nilable(Prism::Node), + operator_loc: Prism::Location + ).returns(Prism::BlockArgumentNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1463 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, expression: Prism::node?, operator_loc: Location } # # source://prism//lib/prism/node.rb#1488 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader expression: Prism::node? # # source://prism//lib/prism/node.rb#1493 + sig { returns(T.nilable(Prism::Node)) } def expression; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -1628,11 +1955,13 @@ class Prism::BlockArgumentNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#1503 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#1496 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -1769,6 +2098,19 @@ class Prism::BlockNode < ::Prism::Node # @return [BlockNode] a new instance of BlockNode # # source://prism//lib/prism/node.rb#1616 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, locals, parameters, body, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -1780,52 +2122,73 @@ class Prism::BlockNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1629 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: StatementsNode | BeginNode | nil # # source://prism//lib/prism/node.rb#1671 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1634 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#1693 + sig { returns(String) } def closing; end # attr_reader closing_loc: Location # # source://prism//lib/prism/node.rb#1681 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1647 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1639 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, ?body: StatementsNode | BeginNode | nil, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode # # source://prism//lib/prism/node.rb#1652 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::BlockNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1634 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, body: StatementsNode | BeginNode | nil, opening_loc: Location, closing_loc: Location } # # source://prism//lib/prism/node.rb#1660 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -1840,21 +2203,25 @@ class Prism::BlockNode < ::Prism::Node # attr_reader locals: Array[Symbol] # # source://prism//lib/prism/node.rb#1665 + sig { returns(T::Array[Symbol]) } def locals; end # def opening: () -> String # # source://prism//lib/prism/node.rb#1688 + sig { returns(String) } def opening; end # attr_reader opening_loc: Location # # source://prism//lib/prism/node.rb#1674 + sig { returns(Prism::Location) } def opening_loc; end # attr_reader parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil # # source://prism//lib/prism/node.rb#1668 + sig { returns(T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode))) } def parameters; end # Return a symbol representation of this node type. See `Node#type`. @@ -2026,6 +2393,18 @@ class Prism::BlockParametersNode < ::Prism::Node # @return [BlockParametersNode] a new instance of BlockParametersNode # # source://prism//lib/prism/node.rb#1844 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + parameters: T.nilable(Prism::ParametersNode), + locals: T::Array[Prism::BlockLocalVariableNode], + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, parameters, locals, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -2037,47 +2416,66 @@ class Prism::BlockParametersNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1856 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1861 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # # source://prism//lib/prism/node.rb#1929 + sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # # source://prism//lib/prism/node.rb#1911 + sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1874 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1866 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?) -> BlockParametersNode # # source://prism//lib/prism/node.rb#1879 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + parameters: T.nilable(Prism::ParametersNode), + locals: T::Array[Prism::BlockLocalVariableNode], + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::BlockParametersNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parameters: T.unsafe(nil), locals: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1861 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, parameters: ParametersNode?, locals: Array[BlockLocalVariableNode], opening_loc: Location?, closing_loc: Location? } # # source://prism//lib/prism/node.rb#1887 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -2092,21 +2490,25 @@ class Prism::BlockParametersNode < ::Prism::Node # attr_reader locals: Array[BlockLocalVariableNode] # # source://prism//lib/prism/node.rb#1895 + sig { returns(T::Array[Prism::BlockLocalVariableNode]) } def locals; end # def opening: () -> String? # # source://prism//lib/prism/node.rb#1924 + sig { returns(T.nilable(String)) } def opening; end # attr_reader opening_loc: Location? # # source://prism//lib/prism/node.rb#1898 + sig { returns(T.nilable(Prism::Location)) } def opening_loc; end # attr_reader parameters: ParametersNode? # # source://prism//lib/prism/node.rb#1892 + sig { returns(T.nilable(Prism::ParametersNode)) } def parameters; end # Return a symbol representation of this node type. See `Node#type`. @@ -2135,6 +2537,16 @@ class Prism::BreakNode < ::Prism::Node # @return [BreakNode] a new instance of BreakNode # # source://prism//lib/prism/node.rb#1966 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, arguments, keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -2146,6 +2558,7 @@ class Prism::BreakNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#1976 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # The arguments to the break statement, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). @@ -2154,37 +2567,52 @@ class Prism::BreakNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#2014 + sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1981 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#1993 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#1986 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> BreakNode # # source://prism//lib/prism/node.rb#1998 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location + ).returns(Prism::BreakNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#1981 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, arguments: ArgumentsNode?, keyword_loc: Location } # # source://prism//lib/prism/node.rb#2006 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -2199,6 +2627,7 @@ class Prism::BreakNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#2027 + sig { returns(String) } def keyword; end # The location of the `break` keyword. @@ -2207,6 +2636,7 @@ class Prism::BreakNode < ::Prism::Node # ^^^^^ # # source://prism//lib/prism/node.rb#2020 + sig { returns(Prism::Location) } def keyword_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -3334,6 +3764,17 @@ class Prism::CapturePatternNode < ::Prism::Node # @return [CapturePatternNode] a new instance of CapturePatternNode # # source://prism//lib/prism/node.rb#2911 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + target: Prism::LocalVariableTargetNode, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, value, target, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -3345,37 +3786,53 @@ class Prism::CapturePatternNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#2922 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#2927 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#2937 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#2932 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?target: LocalVariableTargetNode, ?operator_loc: Location) -> CapturePatternNode # # source://prism//lib/prism/node.rb#2942 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + target: Prism::LocalVariableTargetNode, + operator_loc: Prism::Location + ).returns(Prism::CapturePatternNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#2927 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node, target: LocalVariableTargetNode, operator_loc: Location } # # source://prism//lib/prism/node.rb#2950 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -3390,16 +3847,19 @@ class Prism::CapturePatternNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#2968 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#2961 + sig { returns(Prism::Location) } def operator_loc; end # attr_reader target: LocalVariableTargetNode # # source://prism//lib/prism/node.rb#2958 + sig { returns(Prism::LocalVariableTargetNode) } def target; end # Return a symbol representation of this node type. See `Node#type`. @@ -3411,6 +3871,7 @@ class Prism::CapturePatternNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#2955 + sig { returns(Prism::Node) } def value; end class << self @@ -3435,6 +3896,19 @@ class Prism::CaseMatchNode < ::Prism::Node # @return [CaseMatchNode] a new instance of CaseMatchNode # # source://prism//lib/prism/node.rb#3005 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + predicate: T.nilable(Prism::Node), + conditions: T::Array[Prism::InNode], + else_clause: T.nilable(Prism::ElseNode), + case_keyword_loc: Prism::Location, + end_keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -3446,36 +3920,43 @@ class Prism::CaseMatchNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3018 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def case_keyword: () -> String # # source://prism//lib/prism/node.rb#3078 + sig { returns(String) } def case_keyword; end # attr_reader case_keyword_loc: Location # # source://prism//lib/prism/node.rb#3064 + sig { returns(Prism::Location) } def case_keyword_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3023 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3037 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3028 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader conditions: Array[InNode] # # source://prism//lib/prism/node.rb#3058 + sig { returns(T::Array[Prism::InNode]) } def conditions; end # Returns the else clause of the case match node. This method is deprecated @@ -3487,32 +3968,49 @@ class Prism::CaseMatchNode < ::Prism::Node # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[InNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode # # source://prism//lib/prism/node.rb#3042 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + predicate: T.nilable(Prism::Node), + conditions: T::Array[Prism::InNode], + else_clause: T.nilable(Prism::ElseNode), + case_keyword_loc: Prism::Location, + end_keyword_loc: Prism::Location + ).returns(Prism::CaseMatchNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3023 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, predicate: Prism::node?, conditions: Array[InNode], else_clause: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location } # # source://prism//lib/prism/node.rb#3050 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader else_clause: ElseNode? # # source://prism//lib/prism/node.rb#3061 + sig { returns(T.nilable(Prism::ElseNode)) } def else_clause; end # def end_keyword: () -> String # # source://prism//lib/prism/node.rb#3083 + sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # # source://prism//lib/prism/node.rb#3071 + sig { returns(Prism::Location) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -3527,6 +4025,7 @@ class Prism::CaseMatchNode < ::Prism::Node # attr_reader predicate: Prism::node? # # source://prism//lib/prism/node.rb#3055 + sig { returns(T.nilable(Prism::Node)) } def predicate; end # Return a symbol representation of this node type. See `Node#type`. @@ -3557,6 +4056,19 @@ class Prism::CaseNode < ::Prism::Node # @return [CaseNode] a new instance of CaseNode # # source://prism//lib/prism/node.rb#3123 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + predicate: T.nilable(Prism::Node), + conditions: T::Array[Prism::WhenNode], + else_clause: T.nilable(Prism::ElseNode), + case_keyword_loc: Prism::Location, + end_keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -3568,36 +4080,43 @@ class Prism::CaseNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3136 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def case_keyword: () -> String # # source://prism//lib/prism/node.rb#3196 + sig { returns(String) } def case_keyword; end # attr_reader case_keyword_loc: Location # # source://prism//lib/prism/node.rb#3182 + sig { returns(Prism::Location) } def case_keyword_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3141 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3155 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3146 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader conditions: Array[WhenNode] # # source://prism//lib/prism/node.rb#3176 + sig { returns(T::Array[Prism::WhenNode]) } def conditions; end # Returns the else clause of the case node. This method is deprecated in @@ -3609,32 +4128,49 @@ class Prism::CaseNode < ::Prism::Node # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[WhenNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseNode # # source://prism//lib/prism/node.rb#3160 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + predicate: T.nilable(Prism::Node), + conditions: T::Array[Prism::WhenNode], + else_clause: T.nilable(Prism::ElseNode), + case_keyword_loc: Prism::Location, + end_keyword_loc: Prism::Location + ).returns(Prism::CaseNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), predicate: T.unsafe(nil), conditions: T.unsafe(nil), else_clause: T.unsafe(nil), case_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3141 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, predicate: Prism::node?, conditions: Array[WhenNode], else_clause: ElseNode?, case_keyword_loc: Location, end_keyword_loc: Location } # # source://prism//lib/prism/node.rb#3168 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader else_clause: ElseNode? # # source://prism//lib/prism/node.rb#3179 + sig { returns(T.nilable(Prism::ElseNode)) } def else_clause; end # def end_keyword: () -> String # # source://prism//lib/prism/node.rb#3201 + sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # # source://prism//lib/prism/node.rb#3189 + sig { returns(Prism::Location) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -3649,6 +4185,7 @@ class Prism::CaseNode < ::Prism::Node # attr_reader predicate: Prism::node? # # source://prism//lib/prism/node.rb#3173 + sig { returns(T.nilable(Prism::Node)) } def predicate; end # Return a symbol representation of this node type. See `Node#type`. @@ -3677,6 +4214,22 @@ class Prism::ClassNode < ::Prism::Node # @return [ClassNode] a new instance of ClassNode # # source://prism//lib/prism/node.rb#3239 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::CallNode), + inheritance_operator_loc: T.nilable(Prism::Location), + superclass: T.nilable(Prism::Node), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).void + end def initialize(source, node_id, location, flags, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name); end # Implements case-equality for the node. This is effectively == but without @@ -3688,67 +4241,94 @@ class Prism::ClassNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3255 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: StatementsNode | BeginNode | nil # # source://prism//lib/prism/node.rb#3321 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3260 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def class_keyword: () -> String # # source://prism//lib/prism/node.rb#3334 + sig { returns(String) } def class_keyword; end # attr_reader class_keyword_loc: Location # # source://prism//lib/prism/node.rb#3295 + sig { returns(Prism::Location) } def class_keyword_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3274 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3265 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader constant_path: ConstantReadNode | ConstantPathNode | CallNode # # source://prism//lib/prism/node.rb#3302 + sig { returns(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::CallNode)) } def constant_path; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode | CallNode, ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: StatementsNode | BeginNode | nil, ?end_keyword_loc: Location, ?name: Symbol) -> ClassNode # # source://prism//lib/prism/node.rb#3279 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::CallNode), + inheritance_operator_loc: T.nilable(Prism::Location), + superclass: T.nilable(Prism::Node), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).returns(Prism::ClassNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), inheritance_operator_loc: T.unsafe(nil), superclass: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3260 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], class_keyword_loc: Location, constant_path: ConstantReadNode | ConstantPathNode | CallNode, inheritance_operator_loc: Location?, superclass: Prism::node?, body: StatementsNode | BeginNode | nil, end_keyword_loc: Location, name: Symbol } # # source://prism//lib/prism/node.rb#3287 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String # # source://prism//lib/prism/node.rb#3344 + sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # # source://prism//lib/prism/node.rb#3324 + sig { returns(Prism::Location) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -3757,11 +4337,13 @@ class Prism::ClassNode < ::Prism::Node # def inheritance_operator: () -> String? # # source://prism//lib/prism/node.rb#3339 + sig { returns(T.nilable(String)) } def inheritance_operator; end # attr_reader inheritance_operator_loc: Location? # # source://prism//lib/prism/node.rb#3305 + sig { returns(T.nilable(Prism::Location)) } def inheritance_operator_loc; end # def inspect -> String @@ -3773,16 +4355,19 @@ class Prism::ClassNode < ::Prism::Node # attr_reader locals: Array[Symbol] # # source://prism//lib/prism/node.rb#3292 + sig { returns(T::Array[Symbol]) } def locals; end # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#3331 + sig { returns(Symbol) } def name; end # attr_reader superclass: Prism::node? # # source://prism//lib/prism/node.rb#3318 + sig { returns(T.nilable(Prism::Node)) } def superclass; end # Return a symbol representation of this node type. See `Node#type`. @@ -3811,6 +4396,18 @@ class Prism::ClassVariableAndWriteNode < ::Prism::Node # @return [ClassVariableAndWriteNode] a new instance of ClassVariableAndWriteNode # # source://prism//lib/prism/node.rb#3385 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -3822,37 +4419,54 @@ class Prism::ClassVariableAndWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3397 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3402 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3412 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3407 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableAndWriteNode # # source://prism//lib/prism/node.rb#3417 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ClassVariableAndWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3402 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#3425 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#164 @@ -3870,21 +4484,25 @@ class Prism::ClassVariableAndWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#3430 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#3433 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#3450 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#3440 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -3896,6 +4514,7 @@ class Prism::ClassVariableAndWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#3447 + sig { returns(Prism::Node) } def value; end class << self @@ -3918,6 +4537,19 @@ class Prism::ClassVariableOperatorWriteNode < ::Prism::Node # @return [ClassVariableOperatorWriteNode] a new instance of ClassVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#3486 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).void + end def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without @@ -3929,47 +4561,67 @@ class Prism::ClassVariableOperatorWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3499 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader binary_operator: Symbol # # source://prism//lib/prism/node.rb#3552 + sig { returns(Symbol) } def binary_operator; end # attr_reader binary_operator_loc: Location # # source://prism//lib/prism/node.rb#3542 + sig { returns(Prism::Location) } def binary_operator_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3504 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3514 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3509 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ClassVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#3519 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::ClassVariableOperatorWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3504 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # # source://prism//lib/prism/node.rb#3527 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#176 @@ -3987,11 +4639,13 @@ class Prism::ClassVariableOperatorWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#3532 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#3535 + sig { returns(Prism::Location) } def name_loc; end # Returns the binary operator used to modify the receiver. This method is @@ -4015,6 +4669,7 @@ class Prism::ClassVariableOperatorWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#3549 + sig { returns(Prism::Node) } def value; end class << self @@ -4037,6 +4692,18 @@ class Prism::ClassVariableOrWriteNode < ::Prism::Node # @return [ClassVariableOrWriteNode] a new instance of ClassVariableOrWriteNode # # source://prism//lib/prism/node.rb#3587 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -4048,37 +4715,54 @@ class Prism::ClassVariableOrWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3599 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3604 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3614 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3609 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableOrWriteNode # # source://prism//lib/prism/node.rb#3619 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ClassVariableOrWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3604 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#3627 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#170 @@ -4096,21 +4780,25 @@ class Prism::ClassVariableOrWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#3632 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#3635 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#3652 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#3642 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -4122,6 +4810,7 @@ class Prism::ClassVariableOrWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#3649 + sig { returns(Prism::Node) } def value; end class << self @@ -4144,6 +4833,7 @@ class Prism::ClassVariableReadNode < ::Prism::Node # @return [ClassVariableReadNode] a new instance of ClassVariableReadNode # # source://prism//lib/prism/node.rb#3688 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -4155,37 +4845,51 @@ class Prism::ClassVariableReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3697 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3702 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3712 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3707 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableReadNode # # source://prism//lib/prism/node.rb#3717 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ClassVariableReadNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3702 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#3725 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -4204,6 +4908,7 @@ class Prism::ClassVariableReadNode < ::Prism::Node # @@_test # name `:@@_test` # # source://prism//lib/prism/node.rb#3734 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -4232,6 +4937,7 @@ class Prism::ClassVariableTargetNode < ::Prism::Node # @return [ClassVariableTargetNode] a new instance of ClassVariableTargetNode # # source://prism//lib/prism/node.rb#3765 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -4243,37 +4949,51 @@ class Prism::ClassVariableTargetNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3774 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3779 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3789 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3784 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableTargetNode # # source://prism//lib/prism/node.rb#3794 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ClassVariableTargetNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3779 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#3802 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -4288,6 +5008,7 @@ class Prism::ClassVariableTargetNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#3807 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -4316,6 +5037,18 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # @return [ClassVariableWriteNode] a new instance of ClassVariableWriteNode # # source://prism//lib/prism/node.rb#3838 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -4327,37 +5060,54 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3850 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3855 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3865 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3860 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ClassVariableWriteNode # # source://prism//lib/prism/node.rb#3870 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::ClassVariableWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3855 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#3878 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -4376,6 +5126,7 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # @@_test = :test # name `@@_test` # # source://prism//lib/prism/node.rb#3887 + sig { returns(Symbol) } def name; end # The location of the variable name. @@ -4384,11 +5135,13 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # ^^^^^ # # source://prism//lib/prism/node.rb#3893 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#3919 + sig { returns(String) } def operator; end # The location of the `=` operator. @@ -4397,6 +5150,7 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#3912 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -4414,6 +5168,7 @@ class Prism::ClassVariableWriteNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#3906 + sig { returns(Prism::Node) } def value; end class << self @@ -4424,10 +5179,63 @@ class Prism::ClassVariableWriteNode < ::Prism::Node end end +# A cache that can be used to quickly compute code unit offsets from byte +# offsets. It purposefully provides only a single #[] method to access the +# cache in order to minimize surface area. +# +# Note that there are some known issues here that may or may not be addressed +# in the future: +# +# * The first is that there are issues when the cache computes values that are +# not on character boundaries. This can result in subsequent computations +# being off by one or more code units. +# * The second is that this cache is currently unbounded. In theory we could +# introduce some kind of LRU cache to limit the number of entries, but this +# has not yet been implemented. +# +# source://prism//lib/prism/parse_result.rb#172 +class Prism::CodeUnitsCache + # Initialize a new cache with the given source and encoding. + # + # @return [CodeUnitsCache] a new instance of CodeUnitsCache + # + # source://prism//lib/prism/parse_result.rb#198 + sig { params(source: String, encoding: Encoding).void } + def initialize(source, encoding); end + + # Retrieve the code units offset from the given byte offset. + # + # source://prism//lib/prism/parse_result.rb#212 + sig { params(byte_offset: Integer).returns(Integer) } + def [](byte_offset); end +end + +# source://prism//lib/prism/parse_result.rb#184 +class Prism::CodeUnitsCache::LengthCounter + # @return [LengthCounter] a new instance of LengthCounter + # + # source://prism//lib/prism/parse_result.rb#185 + def initialize(source, encoding); end + + # source://prism//lib/prism/parse_result.rb#190 + def count(byte_offset, byte_length); end +end + +# source://prism//lib/prism/parse_result.rb#173 +class Prism::CodeUnitsCache::UTF16Counter + # @return [UTF16Counter] a new instance of UTF16Counter + # + # source://prism//lib/prism/parse_result.rb#174 + def initialize(source, encoding); end + + # source://prism//lib/prism/parse_result.rb#179 + def count(byte_offset, byte_length); end +end + # This represents a comment that was encountered during parsing. It is the # base class for all comment types. # -# source://prism//lib/prism/parse_result.rb#375 +# source://prism//lib/prism/parse_result.rb#507 class Prism::Comment abstract! @@ -4435,25 +5243,25 @@ class Prism::Comment # # @return [Comment] a new instance of Comment # - # source://prism//lib/prism/parse_result.rb#380 + # source://prism//lib/prism/parse_result.rb#512 sig { params(location: Prism::Location).void } def initialize(location); end # Implement the hash pattern matching interface for Comment. # - # source://prism//lib/prism/parse_result.rb#385 + # source://prism//lib/prism/parse_result.rb#517 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The location of this comment in the source. # - # source://prism//lib/prism/parse_result.rb#377 + # source://prism//lib/prism/parse_result.rb#509 sig { returns(Prism::Location) } def location; end # Returns the content of the comment by slicing it from the source code. # - # source://prism//lib/prism/parse_result.rb#390 + # source://prism//lib/prism/parse_result.rb#522 sig { returns(String) } def slice; end @@ -5417,6 +6225,18 @@ class Prism::ConstantAndWriteNode < ::Prism::Node # @return [ConstantAndWriteNode] a new instance of ConstantAndWriteNode # # source://prism//lib/prism/node.rb#3955 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -5428,37 +6248,54 @@ class Prism::ConstantAndWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#3967 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3972 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#3982 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#3977 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantAndWriteNode # # source://prism//lib/prism/node.rb#3987 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantAndWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#3972 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#3995 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#182 @@ -5476,21 +6313,25 @@ class Prism::ConstantAndWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#4000 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#4003 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#4020 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#4010 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -5502,6 +6343,7 @@ class Prism::ConstantAndWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#4017 + sig { returns(Prism::Node) } def value; end class << self @@ -5524,6 +6366,19 @@ class Prism::ConstantOperatorWriteNode < ::Prism::Node # @return [ConstantOperatorWriteNode] a new instance of ConstantOperatorWriteNode # # source://prism//lib/prism/node.rb#4056 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).void + end def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without @@ -5535,47 +6390,67 @@ class Prism::ConstantOperatorWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4069 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader binary_operator: Symbol # # source://prism//lib/prism/node.rb#4122 + sig { returns(Symbol) } def binary_operator; end # attr_reader binary_operator_loc: Location # # source://prism//lib/prism/node.rb#4112 + sig { returns(Prism::Location) } def binary_operator_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4074 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4084 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4079 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantOperatorWriteNode # # source://prism//lib/prism/node.rb#4089 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::ConstantOperatorWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4074 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # # source://prism//lib/prism/node.rb#4097 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#194 @@ -5593,11 +6468,13 @@ class Prism::ConstantOperatorWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#4102 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#4105 + sig { returns(Prism::Location) } def name_loc; end # Returns the binary operator used to modify the receiver. This method is @@ -5621,6 +6498,7 @@ class Prism::ConstantOperatorWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#4119 + sig { returns(Prism::Node) } def value; end class << self @@ -5643,6 +6521,18 @@ class Prism::ConstantOrWriteNode < ::Prism::Node # @return [ConstantOrWriteNode] a new instance of ConstantOrWriteNode # # source://prism//lib/prism/node.rb#4157 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -5654,37 +6544,54 @@ class Prism::ConstantOrWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4169 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4174 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4184 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4179 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantOrWriteNode # # source://prism//lib/prism/node.rb#4189 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantOrWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4174 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#4197 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#188 @@ -5702,21 +6609,25 @@ class Prism::ConstantOrWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#4202 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#4205 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#4222 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#4212 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -5728,6 +6639,7 @@ class Prism::ConstantOrWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#4219 + sig { returns(Prism::Node) } def value; end class << self @@ -5750,6 +6662,17 @@ class Prism::ConstantPathAndWriteNode < ::Prism::Node # @return [ConstantPathAndWriteNode] a new instance of ConstantPathAndWriteNode # # source://prism//lib/prism/node.rb#4258 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, target, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -5761,37 +6684,53 @@ class Prism::ConstantPathAndWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4269 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4274 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4284 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4279 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathAndWriteNode # # source://prism//lib/prism/node.rb#4289 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantPathAndWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4274 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#4297 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -5806,16 +6745,19 @@ class Prism::ConstantPathAndWriteNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#4315 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#4305 + sig { returns(Prism::Location) } def operator_loc; end # attr_reader target: ConstantPathNode # # source://prism//lib/prism/node.rb#4302 + sig { returns(Prism::ConstantPathNode) } def target; end # Return a symbol representation of this node type. See `Node#type`. @@ -5827,6 +6769,7 @@ class Prism::ConstantPathAndWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#4312 + sig { returns(Prism::Node) } def value; end class << self @@ -5849,6 +6792,18 @@ class Prism::ConstantPathNode < ::Prism::Node # @return [ConstantPathNode] a new instance of ConstantPathNode # # source://prism//lib/prism/node.rb#4350 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + parent: T.nilable(Prism::Node), + name: T.nilable(Symbol), + delimiter_loc: Prism::Location, + name_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, parent, name, delimiter_loc, name_loc); end # Implements case-equality for the node. This is effectively == but without @@ -5860,6 +6815,7 @@ class Prism::ConstantPathNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4362 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # Previously, we had a child node on this class that contained either a @@ -5872,37 +6828,54 @@ class Prism::ConstantPathNode < ::Prism::Node # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4367 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4379 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4372 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathNode # # source://prism//lib/prism/node.rb#4384 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + parent: T.nilable(Prism::Node), + name: T.nilable(Symbol), + delimiter_loc: Prism::Location, + name_loc: Prism::Location + ).returns(Prism::ConstantPathNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4367 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, parent: Prism::node?, name: Symbol?, delimiter_loc: Location, name_loc: Location } # # source://prism//lib/prism/node.rb#4392 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def delimiter: () -> String # # source://prism//lib/prism/node.rb#4438 + sig { returns(String) } def delimiter; end # The location of the `::` delimiter. @@ -5914,6 +6887,7 @@ class Prism::ConstantPathNode < ::Prism::Node # ^^ # # source://prism//lib/prism/node.rb#4418 + sig { returns(Prism::Location) } def delimiter_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -5941,6 +6915,7 @@ class Prism::ConstantPathNode < ::Prism::Node # The name of the constant being accessed. This could be `nil` in the event of a syntax error. # # source://prism//lib/prism/node.rb#4409 + sig { returns(T.nilable(Symbol)) } def name; end # The location of the name of the constant. @@ -5952,6 +6927,7 @@ class Prism::ConstantPathNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#4431 + sig { returns(Prism::Location) } def name_loc; end # The left-hand node of the path, if present. It can be `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). It will be `nil` when the constant lookup is at the root of the module tree. @@ -5966,6 +6942,7 @@ class Prism::ConstantPathNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#4406 + sig { returns(T.nilable(Prism::Node)) } def parent; end # Return a symbol representation of this node type. See `Node#type`. @@ -6011,6 +6988,18 @@ class Prism::ConstantPathOperatorWriteNode < ::Prism::Node # @return [ConstantPathOperatorWriteNode] a new instance of ConstantPathOperatorWriteNode # # source://prism//lib/prism/node.rb#4474 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).void + end def initialize(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without @@ -6022,47 +7011,66 @@ class Prism::ConstantPathOperatorWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4486 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader binary_operator: Symbol # # source://prism//lib/prism/node.rb#4532 + sig { returns(Symbol) } def binary_operator; end # attr_reader binary_operator_loc: Location # # source://prism//lib/prism/node.rb#4522 + sig { returns(Prism::Location) } def binary_operator_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4491 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4501 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4496 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode # # source://prism//lib/prism/node.rb#4506 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::ConstantPathOperatorWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4491 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # # source://prism//lib/prism/node.rb#4514 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -6089,6 +7097,7 @@ class Prism::ConstantPathOperatorWriteNode < ::Prism::Node # attr_reader target: ConstantPathNode # # source://prism//lib/prism/node.rb#4519 + sig { returns(Prism::ConstantPathNode) } def target; end # Return a symbol representation of this node type. See `Node#type`. @@ -6100,6 +7109,7 @@ class Prism::ConstantPathOperatorWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#4529 + sig { returns(Prism::Node) } def value; end class << self @@ -6122,6 +7132,17 @@ class Prism::ConstantPathOrWriteNode < ::Prism::Node # @return [ConstantPathOrWriteNode] a new instance of ConstantPathOrWriteNode # # source://prism//lib/prism/node.rb#4566 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, target, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -6133,37 +7154,53 @@ class Prism::ConstantPathOrWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4577 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4582 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4592 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4587 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathOrWriteNode # # source://prism//lib/prism/node.rb#4597 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantPathOrWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4582 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#4605 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -6178,16 +7215,19 @@ class Prism::ConstantPathOrWriteNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#4623 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#4613 + sig { returns(Prism::Location) } def operator_loc; end # attr_reader target: ConstantPathNode # # source://prism//lib/prism/node.rb#4610 + sig { returns(Prism::ConstantPathNode) } def target; end # Return a symbol representation of this node type. See `Node#type`. @@ -6199,6 +7239,7 @@ class Prism::ConstantPathOrWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#4620 + sig { returns(Prism::Node) } def value; end class << self @@ -6221,6 +7262,18 @@ class Prism::ConstantPathTargetNode < ::Prism::Node # @return [ConstantPathTargetNode] a new instance of ConstantPathTargetNode # # source://prism//lib/prism/node.rb#4658 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + parent: T.nilable(Prism::Node), + name: T.nilable(Symbol), + delimiter_loc: Prism::Location, + name_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, parent, name, delimiter_loc, name_loc); end # Implements case-equality for the node. This is effectively == but without @@ -6232,6 +7285,7 @@ class Prism::ConstantPathTargetNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4670 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # Previously, we had a child node on this class that contained either a @@ -6244,42 +7298,60 @@ class Prism::ConstantPathTargetNode < ::Prism::Node # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4675 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4687 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4680 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathTargetNode # # source://prism//lib/prism/node.rb#4692 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + parent: T.nilable(Prism::Node), + name: T.nilable(Symbol), + delimiter_loc: Prism::Location, + name_loc: Prism::Location + ).returns(Prism::ConstantPathTargetNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), parent: T.unsafe(nil), name: T.unsafe(nil), delimiter_loc: T.unsafe(nil), name_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4675 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, parent: Prism::node?, name: Symbol?, delimiter_loc: Location, name_loc: Location } # # source://prism//lib/prism/node.rb#4700 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def delimiter: () -> String # # source://prism//lib/prism/node.rb#4725 + sig { returns(String) } def delimiter; end # attr_reader delimiter_loc: Location # # source://prism//lib/prism/node.rb#4711 + sig { returns(Prism::Location) } def delimiter_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -6307,16 +7379,19 @@ class Prism::ConstantPathTargetNode < ::Prism::Node # attr_reader name: Symbol? # # source://prism//lib/prism/node.rb#4708 + sig { returns(T.nilable(Symbol)) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#4718 + sig { returns(Prism::Location) } def name_loc; end # attr_reader parent: Prism::node? # # source://prism//lib/prism/node.rb#4705 + sig { returns(T.nilable(Prism::Node)) } def parent; end # Return a symbol representation of this node type. See `Node#type`. @@ -6351,6 +7426,17 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # @return [ConstantPathWriteNode] a new instance of ConstantPathWriteNode # # source://prism//lib/prism/node.rb#4767 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, target, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -6362,37 +7448,53 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4778 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4783 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4793 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4788 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathWriteNode # # source://prism//lib/prism/node.rb#4798 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + target: Prism::ConstantPathNode, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::ConstantPathWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), target: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4783 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, target: ConstantPathNode, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#4806 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -6407,6 +7509,7 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#4836 + sig { returns(String) } def operator; end # The location of the `=` operator. @@ -6415,6 +7518,7 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#4823 + sig { returns(Prism::Location) } def operator_loc; end # A node representing the constant path being written to. @@ -6426,6 +7530,7 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # ^^^^^ # # source://prism//lib/prism/node.rb#4817 + sig { returns(Prism::ConstantPathNode) } def target; end # Return a symbol representation of this node type. See `Node#type`. @@ -6440,6 +7545,7 @@ class Prism::ConstantPathWriteNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#4833 + sig { returns(Prism::Node) } def value; end class << self @@ -6462,6 +7568,7 @@ class Prism::ConstantReadNode < ::Prism::Node # @return [ConstantReadNode] a new instance of ConstantReadNode # # source://prism//lib/prism/node.rb#4871 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -6473,37 +7580,51 @@ class Prism::ConstantReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4880 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4885 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4895 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4890 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantReadNode # # source://prism//lib/prism/node.rb#4900 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ConstantReadNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4885 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#4908 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -6535,6 +7656,7 @@ class Prism::ConstantReadNode < ::Prism::Node # SOME_CONSTANT # name `:SOME_CONSTANT` # # source://prism//lib/prism/node.rb#4917 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -6563,6 +7685,7 @@ class Prism::ConstantTargetNode < ::Prism::Node # @return [ConstantTargetNode] a new instance of ConstantTargetNode # # source://prism//lib/prism/node.rb#4948 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -6574,37 +7697,51 @@ class Prism::ConstantTargetNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#4957 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4962 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#4972 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#4967 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantTargetNode # # source://prism//lib/prism/node.rb#4977 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::ConstantTargetNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#4962 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#4985 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -6632,6 +7769,7 @@ class Prism::ConstantTargetNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#4990 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -6660,6 +7798,18 @@ class Prism::ConstantWriteNode < ::Prism::Node # @return [ConstantWriteNode] a new instance of ConstantWriteNode # # source://prism//lib/prism/node.rb#5021 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -6671,37 +7821,54 @@ class Prism::ConstantWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5033 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5038 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5048 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5043 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode # # source://prism//lib/prism/node.rb#5053 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::ConstantWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5038 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#5061 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -6733,6 +7900,7 @@ class Prism::ConstantWriteNode < ::Prism::Node # XYZ = 1 # name `:XYZ` # # source://prism//lib/prism/node.rb#5070 + sig { returns(Symbol) } def name; end # The location of the constant name. @@ -6741,11 +7909,13 @@ class Prism::ConstantWriteNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#5076 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#5102 + sig { returns(String) } def operator; end # The location of the `=` operator. @@ -6754,6 +7924,7 @@ class Prism::ConstantWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#5095 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -6771,6 +7942,7 @@ class Prism::ConstantWriteNode < ::Prism::Node # ^^^^^^^^^ # # source://prism//lib/prism/node.rb#5089 + sig { returns(Prism::Node) } def value; end class << self @@ -9432,6 +10604,26 @@ class Prism::DefNode < ::Prism::Node # @return [DefNode] a new instance of DefNode # # source://prism//lib/prism/node.rb#5139 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + receiver: T.nilable(Prism::Node), + parameters: T.nilable(Prism::ParametersNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + locals: T::Array[Symbol], + def_keyword_loc: Prism::Location, + operator_loc: T.nilable(Prism::Location), + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), + equal_loc: T.nilable(Prism::Location), + end_keyword_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -9443,72 +10635,104 @@ class Prism::DefNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5159 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: StatementsNode | BeginNode | nil # # source://prism//lib/prism/node.rb#5212 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5164 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5178 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5169 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: StatementsNode | BeginNode | nil, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?) -> DefNode # # source://prism//lib/prism/node.rb#5183 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + receiver: T.nilable(Prism::Node), + parameters: T.nilable(Prism::ParametersNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + locals: T::Array[Symbol], + def_keyword_loc: Prism::Location, + operator_loc: T.nilable(Prism::Location), + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), + equal_loc: T.nilable(Prism::Location), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::DefNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), receiver: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil), locals: T.unsafe(nil), def_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), equal_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5164 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, receiver: Prism::node?, parameters: ParametersNode?, body: StatementsNode | BeginNode | nil, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location? } # # source://prism//lib/prism/node.rb#5191 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def def_keyword: () -> String # # source://prism//lib/prism/node.rb#5290 + sig { returns(String) } def def_keyword; end # attr_reader def_keyword_loc: Location # # source://prism//lib/prism/node.rb#5218 + sig { returns(Prism::Location) } def def_keyword_loc; end # def end_keyword: () -> String? # # source://prism//lib/prism/node.rb#5315 + sig { returns(T.nilable(String)) } def end_keyword; end # attr_reader end_keyword_loc: Location? # # source://prism//lib/prism/node.rb#5277 + sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end # def equal: () -> String? # # source://prism//lib/prism/node.rb#5310 + sig { returns(T.nilable(String)) } def equal; end # attr_reader equal_loc: Location? # # source://prism//lib/prism/node.rb#5264 + sig { returns(T.nilable(Prism::Location)) } def equal_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -9523,56 +10747,67 @@ class Prism::DefNode < ::Prism::Node # attr_reader locals: Array[Symbol] # # source://prism//lib/prism/node.rb#5215 + sig { returns(T::Array[Symbol]) } def locals; end # def lparen: () -> String? # # source://prism//lib/prism/node.rb#5300 + sig { returns(T.nilable(String)) } def lparen; end # attr_reader lparen_loc: Location? # # source://prism//lib/prism/node.rb#5238 + sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#5196 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#5199 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String? # # source://prism//lib/prism/node.rb#5295 + sig { returns(T.nilable(String)) } def operator; end # attr_reader operator_loc: Location? # # source://prism//lib/prism/node.rb#5225 + sig { returns(T.nilable(Prism::Location)) } def operator_loc; end # attr_reader parameters: ParametersNode? # # source://prism//lib/prism/node.rb#5209 + sig { returns(T.nilable(Prism::ParametersNode)) } def parameters; end # attr_reader receiver: Prism::node? # # source://prism//lib/prism/node.rb#5206 + sig { returns(T.nilable(Prism::Node)) } def receiver; end # def rparen: () -> String? # # source://prism//lib/prism/node.rb#5305 + sig { returns(T.nilable(String)) } def rparen; end # attr_reader rparen_loc: Location? # # source://prism//lib/prism/node.rb#5251 + sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -9601,6 +10836,18 @@ class Prism::DefinedNode < ::Prism::Node # @return [DefinedNode] a new instance of DefinedNode # # source://prism//lib/prism/node.rb#5360 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + lparen_loc: T.nilable(Prism::Location), + value: Prism::Node, + rparen_loc: T.nilable(Prism::Location), + keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, lparen_loc, value, rparen_loc, keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -9612,37 +10859,54 @@ class Prism::DefinedNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5372 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5377 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5387 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5382 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location) -> DefinedNode # # source://prism//lib/prism/node.rb#5392 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + lparen_loc: T.nilable(Prism::Location), + value: Prism::Node, + rparen_loc: T.nilable(Prism::Location), + keyword_loc: Prism::Location + ).returns(Prism::DefinedNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lparen_loc: T.unsafe(nil), value: T.unsafe(nil), rparen_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5377 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, lparen_loc: Location?, value: Prism::node, rparen_loc: Location?, keyword_loc: Location } # # source://prism//lib/prism/node.rb#5400 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -9657,31 +10921,37 @@ class Prism::DefinedNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#5451 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#5434 + sig { returns(Prism::Location) } def keyword_loc; end # def lparen: () -> String? # # source://prism//lib/prism/node.rb#5441 + sig { returns(T.nilable(String)) } def lparen; end # attr_reader lparen_loc: Location? # # source://prism//lib/prism/node.rb#5405 + sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # def rparen: () -> String? # # source://prism//lib/prism/node.rb#5446 + sig { returns(T.nilable(String)) } def rparen; end # attr_reader rparen_loc: Location? # # source://prism//lib/prism/node.rb#5421 + sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -9693,6 +10963,7 @@ class Prism::DefinedNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#5418 + sig { returns(Prism::Node) } def value; end class << self @@ -12705,6 +13976,17 @@ class Prism::ElseNode < ::Prism::Node # @return [ElseNode] a new instance of ElseNode # # source://prism//lib/prism/node.rb#5487 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + else_keyword_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + end_keyword_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, else_keyword_loc, statements, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -12716,57 +13998,77 @@ class Prism::ElseNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5498 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5503 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5515 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5508 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?) -> ElseNode # # source://prism//lib/prism/node.rb#5520 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + else_keyword_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::ElseNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), else_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5503 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, else_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location? } # # source://prism//lib/prism/node.rb#5528 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def else_keyword: () -> String # # source://prism//lib/prism/node.rb#5556 + sig { returns(String) } def else_keyword; end # attr_reader else_keyword_loc: Location # # source://prism//lib/prism/node.rb#5533 + sig { returns(Prism::Location) } def else_keyword_loc; end # def end_keyword: () -> String? # # source://prism//lib/prism/node.rb#5561 + sig { returns(T.nilable(String)) } def end_keyword; end # attr_reader end_keyword_loc: Location? # # source://prism//lib/prism/node.rb#5543 + sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -12781,6 +14083,7 @@ class Prism::ElseNode < ::Prism::Node # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#5540 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -12800,11 +14103,11 @@ end # EmbDocComment objects correspond to comments that are surrounded by =begin # and =end. # -# source://prism//lib/prism/parse_result.rb#412 +# source://prism//lib/prism/parse_result.rb#544 class Prism::EmbDocComment < ::Prism::Comment # Returns a string representation of this comment. # - # source://prism//lib/prism/parse_result.rb#419 + # source://prism//lib/prism/parse_result.rb#551 sig { returns(String) } def inspect; end @@ -12812,7 +14115,7 @@ class Prism::EmbDocComment < ::Prism::Comment # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#414 + # source://prism//lib/prism/parse_result.rb#546 sig { override.returns(T::Boolean) } def trailing?; end end @@ -12829,6 +14132,17 @@ class Prism::EmbeddedStatementsNode < ::Prism::Node # @return [EmbeddedStatementsNode] a new instance of EmbeddedStatementsNode # # source://prism//lib/prism/node.rb#5596 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + closing_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, opening_loc, statements, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -12840,47 +14154,65 @@ class Prism::EmbeddedStatementsNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5607 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5612 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#5664 + sig { returns(String) } def closing; end # attr_reader closing_loc: Location # # source://prism//lib/prism/node.rb#5652 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5624 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5617 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location) -> EmbeddedStatementsNode # # source://prism//lib/prism/node.rb#5629 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + closing_loc: Prism::Location + ).returns(Prism::EmbeddedStatementsNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), statements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5612 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, statements: StatementsNode?, closing_loc: Location } # # source://prism//lib/prism/node.rb#5637 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -12895,16 +14227,19 @@ class Prism::EmbeddedStatementsNode < ::Prism::Node # def opening: () -> String # # source://prism//lib/prism/node.rb#5659 + sig { returns(String) } def opening; end # attr_reader opening_loc: Location # # source://prism//lib/prism/node.rb#5642 + sig { returns(Prism::Location) } def opening_loc; end # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#5649 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -12933,6 +14268,16 @@ class Prism::EmbeddedVariableNode < ::Prism::Node # @return [EmbeddedVariableNode] a new instance of EmbeddedVariableNode # # source://prism//lib/prism/node.rb#5699 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + variable: T.any(Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode) + ).void + end def initialize(source, node_id, location, flags, operator_loc, variable); end # Implements case-equality for the node. This is effectively == but without @@ -12944,37 +14289,52 @@ class Prism::EmbeddedVariableNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5709 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5714 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5724 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5719 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode) -> EmbeddedVariableNode # # source://prism//lib/prism/node.rb#5729 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + variable: T.any(Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode) + ).returns(Prism::EmbeddedVariableNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), variable: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5714 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, operator_loc: Location, variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode } # # source://prism//lib/prism/node.rb#5737 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -12989,11 +14349,13 @@ class Prism::EmbeddedVariableNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#5752 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#5742 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -13005,6 +14367,9 @@ class Prism::EmbeddedVariableNode < ::Prism::Node # attr_reader variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode # # source://prism//lib/prism/node.rb#5749 + sig do + returns(T.any(Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)) + end def variable; end class << self @@ -13046,6 +14411,17 @@ class Prism::EnsureNode < ::Prism::Node # @return [EnsureNode] a new instance of EnsureNode # # source://prism//lib/prism/node.rb#5790 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + ensure_keyword_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + end_keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, ensure_keyword_loc, statements, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -13057,57 +14433,77 @@ class Prism::EnsureNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5801 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5806 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5818 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5811 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location) -> EnsureNode # # source://prism//lib/prism/node.rb#5823 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + ensure_keyword_loc: Prism::Location, + statements: T.nilable(Prism::StatementsNode), + end_keyword_loc: Prism::Location + ).returns(Prism::EnsureNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), ensure_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5806 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, ensure_keyword_loc: Location, statements: StatementsNode?, end_keyword_loc: Location } # # source://prism//lib/prism/node.rb#5831 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String # # source://prism//lib/prism/node.rb#5858 + sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # # source://prism//lib/prism/node.rb#5846 + sig { returns(Prism::Location) } def end_keyword_loc; end # def ensure_keyword: () -> String # # source://prism//lib/prism/node.rb#5853 + sig { returns(String) } def ensure_keyword; end # attr_reader ensure_keyword_loc: Location # # source://prism//lib/prism/node.rb#5836 + sig { returns(Prism::Location) } def ensure_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13122,6 +14518,7 @@ class Prism::EnsureNode < ::Prism::Node # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#5843 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -13150,6 +14547,7 @@ class Prism::FalseNode < ::Prism::Node # @return [FalseNode] a new instance of FalseNode # # source://prism//lib/prism/node.rb#5893 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -13161,37 +14559,44 @@ class Prism::FalseNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5901 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5906 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#5916 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5911 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> FalseNode # # source://prism//lib/prism/node.rb#5921 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::FalseNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5906 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#5929 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13235,6 +14640,20 @@ class Prism::FindPatternNode < ::Prism::Node # @return [FindPatternNode] a new instance of FindPatternNode # # source://prism//lib/prism/node.rb#5967 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + left: Prism::SplatNode, + requireds: T::Array[Prism::Node], + right: T.any(Prism::SplatNode, Prism::MissingNode), + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, constant, left, requireds, right, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -13246,52 +14665,74 @@ class Prism::FindPatternNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#5981 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5986 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # # source://prism//lib/prism/node.rb#6062 + sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # # source://prism//lib/prism/node.rb#6044 + sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6001 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#5991 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader constant: ConstantReadNode | ConstantPathNode | nil # # source://prism//lib/prism/node.rb#6019 + sig { returns(T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode))) } def constant; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: ConstantReadNode | ConstantPathNode | nil, ?left: SplatNode, ?requireds: Array[Prism::node], ?right: SplatNode | MissingNode, ?opening_loc: Location?, ?closing_loc: Location?) -> FindPatternNode # # source://prism//lib/prism/node.rb#6006 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + left: Prism::SplatNode, + requireds: T::Array[Prism::Node], + right: T.any(Prism::SplatNode, Prism::MissingNode), + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::FindPatternNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), left: T.unsafe(nil), requireds: T.unsafe(nil), right: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#5986 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, constant: ConstantReadNode | ConstantPathNode | nil, left: SplatNode, requireds: Array[Prism::node], right: SplatNode | MissingNode, opening_loc: Location?, closing_loc: Location? } # # source://prism//lib/prism/node.rb#6014 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13306,26 +14747,31 @@ class Prism::FindPatternNode < ::Prism::Node # attr_reader left: SplatNode # # source://prism//lib/prism/node.rb#6022 + sig { returns(Prism::SplatNode) } def left; end # def opening: () -> String? # # source://prism//lib/prism/node.rb#6057 + sig { returns(T.nilable(String)) } def opening; end # attr_reader opening_loc: Location? # # source://prism//lib/prism/node.rb#6031 + sig { returns(T.nilable(Prism::Location)) } def opening_loc; end # attr_reader requireds: Array[Prism::node] # # source://prism//lib/prism/node.rb#6025 + sig { returns(T::Array[Prism::Node]) } def requireds; end # attr_reader right: SplatNode | MissingNode # # source://prism//lib/prism/node.rb#6028 + sig { returns(T.any(Prism::SplatNode, Prism::MissingNode)) } def right; end # Return a symbol representation of this node type. See `Node#type`. @@ -13492,6 +14938,7 @@ class Prism::FloatNode < ::Prism::Node # @return [FloatNode] a new instance of FloatNode # # source://prism//lib/prism/node.rb#6202 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, value: Float).void } def initialize(source, node_id, location, flags, value); end # Implements case-equality for the node. This is effectively == but without @@ -13503,37 +14950,44 @@ class Prism::FloatNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6211 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6216 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6226 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6221 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Float) -> FloatNode # # source://prism//lib/prism/node.rb#6231 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer, value: Float).returns(Prism::FloatNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6216 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Float } # # source://prism//lib/prism/node.rb#6239 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13554,6 +15008,7 @@ class Prism::FloatNode < ::Prism::Node # The value of the floating point number as a Float. # # source://prism//lib/prism/node.rb#6244 + sig { returns(Float) } def value; end class << self @@ -13576,6 +15031,21 @@ class Prism::ForNode < ::Prism::Node # @return [ForNode] a new instance of ForNode # # source://prism//lib/prism/node.rb#6275 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + index: T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode), + collection: Prism::Node, + statements: T.nilable(Prism::StatementsNode), + for_keyword_loc: Prism::Location, + in_keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), + end_keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -13587,11 +15057,13 @@ class Prism::ForNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6290 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6295 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # The collection to iterate over. @@ -13600,37 +15072,57 @@ class Prism::ForNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#6336 + sig { returns(Prism::Node) } def collection; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6309 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6300 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?index: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode, ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode # # source://prism//lib/prism/node.rb#6314 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + index: T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode), + collection: Prism::Node, + statements: T.nilable(Prism::StatementsNode), + for_keyword_loc: Prism::Location, + in_keyword_loc: Prism::Location, + do_keyword_loc: T.nilable(Prism::Location), + end_keyword_loc: Prism::Location + ).returns(Prism::ForNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), index: T.unsafe(nil), collection: T.unsafe(nil), statements: T.unsafe(nil), for_keyword_loc: T.unsafe(nil), in_keyword_loc: T.unsafe(nil), do_keyword_loc: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6295 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, index: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode, collection: Prism::node, statements: StatementsNode?, for_keyword_loc: Location, in_keyword_loc: Location, do_keyword_loc: Location?, end_keyword_loc: Location } # # source://prism//lib/prism/node.rb#6322 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def do_keyword: () -> String? # # source://prism//lib/prism/node.rb#6403 + sig { returns(T.nilable(String)) } def do_keyword; end # The location of the `do` keyword, if present. @@ -13639,11 +15131,13 @@ class Prism::ForNode < ::Prism::Node # ^^ # # source://prism//lib/prism/node.rb#6370 + sig { returns(T.nilable(Prism::Location)) } def do_keyword_loc; end # def end_keyword: () -> String # # source://prism//lib/prism/node.rb#6408 + sig { returns(String) } def end_keyword; end # The location of the `end` keyword. @@ -13652,6 +15146,7 @@ class Prism::ForNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#6386 + sig { returns(Prism::Location) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13660,6 +15155,7 @@ class Prism::ForNode < ::Prism::Node # def for_keyword: () -> String # # source://prism//lib/prism/node.rb#6393 + sig { returns(String) } def for_keyword; end # The location of the `for` keyword. @@ -13668,11 +15164,13 @@ class Prism::ForNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#6350 + sig { returns(Prism::Location) } def for_keyword_loc; end # def in_keyword: () -> String # # source://prism//lib/prism/node.rb#6398 + sig { returns(String) } def in_keyword; end # The location of the `in` keyword. @@ -13681,6 +15179,7 @@ class Prism::ForNode < ::Prism::Node # ^^ # # source://prism//lib/prism/node.rb#6360 + sig { returns(Prism::Location) } def in_keyword_loc; end # The index expression for `for` loops. @@ -13689,6 +15188,9 @@ class Prism::ForNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#6330 + sig do + returns(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode)) + end def index; end # def inspect -> String @@ -13705,6 +15207,7 @@ class Prism::ForNode < ::Prism::Node # end # # source://prism//lib/prism/node.rb#6344 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -13735,6 +15238,7 @@ class Prism::ForwardingArgumentsNode < ::Prism::Node # @return [ForwardingArgumentsNode] a new instance of ForwardingArgumentsNode # # source://prism//lib/prism/node.rb#6449 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -13746,37 +15250,44 @@ class Prism::ForwardingArgumentsNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6457 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6462 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6472 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6467 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingArgumentsNode # # source://prism//lib/prism/node.rb#6477 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ForwardingArgumentsNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6462 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#6485 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13815,6 +15326,7 @@ class Prism::ForwardingParameterNode < ::Prism::Node # @return [ForwardingParameterNode] a new instance of ForwardingParameterNode # # source://prism//lib/prism/node.rb#6518 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -13826,37 +15338,44 @@ class Prism::ForwardingParameterNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6526 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6531 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6541 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6536 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingParameterNode # # source://prism//lib/prism/node.rb#6546 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ForwardingParameterNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6531 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#6554 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13894,6 +15413,15 @@ class Prism::ForwardingSuperNode < ::Prism::Node # @return [ForwardingSuperNode] a new instance of ForwardingSuperNode # # source://prism//lib/prism/node.rb#6586 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + block: T.nilable(Prism::BlockNode) + ).void + end def initialize(source, node_id, location, flags, block); end # Implements case-equality for the node. This is effectively == but without @@ -13905,42 +15433,57 @@ class Prism::ForwardingSuperNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6595 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader block: BlockNode? # # source://prism//lib/prism/node.rb#6630 + sig { returns(T.nilable(Prism::BlockNode)) } def block; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6600 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6612 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6605 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?block: BlockNode?) -> ForwardingSuperNode # # source://prism//lib/prism/node.rb#6617 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + block: T.nilable(Prism::BlockNode) + ).returns(Prism::ForwardingSuperNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), block: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6600 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, block: BlockNode? } # # source://prism//lib/prism/node.rb#6625 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -13978,6 +15521,18 @@ class Prism::GlobalVariableAndWriteNode < ::Prism::Node # @return [GlobalVariableAndWriteNode] a new instance of GlobalVariableAndWriteNode # # source://prism//lib/prism/node.rb#6661 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -13989,37 +15544,54 @@ class Prism::GlobalVariableAndWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6673 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6678 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6688 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6683 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableAndWriteNode # # source://prism//lib/prism/node.rb#6693 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::GlobalVariableAndWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6678 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#6701 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#200 @@ -14037,21 +15609,25 @@ class Prism::GlobalVariableAndWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#6706 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#6709 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#6726 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#6716 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -14063,6 +15639,7 @@ class Prism::GlobalVariableAndWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#6723 + sig { returns(Prism::Node) } def value; end class << self @@ -14085,6 +15662,19 @@ class Prism::GlobalVariableOperatorWriteNode < ::Prism::Node # @return [GlobalVariableOperatorWriteNode] a new instance of GlobalVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#6762 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).void + end def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without @@ -14096,47 +15686,67 @@ class Prism::GlobalVariableOperatorWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6775 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader binary_operator: Symbol # # source://prism//lib/prism/node.rb#6828 + sig { returns(Symbol) } def binary_operator; end # attr_reader binary_operator_loc: Location # # source://prism//lib/prism/node.rb#6818 + sig { returns(Prism::Location) } def binary_operator_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6780 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6790 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6785 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> GlobalVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#6795 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::GlobalVariableOperatorWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6780 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # # source://prism//lib/prism/node.rb#6803 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#212 @@ -14154,11 +15764,13 @@ class Prism::GlobalVariableOperatorWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#6808 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#6811 + sig { returns(Prism::Location) } def name_loc; end # Returns the binary operator used to modify the receiver. This method is @@ -14182,6 +15794,7 @@ class Prism::GlobalVariableOperatorWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#6825 + sig { returns(Prism::Node) } def value; end class << self @@ -14204,6 +15817,18 @@ class Prism::GlobalVariableOrWriteNode < ::Prism::Node # @return [GlobalVariableOrWriteNode] a new instance of GlobalVariableOrWriteNode # # source://prism//lib/prism/node.rb#6863 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -14215,37 +15840,54 @@ class Prism::GlobalVariableOrWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6875 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6880 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6890 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6885 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableOrWriteNode # # source://prism//lib/prism/node.rb#6895 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::GlobalVariableOrWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6880 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#6903 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#206 @@ -14263,21 +15905,25 @@ class Prism::GlobalVariableOrWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#6908 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#6911 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#6928 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#6918 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -14289,6 +15935,7 @@ class Prism::GlobalVariableOrWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#6925 + sig { returns(Prism::Node) } def value; end class << self @@ -14311,6 +15958,7 @@ class Prism::GlobalVariableReadNode < ::Prism::Node # @return [GlobalVariableReadNode] a new instance of GlobalVariableReadNode # # source://prism//lib/prism/node.rb#6964 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -14322,37 +15970,51 @@ class Prism::GlobalVariableReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#6973 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6978 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#6988 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#6983 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableReadNode # # source://prism//lib/prism/node.rb#6993 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::GlobalVariableReadNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#6978 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#7001 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -14371,6 +16033,7 @@ class Prism::GlobalVariableReadNode < ::Prism::Node # $_Test # name `:$_Test` # # source://prism//lib/prism/node.rb#7010 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -14399,6 +16062,7 @@ class Prism::GlobalVariableTargetNode < ::Prism::Node # @return [GlobalVariableTargetNode] a new instance of GlobalVariableTargetNode # # source://prism//lib/prism/node.rb#7041 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -14410,37 +16074,51 @@ class Prism::GlobalVariableTargetNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7050 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7055 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7065 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7060 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode # # source://prism//lib/prism/node.rb#7070 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::GlobalVariableTargetNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7055 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#7078 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -14455,6 +16133,7 @@ class Prism::GlobalVariableTargetNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#7083 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -14483,6 +16162,18 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # @return [GlobalVariableWriteNode] a new instance of GlobalVariableWriteNode # # source://prism//lib/prism/node.rb#7114 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -14494,37 +16185,54 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7126 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7131 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7141 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7136 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> GlobalVariableWriteNode # # source://prism//lib/prism/node.rb#7146 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::GlobalVariableWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7131 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#7154 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -14543,6 +16251,7 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # $_Test = 123 # name `:$_Test` # # source://prism//lib/prism/node.rb#7163 + sig { returns(Symbol) } def name; end # The location of the global variable's name. @@ -14551,11 +16260,13 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#7169 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#7195 + sig { returns(String) } def operator; end # The location of the `=` operator. @@ -14564,6 +16275,7 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#7188 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -14581,6 +16293,7 @@ class Prism::GlobalVariableWriteNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#7182 + sig { returns(Prism::Node) } def value; end class << self @@ -14603,6 +16316,17 @@ class Prism::HashNode < ::Prism::Node # @return [HashNode] a new instance of HashNode # # source://prism//lib/prism/node.rb#7231 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)], + closing_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, opening_loc, elements, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -14614,16 +16338,19 @@ class Prism::HashNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7242 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7247 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#7309 + sig { returns(String) } def closing; end # The location of the closing brace. @@ -14632,32 +16359,47 @@ class Prism::HashNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#7297 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7257 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7252 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location) -> HashNode # # source://prism//lib/prism/node.rb#7262 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + elements: T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)], + closing_loc: Prism::Location + ).returns(Prism::HashNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), elements: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7247 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, elements: Array[AssocNode | AssocSplatNode], closing_loc: Location } # # source://prism//lib/prism/node.rb#7270 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s. @@ -14669,6 +16411,7 @@ class Prism::HashNode < ::Prism::Node # ^^^^^ # # source://prism//lib/prism/node.rb#7291 + sig { returns(T::Array[T.any(Prism::AssocNode, Prism::AssocSplatNode)]) } def elements; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -14683,6 +16426,7 @@ class Prism::HashNode < ::Prism::Node # def opening: () -> String # # source://prism//lib/prism/node.rb#7304 + sig { returns(String) } def opening; end # The location of the opening brace. @@ -14691,6 +16435,7 @@ class Prism::HashNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#7278 + sig { returns(Prism::Location) } def opening_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -14722,6 +16467,19 @@ class Prism::HashPatternNode < ::Prism::Node # @return [HashPatternNode] a new instance of HashPatternNode # # source://prism//lib/prism/node.rb#7348 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + elements: T::Array[Prism::AssocNode], + rest: T.nilable(T.any(Prism::AssocSplatNode, Prism::NoKeywordsParameterNode)), + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, constant, elements, rest, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -14733,57 +16491,79 @@ class Prism::HashPatternNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7361 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7366 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # # source://prism//lib/prism/node.rb#7438 + sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # # source://prism//lib/prism/node.rb#7420 + sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7380 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7371 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader constant: ConstantReadNode | ConstantPathNode | nil # # source://prism//lib/prism/node.rb#7398 + sig { returns(T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode))) } def constant; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: ConstantReadNode | ConstantPathNode | nil, ?elements: Array[AssocNode], ?rest: AssocSplatNode | NoKeywordsParameterNode | nil, ?opening_loc: Location?, ?closing_loc: Location?) -> HashPatternNode # # source://prism//lib/prism/node.rb#7385 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + constant: T.nilable(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode)), + elements: T::Array[Prism::AssocNode], + rest: T.nilable(T.any(Prism::AssocSplatNode, Prism::NoKeywordsParameterNode)), + opening_loc: T.nilable(Prism::Location), + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::HashPatternNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), constant: T.unsafe(nil), elements: T.unsafe(nil), rest: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7366 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, constant: ConstantReadNode | ConstantPathNode | nil, elements: Array[AssocNode], rest: AssocSplatNode | NoKeywordsParameterNode | nil, opening_loc: Location?, closing_loc: Location? } # # source://prism//lib/prism/node.rb#7393 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader elements: Array[AssocNode] # # source://prism//lib/prism/node.rb#7401 + sig { returns(T::Array[Prism::AssocNode]) } def elements; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -14798,16 +16578,19 @@ class Prism::HashPatternNode < ::Prism::Node # def opening: () -> String? # # source://prism//lib/prism/node.rb#7433 + sig { returns(T.nilable(String)) } def opening; end # attr_reader opening_loc: Location? # # source://prism//lib/prism/node.rb#7407 + sig { returns(T.nilable(Prism::Location)) } def opening_loc; end # attr_reader rest: AssocSplatNode | NoKeywordsParameterNode | nil # # source://prism//lib/prism/node.rb#7404 + sig { returns(T.nilable(T.any(Prism::AssocSplatNode, Prism::NoKeywordsParameterNode))) } def rest; end # Return a symbol representation of this node type. See `Node#type`. @@ -14852,6 +16635,20 @@ class Prism::IfNode < ::Prism::Node # @return [IfNode] a new instance of IfNode # # source://prism//lib/prism/node.rb#7482 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + if_keyword_loc: T.nilable(Prism::Location), + predicate: Prism::Node, + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(T.any(Prism::ElseNode, Prism::IfNode)), + end_keyword_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, if_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -14863,21 +16660,25 @@ class Prism::IfNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7496 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7501 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7515 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7506 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # Returns the subsequent if/elsif/else clause of the if node. This method is @@ -14889,22 +16690,38 @@ class Prism::IfNode < ::Prism::Node # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: ElseNode | IfNode | nil, ?end_keyword_loc: Location?) -> IfNode # # source://prism//lib/prism/node.rb#7520 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + if_keyword_loc: T.nilable(Prism::Location), + predicate: Prism::Node, + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(T.any(Prism::ElseNode, Prism::IfNode)), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::IfNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), if_keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7501 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, if_keyword_loc: Location?, predicate: Prism::node, then_keyword_loc: Location?, statements: StatementsNode?, subsequent: ElseNode | IfNode | nil, end_keyword_loc: Location? } # # source://prism//lib/prism/node.rb#7528 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String? # # source://prism//lib/prism/node.rb#7637 + sig { returns(T.nilable(String)) } def end_keyword; end # The location of the `end` keyword if present, `nil` otherwise. @@ -14915,6 +16732,7 @@ class Prism::IfNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#7614 + sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -14923,6 +16741,7 @@ class Prism::IfNode < ::Prism::Node # def if_keyword: () -> String? # # source://prism//lib/prism/node.rb#7627 + sig { returns(T.nilable(String)) } def if_keyword; end # The location of the `if` keyword if present. @@ -14933,6 +16752,7 @@ class Prism::IfNode < ::Prism::Node # The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression. # # source://prism//lib/prism/node.rb#7538 + sig { returns(T.nilable(Prism::Location)) } def if_keyword_loc; end # def inspect -> String @@ -14958,6 +16778,7 @@ class Prism::IfNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#7562 + sig { returns(Prism::Node) } def predicate; end # Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided. @@ -14970,6 +16791,7 @@ class Prism::IfNode < ::Prism::Node # end # # source://prism//lib/prism/node.rb#7591 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement. @@ -14987,11 +16809,13 @@ class Prism::IfNode < ::Prism::Node # ^^^^^^^^^^^^ # # source://prism//lib/prism/node.rb#7606 + sig { returns(T.nilable(T.any(Prism::ElseNode, Prism::IfNode))) } def subsequent; end # def then_keyword: () -> String? # # source://prism//lib/prism/node.rb#7632 + sig { returns(T.nilable(String)) } def then_keyword; end # The location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise. @@ -15003,6 +16827,7 @@ class Prism::IfNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#7571 + sig { returns(T.nilable(Prism::Location)) } def then_keyword_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -15031,6 +16856,15 @@ class Prism::ImaginaryNode < ::Prism::Node # @return [ImaginaryNode] a new instance of ImaginaryNode # # source://prism//lib/prism/node.rb#7675 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + numeric: T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode) + ).void + end def initialize(source, node_id, location, flags, numeric); end # Implements case-equality for the node. This is effectively == but without @@ -15042,37 +16876,51 @@ class Prism::ImaginaryNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7684 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7689 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7699 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7694 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?numeric: FloatNode | IntegerNode | RationalNode) -> ImaginaryNode # # source://prism//lib/prism/node.rb#7704 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + numeric: T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode) + ).returns(Prism::ImaginaryNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), numeric: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7689 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, numeric: FloatNode | IntegerNode | RationalNode } # # source://prism//lib/prism/node.rb#7712 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -15087,6 +16935,7 @@ class Prism::ImaginaryNode < ::Prism::Node # attr_reader numeric: FloatNode | IntegerNode | RationalNode # # source://prism//lib/prism/node.rb#7717 + sig { returns(T.any(Prism::FloatNode, Prism::IntegerNode, Prism::RationalNode)) } def numeric; end # Return a symbol representation of this node type. See `Node#type`. @@ -15127,6 +16976,15 @@ class Prism::ImplicitNode < ::Prism::Node # @return [ImplicitNode] a new instance of ImplicitNode # # source://prism//lib/prism/node.rb#7754 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.any(Prism::LocalVariableReadNode, Prism::CallNode, Prism::ConstantReadNode, Prism::LocalVariableTargetNode) + ).void + end def initialize(source, node_id, location, flags, value); end # Implements case-equality for the node. This is effectively == but without @@ -15138,37 +16996,51 @@ class Prism::ImplicitNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7763 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7768 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7778 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7773 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode) -> ImplicitNode # # source://prism//lib/prism/node.rb#7783 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: T.any(Prism::LocalVariableReadNode, Prism::CallNode, Prism::ConstantReadNode, Prism::LocalVariableTargetNode) + ).returns(Prism::ImplicitNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7768 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode } # # source://prism//lib/prism/node.rb#7791 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -15189,6 +17061,9 @@ class Prism::ImplicitNode < ::Prism::Node # attr_reader value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode # # source://prism//lib/prism/node.rb#7796 + sig do + returns(T.any(Prism::LocalVariableReadNode, Prism::CallNode, Prism::ConstantReadNode, Prism::LocalVariableTargetNode)) + end def value; end class << self @@ -15220,6 +17095,7 @@ class Prism::ImplicitRestNode < ::Prism::Node # @return [ImplicitRestNode] a new instance of ImplicitRestNode # # source://prism//lib/prism/node.rb#7836 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -15231,37 +17107,44 @@ class Prism::ImplicitRestNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7844 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7849 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7859 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7854 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ImplicitRestNode # # source://prism//lib/prism/node.rb#7864 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ImplicitRestNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7849 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#7872 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -15299,6 +17182,18 @@ class Prism::InNode < ::Prism::Node # @return [InNode] a new instance of InNode # # source://prism//lib/prism/node.rb#7904 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + pattern: Prism::Node, + statements: T.nilable(Prism::StatementsNode), + in_loc: Prism::Location, + then_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, pattern, statements, in_loc, then_loc); end # Implements case-equality for the node. This is effectively == but without @@ -15310,37 +17205,54 @@ class Prism::InNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#7916 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7921 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#7934 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#7926 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_loc: Location, ?then_loc: Location?) -> InNode # # source://prism//lib/prism/node.rb#7939 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + pattern: Prism::Node, + statements: T.nilable(Prism::StatementsNode), + in_loc: Prism::Location, + then_loc: T.nilable(Prism::Location) + ).returns(Prism::InNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), pattern: T.unsafe(nil), statements: T.unsafe(nil), in_loc: T.unsafe(nil), then_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#7921 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, pattern: Prism::node, statements: StatementsNode?, in_loc: Location, then_loc: Location? } # # source://prism//lib/prism/node.rb#7947 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -15349,11 +17261,13 @@ class Prism::InNode < ::Prism::Node # def in: () -> String # # source://prism//lib/prism/node.rb#7978 + sig { returns(String) } def in; end # attr_reader in_loc: Location # # source://prism//lib/prism/node.rb#7958 + sig { returns(Prism::Location) } def in_loc; end # def inspect -> String @@ -15365,21 +17279,25 @@ class Prism::InNode < ::Prism::Node # attr_reader pattern: Prism::node # # source://prism//lib/prism/node.rb#7952 + sig { returns(Prism::Node) } def pattern; end # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#7955 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # def then: () -> String? # # source://prism//lib/prism/node.rb#7983 + sig { returns(T.nilable(String)) } def then; end # attr_reader then_loc: Location? # # source://prism//lib/prism/node.rb#7965 + sig { returns(T.nilable(Prism::Location)) } def then_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -16265,11 +18183,11 @@ end # InlineComment objects are the most common. They correspond to comments in # the source file like this one that start with #. # -# source://prism//lib/prism/parse_result.rb#397 +# source://prism//lib/prism/parse_result.rb#529 class Prism::InlineComment < ::Prism::Comment # Returns a string representation of this comment. # - # source://prism//lib/prism/parse_result.rb#405 + # source://prism//lib/prism/parse_result.rb#537 sig { returns(String) } def inspect; end @@ -16278,7 +18196,7 @@ class Prism::InlineComment < ::Prism::Comment # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#400 + # source://prism//lib/prism/parse_result.rb#532 sig { override.returns(T::Boolean) } def trailing?; end end @@ -17117,6 +19035,18 @@ class Prism::InstanceVariableAndWriteNode < ::Prism::Node # @return [InstanceVariableAndWriteNode] a new instance of InstanceVariableAndWriteNode # # source://prism//lib/prism/node.rb#8691 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -17128,37 +19058,54 @@ class Prism::InstanceVariableAndWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#8703 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#8708 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#8718 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#8713 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableAndWriteNode # # source://prism//lib/prism/node.rb#8723 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::InstanceVariableAndWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#8708 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#8731 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#218 @@ -17176,21 +19123,25 @@ class Prism::InstanceVariableAndWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#8736 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#8739 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#8756 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#8746 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -17202,6 +19153,7 @@ class Prism::InstanceVariableAndWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#8753 + sig { returns(Prism::Node) } def value; end class << self @@ -17224,6 +19176,19 @@ class Prism::InstanceVariableOperatorWriteNode < ::Prism::Node # @return [InstanceVariableOperatorWriteNode] a new instance of InstanceVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#8792 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).void + end def initialize(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator); end # Implements case-equality for the node. This is effectively == but without @@ -17235,47 +19200,67 @@ class Prism::InstanceVariableOperatorWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#8805 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader binary_operator: Symbol # # source://prism//lib/prism/node.rb#8858 + sig { returns(Symbol) } def binary_operator; end # attr_reader binary_operator_loc: Location # # source://prism//lib/prism/node.rb#8848 + sig { returns(Prism::Location) } def binary_operator_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#8810 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#8820 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#8815 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> InstanceVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#8825 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + binary_operator: Symbol + ).returns(Prism::InstanceVariableOperatorWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), binary_operator: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#8810 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol } # # source://prism//lib/prism/node.rb#8833 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#230 @@ -17293,11 +19278,13 @@ class Prism::InstanceVariableOperatorWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#8838 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#8841 + sig { returns(Prism::Location) } def name_loc; end # Returns the binary operator used to modify the receiver. This method is @@ -17321,6 +19308,7 @@ class Prism::InstanceVariableOperatorWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#8855 + sig { returns(Prism::Node) } def value; end class << self @@ -17343,6 +19331,18 @@ class Prism::InstanceVariableOrWriteNode < ::Prism::Node # @return [InstanceVariableOrWriteNode] a new instance of InstanceVariableOrWriteNode # # source://prism//lib/prism/node.rb#8893 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, name, name_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -17354,37 +19354,54 @@ class Prism::InstanceVariableOrWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#8905 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#8910 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#8920 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#8915 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableOrWriteNode # # source://prism//lib/prism/node.rb#8925 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::InstanceVariableOrWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#8910 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#8933 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # source://prism//lib/prism/desugar_compiler.rb#224 @@ -17402,21 +19419,25 @@ class Prism::InstanceVariableOrWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#8938 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#8941 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#8958 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#8948 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -17428,6 +19449,7 @@ class Prism::InstanceVariableOrWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#8955 + sig { returns(Prism::Node) } def value; end class << self @@ -17450,6 +19472,7 @@ class Prism::InstanceVariableReadNode < ::Prism::Node # @return [InstanceVariableReadNode] a new instance of InstanceVariableReadNode # # source://prism//lib/prism/node.rb#8994 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -17461,37 +19484,51 @@ class Prism::InstanceVariableReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#9003 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9008 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#9018 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#9013 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableReadNode # # source://prism//lib/prism/node.rb#9023 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::InstanceVariableReadNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9008 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#9031 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -17510,6 +19547,7 @@ class Prism::InstanceVariableReadNode < ::Prism::Node # @_test # name `:@_test` # # source://prism//lib/prism/node.rb#9040 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -17538,6 +19576,7 @@ class Prism::InstanceVariableTargetNode < ::Prism::Node # @return [InstanceVariableTargetNode] a new instance of InstanceVariableTargetNode # # source://prism//lib/prism/node.rb#9071 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer, name: Symbol).void } def initialize(source, node_id, location, flags, name); end # Implements case-equality for the node. This is effectively == but without @@ -17549,37 +19588,51 @@ class Prism::InstanceVariableTargetNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#9080 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9085 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#9095 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#9090 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableTargetNode # # source://prism//lib/prism/node.rb#9100 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol + ).returns(Prism::InstanceVariableTargetNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9085 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol } # # source://prism//lib/prism/node.rb#9108 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -17594,6 +19647,7 @@ class Prism::InstanceVariableTargetNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#9113 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -17622,6 +19676,18 @@ class Prism::InstanceVariableWriteNode < ::Prism::Node # @return [InstanceVariableWriteNode] a new instance of InstanceVariableWriteNode # # source://prism//lib/prism/node.rb#9144 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, name, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -17633,37 +19699,54 @@ class Prism::InstanceVariableWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#9156 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9161 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#9171 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#9166 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> InstanceVariableWriteNode # # source://prism//lib/prism/node.rb#9176 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::InstanceVariableWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9161 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#9184 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -17682,6 +19765,7 @@ class Prism::InstanceVariableWriteNode < ::Prism::Node # @_foo = "bar" # name `@_foo` # # source://prism//lib/prism/node.rb#9193 + sig { returns(Symbol) } def name; end # The location of the variable name. @@ -17690,11 +19774,13 @@ class Prism::InstanceVariableWriteNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#9199 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#9225 + sig { returns(String) } def operator; end # The location of the `=` operator. @@ -17703,6 +19789,7 @@ class Prism::InstanceVariableWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#9218 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -17720,6 +19807,7 @@ class Prism::InstanceVariableWriteNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#9212 + sig { returns(Prism::Node) } def value; end class << self @@ -18544,6 +20632,17 @@ class Prism::InterpolatedSymbolNode < ::Prism::Node # @return [InterpolatedSymbolNode] a new instance of InterpolatedSymbolNode # # source://prism//lib/prism/node.rb#9796 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -18555,47 +20654,65 @@ class Prism::InterpolatedSymbolNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#9807 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9812 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String? # # source://prism//lib/prism/node.rb#9874 + sig { returns(T.nilable(String)) } def closing; end # attr_reader closing_loc: Location? # # source://prism//lib/prism/node.rb#9856 + sig { returns(T.nilable(Prism::Location)) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#9822 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#9817 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?) -> InterpolatedSymbolNode # # source://prism//lib/prism/node.rb#9827 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: T.nilable(Prism::Location), + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: T.nilable(Prism::Location) + ).returns(Prism::InterpolatedSymbolNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9812 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location?, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location? } # # source://prism//lib/prism/node.rb#9835 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -18613,16 +20730,19 @@ class Prism::InterpolatedSymbolNode < ::Prism::Node # def opening: () -> String? # # source://prism//lib/prism/node.rb#9869 + sig { returns(T.nilable(String)) } def opening; end # attr_reader opening_loc: Location? # # source://prism//lib/prism/node.rb#9840 + sig { returns(T.nilable(Prism::Location)) } def opening_loc; end # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] # # source://prism//lib/prism/node.rb#9853 + sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } def parts; end # Return a symbol representation of this node type. See `Node#type`. @@ -18653,6 +20773,17 @@ class Prism::InterpolatedXStringNode < ::Prism::Node # @return [InterpolatedXStringNode] a new instance of InterpolatedXStringNode # # source://prism//lib/prism/node.rb#9910 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, opening_loc, parts, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -18664,47 +20795,65 @@ class Prism::InterpolatedXStringNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#9921 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9926 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#9976 + sig { returns(String) } def closing; end # attr_reader closing_loc: Location # # source://prism//lib/prism/node.rb#9964 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#9936 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#9931 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedXStringNode # # source://prism//lib/prism/node.rb#9941 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + opening_loc: Prism::Location, + parts: T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)], + closing_loc: Prism::Location + ).returns(Prism::InterpolatedXStringNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), opening_loc: T.unsafe(nil), parts: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#9926 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, opening_loc: Location, parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], closing_loc: Location } # # source://prism//lib/prism/node.rb#9949 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -18725,16 +20874,19 @@ class Prism::InterpolatedXStringNode < ::Prism::Node # def opening: () -> String # # source://prism//lib/prism/node.rb#9971 + sig { returns(String) } def opening; end # attr_reader opening_loc: Location # # source://prism//lib/prism/node.rb#9954 + sig { returns(Prism::Location) } def opening_loc; end # attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode] # # source://prism//lib/prism/node.rb#9961 + sig { returns(T::Array[T.any(Prism::StringNode, Prism::EmbeddedStatementsNode, Prism::EmbeddedVariableNode)]) } def parts; end # Return a symbol representation of this node type. See `Node#type`. @@ -18763,6 +20915,7 @@ class Prism::ItLocalVariableReadNode < ::Prism::Node # @return [ItLocalVariableReadNode] a new instance of ItLocalVariableReadNode # # source://prism//lib/prism/node.rb#10012 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -18774,37 +20927,44 @@ class Prism::ItLocalVariableReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10020 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10025 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10035 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10030 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ItLocalVariableReadNode # # source://prism//lib/prism/node.rb#10040 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ItLocalVariableReadNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10025 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#10048 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -18842,6 +21002,7 @@ class Prism::ItParametersNode < ::Prism::Node # @return [ItParametersNode] a new instance of ItParametersNode # # source://prism//lib/prism/node.rb#10080 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -18853,37 +21014,44 @@ class Prism::ItParametersNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10088 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10093 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10103 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10098 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> ItParametersNode # # source://prism//lib/prism/node.rb#10108 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::ItParametersNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10093 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#10116 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -19186,6 +21354,20 @@ class Prism::LambdaNode < ::Prism::Node # @return [LambdaNode] a new instance of LambdaNode # # source://prism//lib/prism/node.rb#10337 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + operator_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location, + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)) + ).void + end def initialize(source, node_id, location, flags, locals, operator_loc, opening_loc, closing_loc, parameters, body); end # Implements case-equality for the node. This is effectively == but without @@ -19197,52 +21379,74 @@ class Prism::LambdaNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10351 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: StatementsNode | BeginNode | nil # # source://prism//lib/prism/node.rb#10414 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10356 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#10427 + sig { returns(String) } def closing; end # attr_reader closing_loc: Location # # source://prism//lib/prism/node.rb#10404 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10369 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10361 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, ?body: StatementsNode | BeginNode | nil) -> LambdaNode # # source://prism//lib/prism/node.rb#10374 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + operator_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location, + parameters: T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode)), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)) + ).returns(Prism::LambdaNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), operator_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil), parameters: T.unsafe(nil), body: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10356 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], operator_loc: Location, opening_loc: Location, closing_loc: Location, parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil, body: StatementsNode | BeginNode | nil } # # source://prism//lib/prism/node.rb#10382 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -19257,31 +21461,37 @@ class Prism::LambdaNode < ::Prism::Node # attr_reader locals: Array[Symbol] # # source://prism//lib/prism/node.rb#10387 + sig { returns(T::Array[Symbol]) } def locals; end # def opening: () -> String # # source://prism//lib/prism/node.rb#10422 + sig { returns(String) } def opening; end # attr_reader opening_loc: Location # # source://prism//lib/prism/node.rb#10397 + sig { returns(Prism::Location) } def opening_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#10417 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#10390 + sig { returns(Prism::Location) } def operator_loc; end # attr_reader parameters: BlockParametersNode | NumberedParametersNode | ItParametersNode | nil # # source://prism//lib/prism/node.rb#10411 + sig { returns(T.nilable(T.any(Prism::BlockParametersNode, Prism::NumberedParametersNode, Prism::ItParametersNode))) } def parameters; end # Return a symbol representation of this node type. See `Node#type`. @@ -19549,13 +21759,13 @@ end # This is a result specific to the `lex` and `lex_file` methods. # -# source://prism//lib/prism/parse_result.rb#627 +# source://prism//lib/prism/parse_result.rb#764 class Prism::LexResult < ::Prism::Result # Create a new lex result object with the given values. # # @return [LexResult] a new instance of LexResult # - # source://prism//lib/prism/parse_result.rb#632 + # source://prism//lib/prism/parse_result.rb#769 sig do params( value: T::Array[T.untyped], @@ -19571,13 +21781,13 @@ class Prism::LexResult < ::Prism::Result # Implement the hash pattern matching interface for LexResult. # - # source://prism//lib/prism/parse_result.rb#638 + # source://prism//lib/prism/parse_result.rb#775 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The list of tokens that were parsed from the source code. # - # source://prism//lib/prism/parse_result.rb#629 + # source://prism//lib/prism/parse_result.rb#766 sig { returns(T::Array[T.untyped]) } def value; end end @@ -19616,6 +21826,19 @@ class Prism::LocalVariableAndWriteNode < ::Prism::Node # @return [LocalVariableAndWriteNode] a new instance of LocalVariableAndWriteNode # # source://prism//lib/prism/node.rb#10466 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).void + end def initialize(source, node_id, location, flags, name_loc, operator_loc, value, name, depth); end # Implements case-equality for the node. This is effectively == but without @@ -19627,42 +21850,61 @@ class Prism::LocalVariableAndWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10479 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10484 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10494 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10489 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableAndWriteNode # # source://prism//lib/prism/node.rb#10499 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableAndWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10484 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name_loc: Location, operator_loc: Location, value: Prism::node, name: Symbol, depth: Integer } # # source://prism//lib/prism/node.rb#10507 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader depth: Integer # # source://prism//lib/prism/node.rb#10532 + sig { returns(Integer) } def depth; end # source://prism//lib/prism/desugar_compiler.rb#236 @@ -19680,21 +21922,25 @@ class Prism::LocalVariableAndWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#10529 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#10512 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#10535 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#10519 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -19706,6 +21952,7 @@ class Prism::LocalVariableAndWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#10526 + sig { returns(Prism::Node) } def value; end class << self @@ -19728,6 +21975,20 @@ class Prism::LocalVariableOperatorWriteNode < ::Prism::Node # @return [LocalVariableOperatorWriteNode] a new instance of LocalVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#10572 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + binary_operator: Symbol, + depth: Integer + ).void + end def initialize(source, node_id, location, flags, name_loc, binary_operator_loc, value, name, binary_operator, depth); end # Implements case-equality for the node. This is effectively == but without @@ -19739,52 +22000,74 @@ class Prism::LocalVariableOperatorWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10586 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader binary_operator: Symbol # # source://prism//lib/prism/node.rb#10639 + sig { returns(Symbol) } def binary_operator; end # attr_reader binary_operator_loc: Location # # source://prism//lib/prism/node.rb#10626 + sig { returns(Prism::Location) } def binary_operator_loc; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10591 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10601 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10596 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer) -> LocalVariableOperatorWriteNode # # source://prism//lib/prism/node.rb#10606 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + binary_operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + binary_operator: Symbol, + depth: Integer + ).returns(Prism::LocalVariableOperatorWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), binary_operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), binary_operator: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10591 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name_loc: Location, binary_operator_loc: Location, value: Prism::node, name: Symbol, binary_operator: Symbol, depth: Integer } # # source://prism//lib/prism/node.rb#10614 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader depth: Integer # # source://prism//lib/prism/node.rb#10642 + sig { returns(Integer) } def depth; end # source://prism//lib/prism/desugar_compiler.rb#248 @@ -19802,11 +22085,13 @@ class Prism::LocalVariableOperatorWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#10636 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#10619 + sig { returns(Prism::Location) } def name_loc; end # Returns the binary operator used to modify the receiver. This method is @@ -19830,6 +22115,7 @@ class Prism::LocalVariableOperatorWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#10633 + sig { returns(Prism::Node) } def value; end class << self @@ -19852,6 +22138,19 @@ class Prism::LocalVariableOrWriteNode < ::Prism::Node # @return [LocalVariableOrWriteNode] a new instance of LocalVariableOrWriteNode # # source://prism//lib/prism/node.rb#10678 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).void + end def initialize(source, node_id, location, flags, name_loc, operator_loc, value, name, depth); end # Implements case-equality for the node. This is effectively == but without @@ -19863,42 +22162,61 @@ class Prism::LocalVariableOrWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10691 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10696 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10706 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10701 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableOrWriteNode # # source://prism//lib/prism/node.rb#10711 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name_loc: Prism::Location, + operator_loc: Prism::Location, + value: Prism::Node, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableOrWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10696 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name_loc: Location, operator_loc: Location, value: Prism::node, name: Symbol, depth: Integer } # # source://prism//lib/prism/node.rb#10719 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader depth: Integer # # source://prism//lib/prism/node.rb#10744 + sig { returns(Integer) } def depth; end # source://prism//lib/prism/desugar_compiler.rb#242 @@ -19916,21 +22234,25 @@ class Prism::LocalVariableOrWriteNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#10741 + sig { returns(Symbol) } def name; end # attr_reader name_loc: Location # # source://prism//lib/prism/node.rb#10724 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#10747 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#10731 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -19942,6 +22264,7 @@ class Prism::LocalVariableOrWriteNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#10738 + sig { returns(Prism::Node) } def value; end class << self @@ -19964,6 +22287,16 @@ class Prism::LocalVariableReadNode < ::Prism::Node # @return [LocalVariableReadNode] a new instance of LocalVariableReadNode # # source://prism//lib/prism/node.rb#10784 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).void + end def initialize(source, node_id, location, flags, name, depth); end # Implements case-equality for the node. This is effectively == but without @@ -19975,37 +22308,52 @@ class Prism::LocalVariableReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10794 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10799 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10809 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10804 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableReadNode # # source://prism//lib/prism/node.rb#10814 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableReadNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10799 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer } # # source://prism//lib/prism/node.rb#10822 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The number of visible scopes that should be searched to find the origin of this local variable. @@ -20017,6 +22365,7 @@ class Prism::LocalVariableReadNode < ::Prism::Node # The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). # # source://prism//lib/prism/node.rb#10844 + sig { returns(Integer) } def depth; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -20039,6 +22388,7 @@ class Prism::LocalVariableReadNode < ::Prism::Node # _1 # name `:_1` # # source://prism//lib/prism/node.rb#10835 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -20067,6 +22417,16 @@ class Prism::LocalVariableTargetNode < ::Prism::Node # @return [LocalVariableTargetNode] a new instance of LocalVariableTargetNode # # source://prism//lib/prism/node.rb#10876 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).void + end def initialize(source, node_id, location, flags, name, depth); end # Implements case-equality for the node. This is effectively == but without @@ -20078,42 +22438,58 @@ class Prism::LocalVariableTargetNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10886 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10891 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10901 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10896 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode # # source://prism//lib/prism/node.rb#10906 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer + ).returns(Prism::LocalVariableTargetNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10891 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer } # # source://prism//lib/prism/node.rb#10914 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader depth: Integer # # source://prism//lib/prism/node.rb#10922 + sig { returns(Integer) } def depth; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -20128,6 +22504,7 @@ class Prism::LocalVariableTargetNode < ::Prism::Node # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#10919 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -20156,6 +22533,19 @@ class Prism::LocalVariableWriteNode < ::Prism::Node # @return [LocalVariableWriteNode] a new instance of LocalVariableWriteNode # # source://prism//lib/prism/node.rb#10954 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, name, depth, name_loc, value, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -20167,37 +22557,55 @@ class Prism::LocalVariableWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#10967 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10972 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#10982 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#10977 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> LocalVariableWriteNode # # source://prism//lib/prism/node.rb#10987 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + name: Symbol, + depth: Integer, + name_loc: Prism::Location, + value: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::LocalVariableWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), name: T.unsafe(nil), depth: T.unsafe(nil), name_loc: T.unsafe(nil), value: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#10972 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, name: Symbol, depth: Integer, name_loc: Location, value: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#10995 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The number of semantic scopes we have to traverse to find the declaration of this variable. @@ -20209,6 +22617,7 @@ class Prism::LocalVariableWriteNode < ::Prism::Node # The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). # # source://prism//lib/prism/node.rb#11013 + sig { returns(Integer) } def depth; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -20227,6 +22636,7 @@ class Prism::LocalVariableWriteNode < ::Prism::Node # abc = 123 # name `:abc` # # source://prism//lib/prism/node.rb#11004 + sig { returns(Symbol) } def name; end # The location of the variable name. @@ -20235,11 +22645,13 @@ class Prism::LocalVariableWriteNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#11019 + sig { returns(Prism::Location) } def name_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#11049 + sig { returns(String) } def operator; end # The location of the `=` operator. @@ -20248,6 +22660,7 @@ class Prism::LocalVariableWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11042 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -20269,6 +22682,7 @@ class Prism::LocalVariableWriteNode < ::Prism::Node # foo = foo # # source://prism//lib/prism/node.rb#11036 + sig { returns(Prism::Node) } def value; end class << self @@ -20281,20 +22695,20 @@ end # This represents a location in the source. # -# source://prism//lib/prism/parse_result.rb#165 +# source://prism//lib/prism/parse_result.rb#273 class Prism::Location # Create a new location object with the given source, start byte offset, and # byte length. # # @return [Location] a new instance of Location # - # source://prism//lib/prism/parse_result.rb#180 + # source://prism//lib/prism/parse_result.rb#288 sig { params(source: Prism::Source, start_offset: Integer, length: Integer).void } def initialize(source, start_offset, length); end # Returns true if the given other location is equal to this location. # - # source://prism//lib/prism/parse_result.rb#344 + # source://prism//lib/prism/parse_result.rb#476 sig { params(other: T.untyped).returns(T::Boolean) } def ==(other); end @@ -20302,84 +22716,128 @@ class Prism::Location # that occurs after this location on the same line, and return the new # location. This will raise an error if the string does not exist. # - # source://prism//lib/prism/parse_result.rb#363 + # source://prism//lib/prism/parse_result.rb#495 sig { params(string: String).returns(Prism::Location) } def adjoin(string); end + # The end column in code units using the given cache to fetch or calculate + # the value. + # + # source://prism//lib/prism/parse_result.rb#461 + sig do + params( + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) + end + def cached_end_code_units_column(cache); end + + # The end offset from the start of the file in code units using the given + # cache to fetch or calculate the value. + # + # source://prism//lib/prism/parse_result.rb#397 + sig do + params( + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) + end + def cached_end_code_units_offset(cache); end + + # The start column in code units using the given cache to fetch or calculate + # the value. + # + # source://prism//lib/prism/parse_result.rb#437 + sig do + params( + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) + end + def cached_start_code_units_column(cache); end + + # The start offset from the start of the file in code units using the given + # cache to fetch or calculate the value. + # + # source://prism//lib/prism/parse_result.rb#375 + sig do + params( + cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer)) + ).returns(Integer) + end + def cached_start_code_units_offset(cache); end + # Returns a new location that is the result of chopping off the last byte. # - # source://prism//lib/prism/parse_result.rb#226 + # source://prism//lib/prism/parse_result.rb#334 sig { returns(Prism::Location) } def chop; end # Returns all comments that are associated with this location (both leading # and trailing comments). # - # source://prism//lib/prism/parse_result.rb#216 + # source://prism//lib/prism/parse_result.rb#324 sig { returns(T::Array[Prism::Comment]) } def comments; end # Create a new location object with the given options. # - # source://prism//lib/prism/parse_result.rb#221 + # source://prism//lib/prism/parse_result.rb#329 sig { params(source: Prism::Source, start_offset: Integer, length: Integer).returns(Prism::Location) } def copy(source: T.unsafe(nil), start_offset: T.unsafe(nil), length: T.unsafe(nil)); end # Implement the hash pattern matching interface for Location. # - # source://prism//lib/prism/parse_result.rb#334 + # source://prism//lib/prism/parse_result.rb#466 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The column number in characters where this location ends from the start of # the line. # - # source://prism//lib/prism/parse_result.rb#323 + # source://prism//lib/prism/parse_result.rb#449 sig { returns(Integer) } def end_character_column; end # The character offset from the beginning of the source where this location # ends. # - # source://prism//lib/prism/parse_result.rb#272 + # source://prism//lib/prism/parse_result.rb#386 sig { returns(Integer) } def end_character_offset; end # The column number in code units of the given encoding where this location # ends from the start of the line. # - # source://prism//lib/prism/parse_result.rb#329 + # source://prism//lib/prism/parse_result.rb#455 sig { params(encoding: Encoding).returns(Integer) } def end_code_units_column(encoding = T.unsafe(nil)); end # The offset from the start of the file in code units of the given encoding. # - # source://prism//lib/prism/parse_result.rb#277 + # source://prism//lib/prism/parse_result.rb#391 sig { params(encoding: Encoding).returns(Integer) } def end_code_units_offset(encoding = T.unsafe(nil)); end # The column number in bytes where this location ends from the start of the # line. # - # source://prism//lib/prism/parse_result.rb#317 + # source://prism//lib/prism/parse_result.rb#443 sig { returns(Integer) } def end_column; end # The line number where this location ends. # - # source://prism//lib/prism/parse_result.rb#293 + # source://prism//lib/prism/parse_result.rb#413 sig { returns(Integer) } def end_line; end # The byte offset from the beginning of the source where this location ends. # - # source://prism//lib/prism/parse_result.rb#266 + # source://prism//lib/prism/parse_result.rb#380 sig { returns(Integer) } def end_offset; end # Returns a string representation of this location. # - # source://prism//lib/prism/parse_result.rb#231 + # source://prism//lib/prism/parse_result.rb#339 sig { returns(String) } def inspect; end @@ -20387,38 +22845,38 @@ class Prism::Location # other location. Raises an error if this location is not before the other # location or if they don't share the same source. # - # source://prism//lib/prism/parse_result.rb#353 + # source://prism//lib/prism/parse_result.rb#485 sig { params(other: Prism::Location).returns(Prism::Location) } def join(other); end # Attach a comment to the leading comments of this location. # - # source://prism//lib/prism/parse_result.rb#199 + # source://prism//lib/prism/parse_result.rb#307 sig { params(comment: Prism::Comment).void } def leading_comment(comment); end # These are the comments that are associated with this location that exist # before the start of this location. # - # source://prism//lib/prism/parse_result.rb#194 + # source://prism//lib/prism/parse_result.rb#302 sig { returns(T::Array[Prism::Comment]) } def leading_comments; end # The length of this location in bytes. # - # source://prism//lib/prism/parse_result.rb#176 + # source://prism//lib/prism/parse_result.rb#284 sig { returns(Integer) } def length; end # Implement the pretty print interface for Location. # - # source://prism//lib/prism/parse_result.rb#339 + # source://prism//lib/prism/parse_result.rb#471 sig { params(q: T.untyped).void } def pretty_print(q); end # The source code that this location represents. # - # source://prism//lib/prism/parse_result.rb#241 + # source://prism//lib/prism/parse_result.rb#349 sig { returns(String) } def slice; end @@ -20426,78 +22884,78 @@ class Prism::Location # of the line that this location starts on to the end of the line that this # location ends on. # - # source://prism//lib/prism/parse_result.rb#248 + # source://prism//lib/prism/parse_result.rb#356 def slice_lines; end # Returns all of the lines of the source code associated with this location. # - # source://prism//lib/prism/parse_result.rb#236 + # source://prism//lib/prism/parse_result.rb#344 sig { returns(T::Array[String]) } def source_lines; end # The column number in characters where this location ends from the start of # the line. # - # source://prism//lib/prism/parse_result.rb#305 + # source://prism//lib/prism/parse_result.rb#425 sig { returns(Integer) } def start_character_column; end # The character offset from the beginning of the source where this location # starts. # - # source://prism//lib/prism/parse_result.rb#256 + # source://prism//lib/prism/parse_result.rb#364 sig { returns(Integer) } def start_character_offset; end # The column number in code units of the given encoding where this location # starts from the start of the line. # - # source://prism//lib/prism/parse_result.rb#311 + # source://prism//lib/prism/parse_result.rb#431 sig { params(encoding: Encoding).returns(Integer) } def start_code_units_column(encoding = T.unsafe(nil)); end # The offset from the start of the file in code units of the given encoding. # - # source://prism//lib/prism/parse_result.rb#261 + # source://prism//lib/prism/parse_result.rb#369 sig { params(encoding: Encoding).returns(Integer) } def start_code_units_offset(encoding = T.unsafe(nil)); end # The column number in bytes where this location starts from the start of # the line. # - # source://prism//lib/prism/parse_result.rb#299 + # source://prism//lib/prism/parse_result.rb#419 sig { returns(Integer) } def start_column; end # The line number where this location starts. # - # source://prism//lib/prism/parse_result.rb#282 + # source://prism//lib/prism/parse_result.rb#402 sig { returns(Integer) } def start_line; end # The content of the line where this location starts before this location. # - # source://prism//lib/prism/parse_result.rb#287 + # source://prism//lib/prism/parse_result.rb#407 sig { returns(String) } def start_line_slice; end # The byte offset from the beginning of the source where this location # starts. # - # source://prism//lib/prism/parse_result.rb#173 + # source://prism//lib/prism/parse_result.rb#281 sig { returns(Integer) } def start_offset; end # Attach a comment to the trailing comments of this location. # - # source://prism//lib/prism/parse_result.rb#210 + # source://prism//lib/prism/parse_result.rb#318 sig { params(comment: Prism::Comment).void } def trailing_comment(comment); end # These are the comments that are associated with this location that exist # after the end of this location. # - # source://prism//lib/prism/parse_result.rb#205 + # source://prism//lib/prism/parse_result.rb#313 sig { returns(T::Array[Prism::Comment]) } def trailing_comments; end @@ -20506,7 +22964,7 @@ class Prism::Location # A Source object that is used to determine more information from the given # offset and length. # - # source://prism//lib/prism/parse_result.rb#168 + # source://prism//lib/prism/parse_result.rb#276 sig { returns(Prism::Source) } def source; end end @@ -20523,49 +22981,49 @@ Prism::LoopFlags::BEGIN_MODIFIER = T.let(T.unsafe(nil), Integer) # This represents a magic comment that was encountered during parsing. # -# source://prism//lib/prism/parse_result.rb#425 +# source://prism//lib/prism/parse_result.rb#557 class Prism::MagicComment # Create a new magic comment object with the given key and value locations. # # @return [MagicComment] a new instance of MagicComment # - # source://prism//lib/prism/parse_result.rb#433 + # source://prism//lib/prism/parse_result.rb#565 sig { params(key_loc: Prism::Location, value_loc: Prism::Location).void } def initialize(key_loc, value_loc); end # Implement the hash pattern matching interface for MagicComment. # - # source://prism//lib/prism/parse_result.rb#449 + # source://prism//lib/prism/parse_result.rb#581 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # Returns a string representation of this magic comment. # - # source://prism//lib/prism/parse_result.rb#454 + # source://prism//lib/prism/parse_result.rb#586 sig { returns(String) } def inspect; end # Returns the key of the magic comment by slicing it from the source code. # - # source://prism//lib/prism/parse_result.rb#439 + # source://prism//lib/prism/parse_result.rb#571 sig { returns(String) } def key; end # A Location object representing the location of the key in the source. # - # source://prism//lib/prism/parse_result.rb#427 + # source://prism//lib/prism/parse_result.rb#559 sig { returns(Prism::Location) } def key_loc; end # Returns the value of the magic comment by slicing it from the source code. # - # source://prism//lib/prism/parse_result.rb#444 + # source://prism//lib/prism/parse_result.rb#576 sig { returns(String) } def value; end # A Location object representing the location of the value in the source. # - # source://prism//lib/prism/parse_result.rb#430 + # source://prism//lib/prism/parse_result.rb#562 sig { returns(Prism::Location) } def value_loc; end end @@ -20825,6 +23283,17 @@ class Prism::MatchPredicateNode < ::Prism::Node # @return [MatchPredicateNode] a new instance of MatchPredicateNode # # source://prism//lib/prism/node.rb#11257 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, value, pattern, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -20836,37 +23305,53 @@ class Prism::MatchPredicateNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#11268 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11273 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#11283 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#11278 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchPredicateNode # # source://prism//lib/prism/node.rb#11288 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::MatchPredicateNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11273 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node, pattern: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#11296 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -20881,16 +23366,19 @@ class Prism::MatchPredicateNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#11314 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#11307 + sig { returns(Prism::Location) } def operator_loc; end # attr_reader pattern: Prism::node # # source://prism//lib/prism/node.rb#11304 + sig { returns(Prism::Node) } def pattern; end # Return a symbol representation of this node type. See `Node#type`. @@ -20902,6 +23390,7 @@ class Prism::MatchPredicateNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#11301 + sig { returns(Prism::Node) } def value; end class << self @@ -20924,6 +23413,17 @@ class Prism::MatchRequiredNode < ::Prism::Node # @return [MatchRequiredNode] a new instance of MatchRequiredNode # # source://prism//lib/prism/node.rb#11349 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, value, pattern, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -20935,37 +23435,53 @@ class Prism::MatchRequiredNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#11360 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11365 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#11375 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#11370 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchRequiredNode # # source://prism//lib/prism/node.rb#11380 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + value: Prism::Node, + pattern: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::MatchRequiredNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), value: T.unsafe(nil), pattern: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11365 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, value: Prism::node, pattern: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#11388 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -20980,16 +23496,19 @@ class Prism::MatchRequiredNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#11406 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#11399 + sig { returns(Prism::Location) } def operator_loc; end # attr_reader pattern: Prism::node # # source://prism//lib/prism/node.rb#11396 + sig { returns(Prism::Node) } def pattern; end # Return a symbol representation of this node type. See `Node#type`. @@ -21001,6 +23520,7 @@ class Prism::MatchRequiredNode < ::Prism::Node # attr_reader value: Prism::node # # source://prism//lib/prism/node.rb#11393 + sig { returns(Prism::Node) } def value; end class << self @@ -21023,6 +23543,16 @@ class Prism::MatchWriteNode < ::Prism::Node # @return [MatchWriteNode] a new instance of MatchWriteNode # # source://prism//lib/prism/node.rb#11441 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + call: Prism::CallNode, + targets: T::Array[Prism::LocalVariableTargetNode] + ).void + end def initialize(source, node_id, location, flags, call, targets); end # Implements case-equality for the node. This is effectively == but without @@ -21034,42 +23564,58 @@ class Prism::MatchWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#11451 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader call: CallNode # # source://prism//lib/prism/node.rb#11484 + sig { returns(Prism::CallNode) } def call; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11456 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#11466 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#11461 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?call: CallNode, ?targets: Array[LocalVariableTargetNode]) -> MatchWriteNode # # source://prism//lib/prism/node.rb#11471 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + call: Prism::CallNode, + targets: T::Array[Prism::LocalVariableTargetNode] + ).returns(Prism::MatchWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), call: T.unsafe(nil), targets: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11456 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, call: CallNode, targets: Array[LocalVariableTargetNode] } # # source://prism//lib/prism/node.rb#11479 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -21084,6 +23630,7 @@ class Prism::MatchWriteNode < ::Prism::Node # attr_reader targets: Array[LocalVariableTargetNode] # # source://prism//lib/prism/node.rb#11487 + sig { returns(T::Array[Prism::LocalVariableTargetNode]) } def targets; end # Return a symbol representation of this node type. See `Node#type`. @@ -21109,6 +23656,7 @@ class Prism::MissingNode < ::Prism::Node # @return [MissingNode] a new instance of MissingNode # # source://prism//lib/prism/node.rb#11517 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -21120,37 +23668,44 @@ class Prism::MissingNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#11525 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11530 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#11540 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#11535 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> MissingNode # # source://prism//lib/prism/node.rb#11545 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::MissingNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11530 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#11553 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -21188,6 +23743,20 @@ class Prism::ModuleNode < ::Prism::Node # @return [ModuleNode] a new instance of ModuleNode # # source://prism//lib/prism/node.rb#11585 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + module_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::MissingNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).void + end def initialize(source, node_id, location, flags, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name); end # Implements case-equality for the node. This is effectively == but without @@ -21199,57 +23768,80 @@ class Prism::ModuleNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#11599 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: StatementsNode | BeginNode | nil # # source://prism//lib/prism/node.rb#11648 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11604 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#11617 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#11609 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader constant_path: ConstantReadNode | ConstantPathNode | MissingNode # # source://prism//lib/prism/node.rb#11645 + sig { returns(T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::MissingNode)) } def constant_path; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: ConstantReadNode | ConstantPathNode | MissingNode, ?body: StatementsNode | BeginNode | nil, ?end_keyword_loc: Location, ?name: Symbol) -> ModuleNode # # source://prism//lib/prism/node.rb#11622 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + module_keyword_loc: Prism::Location, + constant_path: T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::MissingNode), + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location, + name: Symbol + ).returns(Prism::ModuleNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), module_keyword_loc: T.unsafe(nil), constant_path: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil), name: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11604 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], module_keyword_loc: Location, constant_path: ConstantReadNode | ConstantPathNode | MissingNode, body: StatementsNode | BeginNode | nil, end_keyword_loc: Location, name: Symbol } # # source://prism//lib/prism/node.rb#11630 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String # # source://prism//lib/prism/node.rb#11666 + sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # # source://prism//lib/prism/node.rb#11651 + sig { returns(Prism::Location) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -21264,21 +23856,25 @@ class Prism::ModuleNode < ::Prism::Node # attr_reader locals: Array[Symbol] # # source://prism//lib/prism/node.rb#11635 + sig { returns(T::Array[Symbol]) } def locals; end # def module_keyword: () -> String # # source://prism//lib/prism/node.rb#11661 + sig { returns(String) } def module_keyword; end # attr_reader module_keyword_loc: Location # # source://prism//lib/prism/node.rb#11638 + sig { returns(Prism::Location) } def module_keyword_loc; end # attr_reader name: Symbol # # source://prism//lib/prism/node.rb#11658 + sig { returns(Symbol) } def name; end # Return a symbol representation of this node type. See `Node#type`. @@ -21312,6 +23908,19 @@ class Prism::MultiTargetNode < ::Prism::Node # @return [MultiTargetNode] a new instance of MultiTargetNode # # source://prism//lib/prism/node.rb#11710 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc); end # Implements case-equality for the node. This is effectively == but without @@ -21323,37 +23932,55 @@ class Prism::MultiTargetNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#11723 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11728 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#11742 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#11733 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], ?rest: ImplicitRestNode | SplatNode | nil, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], ?lparen_loc: Location?, ?rparen_loc: Location?) -> MultiTargetNode # # source://prism//lib/prism/node.rb#11747 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location) + ).returns(Prism::MultiTargetNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11728 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], rest: ImplicitRestNode | SplatNode | nil, rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode | BackReferenceReadNode | NumberedReferenceReadNode], lparen_loc: Location?, rparen_loc: Location? } # # source://prism//lib/prism/node.rb#11755 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -21376,11 +24003,15 @@ class Prism::MultiTargetNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#11768 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) + end def lefts; end # def lparen: () -> String? # # source://prism//lib/prism/node.rb#11825 + sig { returns(T.nilable(String)) } def lparen; end # The location of the opening parenthesis. @@ -21389,6 +24020,7 @@ class Prism::MultiTargetNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11796 + sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # Represents a splat node in the target expression. @@ -21407,6 +24039,7 @@ class Prism::MultiTargetNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11784 + sig { returns(T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode))) } def rest; end # Represents the targets expressions after a splat node. @@ -21415,11 +24048,15 @@ class Prism::MultiTargetNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#11790 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::RequiredParameterNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) + end def rights; end # def rparen: () -> String? # # source://prism//lib/prism/node.rb#11830 + sig { returns(T.nilable(String)) } def rparen; end # The location of the closing parenthesis. @@ -21428,6 +24065,7 @@ class Prism::MultiTargetNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11812 + sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -21456,6 +24094,21 @@ class Prism::MultiWriteNode < ::Prism::Node # @return [MultiWriteNode] a new instance of MultiWriteNode # # source://prism//lib/prism/node.rb#11869 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location, + value: Prism::Node + ).void + end def initialize(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value); end # Implements case-equality for the node. This is effectively == but without @@ -21467,37 +24120,57 @@ class Prism::MultiWriteNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#11884 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11889 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#11904 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#11894 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], ?rest: ImplicitRestNode | SplatNode | nil, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode # # source://prism//lib/prism/node.rb#11909 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + lefts: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + rest: T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode)), + rights: T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)], + lparen_loc: T.nilable(Prism::Location), + rparen_loc: T.nilable(Prism::Location), + operator_loc: Prism::Location, + value: Prism::Node + ).returns(Prism::MultiWriteNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), lefts: T.unsafe(nil), rest: T.unsafe(nil), rights: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), value: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#11889 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], rest: ImplicitRestNode | SplatNode | nil, rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode], lparen_loc: Location?, rparen_loc: Location?, operator_loc: Location, value: Prism::node } # # source://prism//lib/prism/node.rb#11917 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -21520,11 +24193,15 @@ class Prism::MultiWriteNode < ::Prism::Node # ^^^^^^^ # # source://prism//lib/prism/node.rb#11930 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) + end def lefts; end # def lparen: () -> String? # # source://prism//lib/prism/node.rb#12003 + sig { returns(T.nilable(String)) } def lparen; end # The location of the opening parenthesis. @@ -21533,11 +24210,13 @@ class Prism::MultiWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11958 + sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#12013 + sig { returns(String) } def operator; end # The location of the operator. @@ -21546,6 +24225,7 @@ class Prism::MultiWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11990 + sig { returns(Prism::Location) } def operator_loc; end # Represents a splat node in the target expression. @@ -21564,6 +24244,7 @@ class Prism::MultiWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11946 + sig { returns(T.nilable(T.any(Prism::ImplicitRestNode, Prism::SplatNode))) } def rest; end # Represents the targets expressions after a splat node. @@ -21572,11 +24253,15 @@ class Prism::MultiWriteNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#11952 + sig do + returns(T::Array[T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::MultiTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode)]) + end def rights; end # def rparen: () -> String? # # source://prism//lib/prism/node.rb#12008 + sig { returns(T.nilable(String)) } def rparen; end # The location of the closing parenthesis. @@ -21585,6 +24270,7 @@ class Prism::MultiWriteNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#11974 + sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -21599,6 +24285,7 @@ class Prism::MultiWriteNode < ::Prism::Node # ^^^^^^^ # # source://prism//lib/prism/node.rb#12000 + sig { returns(Prism::Node) } def value; end class << self @@ -22383,6 +25070,16 @@ class Prism::NextNode < ::Prism::Node # @return [NextNode] a new instance of NextNode # # source://prism//lib/prism/node.rb#12054 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, arguments, keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -22394,42 +25091,58 @@ class Prism::NextNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12064 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # # source://prism//lib/prism/node.rb#12099 + sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12069 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12081 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12074 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> NextNode # # source://prism//lib/prism/node.rb#12086 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + arguments: T.nilable(Prism::ArgumentsNode), + keyword_loc: Prism::Location + ).returns(Prism::NextNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), arguments: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12069 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, arguments: ArgumentsNode?, keyword_loc: Location } # # source://prism//lib/prism/node.rb#12094 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -22444,11 +25157,13 @@ class Prism::NextNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#12109 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#12102 + sig { returns(Prism::Location) } def keyword_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -22477,6 +25192,7 @@ class Prism::NilNode < ::Prism::Node # @return [NilNode] a new instance of NilNode # # source://prism//lib/prism/node.rb#12143 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -22488,37 +25204,44 @@ class Prism::NilNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12151 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12156 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12166 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12161 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> NilNode # # source://prism//lib/prism/node.rb#12171 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::NilNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12156 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#12179 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -22557,6 +25280,16 @@ class Prism::NoKeywordsParameterNode < ::Prism::Node # @return [NoKeywordsParameterNode] a new instance of NoKeywordsParameterNode # # source://prism//lib/prism/node.rb#12212 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, operator_loc, keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -22568,37 +25301,52 @@ class Prism::NoKeywordsParameterNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12222 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12227 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12237 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12232 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode # # source://prism//lib/prism/node.rb#12242 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + keyword_loc: Prism::Location + ).returns(Prism::NoKeywordsParameterNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12227 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, operator_loc: Location, keyword_loc: Location } # # source://prism//lib/prism/node.rb#12250 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -22613,21 +25361,25 @@ class Prism::NoKeywordsParameterNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#12274 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#12262 + sig { returns(Prism::Location) } def keyword_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#12269 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#12255 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -22912,6 +25664,15 @@ class Prism::NumberedParametersNode < ::Prism::Node # @return [NumberedParametersNode] a new instance of NumberedParametersNode # # source://prism//lib/prism/node.rb#12308 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + maximum: Integer + ).void + end def initialize(source, node_id, location, flags, maximum); end # Implements case-equality for the node. This is effectively == but without @@ -22923,37 +25684,51 @@ class Prism::NumberedParametersNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12317 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12322 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12332 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12327 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode # # source://prism//lib/prism/node.rb#12337 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + maximum: Integer + ).returns(Prism::NumberedParametersNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), maximum: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12322 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, maximum: Integer } # # source://prism//lib/prism/node.rb#12345 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -22968,6 +25743,7 @@ class Prism::NumberedParametersNode < ::Prism::Node # attr_reader maximum: Integer # # source://prism//lib/prism/node.rb#12350 + sig { returns(Integer) } def maximum; end # Return a symbol representation of this node type. See `Node#type`. @@ -22996,6 +25772,15 @@ class Prism::NumberedReferenceReadNode < ::Prism::Node # @return [NumberedReferenceReadNode] a new instance of NumberedReferenceReadNode # # source://prism//lib/prism/node.rb#12381 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + number: Integer + ).void + end def initialize(source, node_id, location, flags, number); end # Implements case-equality for the node. This is effectively == but without @@ -23007,37 +25792,51 @@ class Prism::NumberedReferenceReadNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12390 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12395 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12405 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12400 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?number: Integer) -> NumberedReferenceReadNode # # source://prism//lib/prism/node.rb#12410 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + number: Integer + ).returns(Prism::NumberedReferenceReadNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), number: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12395 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, number: Integer } # # source://prism//lib/prism/node.rb#12418 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -23058,6 +25857,7 @@ class Prism::NumberedReferenceReadNode < ::Prism::Node # $4294967296 # number `0` # # source://prism//lib/prism/node.rb#12429 + sig { returns(Integer) } def number; end # Return a symbol representation of this node type. See `Node#type`. @@ -23366,6 +26166,17 @@ class Prism::OrNode < ::Prism::Node # @return [OrNode] a new instance of OrNode # # source://prism//lib/prism/node.rb#12662 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, left, right, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -23377,37 +26188,53 @@ class Prism::OrNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12673 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12678 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12688 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12683 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> OrNode # # source://prism//lib/prism/node.rb#12693 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + left: Prism::Node, + right: Prism::Node, + operator_loc: Prism::Location + ).returns(Prism::OrNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), left: T.unsafe(nil), right: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12678 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, left: Prism::node, right: Prism::node, operator_loc: Location } # # source://prism//lib/prism/node.rb#12701 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -23428,11 +26255,13 @@ class Prism::OrNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#12712 + sig { returns(Prism::Node) } def left; end # def operator: () -> String # # source://prism//lib/prism/node.rb#12734 + sig { returns(String) } def operator; end # The location of the `or` keyword or the `||` operator. @@ -23441,6 +26270,7 @@ class Prism::OrNode < ::Prism::Node # ^^ # # source://prism//lib/prism/node.rb#12727 + sig { returns(Prism::Location) } def operator_loc; end # Represents the right side of the expression. @@ -23452,6 +26282,7 @@ class Prism::OrNode < ::Prism::Node # ^ # # source://prism//lib/prism/node.rb#12721 + sig { returns(Prism::Node) } def right; end # Return a symbol representation of this node type. See `Node#type`. @@ -23733,6 +26564,21 @@ class Prism::ParametersNode < ::Prism::Node # @return [ParametersNode] a new instance of ParametersNode # # source://prism//lib/prism/node.rb#12770 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + requireds: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)], + optionals: T::Array[Prism::OptionalParameterNode], + rest: T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode)), + posts: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode, Prism::ForwardingParameterNode)], + keywords: T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)], + keyword_rest: T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode)), + block: T.nilable(Prism::BlockParameterNode) + ).void + end def initialize(source, node_id, location, flags, requireds, optionals, rest, posts, keywords, keyword_rest, block); end # Implements case-equality for the node. This is effectively == but without @@ -23744,42 +26590,63 @@ class Prism::ParametersNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12785 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader block: BlockParameterNode? # # source://prism//lib/prism/node.rb#12844 + sig { returns(T.nilable(Prism::BlockParameterNode)) } def block; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12790 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12808 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12795 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: RestParameterNode | ImplicitRestNode | nil, ?posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, ?block: BlockParameterNode?) -> ParametersNode # # source://prism//lib/prism/node.rb#12813 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + requireds: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)], + optionals: T::Array[Prism::OptionalParameterNode], + rest: T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode)), + posts: T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode, Prism::ForwardingParameterNode)], + keywords: T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)], + keyword_rest: T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode)), + block: T.nilable(Prism::BlockParameterNode) + ).returns(Prism::ParametersNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), requireds: T.unsafe(nil), optionals: T.unsafe(nil), rest: T.unsafe(nil), posts: T.unsafe(nil), keywords: T.unsafe(nil), keyword_rest: T.unsafe(nil), block: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12790 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, requireds: Array[RequiredParameterNode | MultiTargetNode], optionals: Array[OptionalParameterNode], rest: RestParameterNode | ImplicitRestNode | nil, posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode], keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, block: BlockParameterNode? } # # source://prism//lib/prism/node.rb#12821 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -23794,31 +26661,41 @@ class Prism::ParametersNode < ::Prism::Node # attr_reader keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil # # source://prism//lib/prism/node.rb#12841 + sig do + returns(T.nilable(T.any(Prism::KeywordRestParameterNode, Prism::ForwardingParameterNode, Prism::NoKeywordsParameterNode))) + end def keyword_rest; end # attr_reader keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] # # source://prism//lib/prism/node.rb#12838 + sig { returns(T::Array[T.any(Prism::RequiredKeywordParameterNode, Prism::OptionalKeywordParameterNode)]) } def keywords; end # attr_reader optionals: Array[OptionalParameterNode] # # source://prism//lib/prism/node.rb#12829 + sig { returns(T::Array[Prism::OptionalParameterNode]) } def optionals; end # attr_reader posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode] # # source://prism//lib/prism/node.rb#12835 + sig do + returns(T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode, Prism::KeywordRestParameterNode, Prism::NoKeywordsParameterNode, Prism::ForwardingParameterNode)]) + end def posts; end # attr_reader requireds: Array[RequiredParameterNode | MultiTargetNode] # # source://prism//lib/prism/node.rb#12826 + sig { returns(T::Array[T.any(Prism::RequiredParameterNode, Prism::MultiTargetNode)]) } def requireds; end # attr_reader rest: RestParameterNode | ImplicitRestNode | nil # # source://prism//lib/prism/node.rb#12832 + sig { returns(T.nilable(T.any(Prism::RestParameterNode, Prism::ImplicitRestNode))) } def rest; end # Mirrors the Method#parameters method. @@ -23853,6 +26730,17 @@ class Prism::ParenthesesNode < ::Prism::Node # @return [ParenthesesNode] a new instance of ParenthesesNode # # source://prism//lib/prism/node.rb#12885 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T.nilable(Prism::Node), + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, body, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -23864,52 +26752,71 @@ class Prism::ParenthesesNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#12896 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: Prism::node? # # source://prism//lib/prism/node.rb#12931 + sig { returns(T.nilable(Prism::Node)) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12901 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#12953 + sig { returns(String) } def closing; end # attr_reader closing_loc: Location # # source://prism//lib/prism/node.rb#12941 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#12913 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#12906 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location) -> ParenthesesNode # # source://prism//lib/prism/node.rb#12918 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T.nilable(Prism::Node), + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::ParenthesesNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#12901 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, body: Prism::node?, opening_loc: Location, closing_loc: Location } # # source://prism//lib/prism/node.rb#12926 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -23927,11 +26834,13 @@ class Prism::ParenthesesNode < ::Prism::Node # def opening: () -> String # # source://prism//lib/prism/node.rb#12948 + sig { returns(String) } def opening; end # attr_reader opening_loc: Location # # source://prism//lib/prism/node.rb#12934 + sig { returns(Prism::Location) } def opening_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -23950,63 +26859,63 @@ end # This represents an error that was encountered during parsing. # -# source://prism//lib/prism/parse_result.rb#460 +# source://prism//lib/prism/parse_result.rb#592 class Prism::ParseError # Create a new error object with the given message and location. # # @return [ParseError] a new instance of ParseError # - # source://prism//lib/prism/parse_result.rb#475 + # source://prism//lib/prism/parse_result.rb#607 sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void } def initialize(type, message, location, level); end # Implement the hash pattern matching interface for ParseError. # - # source://prism//lib/prism/parse_result.rb#483 + # source://prism//lib/prism/parse_result.rb#615 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # Returns a string representation of this error. # - # source://prism//lib/prism/parse_result.rb#488 + # source://prism//lib/prism/parse_result.rb#620 sig { returns(String) } def inspect; end # The level of this error. # - # source://prism//lib/prism/parse_result.rb#472 + # source://prism//lib/prism/parse_result.rb#604 sig { returns(Symbol) } def level; end # A Location object representing the location of this error in the source. # - # source://prism//lib/prism/parse_result.rb#469 + # source://prism//lib/prism/parse_result.rb#601 sig { returns(Prism::Location) } def location; end # The message associated with this error. # - # source://prism//lib/prism/parse_result.rb#466 + # source://prism//lib/prism/parse_result.rb#598 sig { returns(String) } def message; end # The type of error. This is an _internal_ symbol that is used for # communicating with translation layers. It is not meant to be public API. # - # source://prism//lib/prism/parse_result.rb#463 + # source://prism//lib/prism/parse_result.rb#595 sig { returns(Symbol) } def type; end end # This is a result specific to the `parse_lex` and `parse_lex_file` methods. # -# source://prism//lib/prism/parse_result.rb#644 +# source://prism//lib/prism/parse_result.rb#781 class Prism::ParseLexResult < ::Prism::Result # Create a new parse lex result object with the given values. # # @return [ParseLexResult] a new instance of ParseLexResult # - # source://prism//lib/prism/parse_result.rb#650 + # source://prism//lib/prism/parse_result.rb#787 sig do params( value: [Prism::ProgramNode, T::Array[T.untyped]], @@ -24022,27 +26931,27 @@ class Prism::ParseLexResult < ::Prism::Result # Implement the hash pattern matching interface for ParseLexResult. # - # source://prism//lib/prism/parse_result.rb#656 + # source://prism//lib/prism/parse_result.rb#793 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # A tuple of the syntax tree and the list of tokens that were parsed from # the source code. # - # source://prism//lib/prism/parse_result.rb#647 + # source://prism//lib/prism/parse_result.rb#784 sig { returns([Prism::ProgramNode, T::Array[T.untyped]]) } def value; end end # This is a result specific to the `parse` and `parse_file` methods. # -# source://prism//lib/prism/parse_result.rb#585 +# source://prism//lib/prism/parse_result.rb#722 class Prism::ParseResult < ::Prism::Result # Create a new parse result object with the given values. # # @return [ParseResult] a new instance of ParseResult # - # source://prism//lib/prism/parse_result.rb#598 + # source://prism//lib/prism/parse_result.rb#735 sig do params( value: Prism::ProgramNode, @@ -24058,30 +26967,30 @@ class Prism::ParseResult < ::Prism::Result # Attach the list of comments to their respective locations in the tree. # - # source://prism//lib/prism/parse_result.rb#609 + # source://prism//lib/prism/parse_result.rb#746 def attach_comments!; end # Implement the hash pattern matching interface for ParseResult. # - # source://prism//lib/prism/parse_result.rb#604 + # source://prism//lib/prism/parse_result.rb#741 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # Returns a string representation of the syntax tree with the errors # displayed inline. # - # source://prism//lib/prism/parse_result.rb#621 + # source://prism//lib/prism/parse_result.rb#758 def errors_format; end # Walk the tree and mark nodes that are on a new line, loosely emulating # the behavior of CRuby's `:line` tracepoint event. # - # source://prism//lib/prism/parse_result.rb#615 + # source://prism//lib/prism/parse_result.rb#752 def mark_newlines!; end # The syntax tree that was parsed from the source code. # - # source://prism//lib/prism/parse_result.rb#595 + # source://prism//lib/prism/parse_result.rb#732 sig { returns(Prism::ProgramNode) } def value; end end @@ -24274,50 +27183,50 @@ end # This represents a warning that was encountered during parsing. # -# source://prism//lib/prism/parse_result.rb#494 +# source://prism//lib/prism/parse_result.rb#626 class Prism::ParseWarning # Create a new warning object with the given message and location. # # @return [ParseWarning] a new instance of ParseWarning # - # source://prism//lib/prism/parse_result.rb#509 + # source://prism//lib/prism/parse_result.rb#641 sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void } def initialize(type, message, location, level); end # Implement the hash pattern matching interface for ParseWarning. # - # source://prism//lib/prism/parse_result.rb#517 + # source://prism//lib/prism/parse_result.rb#649 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # Returns a string representation of this warning. # - # source://prism//lib/prism/parse_result.rb#522 + # source://prism//lib/prism/parse_result.rb#654 sig { returns(String) } def inspect; end # The level of this warning. # - # source://prism//lib/prism/parse_result.rb#506 + # source://prism//lib/prism/parse_result.rb#638 sig { returns(Symbol) } def level; end # A Location object representing the location of this warning in the source. # - # source://prism//lib/prism/parse_result.rb#503 + # source://prism//lib/prism/parse_result.rb#635 sig { returns(Prism::Location) } def location; end # The message associated with this warning. # - # source://prism//lib/prism/parse_result.rb#500 + # source://prism//lib/prism/parse_result.rb#632 sig { returns(String) } def message; end # The type of warning. This is an _internal_ symbol that is used for # communicating with translation layers. It is not meant to be public API. # - # source://prism//lib/prism/parse_result.rb#497 + # source://prism//lib/prism/parse_result.rb#629 sig { returns(Symbol) } def type; end end @@ -24495,6 +27404,18 @@ class Prism::PinnedExpressionNode < ::Prism::Node # @return [PinnedExpressionNode] a new instance of PinnedExpressionNode # # source://prism//lib/prism/node.rb#12988 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + operator_loc: Prism::Location, + lparen_loc: Prism::Location, + rparen_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc); end # Implements case-equality for the node. This is effectively == but without @@ -24506,42 +27427,60 @@ class Prism::PinnedExpressionNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#13000 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13005 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#13015 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#13010 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode # # source://prism//lib/prism/node.rb#13020 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + operator_loc: Prism::Location, + lparen_loc: Prism::Location, + rparen_loc: Prism::Location + ).returns(Prism::PinnedExpressionNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), operator_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13005 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, expression: Prism::node, operator_loc: Location, lparen_loc: Location, rparen_loc: Location } # # source://prism//lib/prism/node.rb#13028 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader expression: Prism::node # # source://prism//lib/prism/node.rb#13033 + sig { returns(Prism::Node) } def expression; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -24556,31 +27495,37 @@ class Prism::PinnedExpressionNode < ::Prism::Node # def lparen: () -> String # # source://prism//lib/prism/node.rb#13062 + sig { returns(String) } def lparen; end # attr_reader lparen_loc: Location # # source://prism//lib/prism/node.rb#13043 + sig { returns(Prism::Location) } def lparen_loc; end # def operator: () -> String # # source://prism//lib/prism/node.rb#13057 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#13036 + sig { returns(Prism::Location) } def operator_loc; end # def rparen: () -> String # # source://prism//lib/prism/node.rb#13067 + sig { returns(String) } def rparen; end # attr_reader rparen_loc: Location # # source://prism//lib/prism/node.rb#13050 + sig { returns(Prism::Location) } def rparen_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -24609,6 +27554,16 @@ class Prism::PinnedVariableNode < ::Prism::Node # @return [PinnedVariableNode] a new instance of PinnedVariableNode # # source://prism//lib/prism/node.rb#13103 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + variable: T.any(Prism::LocalVariableReadNode, Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::ItLocalVariableReadNode, Prism::MissingNode), + operator_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, variable, operator_loc); end # Implements case-equality for the node. This is effectively == but without @@ -24620,37 +27575,52 @@ class Prism::PinnedVariableNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#13113 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13118 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#13128 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#13123 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode | MissingNode, ?operator_loc: Location) -> PinnedVariableNode # # source://prism//lib/prism/node.rb#13133 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + variable: T.any(Prism::LocalVariableReadNode, Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::ItLocalVariableReadNode, Prism::MissingNode), + operator_loc: Prism::Location + ).returns(Prism::PinnedVariableNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), variable: T.unsafe(nil), operator_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13118 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode | MissingNode, operator_loc: Location } # # source://prism//lib/prism/node.rb#13141 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -24665,11 +27635,13 @@ class Prism::PinnedVariableNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#13156 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#13149 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -24681,6 +27653,9 @@ class Prism::PinnedVariableNode < ::Prism::Node # attr_reader variable: LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode | MissingNode # # source://prism//lib/prism/node.rb#13146 + sig do + returns(T.any(Prism::LocalVariableReadNode, Prism::InstanceVariableReadNode, Prism::ClassVariableReadNode, Prism::GlobalVariableReadNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::ItLocalVariableReadNode, Prism::MissingNode)) + end def variable; end class << self @@ -24703,6 +27678,18 @@ class Prism::PostExecutionNode < ::Prism::Node # @return [PostExecutionNode] a new instance of PostExecutionNode # # source://prism//lib/prism/node.rb#13190 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -24714,47 +27701,66 @@ class Prism::PostExecutionNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#13202 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13207 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#13271 + sig { returns(String) } def closing; end # attr_reader closing_loc: Location # # source://prism//lib/prism/node.rb#13254 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#13219 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#13212 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PostExecutionNode # # source://prism//lib/prism/node.rb#13224 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::PostExecutionNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13207 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location } # # source://prism//lib/prism/node.rb#13232 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -24769,26 +27775,31 @@ class Prism::PostExecutionNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#13261 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#13240 + sig { returns(Prism::Location) } def keyword_loc; end # def opening: () -> String # # source://prism//lib/prism/node.rb#13266 + sig { returns(String) } def opening; end # attr_reader opening_loc: Location # # source://prism//lib/prism/node.rb#13247 + sig { returns(Prism::Location) } def opening_loc; end # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#13237 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -24817,6 +27828,18 @@ class Prism::PreExecutionNode < ::Prism::Node # @return [PreExecutionNode] a new instance of PreExecutionNode # # source://prism//lib/prism/node.rb#13307 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc); end # Implements case-equality for the node. This is effectively == but without @@ -24828,47 +27851,66 @@ class Prism::PreExecutionNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#13319 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13324 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def closing: () -> String # # source://prism//lib/prism/node.rb#13388 + sig { returns(String) } def closing; end # attr_reader closing_loc: Location # # source://prism//lib/prism/node.rb#13371 + sig { returns(Prism::Location) } def closing_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#13336 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#13329 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode # # source://prism//lib/prism/node.rb#13341 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + statements: T.nilable(Prism::StatementsNode), + keyword_loc: Prism::Location, + opening_loc: Prism::Location, + closing_loc: Prism::Location + ).returns(Prism::PreExecutionNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), statements: T.unsafe(nil), keyword_loc: T.unsafe(nil), opening_loc: T.unsafe(nil), closing_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13324 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, statements: StatementsNode?, keyword_loc: Location, opening_loc: Location, closing_loc: Location } # # source://prism//lib/prism/node.rb#13349 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -24883,26 +27925,31 @@ class Prism::PreExecutionNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#13378 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#13357 + sig { returns(Prism::Location) } def keyword_loc; end # def opening: () -> String # # source://prism//lib/prism/node.rb#13383 + sig { returns(String) } def opening; end # attr_reader opening_loc: Location # # source://prism//lib/prism/node.rb#13364 + sig { returns(Prism::Location) } def opening_loc; end # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#13354 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -24928,6 +27975,16 @@ class Prism::ProgramNode < ::Prism::Node # @return [ProgramNode] a new instance of ProgramNode # # source://prism//lib/prism/node.rb#13421 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + statements: Prism::StatementsNode + ).void + end def initialize(source, node_id, location, flags, locals, statements); end # Implements case-equality for the node. This is effectively == but without @@ -24939,37 +27996,52 @@ class Prism::ProgramNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#13431 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13436 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#13446 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#13441 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?statements: StatementsNode) -> ProgramNode # # source://prism//lib/prism/node.rb#13451 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + statements: Prism::StatementsNode + ).returns(Prism::ProgramNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), statements: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13436 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], statements: StatementsNode } # # source://prism//lib/prism/node.rb#13459 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -24984,11 +28056,13 @@ class Prism::ProgramNode < ::Prism::Node # attr_reader locals: Array[Symbol] # # source://prism//lib/prism/node.rb#13464 + sig { returns(T::Array[Symbol]) } def locals; end # attr_reader statements: StatementsNode # # source://prism//lib/prism/node.rb#13467 + sig { returns(Prism::StatementsNode) } def statements; end # Return a symbol representation of this node type. See `Node#type`. @@ -25345,6 +28419,7 @@ class Prism::RedoNode < ::Prism::Node # @return [RedoNode] a new instance of RedoNode # # source://prism//lib/prism/node.rb#13720 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -25356,37 +28431,44 @@ class Prism::RedoNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#13728 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13733 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#13743 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#13738 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RedoNode # # source://prism//lib/prism/node.rb#13748 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::RedoNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#13733 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#13756 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -26100,6 +29182,17 @@ class Prism::RescueModifierNode < ::Prism::Node # @return [RescueModifierNode] a new instance of RescueModifierNode # # source://prism//lib/prism/node.rb#14128 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + keyword_loc: Prism::Location, + rescue_expression: Prism::Node + ).void + end def initialize(source, node_id, location, flags, expression, keyword_loc, rescue_expression); end # Implements case-equality for the node. This is effectively == but without @@ -26111,42 +29204,59 @@ class Prism::RescueModifierNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#14139 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14144 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#14154 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#14149 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode # # source://prism//lib/prism/node.rb#14159 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + expression: Prism::Node, + keyword_loc: Prism::Location, + rescue_expression: Prism::Node + ).returns(Prism::RescueModifierNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), expression: T.unsafe(nil), keyword_loc: T.unsafe(nil), rescue_expression: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14144 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, expression: Prism::node, keyword_loc: Location, rescue_expression: Prism::node } # # source://prism//lib/prism/node.rb#14167 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader expression: Prism::node # # source://prism//lib/prism/node.rb#14172 + sig { returns(Prism::Node) } def expression; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -26161,11 +29271,13 @@ class Prism::RescueModifierNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#14185 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#14175 + sig { returns(Prism::Location) } def keyword_loc; end # source://prism//lib/prism/parse_result/newlines.rb#115 @@ -26174,6 +29286,7 @@ class Prism::RescueModifierNode < ::Prism::Node # attr_reader rescue_expression: Prism::node # # source://prism//lib/prism/node.rb#14182 + sig { returns(Prism::Node) } def rescue_expression; end # Return a symbol representation of this node type. See `Node#type`. @@ -26198,7 +29311,7 @@ end # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # end # -# `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `exception` field. +# `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field. # # source://prism//lib/prism/node.rb#14223 class Prism::RescueNode < ::Prism::Node @@ -26207,6 +29320,20 @@ class Prism::RescueNode < ::Prism::Node # @return [RescueNode] a new instance of RescueNode # # source://prism//lib/prism/node.rb#14225 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + exceptions: T::Array[Prism::Node], + operator_loc: T.nilable(Prism::Location), + reference: T.nilable(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode)), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(Prism::RescueNode) + ).void + end def initialize(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, statements, subsequent); end # Implements case-equality for the node. This is effectively == but without @@ -26218,21 +29345,25 @@ class Prism::RescueNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#14239 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14244 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#14259 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#14249 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # Returns the subsequent rescue clause of the rescue node. This method is @@ -26244,22 +29375,38 @@ class Prism::RescueNode < ::Prism::Node # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode # # source://prism//lib/prism/node.rb#14264 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + exceptions: T::Array[Prism::Node], + operator_loc: T.nilable(Prism::Location), + reference: T.nilable(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode)), + statements: T.nilable(Prism::StatementsNode), + subsequent: T.nilable(Prism::RescueNode) + ).returns(Prism::RescueNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), exceptions: T.unsafe(nil), operator_loc: T.unsafe(nil), reference: T.unsafe(nil), statements: T.unsafe(nil), subsequent: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14244 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, exceptions: Array[Prism::node], operator_loc: Location?, reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil, statements: StatementsNode?, subsequent: RescueNode? } # # source://prism//lib/prism/node.rb#14272 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader exceptions: Array[Prism::node] # # source://prism//lib/prism/node.rb#14284 + sig { returns(T::Array[Prism::Node]) } def exceptions; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -26274,36 +29421,45 @@ class Prism::RescueNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#14309 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#14277 + sig { returns(Prism::Location) } def keyword_loc; end # def operator: () -> String? # # source://prism//lib/prism/node.rb#14314 + sig { returns(T.nilable(String)) } def operator; end # attr_reader operator_loc: Location? # # source://prism//lib/prism/node.rb#14287 + sig { returns(T.nilable(Prism::Location)) } def operator_loc; end # attr_reader reference: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode | nil # # source://prism//lib/prism/node.rb#14300 + sig do + returns(T.nilable(T.any(Prism::LocalVariableTargetNode, Prism::InstanceVariableTargetNode, Prism::ClassVariableTargetNode, Prism::GlobalVariableTargetNode, Prism::ConstantTargetNode, Prism::ConstantPathTargetNode, Prism::CallTargetNode, Prism::IndexTargetNode, Prism::BackReferenceReadNode, Prism::NumberedReferenceReadNode, Prism::MissingNode))) + end def reference; end # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#14303 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # attr_reader subsequent: RescueNode? # # source://prism//lib/prism/node.rb#14306 + sig { returns(T.nilable(Prism::RescueNode)) } def subsequent; end # Return a symbol representation of this node type. See `Node#type`. @@ -26463,13 +29619,13 @@ end # the requested structure, any comments that were encounters, and any errors # that were encountered. # -# source://prism//lib/prism/parse_result.rb#530 +# source://prism//lib/prism/parse_result.rb#662 class Prism::Result # Create a new result object with the given values. # # @return [Result] a new instance of Result # - # source://prism//lib/prism/parse_result.rb#552 + # source://prism//lib/prism/parse_result.rb#684 sig do params( comments: T::Array[Prism::Comment], @@ -26482,9 +29638,19 @@ class Prism::Result end def initialize(comments, magic_comments, data_loc, errors, warnings, source); end + # Create a code units cache for the given encoding. + # + # source://prism//lib/prism/parse_result.rb#716 + sig do + params( + encoding: Encoding + ).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) + end + def code_units_cache(encoding); end + # The list of comments that were encountered during parsing. # - # source://prism//lib/prism/parse_result.rb#532 + # source://prism//lib/prism/parse_result.rb#664 sig { returns(T::Array[Prism::Comment]) } def comments; end @@ -26492,25 +29658,25 @@ class Prism::Result # and the rest of the content of the file. This content is loaded into the # DATA constant when the file being parsed is the main file being executed. # - # source://prism//lib/prism/parse_result.rb#540 + # source://prism//lib/prism/parse_result.rb#672 sig { returns(T.nilable(Prism::Location)) } def data_loc; end # Implement the hash pattern matching interface for Result. # - # source://prism//lib/prism/parse_result.rb#562 + # source://prism//lib/prism/parse_result.rb#694 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # Returns the encoding of the source code that was parsed. # - # source://prism//lib/prism/parse_result.rb#567 + # source://prism//lib/prism/parse_result.rb#699 sig { returns(Encoding) } def encoding; end # The list of errors that were generated during parsing. # - # source://prism//lib/prism/parse_result.rb#543 + # source://prism//lib/prism/parse_result.rb#675 sig { returns(T::Array[Prism::ParseError]) } def errors; end @@ -26519,19 +29685,19 @@ class Prism::Result # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#579 + # source://prism//lib/prism/parse_result.rb#711 sig { returns(T::Boolean) } def failure?; end # The list of magic comments that were encountered during parsing. # - # source://prism//lib/prism/parse_result.rb#535 + # source://prism//lib/prism/parse_result.rb#667 sig { returns(T::Array[Prism::MagicComment]) } def magic_comments; end # A Source instance that represents the source code that was parsed. # - # source://prism//lib/prism/parse_result.rb#549 + # source://prism//lib/prism/parse_result.rb#681 sig { returns(Prism::Source) } def source; end @@ -26540,13 +29706,13 @@ class Prism::Result # # @return [Boolean] # - # source://prism//lib/prism/parse_result.rb#573 + # source://prism//lib/prism/parse_result.rb#705 sig { returns(T::Boolean) } def success?; end # The list of warnings that were generated during parsing. # - # source://prism//lib/prism/parse_result.rb#546 + # source://prism//lib/prism/parse_result.rb#678 sig { returns(T::Array[Prism::ParseWarning]) } def warnings; end end @@ -26563,6 +29729,7 @@ class Prism::RetryNode < ::Prism::Node # @return [RetryNode] a new instance of RetryNode # # source://prism//lib/prism/node.rb#14462 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -26574,37 +29741,44 @@ class Prism::RetryNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#14470 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14475 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#14485 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#14480 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RetryNode # # source://prism//lib/prism/node.rb#14490 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::RetryNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14475 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#14498 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -26642,6 +29816,16 @@ class Prism::ReturnNode < ::Prism::Node # @return [ReturnNode] a new instance of ReturnNode # # source://prism//lib/prism/node.rb#14530 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode) + ).void + end def initialize(source, node_id, location, flags, keyword_loc, arguments); end # Implements case-equality for the node. This is effectively == but without @@ -26653,42 +29837,58 @@ class Prism::ReturnNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#14540 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # # source://prism//lib/prism/node.rb#14582 + sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14545 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#14557 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#14550 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode # # source://prism//lib/prism/node.rb#14562 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + arguments: T.nilable(Prism::ArgumentsNode) + ).returns(Prism::ReturnNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), arguments: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14545 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, arguments: ArgumentsNode? } # # source://prism//lib/prism/node.rb#14570 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -26703,11 +29903,13 @@ class Prism::ReturnNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#14585 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#14575 + sig { returns(Prism::Location) } def keyword_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -26736,6 +29938,7 @@ class Prism::SelfNode < ::Prism::Node # @return [SelfNode] a new instance of SelfNode # # source://prism//lib/prism/node.rb#14619 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -26747,37 +29950,44 @@ class Prism::SelfNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#14627 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14632 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#14642 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#14637 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SelfNode # # source://prism//lib/prism/node.rb#14647 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::SelfNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14632 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#14655 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -26816,154 +30026,154 @@ module Prism::Serialize # Deserialize the tokens represented by the given string into a parse # result. # - # source://prism//lib/prism/serialize.rb#40 + # source://prism//lib/prism/serialize.rb#51 def load_tokens(source, serialized); end end end -# source://prism//lib/prism/serialize.rb#44 +# source://prism//lib/prism/serialize.rb#55 class Prism::Serialize::Loader # @return [Loader] a new instance of Loader # - # source://prism//lib/prism/serialize.rb#80 + # source://prism//lib/prism/serialize.rb#91 def initialize(source, serialized); end # Returns the value of attribute constant_pool. # - # source://prism//lib/prism/serialize.rb#77 + # source://prism//lib/prism/serialize.rb#88 def constant_pool; end # Returns the value of attribute constant_pool_offset. # - # source://prism//lib/prism/serialize.rb#77 + # source://prism//lib/prism/serialize.rb#88 def constant_pool_offset; end # Returns the value of attribute encoding. # - # source://prism//lib/prism/serialize.rb#76 + # source://prism//lib/prism/serialize.rb#87 def encoding; end # Returns the value of attribute input. # - # source://prism//lib/prism/serialize.rb#76 + # source://prism//lib/prism/serialize.rb#87 def input; end # Returns the value of attribute io. # - # source://prism//lib/prism/serialize.rb#76 + # source://prism//lib/prism/serialize.rb#87 def io; end - # source://prism//lib/prism/serialize.rb#118 + # source://prism//lib/prism/serialize.rb#129 def load_comments; end - # source://prism//lib/prism/serialize.rb#104 + # source://prism//lib/prism/serialize.rb#115 def load_encoding; end - # source://prism//lib/prism/serialize.rb#95 + # source://prism//lib/prism/serialize.rb#106 def load_header; end - # source://prism//lib/prism/serialize.rb#114 + # source://prism//lib/prism/serialize.rb#125 def load_line_offsets; end - # source://prism//lib/prism/serialize.rb#450 + # source://prism//lib/prism/serialize.rb#462 def load_metadata; end - # source://prism//lib/prism/serialize.rb#484 + # source://prism//lib/prism/serialize.rb#496 def load_nodes; end - # source://prism//lib/prism/serialize.rb#498 + # source://prism//lib/prism/serialize.rb#510 def load_result; end - # source://prism//lib/prism/serialize.rb#110 + # source://prism//lib/prism/serialize.rb#121 def load_start_line; end - # source://prism//lib/prism/serialize.rb#459 + # source://prism//lib/prism/serialize.rb#471 def load_tokens; end - # source://prism//lib/prism/serialize.rb#472 + # source://prism//lib/prism/serialize.rb#484 def load_tokens_result; end # Returns the value of attribute serialized. # - # source://prism//lib/prism/serialize.rb#76 + # source://prism//lib/prism/serialize.rb#87 def serialized; end # Returns the value of attribute source. # - # source://prism//lib/prism/serialize.rb#77 + # source://prism//lib/prism/serialize.rb#88 def source; end # Returns the value of attribute start_line. # - # source://prism//lib/prism/serialize.rb#78 + # source://prism//lib/prism/serialize.rb#89 def start_line; end private - # source://prism//lib/prism/serialize.rb#584 + # source://prism//lib/prism/serialize.rb#596 def load_constant(index); end - # source://prism//lib/prism/serialize.rb#537 + # source://prism//lib/prism/serialize.rb#549 def load_double; end - # source://prism//lib/prism/serialize.rb#552 + # source://prism//lib/prism/serialize.rb#564 def load_embedded_string; end - # source://prism//lib/prism/serialize.rb#614 + # source://prism//lib/prism/serialize.rb#626 def load_error_level; end - # source://prism//lib/prism/serialize.rb#526 + # source://prism//lib/prism/serialize.rb#538 def load_integer; end - # source://prism//lib/prism/serialize.rb#568 + # source://prism//lib/prism/serialize.rb#580 def load_location; end - # source://prism//lib/prism/serialize.rb#572 + # source://prism//lib/prism/serialize.rb#584 def load_location_object; end - # source://prism//lib/prism/serialize.rb#643 + # source://prism//lib/prism/serialize.rb#655 def load_node; end - # source://prism//lib/prism/serialize.rb#609 + # source://prism//lib/prism/serialize.rb#621 def load_optional_constant; end - # source://prism//lib/prism/serialize.rb#576 + # source://prism//lib/prism/serialize.rb#588 def load_optional_location; end - # source://prism//lib/prism/serialize.rb#580 + # source://prism//lib/prism/serialize.rb#592 def load_optional_location_object; end - # source://prism//lib/prism/serialize.rb#545 + # source://prism//lib/prism/serialize.rb#557 def load_optional_node; end - # source://prism//lib/prism/serialize.rb#605 + # source://prism//lib/prism/serialize.rb#617 def load_required_constant; end - # source://prism//lib/prism/serialize.rb#556 + # source://prism//lib/prism/serialize.rb#568 def load_string; end - # source://prism//lib/prism/serialize.rb#541 + # source://prism//lib/prism/serialize.rb#553 def load_uint32; end - # source://prism//lib/prism/serialize.rb#521 + # source://prism//lib/prism/serialize.rb#533 def load_varsint; end # variable-length integer using https://en.wikipedia.org/wiki/LEB128 # This is also what protobuf uses: https://protobuf.dev/programming-guides/encoding/#varints # - # source://prism//lib/prism/serialize.rb#507 + # source://prism//lib/prism/serialize.rb#519 def load_varuint; end - # source://prism//lib/prism/serialize.rb#629 + # source://prism//lib/prism/serialize.rb#641 def load_warning_level; end end -# source://prism//lib/prism/serialize.rb#127 +# source://prism//lib/prism/serialize.rb#138 Prism::Serialize::Loader::DIAGNOSTIC_TYPES = T.let(T.unsafe(nil), Array) # StringIO is synchronized and that adds a high overhead on TruffleRuby. # -# source://prism//lib/prism/serialize.rb#72 +# source://prism//lib/prism/serialize.rb#83 Prism::Serialize::Loader::FastStringIO = StringIO # The major version of prism that we are expecting to find in the serialized @@ -26986,7 +30196,7 @@ Prism::Serialize::PATCH_VERSION = T.let(T.unsafe(nil), Integer) # The token types that can be indexed by their enum values. # -# source://prism//lib/prism/serialize.rb#1725 +# source://prism//lib/prism/serialize.rb#1737 Prism::Serialize::TOKEN_TYPES = T.let(T.unsafe(nil), Array) # This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified. @@ -27155,6 +30365,20 @@ class Prism::SingletonClassNode < ::Prism::Node # @return [SingletonClassNode] a new instance of SingletonClassNode # # source://prism//lib/prism/node.rb#14777 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + operator_loc: Prism::Location, + expression: Prism::Node, + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -27166,67 +30390,92 @@ class Prism::SingletonClassNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#14791 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: StatementsNode | BeginNode | nil # # source://prism//lib/prism/node.rb#14847 + sig { returns(T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode))) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14796 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def class_keyword: () -> String # # source://prism//lib/prism/node.rb#14857 + sig { returns(String) } def class_keyword; end # attr_reader class_keyword_loc: Location # # source://prism//lib/prism/node.rb#14830 + sig { returns(Prism::Location) } def class_keyword_loc; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#14809 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#14801 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: StatementsNode | BeginNode | nil, ?end_keyword_loc: Location) -> SingletonClassNode # # source://prism//lib/prism/node.rb#14814 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + locals: T::Array[Symbol], + class_keyword_loc: Prism::Location, + operator_loc: Prism::Location, + expression: Prism::Node, + body: T.nilable(T.any(Prism::StatementsNode, Prism::BeginNode)), + end_keyword_loc: Prism::Location + ).returns(Prism::SingletonClassNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), locals: T.unsafe(nil), class_keyword_loc: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil), body: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14796 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Prism::node, body: StatementsNode | BeginNode | nil, end_keyword_loc: Location } # # source://prism//lib/prism/node.rb#14822 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # def end_keyword: () -> String # # source://prism//lib/prism/node.rb#14867 + sig { returns(String) } def end_keyword; end # attr_reader end_keyword_loc: Location # # source://prism//lib/prism/node.rb#14850 + sig { returns(Prism::Location) } def end_keyword_loc; end # attr_reader expression: Prism::node # # source://prism//lib/prism/node.rb#14844 + sig { returns(Prism::Node) } def expression; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -27241,16 +30490,19 @@ class Prism::SingletonClassNode < ::Prism::Node # attr_reader locals: Array[Symbol] # # source://prism//lib/prism/node.rb#14827 + sig { returns(T::Array[Symbol]) } def locals; end # def operator: () -> String # # source://prism//lib/prism/node.rb#14862 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#14837 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -27277,26 +30529,37 @@ class Prism::Source # # @return [Source] a new instance of Source # - # source://prism//lib/prism/parse_result.rb#30 + # source://prism//lib/prism/parse_result.rb#45 sig { params(source: String, start_line: Integer, offsets: T::Array[Integer]).void } def initialize(source, start_line = T.unsafe(nil), offsets = T.unsafe(nil)); end # Return the column number in characters for the given byte offset. # - # source://prism//lib/prism/parse_result.rb#82 + # source://prism//lib/prism/parse_result.rb#97 sig { params(byte_offset: Integer).returns(Integer) } def character_column(byte_offset); end # Return the character offset for the given byte offset. # - # source://prism//lib/prism/parse_result.rb#77 + # source://prism//lib/prism/parse_result.rb#92 sig { params(byte_offset: Integer).returns(Integer) } def character_offset(byte_offset); end + # Generate a cache that targets a specific encoding for calculating code + # unit offsets. + # + # source://prism//lib/prism/parse_result.rb#125 + sig do + params( + encoding: Encoding + ).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) + end + def code_units_cache(encoding); end + # Returns the column number in code units for the given encoding for the # given byte offset. # - # source://prism//lib/prism/parse_result.rb#104 + # source://prism//lib/prism/parse_result.rb#131 sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } def code_units_column(byte_offset, encoding); end @@ -27307,71 +30570,77 @@ class Prism::Source # concept of code units that differs from the number of characters in other # encodings, it is not captured here. # - # source://prism//lib/prism/parse_result.rb#92 + # We purposefully replace invalid and undefined characters with replacement + # characters in this conversion. This happens for two reasons. First, it's + # possible that the given byte offset will not occur on a character + # boundary. Second, it's possible that the source code will contain a + # character that has no equivalent in the given encoding. + # + # source://prism//lib/prism/parse_result.rb#113 sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) } def code_units_offset(byte_offset, encoding); end # Return the column number for the given byte offset. # - # source://prism//lib/prism/parse_result.rb#72 + # source://prism//lib/prism/parse_result.rb#87 sig { params(byte_offset: Integer).returns(Integer) } def column(byte_offset); end # Returns the encoding of the source code, which is set by parameters to the # parser or by the encoding magic comment. # - # source://prism//lib/prism/parse_result.rb#38 + # source://prism//lib/prism/parse_result.rb#53 sig { returns(Encoding) } def encoding; end # Binary search through the offsets to find the line number for the given # byte offset. # - # source://prism//lib/prism/parse_result.rb#55 + # source://prism//lib/prism/parse_result.rb#70 sig { params(byte_offset: Integer).returns(Integer) } def line(byte_offset); end # Returns the byte offset of the end of the line corresponding to the given # byte offset. # - # source://prism//lib/prism/parse_result.rb#67 + # source://prism//lib/prism/parse_result.rb#82 def line_end(byte_offset); end # Return the byte offset of the start of the line corresponding to the given # byte offset. # - # source://prism//lib/prism/parse_result.rb#61 + # source://prism//lib/prism/parse_result.rb#76 sig { params(byte_offset: Integer).returns(Integer) } def line_start(byte_offset); end # Returns the lines of the source code as an array of strings. # - # source://prism//lib/prism/parse_result.rb#43 + # source://prism//lib/prism/parse_result.rb#58 sig { returns(T::Array[String]) } def lines; end # The list of newline byte offsets in the source code. # - # source://prism//lib/prism/parse_result.rb#27 + # source://prism//lib/prism/parse_result.rb#42 sig { returns(T::Array[Integer]) } def offsets; end # Perform a byteslice on the source code using the given byte offset and # byte length. # - # source://prism//lib/prism/parse_result.rb#49 + # source://prism//lib/prism/parse_result.rb#64 sig { params(byte_offset: Integer, length: Integer).returns(String) } def slice(byte_offset, length); end # The source code that this source object represents. # - # source://prism//lib/prism/parse_result.rb#21 + # source://prism//lib/prism/parse_result.rb#36 sig { returns(String) } def source; end # The line number where this source starts. # - # source://prism//lib/prism/parse_result.rb#24 + # source://prism//lib/prism/parse_result.rb#39 sig { returns(Integer) } def start_line; end @@ -27380,7 +30649,7 @@ class Prism::Source # Binary search through the offsets to find the line number for the given # byte offset. # - # source://prism//lib/prism/parse_result.rb#112 + # source://prism//lib/prism/parse_result.rb#139 def find_line(byte_offset); end class << self @@ -27406,6 +30675,7 @@ class Prism::SourceEncodingNode < ::Prism::Node # @return [SourceEncodingNode] a new instance of SourceEncodingNode # # source://prism//lib/prism/node.rb#14906 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -27417,37 +30687,44 @@ class Prism::SourceEncodingNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#14914 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14919 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#14929 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#14924 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceEncodingNode # # source://prism//lib/prism/node.rb#14934 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::SourceEncodingNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#14919 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#14942 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -27625,6 +30902,7 @@ class Prism::SourceLineNode < ::Prism::Node # @return [SourceLineNode] a new instance of SourceLineNode # # source://prism//lib/prism/node.rb#15068 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -27636,37 +30914,44 @@ class Prism::SourceLineNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#15076 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15081 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#15091 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#15086 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceLineNode # # source://prism//lib/prism/node.rb#15096 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::SourceLineNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15081 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#15104 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -27704,6 +30989,16 @@ class Prism::SplatNode < ::Prism::Node # @return [SplatNode] a new instance of SplatNode # # source://prism//lib/prism/node.rb#15136 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + expression: T.nilable(Prism::Node) + ).void + end def initialize(source, node_id, location, flags, operator_loc, expression); end # Implements case-equality for the node. This is effectively == but without @@ -27715,42 +31010,58 @@ class Prism::SplatNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#15146 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15151 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#15163 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#15156 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?expression: Prism::node?) -> SplatNode # # source://prism//lib/prism/node.rb#15168 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + operator_loc: Prism::Location, + expression: T.nilable(Prism::Node) + ).returns(Prism::SplatNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), operator_loc: T.unsafe(nil), expression: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15151 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, operator_loc: Location, expression: Prism::node? } # # source://prism//lib/prism/node.rb#15176 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # attr_reader expression: Prism::node? # # source://prism//lib/prism/node.rb#15188 + sig { returns(T.nilable(Prism::Node)) } def expression; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -27765,11 +31076,13 @@ class Prism::SplatNode < ::Prism::Node # def operator: () -> String # # source://prism//lib/prism/node.rb#15191 + sig { returns(String) } def operator; end # attr_reader operator_loc: Location # # source://prism//lib/prism/node.rb#15181 + sig { returns(Prism::Location) } def operator_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -27798,6 +31111,15 @@ class Prism::StatementsNode < ::Prism::Node # @return [StatementsNode] a new instance of StatementsNode # # source://prism//lib/prism/node.rb#15225 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T::Array[Prism::Node] + ).void + end def initialize(source, node_id, location, flags, body); end # Implements case-equality for the node. This is effectively == but without @@ -27809,42 +31131,57 @@ class Prism::StatementsNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#15234 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader body: Array[Prism::node] # # source://prism//lib/prism/node.rb#15267 + sig { returns(T::Array[Prism::Node]) } def body; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15239 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#15249 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#15244 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Array[Prism::node]) -> StatementsNode # # source://prism//lib/prism/node.rb#15254 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + body: T::Array[Prism::Node] + ).returns(Prism::StatementsNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), body: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15239 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, body: Array[Prism::node] } # # source://prism//lib/prism/node.rb#15262 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -28106,6 +31443,19 @@ class Prism::SuperNode < ::Prism::Node # @return [SuperNode] a new instance of SuperNode # # source://prism//lib/prism/node.rb#15456 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location), + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) + ).void + end def initialize(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc, block); end # Implements case-equality for the node. This is effectively == but without @@ -28117,47 +31467,67 @@ class Prism::SuperNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#15469 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # # source://prism//lib/prism/node.rb#15525 + sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end # attr_reader block: BlockNode | BlockArgumentNode | nil # # source://prism//lib/prism/node.rb#15541 + sig { returns(T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode))) } def block; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15474 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#15487 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#15479 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: BlockNode | BlockArgumentNode | nil) -> SuperNode # # source://prism//lib/prism/node.rb#15492 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location), + block: T.nilable(T.any(Prism::BlockNode, Prism::BlockArgumentNode)) + ).returns(Prism::SuperNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil), block: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15474 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location?, block: BlockNode | BlockArgumentNode | nil } # # source://prism//lib/prism/node.rb#15500 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -28172,31 +31542,37 @@ class Prism::SuperNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#15544 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#15505 + sig { returns(Prism::Location) } def keyword_loc; end # def lparen: () -> String? # # source://prism//lib/prism/node.rb#15549 + sig { returns(T.nilable(String)) } def lparen; end # attr_reader lparen_loc: Location? # # source://prism//lib/prism/node.rb#15512 + sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # def rparen: () -> String? # # source://prism//lib/prism/node.rb#15554 + sig { returns(T.nilable(String)) } def rparen; end # attr_reader rparen_loc: Location? # # source://prism//lib/prism/node.rb#15528 + sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -28412,54 +31788,54 @@ end # This represents a token from the Ruby source. # -# source://prism//lib/prism/parse_result.rb#662 +# source://prism//lib/prism/parse_result.rb#799 class Prism::Token # Create a new token object with the given type, value, and location. # # @return [Token] a new instance of Token # - # source://prism//lib/prism/parse_result.rb#674 + # source://prism//lib/prism/parse_result.rb#811 sig { params(source: Prism::Source, type: Symbol, value: String, location: T.any(Integer, Prism::Location)).void } def initialize(source, type, value, location); end # Returns true if the given other token is equal to this token. # - # source://prism//lib/prism/parse_result.rb#709 + # source://prism//lib/prism/parse_result.rb#846 sig { params(other: T.untyped).returns(T::Boolean) } def ==(other); end # Implement the hash pattern matching interface for Token. # - # source://prism//lib/prism/parse_result.rb#682 + # source://prism//lib/prism/parse_result.rb#819 sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # Returns a string representation of this token. # - # source://prism//lib/prism/parse_result.rb#716 + # source://prism//lib/prism/parse_result.rb#853 def inspect; end # A Location object representing the location of this token in the source. # - # source://prism//lib/prism/parse_result.rb#687 + # source://prism//lib/prism/parse_result.rb#824 sig { returns(Prism::Location) } def location; end # Implement the pretty print interface for Token. # - # source://prism//lib/prism/parse_result.rb#694 + # source://prism//lib/prism/parse_result.rb#831 sig { params(q: T.untyped).void } def pretty_print(q); end # The type of token that this token is. # - # source://prism//lib/prism/parse_result.rb#668 + # source://prism//lib/prism/parse_result.rb#805 sig { returns(Symbol) } def type; end # A byteslice of the source that this token represents. # - # source://prism//lib/prism/parse_result.rb#671 + # source://prism//lib/prism/parse_result.rb#808 sig { returns(String) } def value; end @@ -28467,7 +31843,7 @@ class Prism::Token # The Source object that represents the source this token came from. # - # source://prism//lib/prism/parse_result.rb#664 + # source://prism//lib/prism/parse_result.rb#801 sig { returns(Prism::Source) } def source; end end @@ -30905,25 +34281,25 @@ class Prism::Translation::Ripper < ::Prism::Compiler # :stopdoc: # - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def _dispatch_0; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def _dispatch_1(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def _dispatch_2(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def _dispatch_3(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3393 + # source://prism//lib/prism/translation/ripper.rb#3389 def _dispatch_4(_, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3394 + # source://prism//lib/prism/translation/ripper.rb#3390 def _dispatch_5(_, _, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3395 + # source://prism//lib/prism/translation/ripper.rb#3391 def _dispatch_7(_, _, _, _, _, _, _); end # This method is responsible for updating lineno and column information @@ -30932,7 +34308,7 @@ class Prism::Translation::Ripper < ::Prism::Compiler # This method could be drastically improved with some caching on the start # of every line, but for now it's good enough. # - # source://prism//lib/prism/translation/ripper.rb#3379 + # source://prism//lib/prism/translation/ripper.rb#3375 def bounds(location); end # Returns true if the given node is a command node. @@ -30944,7 +34320,7 @@ class Prism::Translation::Ripper < ::Prism::Compiler # This method is called when the parser found syntax error. # - # source://prism//lib/prism/translation/ripper.rb#3417 + # source://prism//lib/prism/translation/ripper.rb#3413 def compile_error(msg); end # This method is provided by the Ripper C extension. It is called when a @@ -30952,577 +34328,577 @@ class Prism::Translation::Ripper < ::Prism::Compiler # that it will modify the string in place and return the number of bytes # that were removed. # - # source://prism//lib/prism/translation/ripper.rb#3432 + # source://prism//lib/prism/translation/ripper.rb#3428 def dedent_string(string, width); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_BEGIN(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_CHAR(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_END(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on___end__(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_alias(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_alias_error(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_aref(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_aref_field(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_arg_ambiguous(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_arg_paren(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_args_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_args_add_block(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_args_add_star(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_args_forward; end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_args_new; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_array(_); end - # source://prism//lib/prism/translation/ripper.rb#3393 + # source://prism//lib/prism/translation/ripper.rb#3389 def on_aryptn(_, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_assign(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_assign_error(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_assoc_new(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_assoc_splat(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_assoclist_from_args(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_backref(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_backtick(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_bare_assoc_hash(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_begin(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_binary(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_block_var(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_blockarg(_); end - # source://prism//lib/prism/translation/ripper.rb#3393 + # source://prism//lib/prism/translation/ripper.rb#3389 def on_bodystmt(_, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_brace_block(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_break(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_call(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_case(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_class(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_class_name_error(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_comma(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_command(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3393 + # source://prism//lib/prism/translation/ripper.rb#3389 def on_command_call(_, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_comment(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_const(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_const_path_field(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_const_path_ref(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_const_ref(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_cvar(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_def(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_defined(_); end - # source://prism//lib/prism/translation/ripper.rb#3394 + # source://prism//lib/prism/translation/ripper.rb#3390 def on_defs(_, _, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_do_block(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_dot2(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_dot3(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_dyna_symbol(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_else(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_elsif(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_embdoc(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_embdoc_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_embdoc_end(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_embexpr_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_embexpr_end(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_embvar(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_ensure(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_excessed_comma; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_fcall(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_field(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_float(_); end - # source://prism//lib/prism/translation/ripper.rb#3393 + # source://prism//lib/prism/translation/ripper.rb#3389 def on_fndptn(_, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_for(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_gvar(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_hash(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_heredoc_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_heredoc_dedent(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_heredoc_end(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_hshptn(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_ident(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_if(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_if_mod(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_ifop(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_ignored_nl(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_ignored_sp(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_imaginary(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_in(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_int(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_ivar(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_kw(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_kwrest_param(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_label(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_label_end(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_lambda(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_lbrace(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_lbracket(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_lparen(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_magic_comment(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_massign(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_method_add_arg(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_method_add_block(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_mlhs_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_mlhs_add_post(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_mlhs_add_star(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_mlhs_new; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_mlhs_paren(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_module(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_mrhs_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_mrhs_add_star(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_mrhs_new; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_mrhs_new_from_args(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_next(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_nl(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_nokw_param(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_op(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_opassign(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_operator_ambiguous(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_param_error(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3395 + # source://prism//lib/prism/translation/ripper.rb#3391 def on_params(_, _, _, _, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_paren(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_parse_error(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_period(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_program(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_qsymbols_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_qsymbols_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_qsymbols_new; end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_qwords_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_qwords_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_qwords_new; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_rational(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_rbrace(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_rbracket(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_redo; end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_regexp_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_regexp_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_regexp_end(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_regexp_literal(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_regexp_new; end - # source://prism//lib/prism/translation/ripper.rb#3393 + # source://prism//lib/prism/translation/ripper.rb#3389 def on_rescue(_, _, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_rescue_mod(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_rest_param(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_retry; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_return(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_return0; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_rparen(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_sclass(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_semicolon(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_sp(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_stmts_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_stmts_new; end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_string_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_string_concat(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_string_content; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_string_dvar(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_string_embexpr(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_string_literal(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_super(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_symbeg(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_symbol(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_symbol_literal(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_symbols_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_symbols_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_symbols_new; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_tlambda(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_tlambeg(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_top_const_field(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_top_const_ref(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_tstring_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_tstring_content(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_tstring_end(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_unary(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_undef(_); end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_unless(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_unless_mod(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_until(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_until_mod(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_var_alias(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_var_field(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_var_ref(_); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_vcall(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_void_stmt; end - # source://prism//lib/prism/translation/ripper.rb#3392 + # source://prism//lib/prism/translation/ripper.rb#3388 def on_when(_, _, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_while(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_while_mod(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_word_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_word_new; end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_words_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_words_beg(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_words_new; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_words_sep(_); end - # source://prism//lib/prism/translation/ripper.rb#3391 + # source://prism//lib/prism/translation/ripper.rb#3387 def on_xstring_add(_, _); end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_xstring_literal(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_xstring_new; end - # source://prism//lib/prism/translation/ripper.rb#3390 + # source://prism//lib/prism/translation/ripper.rb#3386 def on_yield(_); end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_yield0; end - # source://prism//lib/prism/translation/ripper.rb#3389 + # source://prism//lib/prism/translation/ripper.rb#3385 def on_zsuper; end # Lazily initialize the parse result. @@ -31534,7 +34910,7 @@ class Prism::Translation::Ripper < ::Prism::Compiler # # @return [Boolean] # - # source://prism//lib/prism/translation/ripper.rb#3284 + # source://prism//lib/prism/translation/ripper.rb#3280 def trailing_comma?(left, right); end # Visit one side of an alias global variable node. @@ -31606,7 +34982,7 @@ class Prism::Translation::Ripper < ::Prism::Compiler # Visit a node that represents a number. We need to explicitly handle the # unary - operator. # - # source://prism//lib/prism/translation/ripper.rb#3323 + # source://prism//lib/prism/translation/ripper.rb#3319 def visit_number_node(node); end # Visit a pattern within a pattern match. This is used to bypass the @@ -31631,7 +35007,7 @@ class Prism::Translation::Ripper < ::Prism::Compiler # Visit the string content of a particular node. This method is used to # split into the various token types. # - # source://prism//lib/prism/translation/ripper.rb#3296 + # source://prism//lib/prism/translation/ripper.rb#3292 def visit_token(token, allow_keywords = T.unsafe(nil)); end # Dispatch a words_sep event that contains the space between the elements @@ -31643,26 +35019,26 @@ class Prism::Translation::Ripper < ::Prism::Compiler # Visit a node that represents a write value. This is used to handle the # special case of an implicit array that is generated without brackets. # - # source://prism//lib/prism/translation/ripper.rb#3341 + # source://prism//lib/prism/translation/ripper.rb#3337 def visit_write_value(node); end # Returns true if there is a semicolon between the two locations. # # @return [Boolean] # - # source://prism//lib/prism/translation/ripper.rb#3289 + # source://prism//lib/prism/translation/ripper.rb#3285 def void_stmt?(left, right, allow_newline); end # This method is called when weak warning is produced by the parser. # +fmt+ and +args+ is printf style. # - # source://prism//lib/prism/translation/ripper.rb#3408 + # source://prism//lib/prism/translation/ripper.rb#3404 def warn(fmt, *args); end # This method is called when strong warning is produced by the parser. # +fmt+ and +args+ is printf style. # - # source://prism//lib/prism/translation/ripper.rb#3413 + # source://prism//lib/prism/translation/ripper.rb#3409 def warning(fmt, *args); end class << self @@ -33587,6 +36963,7 @@ class Prism::TrueNode < ::Prism::Node # @return [TrueNode] a new instance of TrueNode # # source://prism//lib/prism/node.rb#15743 + sig { params(source: Prism::Source, node_id: Integer, location: Prism::Location, flags: Integer).void } def initialize(source, node_id, location, flags); end # Implements case-equality for the node. This is effectively == but without @@ -33598,37 +36975,44 @@ class Prism::TrueNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#15751 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15756 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#15766 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#15761 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> TrueNode # # source://prism//lib/prism/node.rb#15771 + sig { params(node_id: Integer, location: Prism::Location, flags: Integer).returns(Prism::TrueNode) } def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15756 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location } # # source://prism//lib/prism/node.rb#15779 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -33666,6 +37050,16 @@ class Prism::UndefNode < ::Prism::Node # @return [UndefNode] a new instance of UndefNode # # source://prism//lib/prism/node.rb#15811 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + names: T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)], + keyword_loc: Prism::Location + ).void + end def initialize(source, node_id, location, flags, names, keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -33677,37 +37071,52 @@ class Prism::UndefNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#15821 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15826 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#15836 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#15831 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location) -> UndefNode # # source://prism//lib/prism/node.rb#15841 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + names: T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)], + keyword_loc: Prism::Location + ).returns(Prism::UndefNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), names: T.unsafe(nil), keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15826 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, names: Array[SymbolNode | InterpolatedSymbolNode], keyword_loc: Location } # # source://prism//lib/prism/node.rb#15849 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -33722,16 +37131,19 @@ class Prism::UndefNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#15864 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#15857 + sig { returns(Prism::Location) } def keyword_loc; end # attr_reader names: Array[SymbolNode | InterpolatedSymbolNode] # # source://prism//lib/prism/node.rb#15854 + sig { returns(T::Array[T.any(Prism::SymbolNode, Prism::InterpolatedSymbolNode)]) } def names; end # Return a symbol representation of this node type. See `Node#type`. @@ -33763,6 +37175,20 @@ class Prism::UnlessNode < ::Prism::Node # @return [UnlessNode] a new instance of UnlessNode # # source://prism//lib/prism/node.rb#15902 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + predicate: Prism::Node, + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + else_clause: T.nilable(Prism::ElseNode), + end_keyword_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc); end # Implements case-equality for the node. This is effectively == but without @@ -33774,21 +37200,25 @@ class Prism::UnlessNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#15916 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15921 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#15935 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#15926 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # Returns the else clause of the unless node. This method is deprecated in @@ -33800,17 +37230,32 @@ class Prism::UnlessNode < ::Prism::Node # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?else_clause: ElseNode?, ?end_keyword_loc: Location?) -> UnlessNode # # source://prism//lib/prism/node.rb#15940 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + predicate: Prism::Node, + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode), + else_clause: T.nilable(Prism::ElseNode), + end_keyword_loc: T.nilable(Prism::Location) + ).returns(Prism::UnlessNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), predicate: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil), else_clause: T.unsafe(nil), end_keyword_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#15921 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, predicate: Prism::node, then_keyword_loc: Location?, statements: StatementsNode?, else_clause: ElseNode?, end_keyword_loc: Location? } # # source://prism//lib/prism/node.rb#15948 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end # The else clause of the unless expression, if present. @@ -33819,11 +37264,13 @@ class Prism::UnlessNode < ::Prism::Node # ^^^^^^^^ # # source://prism//lib/prism/node.rb#16001 + sig { returns(T.nilable(Prism::ElseNode)) } def else_clause; end # def end_keyword: () -> String? # # source://prism//lib/prism/node.rb#16030 + sig { returns(T.nilable(String)) } def end_keyword; end # The location of the `end` keyword, if present. @@ -33832,6 +37279,7 @@ class Prism::UnlessNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#16007 + sig { returns(T.nilable(Prism::Location)) } def end_keyword_loc; end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -33846,6 +37294,7 @@ class Prism::UnlessNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#16020 + sig { returns(String) } def keyword; end # The location of the `unless` keyword. @@ -33857,6 +37306,7 @@ class Prism::UnlessNode < ::Prism::Node # ^^^^^^ # # source://prism//lib/prism/node.rb#15959 + sig { returns(Prism::Location) } def keyword_loc; end # source://prism//lib/prism/parse_result/newlines.rb#97 @@ -33871,6 +37321,7 @@ class Prism::UnlessNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#15972 + sig { returns(Prism::Node) } def predicate; end # The body of statements that will executed if the unless condition is @@ -33880,11 +37331,13 @@ class Prism::UnlessNode < ::Prism::Node # ^^^ # # source://prism//lib/prism/node.rb#15995 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # def then_keyword: () -> String? # # source://prism//lib/prism/node.rb#16025 + sig { returns(T.nilable(String)) } def then_keyword; end # The location of the `then` keyword, if present. @@ -33893,6 +37346,7 @@ class Prism::UnlessNode < ::Prism::Node # ^^^^ # # source://prism//lib/prism/node.rb#15978 + sig { returns(T.nilable(Prism::Location)) } def then_keyword_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -35012,6 +38466,18 @@ class Prism::WhenNode < ::Prism::Node # @return [WhenNode] a new instance of WhenNode # # source://prism//lib/prism/node.rb#16194 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + conditions: T::Array[Prism::Node], + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode) + ).void + end def initialize(source, node_id, location, flags, keyword_loc, conditions, then_keyword_loc, statements); end # Implements case-equality for the node. This is effectively == but without @@ -35023,42 +38489,60 @@ class Prism::WhenNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#16206 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#16211 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#16224 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#16216 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # attr_reader conditions: Array[Prism::node] # # source://prism//lib/prism/node.rb#16249 + sig { returns(T::Array[Prism::Node]) } def conditions; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?) -> WhenNode # # source://prism//lib/prism/node.rb#16229 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + conditions: T::Array[Prism::Node], + then_keyword_loc: T.nilable(Prism::Location), + statements: T.nilable(Prism::StatementsNode) + ).returns(Prism::WhenNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), conditions: T.unsafe(nil), then_keyword_loc: T.unsafe(nil), statements: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#16211 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, conditions: Array[Prism::node], then_keyword_loc: Location?, statements: StatementsNode? } # # source://prism//lib/prism/node.rb#16237 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -35073,26 +38557,31 @@ class Prism::WhenNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#16268 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#16242 + sig { returns(Prism::Location) } def keyword_loc; end # attr_reader statements: StatementsNode? # # source://prism//lib/prism/node.rb#16265 + sig { returns(T.nilable(Prism::StatementsNode)) } def statements; end # def then_keyword: () -> String? # # source://prism//lib/prism/node.rb#16273 + sig { returns(T.nilable(String)) } def then_keyword; end # attr_reader then_keyword_loc: Location? # # source://prism//lib/prism/node.rb#16252 + sig { returns(T.nilable(Prism::Location)) } def then_keyword_loc; end # Return a symbol representation of this node type. See `Node#type`. @@ -35457,6 +38946,18 @@ class Prism::YieldNode < ::Prism::Node # @return [YieldNode] a new instance of YieldNode # # source://prism//lib/prism/node.rb#16560 + sig do + params( + source: Prism::Source, + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location) + ).void + end def initialize(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc); end # Implements case-equality for the node. This is effectively == but without @@ -35468,42 +38969,60 @@ class Prism::YieldNode < ::Prism::Node # def accept: (Visitor visitor) -> void # # source://prism//lib/prism/node.rb#16572 + sig { override.params(visitor: Prism::Visitor).returns(T.untyped) } def accept(visitor); end # attr_reader arguments: ArgumentsNode? # # source://prism//lib/prism/node.rb#16627 + sig { returns(T.nilable(Prism::ArgumentsNode)) } def arguments; end # def child_nodes: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#16577 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def child_nodes; end # def comment_targets: () -> Array[Node | Location] # # source://prism//lib/prism/node.rb#16589 + sig { override.returns(T::Array[T.any(Prism::Node, Prism::Location)]) } def comment_targets; end # def compact_child_nodes: () -> Array[Node] # # source://prism//lib/prism/node.rb#16582 + sig { override.returns(T::Array[Prism::Node]) } def compact_child_nodes; end # def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode # # source://prism//lib/prism/node.rb#16594 + sig do + params( + node_id: Integer, + location: Prism::Location, + flags: Integer, + keyword_loc: Prism::Location, + lparen_loc: T.nilable(Prism::Location), + arguments: T.nilable(Prism::ArgumentsNode), + rparen_loc: T.nilable(Prism::Location) + ).returns(Prism::YieldNode) + end def copy(node_id: T.unsafe(nil), location: T.unsafe(nil), flags: T.unsafe(nil), keyword_loc: T.unsafe(nil), lparen_loc: T.unsafe(nil), arguments: T.unsafe(nil), rparen_loc: T.unsafe(nil)); end # def child_nodes: () -> Array[nil | Node] # def deconstruct: () -> Array[nil | Node] # # source://prism//lib/prism/node.rb#16577 + sig { override.returns(T::Array[T.nilable(Prism::Node)]) } def deconstruct; end # def deconstruct_keys: (Array[Symbol] keys) -> { node_id: Integer, location: Location, keyword_loc: Location, lparen_loc: Location?, arguments: ArgumentsNode?, rparen_loc: Location? } # # source://prism//lib/prism/node.rb#16602 + sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) } def deconstruct_keys(keys); end sig { override.returns(T::Array[Prism::Reflection::Field]) } @@ -35518,31 +39037,37 @@ class Prism::YieldNode < ::Prism::Node # def keyword: () -> String # # source://prism//lib/prism/node.rb#16643 + sig { returns(String) } def keyword; end # attr_reader keyword_loc: Location # # source://prism//lib/prism/node.rb#16607 + sig { returns(Prism::Location) } def keyword_loc; end # def lparen: () -> String? # # source://prism//lib/prism/node.rb#16648 + sig { returns(T.nilable(String)) } def lparen; end # attr_reader lparen_loc: Location? # # source://prism//lib/prism/node.rb#16614 + sig { returns(T.nilable(Prism::Location)) } def lparen_loc; end # def rparen: () -> String? # # source://prism//lib/prism/node.rb#16653 + sig { returns(T.nilable(String)) } def rparen; end # attr_reader rparen_loc: Location? # # source://prism//lib/prism/node.rb#16630 + sig { returns(T.nilable(Prism::Location)) } def rparen_loc; end # Return a symbol representation of this node type. See `Node#type`. diff --git a/sorbet/rbi/gems/rbi@0.2.0.rbi b/sorbet/rbi/gems/rbi@0.2.1.rbi similarity index 88% rename from sorbet/rbi/gems/rbi@0.2.0.rbi rename to sorbet/rbi/gems/rbi@0.2.1.rbi index 9e73a36373..daeea89cc9 100644 --- a/sorbet/rbi/gems/rbi@0.2.0.rbi +++ b/sorbet/rbi/gems/rbi@0.2.1.rbi @@ -475,6 +475,14 @@ class RBI::File end def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end + # source://rbi//lib/rbi/rbs_printer.rb#996 + sig { params(out: T.any(::IO, ::StringIO), indent: ::Integer, print_locs: T::Boolean).void } + def rbs_print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end + + # source://rbi//lib/rbi/rbs_printer.rb#1002 + sig { params(indent: ::Integer, print_locs: T::Boolean).returns(::String) } + def rbs_string(indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end + # source://rbi//lib/rbi/model.rb#143 sig { returns(::RBI::Tree) } def root; end @@ -1133,6 +1141,14 @@ class RBI::Node end def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end + # source://rbi//lib/rbi/rbs_printer.rb#1013 + sig { params(out: T.any(::IO, ::StringIO), indent: ::Integer, print_locs: T::Boolean).void } + def rbs_print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end + + # source://rbi//lib/rbi/rbs_printer.rb#1019 + sig { params(indent: ::Integer, print_locs: T::Boolean).returns(::String) } + def rbs_string(indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end + # @raise [ReplaceNodeError] # # source://rbi//lib/rbi/model.rb#35 @@ -1792,6 +1808,323 @@ class RBI::Public < ::RBI::Visibility def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end end +# source://rbi//lib/rbi/rbs_printer.rb#5 +class RBI::RBSPrinter < ::RBI::Visitor + # source://rbi//lib/rbi/rbs_printer.rb#18 + sig { params(out: T.any(::IO, ::StringIO), indent: ::Integer, print_locs: T::Boolean).void } + def initialize(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end + + # source://rbi//lib/rbi/rbs_printer.rb#15 + sig { returns(::Integer) } + def current_indent; end + + # source://rbi//lib/rbi/rbs_printer.rb#35 + sig { void } + def dedent; end + + # @return [Boolean] + # + # source://rbi//lib/rbi/rbs_printer.rb#9 + def in_visibility_group; end + + # @return [Boolean] + # + # source://rbi//lib/rbi/rbs_printer.rb#9 + def in_visibility_group=(_arg0); end + + # Printing + # + # source://rbi//lib/rbi/rbs_printer.rb#30 + sig { void } + def indent; end + + # source://rbi//lib/rbi/rbs_printer.rb#12 + sig { returns(T.nilable(::RBI::Node)) } + def previous_node; end + + # Print a string without indentation nor `\n` at the end. + # + # source://rbi//lib/rbi/rbs_printer.rb#41 + sig { params(string: ::String).void } + def print(string); end + + # source://rbi//lib/rbi/rbs_printer.rb#275 + sig { params(node: ::RBI::Attr, sig: ::RBI::Sig).void } + def print_attr_sig(node, sig); end + + # source://rbi//lib/rbi/rbs_printer.rb#9 + sig { returns(T::Boolean) } + def print_locs; end + + # @return [Boolean] + # + # source://rbi//lib/rbi/rbs_printer.rb#9 + def print_locs=(_arg0); end + + # source://rbi//lib/rbi/rbs_printer.rb#350 + sig { params(node: ::RBI::Method, sig: ::RBI::Sig).void } + def print_method_sig(node, sig); end + + # Print a string with indentation and `\n` at the end. + # + # source://rbi//lib/rbi/rbs_printer.rb#61 + sig { params(string: ::String).void } + def printl(string); end + + # Print a string without indentation but with a `\n` at the end. + # + # source://rbi//lib/rbi/rbs_printer.rb#47 + sig { params(string: T.nilable(::String)).void } + def printn(string = T.unsafe(nil)); end + + # Print a string with indentation but without a `\n` at the end. + # + # source://rbi//lib/rbi/rbs_printer.rb#54 + sig { params(string: T.nilable(::String)).void } + def printt(string = T.unsafe(nil)); end + + # source://rbi//lib/rbi/rbs_printer.rb#67 + sig { override.params(nodes: T::Array[::RBI::Node]).void } + def visit_all(nodes); end + + # source://rbi//lib/rbi/rbs_printer.rb#505 + sig { override.params(node: ::RBI::Arg).void } + def visit_arg(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#243 + sig { params(node: ::RBI::Attr).void } + def visit_attr(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#228 + sig { override.params(node: ::RBI::AttrAccessor).void } + def visit_attr_accessor(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#233 + sig { override.params(node: ::RBI::AttrReader).void } + def visit_attr_reader(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#238 + sig { override.params(node: ::RBI::AttrWriter).void } + def visit_attr_writer(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#106 + sig { override.params(node: ::RBI::BlankLine).void } + def visit_blank_line(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#444 + sig { override.params(node: ::RBI::BlockParam).void } + def visit_block_param(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#123 + sig { override.params(node: ::RBI::Class).void } + def visit_class(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#90 + sig { override.params(node: ::RBI::Comment).void } + def visit_comment(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#625 + sig { override.params(node: ::RBI::ConflictTree).void } + def visit_conflict_tree(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#213 + sig { override.params(node: ::RBI::Const).void } + def visit_const(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#454 + sig { override.params(node: ::RBI::Extend).void } + def visit_extend(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#78 + sig { override.params(file: ::RBI::File).void } + def visit_file(file); end + + # source://rbi//lib/rbi/rbs_printer.rb#601 + sig { override.params(node: ::RBI::Group).void } + def visit_group(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#591 + sig { override.params(node: ::RBI::Helper).void } + def visit_helper(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#449 + sig { override.params(node: ::RBI::Include).void } + def visit_include(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#510 + sig { override.params(node: ::RBI::KwArg).void } + def visit_kw_arg(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#434 + sig { override.params(node: ::RBI::KwOptParam).void } + def visit_kw_opt_param(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#429 + sig { override.params(node: ::RBI::KwParam).void } + def visit_kw_param(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#439 + sig { override.params(node: ::RBI::KwRestParam).void } + def visit_kw_rest_param(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#292 + sig { override.params(node: ::RBI::Method).void } + def visit_method(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#596 + sig { override.params(node: ::RBI::MixesInClassMethods).void } + def visit_mixes_in_class_methods(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#459 + sig { params(node: ::RBI::Mixin).void } + def visit_mixin(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#118 + sig { override.params(node: ::RBI::Module).void } + def visit_module(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#419 + sig { override.params(node: ::RBI::OptParam).void } + def visit_opt_param(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#486 + sig { override.params(node: ::RBI::Private).void } + def visit_private(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#481 + sig { override.params(node: ::RBI::Protected).void } + def visit_protected(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#476 + sig { override.params(node: ::RBI::Public).void } + def visit_public(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#414 + sig { override.params(node: ::RBI::ReqParam).void } + def visit_req_param(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#620 + sig { override.params(node: ::RBI::RequiresAncestor).void } + def visit_requires_ancestor(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#424 + sig { override.params(node: ::RBI::RestParam).void } + def visit_rest_param(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#138 + sig { params(node: ::RBI::Scope).void } + def visit_scope(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#201 + sig { params(node: ::RBI::Scope).void } + def visit_scope_body(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#634 + sig { override.params(node: ::RBI::ScopeConflict).void } + def visit_scope_conflict(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#148 + sig { params(node: ::RBI::Scope).void } + def visit_scope_header(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#500 + sig { override.params(node: ::RBI::Send).void } + def visit_send(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#133 + sig { override.params(node: ::RBI::SingletonClass).void } + def visit_singleton_class(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#128 + sig { override.params(node: ::RBI::Struct).void } + def visit_struct(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#563 + sig { override.params(node: ::RBI::TEnum).void } + def visit_tenum(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#568 + sig { override.params(node: ::RBI::TEnumBlock).void } + def visit_tenum_block(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#111 + sig { override.params(node: ::RBI::Tree).void } + def visit_tree(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#515 + sig { override.params(node: ::RBI::TStruct).void } + def visit_tstruct(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#549 + sig { override.params(node: ::RBI::TStructConst).void } + def visit_tstruct_const(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#556 + sig { override.params(node: ::RBI::TStructProp).void } + def visit_tstruct_prop(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#586 + sig { override.params(node: ::RBI::TypeMember).void } + def visit_type_member(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#491 + sig { params(node: ::RBI::Visibility).void } + def visit_visibility(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#607 + sig { override.params(node: ::RBI::VisibilityGroup).void } + def visit_visibility_group(node); end + + private + + # source://rbi//lib/rbi/rbs_printer.rb#782 + sig { params(node: ::RBI::Type).returns(T::Boolean) } + def bare_nilable_proc?(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#777 + sig { params(node: ::RBI::Type).returns(T::Boolean) } + def bare_proc?(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#725 + sig { params(node: ::RBI::Node).returns(T::Boolean) } + def oneline?(node); end + + # Parse a string containing a `T.let(x, X)` and extract the type + # + # Returns `nil` is the string is not a `T.let`. + # + # source://rbi//lib/rbi/rbs_printer.rb#759 + sig { params(code: T.nilable(::String)).returns(T.nilable(::String)) } + def parse_t_let(code); end + + # source://rbi//lib/rbi/rbs_printer.rb#747 + sig { params(type: T.any(::RBI::Type, ::String)).returns(::RBI::Type) } + def parse_type(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#650 + sig { params(node: ::RBI::Node).void } + def print_blank_line_before(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#669 + sig { params(node: ::RBI::Node).void } + def print_loc(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#699 + sig { params(node: ::RBI::Param, last: T::Boolean).void } + def print_param_comment_leading_space(node, last:); end + + # source://rbi//lib/rbi/rbs_printer.rb#675 + sig { params(node: ::RBI::Method, param: ::RBI::SigParam).void } + def print_sig_param(node, param); end + + # source://rbi//lib/rbi/rbs_printer.rb#717 + sig { params(node: ::RBI::SigParam, last: T::Boolean).void } + def print_sig_param_comment_leading_space(node, last:); end +end + +# source://rbi//lib/rbi/rbs_printer.rb#6 +class RBI::RBSPrinter::Error < ::RBI::Error; end + # source://rbi//lib/rbi/model.rb#5 class RBI::ReplaceNodeError < ::RBI::Error; end @@ -2164,7 +2497,7 @@ class RBI::Rewriters::Merge::Conflict < ::T::Struct def to_s; end class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2409,7 +2742,7 @@ class RBI::Rewriters::RemoveKnownDefinitions::Operation < ::T::Struct def to_s; end class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2955,7 +3288,7 @@ class RBI::Tree < ::RBI::NodeWithComments sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void } def annotate!(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#38 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#38 sig do params( name: ::String, @@ -2965,19 +3298,19 @@ class RBI::Tree < ::RBI::NodeWithComments end def create_class(name, superclass_name: T.unsafe(nil), &block); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#45 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#45 sig { params(name: ::String, value: ::String).void } def create_constant(name, value:); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#55 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#55 sig { params(name: ::String).void } def create_extend(name); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#50 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#50 sig { params(name: ::String).void } def create_include(name); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#90 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#90 sig do params( name: ::String, @@ -2991,19 +3324,19 @@ class RBI::Tree < ::RBI::NodeWithComments end def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), class_method: T.unsafe(nil), visibility: T.unsafe(nil), comments: T.unsafe(nil), &block); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#60 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#60 sig { params(name: ::String).void } def create_mixes_in_class_methods(name); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#25 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#25 sig { params(name: ::String, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) } def create_module(name, &block); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#9 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#9 sig { params(constant: ::Module, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) } def create_path(constant, &block); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#74 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#74 sig do params( name: ::String, @@ -3081,11 +3414,11 @@ class RBI::Tree < ::RBI::NodeWithComments private - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#123 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#123 sig { params(node: ::RBI::Node).returns(::RBI::Node) } def create_node(node); end - # source://tapioca/0.16.2-ce6646d5eba21cdce5841255dcbd8bf9ddb56d38/lib/tapioca/rbi_ext/model.rb#118 + # source://tapioca/0.16.3/lib/tapioca/rbi_ext/model.rb#118 sig { returns(T::Hash[::String, ::RBI::Node]) } def nodes_cache; end end @@ -3151,6 +3484,10 @@ class RBI::Type sig { returns(::RBI::Type) } def non_nilable; end + # source://rbi//lib/rbi/rbs_printer.rb#1030 + sig { returns(::String) } + def rbs_string; end + # @abstract # # source://rbi//lib/rbi/type.rb#758 @@ -3839,6 +4176,99 @@ class RBI::TypeMember < ::RBI::NodeWithComments def value; end end +# source://rbi//lib/rbi/rbs_printer.rb#787 +class RBI::TypePrinter + # source://rbi//lib/rbi/rbs_printer.rb#794 + sig { void } + def initialize; end + + # source://rbi//lib/rbi/rbs_printer.rb#791 + sig { returns(::String) } + def string; end + + # source://rbi//lib/rbi/rbs_printer.rb#799 + sig { params(node: ::RBI::Type).void } + def visit(node); end + + # source://rbi//lib/rbi/rbs_printer.rb#907 + sig { params(type: ::RBI::Type::All).void } + def visit_all(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#917 + sig { params(type: ::RBI::Type::Any).void } + def visit_any(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#864 + sig { params(type: ::RBI::Type::Anything).void } + def visit_anything(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#889 + sig { params(type: ::RBI::Type::AttachedClass).void } + def visit_attached_class(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#848 + sig { params(type: ::RBI::Type::Boolean).void } + def visit_boolean(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#969 + sig { params(type: ::RBI::Type::Class).void } + def visit_class(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#900 + sig { params(type: ::RBI::Type::ClassOf).void } + def visit_class_of(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#853 + sig { params(type: ::RBI::Type::Generic).void } + def visit_generic(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#894 + sig { params(type: ::RBI::Type::Nilable).void } + def visit_nilable(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#874 + sig { params(type: ::RBI::Type::NoReturn).void } + def visit_no_return(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#948 + sig { params(type: ::RBI::Type::Proc).void } + def visit_proc(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#884 + sig { params(type: ::RBI::Type::SelfType).void } + def visit_self_type(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#937 + sig { params(type: ::RBI::Type::Shape).void } + def visit_shape(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#843 + sig { params(type: ::RBI::Type::Simple).void } + def visit_simple(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#927 + sig { params(type: ::RBI::Type::Tuple).void } + def visit_tuple(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#964 + sig { params(type: ::RBI::Type::TypeParameter).void } + def visit_type_parameter(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#879 + sig { params(type: ::RBI::Type::Untyped).void } + def visit_untyped(type); end + + # source://rbi//lib/rbi/rbs_printer.rb#869 + sig { params(type: ::RBI::Type::Void).void } + def visit_void(type); end + + private + + # source://rbi//lib/rbi/rbs_printer.rb#978 + sig { params(type_name: ::String).returns(::String) } + def translate_t_type(type_name); end +end + # source://rbi//lib/rbi/rewriters/attr_to_methods.rb#5 class RBI::UnexpectedMultipleSigsError < ::RBI::Error # source://rbi//lib/rbi/rewriters/attr_to_methods.rb#10 diff --git a/sorbet/rbi/gems/rbs@3.6.0.rbi b/sorbet/rbi/gems/rbs@3.6.1.rbi similarity index 100% rename from sorbet/rbi/gems/rbs@3.6.0.rbi rename to sorbet/rbi/gems/rbs@3.6.1.rbi diff --git a/sorbet/rbi/gems/reline@0.5.0.rbi b/sorbet/rbi/gems/reline@0.5.10.rbi similarity index 100% rename from sorbet/rbi/gems/reline@0.5.0.rbi rename to sorbet/rbi/gems/reline@0.5.10.rbi diff --git a/sorbet/rbi/gems/rubocop-ast@1.32.1.rbi b/sorbet/rbi/gems/rubocop-ast@1.32.3.rbi similarity index 88% rename from sorbet/rbi/gems/rubocop-ast@1.32.1.rbi rename to sorbet/rbi/gems/rubocop-ast@1.32.3.rbi index 3618b511ab..b1ff8a584a 100644 --- a/sorbet/rbi/gems/rubocop-ast@1.32.1.rbi +++ b/sorbet/rbi/gems/rubocop-ast@1.32.3.rbi @@ -628,412 +628,412 @@ end # # source://rubocop-ast//lib/rubocop/ast/node/mixin/collection_node.rb#6 module RuboCop::AST::CollectionNode - extend ::Forwardable + extend ::RuboCop::SimpleForwardable - # source://forwardable/1.3.3/forwardable.rb#231 - def &(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def &(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def *(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def *(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def +(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def +(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def -(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def -(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def <<(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def <<(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def [](*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def [](*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def []=(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def []=(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def all?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def all?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def any?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def any?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def append(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def append(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def assoc(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def assoc(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def at(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def at(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def bsearch(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def bsearch(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def bsearch_index(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def bsearch_index(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def chain(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def chain(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def chunk(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def chunk(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def chunk_while(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def chunk_while(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def clear(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def clear(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def collect(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def collect(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def collect!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def collect!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def collect_concat(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def collect_concat(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def combination(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def combination(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def compact(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def compact(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def compact!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def compact!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def concat(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def concat(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def count(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def count(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def cycle(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def cycle(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def deconstruct(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def deconstruct(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def delete(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def delete(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def delete_at(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def delete_at(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def delete_if(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def delete_if(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def detect(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def detect(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def difference(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def difference(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def dig(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def dig(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def drop(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def drop(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def drop_while(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def drop_while(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each_cons(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_cons(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each_entry(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_entry(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each_index(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_index(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each_slice(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_slice(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each_with_index(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_with_index(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each_with_object(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_with_object(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def empty?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def empty?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def entries(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def entries(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def fetch(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def fetch(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def fill(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def fill(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def filter(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def filter(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def filter!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def filter!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def filter_map(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def filter_map(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def find(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def find(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def find_all(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def find_all(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def find_index(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def find_index(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def first(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def first(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def flat_map(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def flat_map(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def flatten(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def flatten(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def flatten!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def flatten!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def grep(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def grep(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def grep_v(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def grep_v(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def group_by(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def group_by(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def include?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def include?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def index(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def index(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def inject(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def inject(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def insert(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def insert(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def intersect?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def intersect?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def intersection(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def intersection(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def join(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def join(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def keep_if(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def keep_if(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def last(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def last(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def lazy(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def lazy(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def length(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def length(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def map(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def map(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def map!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def map!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def max(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def max(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def max_by(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def max_by(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def member?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def member?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def min(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def min(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def min_by(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def min_by(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def minmax(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def minmax(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def minmax_by(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def minmax_by(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def none?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def none?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def one?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def one?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def pack(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def pack(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def partition(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def partition(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def permutation(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def permutation(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def place(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def place(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def pop(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def pop(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def prepend(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def prepend(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def product(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def product(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def push(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def push(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def rassoc(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def rassoc(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def reduce(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def reduce(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def reject(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def reject(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def reject!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def reject!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def repeated_combination(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def repeated_combination(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def repeated_permutation(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def repeated_permutation(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def replace(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def replace(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def reverse(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def reverse(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def reverse!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def reverse!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def reverse_each(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def reverse_each(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def rindex(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def rindex(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def rotate(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def rotate(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def rotate!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def rotate!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def sample(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def sample(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def select(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def select(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def select!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def select!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def shelljoin(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def shelljoin(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def shift(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def shift(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def shuffle(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def shuffle(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def shuffle!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def shuffle!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def size(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def size(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def slice(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def slice(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def slice!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def slice!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def slice_after(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def slice_after(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def slice_before(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def slice_before(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def slice_when(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def slice_when(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def sort(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def sort(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def sort!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def sort!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def sort_by(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def sort_by(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def sort_by!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def sort_by!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def sum(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def sum(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def take(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def take(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def take_while(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def take_while(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def tally(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def tally(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def to_ary(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def to_ary(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def to_h(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def to_h(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def to_set(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def to_set(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def transpose(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def transpose(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def union(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def union(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def uniq(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def uniq(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def uniq!(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def uniq!(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def unshift(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def unshift(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def values_at(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def values_at(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def zip(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def zip(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def |(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def |(*_arg0, **_arg1, &_arg2); end end # source://rubocop-ast//lib/rubocop/ast/node/mixin/collection_node.rb#9 @@ -3527,7 +3527,7 @@ RuboCop::AST::Node::VARIABLES = T.let(T.unsafe(nil), Set) # source://rubocop-ast//lib/rubocop/ast/node_pattern/method_definer.rb#5 class RuboCop::AST::NodePattern include ::RuboCop::AST::NodePattern::MethodDefiner - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # @return [NodePattern] a new instance of NodePattern # @@ -3545,8 +3545,8 @@ class RuboCop::AST::NodePattern # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#73 def ast; end - # source://forwardable/1.3.3/forwardable.rb#231 - def captures(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def captures(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#111 def encode_with(coder); end @@ -3574,16 +3574,16 @@ class RuboCop::AST::NodePattern # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#73 def match_code; end - # source://forwardable/1.3.3/forwardable.rb#231 - def named_parameters(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def named_parameters(*_arg0, **_arg1, &_arg2); end # Returns the value of attribute pattern. # # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#73 def pattern; end - # source://forwardable/1.3.3/forwardable.rb#231 - def positional_parameters(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def positional_parameters(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern.rb#95 def to_s; end @@ -3688,15 +3688,15 @@ end # # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler.rb#11 class RuboCop::AST::NodePattern::Compiler - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # @return [Compiler] a new instance of Compiler # # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler.rb#15 def initialize; end - # source://forwardable/1.3.3/forwardable.rb#231 - def bind(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def bind(*_arg0, **_arg1, &_arg2); end # Returns the value of attribute binding. # @@ -3842,8 +3842,8 @@ class RuboCop::AST::NodePattern::Compiler::Debug < ::RuboCop::AST::NodePattern:: # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler/debug.rb#123 def initialize; end - # source://forwardable/1.3.3/forwardable.rb#231 - def comments(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def comments(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler/debug.rb#128 def named_parameters; end @@ -3856,8 +3856,8 @@ class RuboCop::AST::NodePattern::Compiler::Debug < ::RuboCop::AST::NodePattern:: # source://rubocop-ast//lib/rubocop/ast/node_pattern/compiler/debug.rb#132 def parser; end - # source://forwardable/1.3.3/forwardable.rb#231 - def tokens(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def tokens(*_arg0, **_arg1, &_arg2); end end # @api private @@ -4459,7 +4459,7 @@ class RuboCop::AST::NodePattern::LexerRex # The current location in the parse. # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#103 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#104 def location; end # The StringScanner for this lexer. @@ -4474,22 +4474,22 @@ class RuboCop::AST::NodePattern::LexerRex # Lex the next token. # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#112 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#113 def next_token; end # Parse the given string. # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#83 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#84 def parse(str); end # Read in and parse the file at +path+. # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#93 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#94 def parse_file(path); end # The current scanner class. Must be overridden in subclasses. # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#76 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/lexer.rex.rb#77 def scanner_class; end # The StringScanner for this lexer. @@ -4633,7 +4633,7 @@ end # source://rubocop-ast//lib/rubocop/ast/node_pattern/node.rb#7 class RuboCop::AST::NodePattern::Node < ::Parser::AST::Node include ::RuboCop::AST::Descendence - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # Note: `arity.end` may be `Float::INFINITY` # @@ -4726,8 +4726,8 @@ RuboCop::AST::NodePattern::Node::AnyOrder::ARITIES = T.let(T.unsafe(nil), Hash) # # source://rubocop-ast//lib/rubocop/ast/node_pattern/node.rb#96 class RuboCop::AST::NodePattern::Node::Capture < ::RuboCop::AST::NodePattern::Node - # source://forwardable/1.3.3/forwardable.rb#231 - def arity(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def arity(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # @@ -4740,8 +4740,8 @@ class RuboCop::AST::NodePattern::Node::Capture < ::RuboCop::AST::NodePattern::No # source://rubocop-ast//lib/rubocop/ast/node_pattern/node.rb#104 def nb_captures; end - # source://forwardable/1.3.3/forwardable.rb#231 - def rest?(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def rest?(*_arg0, **_arg1, &_arg2); end end # source://rubocop-ast//lib/rubocop/ast/node_pattern/node.rb#85 @@ -4856,148 +4856,148 @@ end # # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#12 class RuboCop::AST::NodePattern::Parser < ::Racc::Parser - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # @return [Parser] a new instance of Parser # # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.rb#19 def initialize(builder = T.unsafe(nil)); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#335 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#333 def _reduce_10(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#339 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#337 def _reduce_11(val, _values); end # reduce 12 omitted # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#345 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#343 def _reduce_13(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#349 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#347 def _reduce_14(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#353 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#351 def _reduce_15(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#357 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#355 def _reduce_16(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#361 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#359 def _reduce_17(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#365 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#363 def _reduce_18(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#369 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#367 def _reduce_19(val, _values); end # reduce 1 omitted # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#303 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#301 def _reduce_2(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#373 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#371 def _reduce_20(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#377 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#375 def _reduce_21(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#381 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#379 def _reduce_22(val, _values); end # reduce 24 omitted # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#389 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#387 def _reduce_25(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#395 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#393 def _reduce_26(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#307 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#305 def _reduce_3(val, _values); end # reduce 32 omitted # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#415 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#413 def _reduce_33(val, _values); end # reduce 36 omitted # - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#425 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#423 def _reduce_37(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#429 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#427 def _reduce_38(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#433 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#431 def _reduce_39(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#311 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#309 def _reduce_4(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#437 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#435 def _reduce_40(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#441 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#439 def _reduce_41(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#445 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#443 def _reduce_42(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#449 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#447 def _reduce_43(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#453 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#451 def _reduce_44(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#457 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#455 def _reduce_45(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#461 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#459 def _reduce_46(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#315 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#313 def _reduce_5(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#319 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#317 def _reduce_6(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#323 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#321 def _reduce_7(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#327 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#325 def _reduce_8(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#331 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#329 def _reduce_9(val, _values); end - # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#465 + # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#463 def _reduce_none(val, _values); end - # source://forwardable/1.3.3/forwardable.rb#231 - def emit_atom(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def emit_atom(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def emit_call(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def emit_call(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def emit_capture(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def emit_capture(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def emit_list(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def emit_list(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def emit_unary_op(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def emit_unary_op(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def emit_union(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def emit_union(*_arg0, **_arg1, &_arg2); end # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.rb#40 def inspect; end - # source://forwardable/1.3.3/forwardable.rb#231 - def next_token(*args, **_arg1, &block); end + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def next_token(*_arg0, **_arg1, &_arg2); end # (Similar API to `parser` gem) # Parses a source and returns the AST. @@ -5032,10 +5032,10 @@ RuboCop::AST::NodePattern::Parser::Lexer = RuboCop::AST::NodePattern::Lexer # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#227 RuboCop::AST::NodePattern::Parser::Racc_arg = T.let(T.unsafe(nil), Array) -# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#295 +# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#293 RuboCop::AST::NodePattern::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass) -# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#244 +# source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#243 RuboCop::AST::NodePattern::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array) # Overrides Parser to use `WithMeta` variants and provide additional methods @@ -7077,3 +7077,340 @@ class RuboCop::AST::YieldNode < ::RuboCop::AST::Node # source://rubocop-ast//lib/rubocop/ast/node/yield_node.rb#16 def node_parts; end end + +class RuboCop::CommentConfig + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#34 + def initialize(processed_source); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#63 + def comment_only_line?(line_number); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def config(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#51 + def cop_disabled_line_ranges; end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#39 + def cop_enabled_at_line?(cop, line_number); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#47 + def cop_opted_in?(cop); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#55 + def extra_enabled_comments; end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#30 + def processed_source; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def registry(*_arg0, **_arg1, &_arg2); end + + private + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#96 + def analyze; end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#124 + def analyze_cop(analysis, directive); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#144 + def analyze_disabled(analysis, directive); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#155 + def analyze_rest(analysis, directive); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#135 + def analyze_single_line(analysis, directive); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#164 + def cop_line_ranges(analysis); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#170 + def each_directive; end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#69 + def extra_enabled_comments_with_names(extras:, names:); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#190 + def handle_enable_all(directive, names, extras); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#204 + def handle_switch(directive, names, extras); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#115 + def inject_disabled_cops_directives(analyses); end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#183 + def non_comment_token_line_numbers; end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#83 + def opt_in_cops; end + + # source://rubocop/1.66.1/lib/rubocop/comment_config.rb#179 + def qualified_cop_name(cop_name); end +end + +class RuboCop::Config + # source://rubocop/1.66.1/lib/rubocop/config.rb#30 + def initialize(hash = T.unsafe(nil), loaded_path = T.unsafe(nil)); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def [](*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def []=(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#170 + def active_support_extensions_enabled?; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#96 + def add_excludes_from_higher_level(highest_config); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#197 + def allowed_camel_case_file?(file); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#241 + def base_dir_for_path_parameters; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#271 + def bundler_lock_file_path; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#51 + def check; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#142 + def clusivity_config_for_badge?(badge); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def delete(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#108 + def deprecation_check; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def dig(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#162 + def disabled_new_cops?; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each(*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_key(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#166 + def enabled_new_cops?; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def fetch(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#219 + def file_to_exclude?(file); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#178 + def file_to_include?(file); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#158 + def for_all_cops; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#128 + def for_badge(badge); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#122 + def for_cop(cop); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#153 + def for_department(department_name); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#296 + def gem_versions_in_target; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#300 + def inspect; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#76 + def internal?; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def key?(*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def keys(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#47 + def loaded_features; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#20 + def loaded_path; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#81 + def make_excludes_absolute; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def map(*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def merge(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#251 + def parser_engine; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#232 + def path_relative_to_config(path); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#228 + def patterns_to_exclude; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#224 + def patterns_to_include; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#282 + def pending_cops; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#211 + def possibly_include_hidden?; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def replace(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#71 + def signature; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#266 + def smart_loaded_path; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#174 + def string_literals_frozen_by_default?; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#255 + def target_rails_version; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def target_ruby_version(*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def to_h(*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def to_hash(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#67 + def to_s; end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def transform_values(*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def validate(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#58 + def validate_after_resolution; end + + private + + # source://rubocop/1.66.1/lib/rubocop/config.rb#350 + def department_of(qualified_cop_name); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#338 + def enable_cop?(qualified_cop_name, cop_options); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#325 + def gem_version_to_major_minor_float(gem_version); end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#331 + def read_gem_versions_from_target_lockfile; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#312 + def read_rails_version_from_bundler_lock_file; end + + # source://rubocop/1.66.1/lib/rubocop/config.rb#307 + def target_rails_version_from_bundler_lock_file; end + + class << self + # source://rubocop/1.66.1/lib/rubocop/config.rb#22 + def create(hash, path, check: T.unsafe(nil)); end + end +end + +class RuboCop::ConfigValidator + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#26 + def initialize(config); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def for_all_cops(*_arg0, **_arg1, &_arg2); end + + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def smart_loaded_path(*_arg0, **_arg1, &_arg2); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#62 + def target_ruby_version; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#32 + def validate; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#58 + def validate_after_resolution; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#66 + def validate_section_presence(name); end + + private + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#103 + def alert_about_unrecognized_cops(invalid_cop_names); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#253 + def check_cop_config_value(hash, parent = T.unsafe(nil)); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#76 + def check_obsoletions; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#83 + def check_target_ruby; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#194 + def each_invalid_parameter(cop_name); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#119 + def list_unknown_cops(invalid_cop_names); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#273 + def param_error_message(parent, key, value, supposed_values); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#241 + def reject_conflicting_safe_settings; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#232 + def reject_mutually_exclusive_defaults; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#141 + def suggestion(name); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#74 + def target_ruby; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#206 + def validate_enforced_styles(valid_cop_names); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#168 + def validate_new_cops_parameter; end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#179 + def validate_parameter_names(valid_cop_names); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#226 + def validate_support_and_has_list(name, formats, valid); end + + # source://rubocop/1.66.1/lib/rubocop/config_validator.rb#157 + def validate_syntax_cop; end +end + +# Similar to `Forwardable#def_delegators`, but simpler & faster +# +# source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#5 +module RuboCop::SimpleForwardable + # source://rubocop-ast//lib/rubocop/ast/utilities/simple_forwardable.rb#6 + def def_delegators(accessor, *methods); end +end diff --git a/sorbet/rbi/gems/rubocop-md@1.2.2.rbi b/sorbet/rbi/gems/rubocop-md@1.2.3.rbi similarity index 81% rename from sorbet/rbi/gems/rubocop-md@1.2.2.rbi rename to sorbet/rbi/gems/rubocop-md@1.2.3.rbi index 82a2fb0d9c..e76703ff05 100644 --- a/sorbet/rbi/gems/rubocop-md@1.2.2.rbi +++ b/sorbet/rbi/gems/rubocop-md@1.2.3.rbi @@ -26,15 +26,15 @@ RuboCop::Markdown::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname) class RuboCop::Markdown::Preprocess # @return [Preprocess] a new instance of Preprocess # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#51 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#55 def initialize(file); end - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#56 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#60 def call(src); end # Returns the value of attribute config. # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#49 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#53 def config; end private @@ -44,10 +44,10 @@ class RuboCop::Markdown::Preprocess # # @return [Boolean] # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#112 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#116 def autodetect?; end - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#116 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#120 def comment_lines(src); end # Check codeblock attribute to prevent from parsing @@ -55,19 +55,19 @@ class RuboCop::Markdown::Preprocess # # @return [Boolean] # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#87 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#91 def maybe_ruby?(syntax); end # Check codeblack attribute if it's defined and of Ruby type # # @return [Boolean] # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#92 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#96 def ruby?(syntax); end # @return [Boolean] # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#81 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#85 def ruby_codeblock?(syntax, src); end # Try to parse with Ripper @@ -76,17 +76,20 @@ class RuboCop::Markdown::Preprocess # # @return [Boolean] # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#99 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#103 def valid_syntax?(syntax, src); end # Whether to show warning when snippet is not a valid Ruby # # @return [Boolean] # - # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#106 + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#110 def warn_invalid?; end class << self + # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#48 + def restore!(src); end + # Revert preprocess changes. # # When autocorrect is applied, RuboCop re-writes the file @@ -95,7 +98,7 @@ class RuboCop::Markdown::Preprocess # We have to restore it. # # source://rubocop-md//lib/rubocop/markdown/preprocess.rb#42 - def restore!(file); end + def restore_and_save!(file); end end end diff --git a/sorbet/rbi/gems/rubocop@1.65.1.rbi b/sorbet/rbi/gems/rubocop@1.66.1.rbi similarity index 98% rename from sorbet/rbi/gems/rubocop@1.65.1.rbi rename to sorbet/rbi/gems/rubocop@1.66.1.rbi index f5872c64f7..4a8819e362 100644 --- a/sorbet/rbi/gems/rubocop@1.65.1.rbi +++ b/sorbet/rbi/gems/rubocop@1.66.1.rbi @@ -765,7 +765,7 @@ end # # source://rubocop//lib/rubocop/comment_config.rb#6 class RuboCop::CommentConfig - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # @return [CommentConfig] a new instance of CommentConfig # @@ -777,8 +777,8 @@ class RuboCop::CommentConfig # source://rubocop//lib/rubocop/comment_config.rb#63 def comment_only_line?(line_number); end - # source://forwardable/1.3.3/forwardable.rb#231 - def config(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def config(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/comment_config.rb#51 def cop_disabled_line_ranges; end @@ -801,8 +801,8 @@ class RuboCop::CommentConfig # source://rubocop//lib/rubocop/comment_config.rb#30 def processed_source; end - # source://forwardable/1.3.3/forwardable.rb#231 - def registry(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def registry(*_arg0, **_arg1, &_arg2); end private @@ -970,18 +970,18 @@ end class RuboCop::Config include ::RuboCop::PathUtil include ::RuboCop::FileFinder - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # @return [Config] a new instance of Config # # source://rubocop//lib/rubocop/config.rb#30 def initialize(hash = T.unsafe(nil), loaded_path = T.unsafe(nil)); end - # source://forwardable/1.3.3/forwardable.rb#231 - def [](*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def [](*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def []=(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def []=(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # @@ -993,7 +993,7 @@ class RuboCop::Config # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#193 + # source://rubocop//lib/rubocop/config.rb#197 def allowed_camel_case_file?(file); end # Paths specified in configuration files starting with .rubocop are @@ -1002,12 +1002,12 @@ class RuboCop::Config # config/default.yml, for example, are not relative to RuboCop's config # directory since that wouldn't work. # - # source://rubocop//lib/rubocop/config.rb#237 + # source://rubocop//lib/rubocop/config.rb#241 def base_dir_for_path_parameters; end # @return [String, nil] # - # source://rubocop//lib/rubocop/config.rb#267 + # source://rubocop//lib/rubocop/config.rb#271 def bundler_lock_file_path; end # source://rubocop//lib/rubocop/config.rb#51 @@ -1019,42 +1019,42 @@ class RuboCop::Config # source://rubocop//lib/rubocop/config.rb#142 def clusivity_config_for_badge?(badge); end - # source://forwardable/1.3.3/forwardable.rb#231 - def delete(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def delete(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/config.rb#108 def deprecation_check; end - # source://forwardable/1.3.3/forwardable.rb#231 - def dig(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def dig(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # # source://rubocop//lib/rubocop/config.rb#162 def disabled_new_cops?; end - # source://forwardable/1.3.3/forwardable.rb#231 - def each(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def each_key(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def each_key(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # # source://rubocop//lib/rubocop/config.rb#166 def enabled_new_cops?; end - # source://forwardable/1.3.3/forwardable.rb#231 - def fetch(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def fetch(*_arg0, **_arg1, &_arg2); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#215 + # source://rubocop//lib/rubocop/config.rb#219 def file_to_exclude?(file); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#174 + # source://rubocop//lib/rubocop/config.rb#178 def file_to_include?(file); end # source://rubocop//lib/rubocop/config.rb#158 @@ -1085,10 +1085,10 @@ class RuboCop::Config # Returns target's locked gem versions (i.e. from Gemfile.lock or gems.locked) # - # source://rubocop//lib/rubocop/config.rb#292 + # source://rubocop//lib/rubocop/config.rb#296 def gem_versions_in_target; end - # source://rubocop//lib/rubocop/config.rb#296 + # source://rubocop//lib/rubocop/config.rb#300 def inspect; end # True if this is a config file that is shipped with RuboCop @@ -1098,11 +1098,11 @@ class RuboCop::Config # source://rubocop//lib/rubocop/config.rb#76 def internal?; end - # source://forwardable/1.3.3/forwardable.rb#231 - def key?(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def key?(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def keys(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def keys(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/config.rb#47 def loaded_features; end @@ -1115,25 +1115,25 @@ class RuboCop::Config # source://rubocop//lib/rubocop/config.rb#81 def make_excludes_absolute; end - # source://forwardable/1.3.3/forwardable.rb#231 - def map(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def map(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def merge(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def merge(*_arg0, **_arg1, &_arg2); end - # source://rubocop//lib/rubocop/config.rb#247 + # source://rubocop//lib/rubocop/config.rb#251 def parser_engine; end - # source://rubocop//lib/rubocop/config.rb#228 + # source://rubocop//lib/rubocop/config.rb#232 def path_relative_to_config(path); end - # source://rubocop//lib/rubocop/config.rb#224 + # source://rubocop//lib/rubocop/config.rb#228 def patterns_to_exclude; end - # source://rubocop//lib/rubocop/config.rb#220 + # source://rubocop//lib/rubocop/config.rb#224 def patterns_to_include; end - # source://rubocop//lib/rubocop/config.rb#278 + # source://rubocop//lib/rubocop/config.rb#282 def pending_cops; end # Returns true if there's a chance that an Include pattern matches hidden @@ -1141,69 +1141,74 @@ class RuboCop::Config # # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#207 + # source://rubocop//lib/rubocop/config.rb#211 def possibly_include_hidden?; end - # source://forwardable/1.3.3/forwardable.rb#231 - def replace(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def replace(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/config.rb#71 def signature; end - # source://rubocop//lib/rubocop/config.rb#262 + # source://rubocop//lib/rubocop/config.rb#266 def smart_loaded_path; end - # source://rubocop//lib/rubocop/config.rb#251 + # @return [Boolean] + # + # source://rubocop//lib/rubocop/config.rb#174 + def string_literals_frozen_by_default?; end + + # source://rubocop//lib/rubocop/config.rb#255 def target_rails_version; end - # source://forwardable/1.3.3/forwardable.rb#231 - def target_ruby_version(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def target_ruby_version(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def to_h(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def to_h(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def to_hash(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def to_hash(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/config.rb#67 def to_s; end - # source://forwardable/1.3.3/forwardable.rb#231 - def transform_values(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def transform_values(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def validate(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def validate(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/config.rb#58 def validate_after_resolution; end private - # source://rubocop//lib/rubocop/config.rb#346 + # source://rubocop//lib/rubocop/config.rb#350 def department_of(qualified_cop_name); end # @return [Boolean] # - # source://rubocop//lib/rubocop/config.rb#334 + # source://rubocop//lib/rubocop/config.rb#338 def enable_cop?(qualified_cop_name, cop_options); end # @param gem_version [Gem::Version] an object like `Gem::Version.new("7.1.2.3")` # @return [Float] The major and minor version, like `7.1` # - # source://rubocop//lib/rubocop/config.rb#321 + # source://rubocop//lib/rubocop/config.rb#325 def gem_version_to_major_minor_float(gem_version); end - # source://rubocop//lib/rubocop/config.rb#327 + # source://rubocop//lib/rubocop/config.rb#331 def read_gem_versions_from_target_lockfile; end # @return [Float, nil] The Rails version as a `major.minor` Float. # - # source://rubocop//lib/rubocop/config.rb#308 + # source://rubocop//lib/rubocop/config.rb#312 def read_rails_version_from_bundler_lock_file; end # @return [Float, nil] The Rails version as a `major.minor` Float. # - # source://rubocop//lib/rubocop/config.rb#303 + # source://rubocop//lib/rubocop/config.rb#307 def target_rails_version_from_bundler_lock_file; end class << self @@ -1520,10 +1525,10 @@ class RuboCop::ConfigLoader def resolver; end # source://rubocop//lib/rubocop/config_loader.rb#238 - def yaml_safe_load(yaml_code, filename); end + def yaml_tree_to_hash(yaml_tree); end # source://rubocop//lib/rubocop/config_loader.rb#248 - def yaml_safe_load!(yaml_code, filename); end + def yaml_tree_to_hash!(yaml_tree); end end end @@ -1630,12 +1635,12 @@ class RuboCop::ConfigLoaderResolver # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#268 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#267 def gem_config_path(gem_name, relative_config_path); end # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#246 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#245 def handle_disabled_by_default(config, new_default_configuration); end # @api private @@ -1675,7 +1680,7 @@ class RuboCop::ConfigLoaderResolver # @api private # - # source://rubocop//lib/rubocop/config_loader_resolver.rb#264 + # source://rubocop//lib/rubocop/config_loader_resolver.rb#263 def transform(config, &block); end # @api private @@ -2257,18 +2262,18 @@ end # # source://rubocop//lib/rubocop/config_validator.rb#6 class RuboCop::ConfigValidator - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # @return [ConfigValidator] a new instance of ConfigValidator # # source://rubocop//lib/rubocop/config_validator.rb#26 def initialize(config); end - # source://forwardable/1.3.3/forwardable.rb#231 - def for_all_cops(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def for_all_cops(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def smart_loaded_path(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def smart_loaded_path(*_arg0, **_arg1, &_arg2); end # source://rubocop//lib/rubocop/config_validator.rb#62 def target_ruby_version; end @@ -2627,85 +2632,83 @@ RuboCop::Cop::AmbiguousCopName::MSG = T.let(T.unsafe(nil), String) # # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#6 class RuboCop::Cop::AnnotationComment - extend ::Forwardable - # @param comment [Parser::Source::Comment] # @param keywords [Array] # @return [AnnotationComment] a new instance of AnnotationComment # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#13 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#11 def initialize(comment, keywords); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#19 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#17 def annotation?; end # Returns the range bounds for just the annotation # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#31 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#29 def bounds; end # Returns the value of attribute colon. # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#9 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#7 def colon; end # Returns the value of attribute comment. # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#9 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#7 def comment; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#23 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#21 def correct?(colon:); end # Returns the value of attribute keyword. # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#9 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#7 def keyword; end # Returns the value of attribute margin. # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#9 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#7 def margin; end # Returns the value of attribute note. # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#9 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#7 def note; end # Returns the value of attribute space. # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#9 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#7 def space; end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#67 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#65 def just_keyword_of_sentence?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#63 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#61 def keyword_appearance?; end # Returns the value of attribute keywords. # - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#39 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#37 def keywords; end - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#53 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#51 def regex; end - # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#41 + # source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#39 def split_comment(comment); end end -# source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#50 +# source://rubocop//lib/rubocop/cop/mixin/annotation_comment.rb#48 RuboCop::Cop::AnnotationComment::KEYWORDS_REGEX_CACHE = T.let(T.unsafe(nil), Hash) # Handles the `MinSize` configuration option for array-based cops @@ -2963,19 +2966,19 @@ class RuboCop::Cop::Base # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/base.rb#343 + # source://rubocop//lib/rubocop/cop/base.rb#347 def always_autocorrect?; end # Called before any investigation # # @api private # - # source://rubocop//lib/rubocop/cop/base.rb#329 + # source://rubocop//lib/rubocop/cop/base.rb#333 def begin_investigation(processed_source, offset: T.unsafe(nil), original: T.unsafe(nil)); end # @api private # - # source://rubocop//lib/rubocop/cop/base.rb#314 + # source://rubocop//lib/rubocop/cop/base.rb#318 def callbacks_needed; end # Returns the value of attribute config. @@ -2992,7 +2995,7 @@ class RuboCop::Cop::Base # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/base.rb#349 + # source://rubocop//lib/rubocop/cop/base.rb#353 def contextual_autocorrect?; end # Configuration Helpers @@ -3005,7 +3008,7 @@ class RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/base.rb#285 + # source://rubocop//lib/rubocop/cop/base.rb#289 def excluded_file?(file); end # This method should be overridden when a cop's behavior depends @@ -3027,7 +3030,7 @@ class RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/base.rb#234 def external_dependency_checksum; end - # source://rubocop//lib/rubocop/cop/base.rb#353 + # source://rubocop//lib/rubocop/cop/base.rb#357 def inspect; end # Gets called if no message is specified when calling `add_offense` or @@ -3042,7 +3045,7 @@ class RuboCop::Cop::Base # @deprecated Make potential errors with previous API more obvious # - # source://rubocop//lib/rubocop/cop/base.rb#305 + # source://rubocop//lib/rubocop/cop/base.rb#309 def offenses; end # Called after all on_... have been called @@ -3065,7 +3068,7 @@ class RuboCop::Cop::Base # There should be very limited reasons for a Cop to do it's own parsing # - # source://rubocop//lib/rubocop/cop/base.rb#290 + # source://rubocop//lib/rubocop/cop/base.rb#294 def parse(source, path = T.unsafe(nil)); end # source://rubocop//lib/rubocop/cop/base.rb#264 @@ -3080,14 +3083,19 @@ class RuboCop::Cop::Base # # @api private # - # source://rubocop//lib/rubocop/cop/base.rb#296 + # source://rubocop//lib/rubocop/cop/base.rb#300 def ready; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/base.rb#276 + # source://rubocop//lib/rubocop/cop/base.rb#280 def relevant_file?(file); end + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/base.rb#276 + def string_literals_frozen_by_default?; end + # source://rubocop//lib/rubocop/cop/base.rb#268 def target_rails_version; end @@ -3096,90 +3104,90 @@ class RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/base.rb#471 + # source://rubocop//lib/rubocop/cop/base.rb#475 def annotate(message); end - # source://rubocop//lib/rubocop/cop/base.rb#365 + # source://rubocop//lib/rubocop/cop/base.rb#369 def apply_correction(corrector); end # @return [Symbol] offense status # - # source://rubocop//lib/rubocop/cop/base.rb#435 + # source://rubocop//lib/rubocop/cop/base.rb#439 def attempt_correction(range, corrector); end # Reserved for Cop::Cop # - # source://rubocop//lib/rubocop/cop/base.rb#361 + # source://rubocop//lib/rubocop/cop/base.rb#365 def callback_argument(range); end # Called to complete an investigation # - # source://rubocop//lib/rubocop/cop/base.rb#394 + # source://rubocop//lib/rubocop/cop/base.rb#398 def complete_investigation; end # @return [Symbol, Corrector] offense status # - # source://rubocop//lib/rubocop/cop/base.rb#409 + # source://rubocop//lib/rubocop/cop/base.rb#413 def correct(range); end - # source://rubocop//lib/rubocop/cop/base.rb#379 + # source://rubocop//lib/rubocop/cop/base.rb#383 def current_corrector; end # Reserved for Commissioner: # - # source://rubocop//lib/rubocop/cop/base.rb#371 + # source://rubocop//lib/rubocop/cop/base.rb#375 def current_offense_locations; end - # source://rubocop//lib/rubocop/cop/base.rb#383 + # source://rubocop//lib/rubocop/cop/base.rb#387 def current_offenses; end - # source://rubocop//lib/rubocop/cop/base.rb#375 + # source://rubocop//lib/rubocop/cop/base.rb#379 def currently_disabled_lines; end - # source://rubocop//lib/rubocop/cop/base.rb#499 + # source://rubocop//lib/rubocop/cop/base.rb#503 def custom_severity; end - # source://rubocop//lib/rubocop/cop/base.rb#495 + # source://rubocop//lib/rubocop/cop/base.rb#499 def default_severity; end - # source://rubocop//lib/rubocop/cop/base.rb#449 + # source://rubocop//lib/rubocop/cop/base.rb#453 def disable_uncorrectable(range); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/base.rb#485 + # source://rubocop//lib/rubocop/cop/base.rb#489 def enabled_line?(line_number); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/base.rb#477 + # source://rubocop//lib/rubocop/cop/base.rb#481 def file_name_matches_any?(file, parameter, default_result); end - # source://rubocop//lib/rubocop/cop/base.rb#467 + # source://rubocop//lib/rubocop/cop/base.rb#471 def find_message(range, message); end - # source://rubocop//lib/rubocop/cop/base.rb#491 + # source://rubocop//lib/rubocop/cop/base.rb#495 def find_severity(_range, severity); end - # source://rubocop//lib/rubocop/cop/base.rb#512 + # source://rubocop//lib/rubocop/cop/base.rb#516 def range_for_original(range); end - # source://rubocop//lib/rubocop/cop/base.rb#456 + # source://rubocop//lib/rubocop/cop/base.rb#460 def range_from_node_or_range(node_or_range); end # Actually private methods # - # source://rubocop//lib/rubocop/cop/base.rb#404 + # source://rubocop//lib/rubocop/cop/base.rb#408 def reset_investigation; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/base.rb#520 + # source://rubocop//lib/rubocop/cop/base.rb#524 def target_satisfies_all_gem_version_requirements?; end # @return [Symbol] offense status # - # source://rubocop//lib/rubocop/cop/base.rb#424 + # source://rubocop//lib/rubocop/cop/base.rb#428 def use_corrector(range, corrector); end class << self @@ -3199,7 +3207,7 @@ class RuboCop::Cop::Base # @api private # - # source://rubocop//lib/rubocop/cop/base.rb#319 + # source://rubocop//lib/rubocop/cop/base.rb#323 def callbacks_needed; end # source://rubocop//lib/rubocop/cop/base.rb#97 @@ -3290,12 +3298,12 @@ class RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/base.rb#387 + # source://rubocop//lib/rubocop/cop/base.rb#391 def restrict_on_send; end end end -# source://rubocop//lib/rubocop/cop/base.rb#391 +# source://rubocop//lib/rubocop/cop/base.rb#395 RuboCop::Cop::Base::EMPTY_OFFENSES = T.let(T.unsafe(nil), Array) # Reports of an investigation. @@ -5092,7 +5100,7 @@ class RuboCop::Cop::Corrector < ::Parser::Source::TreeRewriter # Legacy # - # source://parser/3.3.4.2/lib/parser/source/tree_rewriter.rb#252 + # source://parser/3.3.5.0/lib/parser/source/tree_rewriter.rb#252 def rewrite; end # Swaps sources at the given ranges. @@ -5158,24 +5166,34 @@ module RuboCop::Cop::Documentation # @api private # - # source://rubocop//lib/rubocop/cop/documentation.rb#24 + # source://rubocop//lib/rubocop/cop/documentation.rb#25 def base_url_for(cop_class, config); end # @api private # - # source://rubocop//lib/rubocop/cop/documentation.rb#40 + # source://rubocop//lib/rubocop/cop/documentation.rb#57 def builtin?(cop_class); end # @api private # - # source://rubocop//lib/rubocop/cop/documentation.rb#35 + # source://rubocop//lib/rubocop/cop/documentation.rb#47 def default_base_url; end + # @api private + # + # source://rubocop//lib/rubocop/cop/documentation.rb#52 + def default_extension; end + # @api private # # source://rubocop//lib/rubocop/cop/documentation.rb#10 def department_to_basename(department); end + # @api private + # + # source://rubocop//lib/rubocop/cop/documentation.rb#36 + def extension_for(cop_class, config); end + # @api private # # source://rubocop//lib/rubocop/cop/documentation.rb#15 @@ -5184,25 +5202,35 @@ module RuboCop::Cop::Documentation class << self # @api private # - # source://rubocop//lib/rubocop/cop/documentation.rb#24 + # source://rubocop//lib/rubocop/cop/documentation.rb#25 def base_url_for(cop_class, config); end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/documentation.rb#40 + # source://rubocop//lib/rubocop/cop/documentation.rb#57 def builtin?(cop_class); end # @api private # - # source://rubocop//lib/rubocop/cop/documentation.rb#35 + # source://rubocop//lib/rubocop/cop/documentation.rb#47 def default_base_url; end + # @api private + # + # source://rubocop//lib/rubocop/cop/documentation.rb#52 + def default_extension; end + # @api private # # source://rubocop//lib/rubocop/cop/documentation.rb#10 def department_to_basename(department); end + # @api private + # + # source://rubocop//lib/rubocop/cop/documentation.rb#36 + def extension_for(cop_class, config); end + # @api private # # source://rubocop//lib/rubocop/cop/documentation.rb#15 @@ -5597,21 +5625,24 @@ module RuboCop::Cop::FrozenStringLiteral # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#15 def frozen_string_literal_comment_exists?; end - # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#66 + # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#76 def frozen_string_literal_specified?; end - # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#60 + # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#70 def frozen_string_literals_disabled?; end - # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#41 + # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#42 def frozen_string_literals_enabled?; end - # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#76 + # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#86 def leading_comment_lines; end - # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#72 + # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#82 def leading_magic_comments; end + # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#35 + def uninterpolated_heredoc?(node); end + # source://rubocop//lib/rubocop/cop/mixin/frozen_string_literal.rb#31 def uninterpolated_string?(node); end @@ -7605,7 +7636,7 @@ RuboCop::Cop::Layout::BeginEndAlignment::MSG = T.let(T.unsafe(nil), String) # start of the line where the expression started. # # `either` (which is the default) : the `end` is allowed to be in either -# location. The autofixer will default to `start_of_line`. +# location. The autocorrect will default to `start_of_line`. # # @example EnforcedStyleAlignWith: either (default) # # bad @@ -7670,54 +7701,63 @@ class RuboCop::Cop::Layout::BlockAlignment < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#228 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#246 def add_space_before(corrector, loc, delta); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#205 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#223 def alt_start_msg(start_loc, source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#155 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#145 def autocorrect(corrector, node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#105 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#95 def block_end_align_target(node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#123 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#113 def check_block_alignment(start_node, block_node); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#178 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#196 def compute_do_source_line_column(node, end_loc); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#220 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#238 def compute_start_col(ancestor_node, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#119 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#109 def disqualified_parent?(parent, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#115 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#105 def end_align_target?(node, parent); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#168 + # In offense message, we want to show the assignment LHS rather than + # the entire assignment. + # + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#191 + def find_lhs_node(node); end + + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#162 def format_message(start_loc, end_loc, do_source_line_column, error_source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#215 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#233 def format_source_line_column(source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#197 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#215 def loc_to_source_line_column(loc); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#136 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#126 def register_offense(block_node, start_loc, end_loc, do_source_line_column); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#232 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#250 def remove_space_before(corrector, end_pos, delta); end - # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#95 + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#172 def start_for_block_node(block_node); end + + # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#179 + def start_for_line_node(block_node); end end # source://rubocop//lib/rubocop/cop/layout/block_alignment.rb#71 @@ -9283,84 +9323,84 @@ class RuboCop::Cop::Layout::EmptyLineBetweenDefs < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#290 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#291 def allowance_range?; end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#274 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#275 def autocorrect_insert_lines(corrector, newline_pos, count); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#267 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#268 def autocorrect_remove_lines(corrector, newline_pos, count); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#227 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#228 def blank_lines_count_between(first_def_node, second_def_node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#171 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#172 def candidate?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#191 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#192 def class_candidate?(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#255 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#256 def def_end(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#163 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#164 def def_location(correction_node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#247 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#248 def def_start(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#178 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#179 def empty_line_between_macros; end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#259 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#260 def end_loc(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#205 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#206 def expected_lines; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#223 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#224 def line_count_allowed?(count); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#239 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#240 def lines_between_defs(first_def_node, second_def_node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#182 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#183 def macro_candidate?(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#235 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#236 def maximum_empty_lines; end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#199 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#200 def message(node, count: T.unsafe(nil)); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#187 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#188 def method_candidate?(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#231 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#232 def minimum_empty_lines; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#195 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#196 def module_candidate?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#214 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#215 def multiple_blank_lines_groups?(first_def_node, second_def_node); end - # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#281 + # source://rubocop//lib/rubocop/cop/layout/empty_line_between_defs.rb#282 def node_type(node); end class << self @@ -10054,22 +10094,24 @@ class RuboCop::Cop::Layout::EmptyLinesAroundExceptionHandlingKeywords < ::RuboCo # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#81 def check_body(body, line_of_def_or_kwbegin); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#108 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#113 def keyword_locations(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#125 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#130 def keyword_locations_in_ensure(node); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#121 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#126 def keyword_locations_in_rescue(node); end + # @return [Boolean] + # # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#96 - def last_rescue_and_end_on_same_line(body); end + def last_body_and_end_on_same_line?(body); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#100 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#105 def message(location, keyword); end - # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#104 + # source://rubocop//lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb#109 def style; end end @@ -10728,7 +10770,6 @@ RuboCop::Cop::Layout::FirstArgumentIndentation::MSG = T.let(T.unsafe(nil), Strin # # defined inside a method call. # # # bad -# # consistent # array = [ # :value # ] @@ -10748,68 +10789,66 @@ RuboCop::Cop::Layout::FirstArgumentIndentation::MSG = T.let(T.unsafe(nil), Strin # # brackets are indented to the same position. # # # bad -# # align_brackets # and_now_for_something = [ # :completely_different # ] # # # good -# # align_brackets # and_now_for_something = [ # :completely_different # ] # -# source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#85 +# source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#82 class RuboCop::Cop::Layout::FirstArrayElementIndentation < ::RuboCop::Cop::Base include ::RuboCop::Cop::Alignment include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::MultilineElementIndentation extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#94 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#91 def on_array(node); end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#100 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#97 def on_csend(node); end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#100 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#97 def on_send(node); end private - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#191 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#188 def array_alignment_config; end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#111 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#108 def autocorrect(corrector, node); end # Returns the description of what the correct indentation is based on. # - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#149 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#146 def base_description(indent_base_type); end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#115 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#112 def brace_alignment_style; end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#119 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#116 def check(array_node, left_parenthesis); end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#133 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#130 def check_right_bracket(right_bracket, first_elem, left_bracket, left_parenthesis); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#185 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#182 def enforce_first_argument_with_fixed_indentation?; end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#162 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#159 def message(base_description); end - # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#170 + # source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#167 def message_for_right_bracket(indent_base_type); end end -# source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#91 +# source://rubocop//lib/rubocop/cop/layout/first_array_element_indentation.rb#88 RuboCop::Cop::Layout::FirstArrayElementIndentation::MSG = T.let(T.unsafe(nil), String) # Checks for a line break before the first element in a @@ -12806,20 +12845,20 @@ RuboCop::Cop::Layout::LineEndStringConcatenationIndentation::PARENT_TYPES_FOR_IN # * `Layout/ArrayAlignment` # * `Layout/BlockAlignment` # * `Layout/BlockEndNewline` -# * `LayoutClosingParenthesisIndentation` -# * `LayoutFirstArgumentIndentation` -# * `LayoutFirstArrayElementIndentation` -# * `LayoutFirstHashElementIndentation` -# * `LayoutFirstParameterIndentation` -# * `LayoutHashAlignment` -# * `LayoutIndentationWidth` -# * `LayoutMultilineArrayLineBreaks` -# * `LayoutMultilineBlockLayout` -# * `LayoutMultilineHashBraceLayout` -# * `LayoutMultilineHashKeyLineBreaks` -# * `LayoutMultilineMethodArgumentLineBreaks` -# * `LayoutMultilineMethodParameterLineBreaks` -# * `Layout/ParameterAlignment` +# * `Layout/ClosingParenthesisIndentation` +# * `Layout/FirstArgumentIndentation` +# * `Layout/FirstArrayElementIndentation` +# * `Layout/FirstHashElementIndentation` +# * `Layout/FirstParameterIndentation` +# * `Layout/HashAlignment` +# * `Layout/IndentationWidth` +# * `Layout/MultilineArrayLineBreaks` +# * `Layout/MultilineBlockLayout` +# * `Layout/MultilineHashBraceLayout` +# * `Layout/MultilineHashKeyLineBreaks` +# * `Layout/MultilineMethodArgumentLineBreaks` +# * `Layout/MultilineMethodParameterLineBreaks` +# * `Layout//ParameterAlignment` # * `Style/BlockDelimiters` # # Together, these cops will pretty print hashes, arrays, @@ -16562,7 +16601,7 @@ class RuboCop::Cop::LineBreakCorrector # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/correctors/line_break_corrector.rb#58 + # source://rubocop//lib/rubocop/cop/correctors/line_break_corrector.rb#60 def trailing_class_definition?(token, body); end end end @@ -16607,7 +16646,7 @@ module RuboCop::Cop::LineLengthHelp # source://rubocop//lib/rubocop/cop/mixin/line_length_help.rb#32 def line_length(line); end - # source://rubocop//lib/rubocop/cop/mixin/line_length_help.rb#105 + # source://rubocop//lib/rubocop/cop/mixin/line_length_help.rb#110 def line_length_without_directive(line); end # source://rubocop//lib/rubocop/cop/mixin/line_length_help.rb#51 @@ -16621,7 +16660,7 @@ module RuboCop::Cop::LineLengthHelp # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/mixin/line_length_help.rb#98 + # source://rubocop//lib/rubocop/cop/mixin/line_length_help.rb#103 def valid_uri?(uri_ish_string); end end @@ -18755,52 +18794,55 @@ class RuboCop::Cop::Lint::EmptyConditionalBody < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#70 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#71 def on_if(node); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#156 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#177 def all_branches_body_missing?(node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#83 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#95 def autocorrect(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#142 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#163 def branch_range(node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#104 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#125 def correct_other_branches(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#162 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#183 def deletion_range(range); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#137 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#158 def else_branch?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#131 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#152 def empty_elsif_branch?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#123 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#144 def empty_if_branch?(node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#89 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#87 + def offense_range(node); end + + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#101 def remove_comments(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#96 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#109 def remove_empty_branch(corrector, node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#116 + # source://rubocop//lib/rubocop/cop/lint/empty_conditional_body.rb#137 def require_other_branches_correction?(node); end end @@ -19264,10 +19306,10 @@ class RuboCop::Cop::Lint::FloatComparison < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#91 + # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#89 def check_numeric_returning_method(node); end - # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#75 + # source://rubocop//lib/rubocop/cop/lint/float_comparison.rb#73 def check_send(node); end # @return [Boolean] @@ -25064,6 +25106,11 @@ RuboCop::Cop::Lint::UselessAccessModifier::MSG = T.let(T.unsafe(nil), String) # reassignments and properly handles varied cases such as branch, loop, # rescue, ensure, etc. # +# This cop's autocorrection avoids cases like `a ||= 1` because removing assignment from +# operator assignment can cause NameError if this assignment has been used to declare +# a local variable. For example, replacing `a ||= 1` with `a || 1` may cause +# "undefined local variable or method `a' for main:Object (NameError)". +# # NOTE: Given the assignment `foo = 1, bar = 2`, removing unused variables # can lead to a syntax error, so this case is not autocorrected. # @@ -25081,83 +25128,83 @@ RuboCop::Cop::Lint::UselessAccessModifier::MSG = T.let(T.unsafe(nil), String) # do_something(some_var) # end # -# source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#41 +# source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#40 class RuboCop::Cop::Lint::UselessAssignment < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#52 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#51 def after_leaving_scope(scope, _variable_table); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#158 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#165 def autocorrect(corrector, assignment); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#99 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#106 def chained_assignment?(node); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#57 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#56 def check_for_unused_assignments(variable); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#142 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#149 def collect_variable_like_names(scope); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#75 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#82 def message_for_useless_assignment(assignment); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#103 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#110 def message_specification(assignment, variable); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#113 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#120 def multiple_assignment_message(variable_name); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#81 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#88 def offense_range(assignment); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#118 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#125 def operator_assignment_message(scope, assignment); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#175 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#182 def remove_exception_assignment_part(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#199 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#206 def remove_local_variable_assignment_part(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#188 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#195 def remove_trailing_character_from_operator(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#184 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#191 def rename_variable_with_underscore(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#192 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#199 def replace_named_capture_group_with_non_capturing_group(corrector, node, variable_name); end # TODO: More precise handling (rescue, ensure, nested begin, etc.) # - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#132 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#139 def return_value_node_of_scope(scope); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#89 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#96 def sequential_assignment?(node); end - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#125 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#132 def similar_name_message(variable); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#151 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#158 def variable_like_method_invocation?(node); end class << self - # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#48 + # source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#47 def joining_forces; end end end -# source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#46 +# source://rubocop//lib/rubocop/cop/lint/useless_assignment.rb#45 RuboCop::Cop::Lint::UselessAssignment::MSG = T.let(T.unsafe(nil), String) # Checks for useless `else` in `begin..end` without `rescue`. @@ -25250,6 +25297,62 @@ end # source://rubocop//lib/rubocop/cop/lint/useless_method_definition.rb#41 RuboCop::Cop::Lint::UselessMethodDefinition::MSG = T.let(T.unsafe(nil), String) +# Certain numeric operations have no impact, being: +# Adding or subtracting 0, multiplying or dividing by 1 or raising to the power of 1. +# These are probably leftover from debugging, or are mistakes. +# +# @example +# +# # bad +# x + 0 +# x - 0 +# x * 1 +# x / 1 +# x ** 1 +# +# # good +# x +# +# # bad +# x += 0 +# x -= 0 +# x *= 1 +# x /= 1 +# x **= 1 +# +# # good +# x = x +# +# source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#32 +class RuboCop::Cop::Lint::UselessNumericOperation < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + # source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#54 + def on_op_asgn(node); end + + # source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#43 + def on_send(node); end + + # source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#41 + def useless_abbreviated_assignment?(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#38 + def useless_operation?(param0 = T.unsafe(nil)); end + + private + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#67 + def useless?(operation, number); end +end + +# source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#34 +RuboCop::Cop::Lint::UselessNumericOperation::MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/lint/useless_numeric_operation.rb#35 +RuboCop::Cop::Lint::UselessNumericOperation::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + # Checks for useless `rescue`s, which only reraise rescued exceptions. # # @example @@ -25611,61 +25714,77 @@ class RuboCop::Cop::Lint::Void < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/lint/void.rb#92 + # source://rubocop//lib/rubocop/cop/lint/void.rb#90 def on_begin(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#82 + # source://rubocop//lib/rubocop/cop/lint/void.rb#81 def on_block(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#92 + # source://rubocop//lib/rubocop/cop/lint/void.rb#95 + def on_ensure(node); end + + # source://rubocop//lib/rubocop/cop/lint/void.rb#90 def on_kwbegin(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#82 + # source://rubocop//lib/rubocop/cop/lint/void.rb#81 def on_numblock(node); end private - # source://rubocop//lib/rubocop/cop/lint/void.rb#222 + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/void.rb#258 + def all_keys_entirely_literal?(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/lint/void.rb#262 + def all_values_entirely_literal?(node); end + + # source://rubocop//lib/rubocop/cop/lint/void.rb#236 def autocorrect_nonmutating_send(corrector, node, suggestion); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#216 + # source://rubocop//lib/rubocop/cop/lint/void.rb#230 def autocorrect_void_expression(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#204 + # source://rubocop//lib/rubocop/cop/lint/void.rb#218 def autocorrect_void_op(corrector, node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#99 + # source://rubocop//lib/rubocop/cop/lint/void.rb#101 def check_begin(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#113 + # source://rubocop//lib/rubocop/cop/lint/void.rb#198 + def check_ensure(node); end + + # source://rubocop//lib/rubocop/cop/lint/void.rb#115 def check_expression(expr); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#154 + # source://rubocop//lib/rubocop/cop/lint/void.rb#156 def check_literal(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#178 + # source://rubocop//lib/rubocop/cop/lint/void.rb#180 def check_nonmutating(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#162 + # source://rubocop//lib/rubocop/cop/lint/void.rb#164 def check_self(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#136 + # source://rubocop//lib/rubocop/cop/lint/void.rb#138 def check_var(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#170 + # source://rubocop//lib/rubocop/cop/lint/void.rb#172 def check_void_expression(node); end - # source://rubocop//lib/rubocop/cop/lint/void.rb#125 + # source://rubocop//lib/rubocop/cop/lint/void.rb#127 def check_void_op(node, &block); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/void.rb#231 + # source://rubocop//lib/rubocop/cop/lint/void.rb#245 def entirely_literal?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/lint/void.rb#196 + # source://rubocop//lib/rubocop/cop/lint/void.rb#211 def in_void_context?(node); end end @@ -25681,13 +25800,13 @@ RuboCop::Cop::Lint::Void::EXPRESSION_MSG = T.let(T.unsafe(nil), String) # source://rubocop//lib/rubocop/cop/lint/void.rb#61 RuboCop::Cop::Lint::Void::LIT_MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/lint/void.rb#77 +# source://rubocop//lib/rubocop/cop/lint/void.rb#76 RuboCop::Cop::Lint::Void::METHODS_REPLACEABLE_BY_EACH = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/lint/void.rb#79 +# source://rubocop//lib/rubocop/cop/lint/void.rb#78 RuboCop::Cop::Lint::Void::NONMUTATING_METHODS = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/lint/void.rb#70 +# source://rubocop//lib/rubocop/cop/lint/void.rb#69 RuboCop::Cop::Lint::Void::NONMUTATING_METHODS_WITH_BANG_VERSION = T.let(T.unsafe(nil), Array) # source://rubocop//lib/rubocop/cop/lint/void.rb#64 @@ -25708,9 +25827,6 @@ RuboCop::Cop::Lint::Void::UNARY_OPERATORS = T.let(T.unsafe(nil), Array) # source://rubocop//lib/rubocop/cop/lint/void.rb#59 RuboCop::Cop::Lint::Void::VAR_MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/lint/void.rb#69 -RuboCop::Cop::Lint::Void::VOID_CONTEXT_TYPES = T.let(T.unsafe(nil), Array) - # Common functionality for obtaining source ranges from regexp matches # # source://rubocop//lib/rubocop/cop/mixin/match_range.rb#6 @@ -25973,8 +26089,9 @@ RuboCop::Cop::Metrics::AbcSize::MSG = T.let(T.unsafe(nil), String) # The cop can be configured to ignore blocks passed to certain methods. # # You can set constructs you want to fold with `CountAsOne`. -# Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -# will be counted as one line regardless of its actual size. +# +# Available are: 'array', 'hash', 'heredoc', and 'method_call'. +# Each construct will be counted as one line regardless of its actual size. # # NOTE: This cop does not apply for `Struct` definitions. # @@ -25982,7 +26099,7 @@ RuboCop::Cop::Metrics::AbcSize::MSG = T.let(T.unsafe(nil), String) # for backwards compatibility. Please use `AllowedMethods` and `AllowedPatterns` # instead. By default, there are no methods to allowed. # -# @example CountAsOne: ['array', 'heredoc', 'method_call'] +# @example CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] # # something do # array = [ # +1 @@ -25990,7 +26107,7 @@ RuboCop::Cop::Metrics::AbcSize::MSG = T.let(T.unsafe(nil), String) # 2 # ] # -# hash = { # +3 +# hash = { # +1 # key: 'value' # } # @@ -26003,32 +26120,32 @@ RuboCop::Cop::Metrics::AbcSize::MSG = T.let(T.unsafe(nil), String) # 1, # 2 # ) -# end # 6 points +# end # 4 points # -# source://rubocop//lib/rubocop/cop/metrics/block_length.rb#44 +# source://rubocop//lib/rubocop/cop/metrics/block_length.rb#45 class RuboCop::Cop::Metrics::BlockLength < ::RuboCop::Cop::Base include ::RuboCop::Cop::CodeLength include ::RuboCop::Cop::AllowedMethods include ::RuboCop::Cop::AllowedPattern - # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#51 + # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#52 def on_block(node); end - # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#51 + # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#52 def on_numblock(node); end private - # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#80 + # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#81 def cop_label; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#62 + # source://rubocop//lib/rubocop/cop/metrics/block_length.rb#63 def method_receiver_excluded?(node); end end -# source://rubocop//lib/rubocop/cop/metrics/block_length.rb#49 +# source://rubocop//lib/rubocop/cop/metrics/block_length.rb#50 RuboCop::Cop::Metrics::BlockLength::LABEL = T.let(T.unsafe(nil), String) # Checks for excessive nesting of conditional and looping constructs. @@ -26085,12 +26202,13 @@ RuboCop::Cop::Metrics::BlockNesting::NESTING_BLOCKS = T.let(T.unsafe(nil), Array # The maximum allowed length is configurable. # # You can set constructs you want to fold with `CountAsOne`. -# Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -# will be counted as one line regardless of its actual size. +# +# Available are: 'array', 'hash', 'heredoc', and 'method_call'. +# Each construct will be counted as one line regardless of its actual size. # # NOTE: This cop also applies for `Struct` definitions. # -# @example CountAsOne: ['array', 'heredoc', 'method_call'] +# @example CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] # # class Foo # ARRAY = [ # +1 @@ -26098,7 +26216,7 @@ RuboCop::Cop::Metrics::BlockNesting::NESTING_BLOCKS = T.let(T.unsafe(nil), Array # 2 # ] # -# HASH = { # +3 +# HASH = { # +1 # key: 'value' # } # @@ -26111,24 +26229,24 @@ RuboCop::Cop::Metrics::BlockNesting::NESTING_BLOCKS = T.let(T.unsafe(nil), Array # 1, # 2 # ) -# end # 6 points +# end # 4 points # -# source://rubocop//lib/rubocop/cop/metrics/class_length.rb#39 +# source://rubocop//lib/rubocop/cop/metrics/class_length.rb#40 class RuboCop::Cop::Metrics::ClassLength < ::RuboCop::Cop::Base include ::RuboCop::Cop::CodeLength - # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#52 + # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#53 def on_casgn(node); end - # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#42 + # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#43 def on_class(node); end - # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#46 + # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#47 def on_sclass(node); end private - # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#70 + # source://rubocop//lib/rubocop/cop/metrics/class_length.rb#71 def message(length, max_length); end end @@ -26259,15 +26377,16 @@ RuboCop::Cop::Metrics::CyclomaticComplexity::MSG = T.let(T.unsafe(nil), String) # The maximum allowed length is configurable. # # You can set constructs you want to fold with `CountAsOne`. -# Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -# will be counted as one line regardless of its actual size. +# +# Available are: 'array', 'hash', 'heredoc', and 'method_call'. +# Each construct will be counted as one line regardless of its actual size. # # NOTE: The `ExcludedMethods` and `IgnoredMethods` configuration is # deprecated and only kept for backwards compatibility. # Please use `AllowedMethods` and `AllowedPatterns` instead. # By default, there are no methods to allowed. # -# @example CountAsOne: ['array', 'heredoc', 'method_call'] +# @example CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] # # def m # array = [ # +1 @@ -26275,7 +26394,7 @@ RuboCop::Cop::Metrics::CyclomaticComplexity::MSG = T.let(T.unsafe(nil), String) # 2 # ] # -# hash = { # +3 +# hash = { # +1 # key: 'value' # } # @@ -26288,33 +26407,33 @@ RuboCop::Cop::Metrics::CyclomaticComplexity::MSG = T.let(T.unsafe(nil), String) # 1, # 2 # ) -# end # 6 points +# end # 4 points # -# source://rubocop//lib/rubocop/cop/metrics/method_length.rb#42 +# source://rubocop//lib/rubocop/cop/metrics/method_length.rb#43 class RuboCop::Cop::Metrics::MethodLength < ::RuboCop::Cop::Base include ::RuboCop::Cop::CodeLength include ::RuboCop::Cop::AllowedMethods include ::RuboCop::Cop::AllowedPattern - # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#56 + # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#57 def on_block(node); end - # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#49 + # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#50 def on_def(node); end - # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#49 + # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#50 def on_defs(node); end - # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#56 + # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#57 def on_numblock(node); end private - # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#65 + # source://rubocop//lib/rubocop/cop/metrics/method_length.rb#66 def cop_label; end end -# source://rubocop//lib/rubocop/cop/metrics/method_length.rb#47 +# source://rubocop//lib/rubocop/cop/metrics/method_length.rb#48 RuboCop::Cop::Metrics::MethodLength::LABEL = T.let(T.unsafe(nil), String) # Checks if the length of a module exceeds some maximum value. @@ -26322,10 +26441,11 @@ RuboCop::Cop::Metrics::MethodLength::LABEL = T.let(T.unsafe(nil), String) # The maximum allowed length is configurable. # # You can set constructs you want to fold with `CountAsOne`. -# Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -# will be counted as one line regardless of its actual size. # -# @example CountAsOne: ['array', 'heredoc', 'method_call'] +# Available are: 'array', 'hash', 'heredoc', and 'method_call'. +# Each construct will be counted as one line regardless of its actual size. +# +# @example CountAsOne: ['array', 'hash', 'heredoc', 'method_call'] # # module M # ARRAY = [ # +1 @@ -26333,7 +26453,7 @@ RuboCop::Cop::Metrics::MethodLength::LABEL = T.let(T.unsafe(nil), String) # 2 # ] # -# HASH = { # +3 +# HASH = { # +1 # key: 'value' # } # @@ -26346,24 +26466,24 @@ RuboCop::Cop::Metrics::MethodLength::LABEL = T.let(T.unsafe(nil), String) # 1, # 2 # ) -# end # 6 points +# end # 4 points # -# source://rubocop//lib/rubocop/cop/metrics/module_length.rb#37 +# source://rubocop//lib/rubocop/cop/metrics/module_length.rb#38 class RuboCop::Cop::Metrics::ModuleLength < ::RuboCop::Cop::Base include ::RuboCop::Cop::CodeLength - # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#51 + # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#52 def module_definition?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#44 + # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#45 def on_casgn(node); end - # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#40 + # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#41 def on_module(node); end private - # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#55 + # source://rubocop//lib/rubocop/cop/metrics/module_length.rb#56 def message(length, max_length); end end @@ -27387,16 +27507,21 @@ class RuboCop::Cop::Naming::AccessorMethodName < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#61 + # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#66 def bad_reader_name?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#65 + # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#70 def bad_writer_name?(node); end - # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#53 + # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#54 def message(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#62 + def proper_attribute_name?(node); end end # source://rubocop//lib/rubocop/cop/naming/accessor_method_name.rb#39 @@ -28548,7 +28673,7 @@ end # def_node_matcher(:is_even) { |value| } # # # good -# # def_node_matcher(:even?) { |value| } +# def_node_matcher(:even?) { |value| } # # source://rubocop//lib/rubocop/cop/naming/predicate_name.rb#75 class RuboCop::Cop::Naming::PredicateName < ::RuboCop::Cop::Base @@ -30602,6 +30727,17 @@ end module RuboCop::Cop::StringLiteralsHelp private + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/mixin/string_literals_help.rb#24 + def enforce_double_quotes?; end + + # source://rubocop//lib/rubocop/cop/mixin/string_literals_help.rb#20 + def preferred_string_literal; end + + # source://rubocop//lib/rubocop/cop/mixin/string_literals_help.rb#28 + def string_literals_config; end + # @return [Boolean] # # source://rubocop//lib/rubocop/cop/mixin/string_literals_help.rb#9 @@ -31242,7 +31378,7 @@ class RuboCop::Cop::Style::ArgumentsForwarding < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#187 def add_forward_all_offenses(node, send_classifications, forwardable_args); end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#353 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#358 def add_parens_if_missing(node, corrector); end # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#214 @@ -31250,10 +31386,10 @@ class RuboCop::Cop::Style::ArgumentsForwarding < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#345 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#350 def allow_only_rest_arguments?; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#337 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#338 def arguments_range(node, first_node); end # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#265 @@ -31264,7 +31400,7 @@ class RuboCop::Cop::Style::ArgumentsForwarding < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#497 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#502 def explicit_block_name?; end # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#170 @@ -31303,7 +31439,7 @@ class RuboCop::Cop::Style::ArgumentsForwarding < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#349 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#354 def use_anonymous_forwarding?; end class << self @@ -31332,115 +31468,115 @@ RuboCop::Cop::Style::ArgumentsForwarding::KWARGS_MSG = T.let(T.unsafe(nil), Stri # Classifies send nodes for possible rest/kwrest/all (including block) forwarding. # -# source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#360 +# source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#365 class RuboCop::Cop::Style::ArgumentsForwarding::SendNodeClassifier extend ::RuboCop::AST::NodePattern::Macros # @return [SendNodeClassifier] a new instance of SendNodeClassifier # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#372 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#377 def initialize(def_node, send_node, referenced_lvars, forwardable_args, **config); end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#400 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#405 def classification; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#367 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#372 def extract_forwarded_kwrest_arg(param0 = T.unsafe(nil), param1); end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#394 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#399 def forwarded_block_arg; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#370 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#375 def forwarded_block_arg?(param0 = T.unsafe(nil), param1); end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#388 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#393 def forwarded_kwrest_arg; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#382 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#387 def forwarded_rest_arg; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#364 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#369 def forwarded_rest_arg?(param0 = T.unsafe(nil), param1); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#468 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#473 def additional_kwargs?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#464 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#469 def additional_kwargs_or_forwarded_kwargs?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#478 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#483 def allow_offense_for_no_block?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#449 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#454 def any_arg_referenced?; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#433 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#438 def arguments; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#412 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#417 def can_forward_all?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#472 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#477 def forward_additional_kwargs?; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#429 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#434 def forwarded_rest_and_kwrest_args; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#491 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#496 def missing_rest_arg_or_kwrest_arg?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#482 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#487 def no_additional_args?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#457 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#462 def no_post_splat_args?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#425 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#430 def offensive_block_forwarding?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#445 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#450 def referenced_block_arg?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#441 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#446 def referenced_kwrest_arg?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#437 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#442 def referenced_rest_arg?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#421 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#426 def ruby_32_missing_rest_or_kwest?; end - # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#453 + # source://rubocop//lib/rubocop/cop/style/arguments_forwarding.rb#458 def target_ruby_version; end end @@ -35432,10 +35568,10 @@ class RuboCop::Cop::Style::EmptyElse < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/empty_else.rb#193 + # source://rubocop//lib/rubocop/cop/style/empty_else.rb#194 def autocorrect_forbidden?(type); end - # source://rubocop//lib/rubocop/cop/style/empty_else.rb#186 + # source://rubocop//lib/rubocop/cop/style/empty_else.rb#187 def base_node(node); end # source://rubocop//lib/rubocop/cop/style/empty_else.rb#145 @@ -35444,7 +35580,7 @@ class RuboCop::Cop::Style::EmptyElse < ::RuboCop::Cop::Base # @return [Boolean] # # source://rubocop//lib/rubocop/cop/style/empty_else.rb#180 - def comment_in_else?(loc); end + def comment_in_else?(node); end # source://rubocop//lib/rubocop/cop/style/empty_else.rb#160 def empty_check(node); end @@ -35454,7 +35590,7 @@ class RuboCop::Cop::Style::EmptyElse < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/empty_else.rb#156 def empty_style?; end - # source://rubocop//lib/rubocop/cop/style/empty_else.rb#197 + # source://rubocop//lib/rubocop/cop/style/empty_else.rb#198 def missing_else_style; end # source://rubocop//lib/rubocop/cop/style/empty_else.rb#166 @@ -35503,26 +35639,14 @@ RuboCop::Cop::Style::EmptyElse::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::EmptyHeredoc < ::RuboCop::Cop::Base include ::RuboCop::Cop::Heredoc include ::RuboCop::Cop::RangeHelp + include ::RuboCop::Cop::StringLiteralsHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/empty_heredoc.rb#43 + # source://rubocop//lib/rubocop/cop/style/empty_heredoc.rb#44 def on_heredoc(node); end - - private - - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/style/empty_heredoc.rb#63 - def enforce_double_quotes?; end - - # source://rubocop//lib/rubocop/cop/style/empty_heredoc.rb#59 - def preferred_string_literal; end - - # source://rubocop//lib/rubocop/cop/style/empty_heredoc.rb#67 - def string_literals_config; end end -# source://rubocop//lib/rubocop/cop/style/empty_heredoc.rb#41 +# source://rubocop//lib/rubocop/cop/style/empty_heredoc.rb#42 RuboCop::Cop::Style::EmptyHeredoc::MSG = T.let(T.unsafe(nil), String) # Checks for parentheses for empty lambda parameters. Parentheses @@ -35563,7 +35687,9 @@ RuboCop::Cop::Style::EmptyLambdaParameter::MSG = T.let(T.unsafe(nil), String) # @example # # bad # a = Array.new +# a = Array[] # h = Hash.new +# h = Hash[] # s = String.new # # # good @@ -35571,83 +35697,79 @@ RuboCop::Cop::Style::EmptyLambdaParameter::MSG = T.let(T.unsafe(nil), String) # h = {} # s = '' # -# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#19 +# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#21 class RuboCop::Cop::Style::EmptyLiteral < ::RuboCop::Cop::Base include ::RuboCop::Cop::FrozenStringLiteral include ::RuboCop::Cop::RangeHelp + include ::RuboCop::Cop::StringLiteralsHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#31 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#34 def array_node(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#40 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#43 def array_with_block(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#34 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#54 + def array_with_index(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#37 def hash_node(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#43 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#46 def hash_with_block(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#50 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#62 + def hash_with_index(param0 = T.unsafe(nil)); end + + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#69 def on_send(node); end - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#37 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#40 def str_node(param0 = T.unsafe(nil)); end private - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#111 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#118 def correction(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#74 - def enforce_double_quotes?; end - - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#82 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#89 def first_argument_unparenthesized?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#129 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#136 def frozen_strings?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#102 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#109 def offense_array_node?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#106 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#113 def offense_hash_node?(node); end - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#60 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#79 def offense_message(node); end - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#70 - def preferred_string_literal; end - - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#89 + # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#96 def replacement_range(node); end - - # source://rubocop//lib/rubocop/cop/style/empty_literal.rb#78 - def string_literals_config; end end -# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#24 +# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#27 RuboCop::Cop::Style::EmptyLiteral::ARR_MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#25 +# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#28 RuboCop::Cop::Style::EmptyLiteral::HASH_MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#28 +# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#31 RuboCop::Cop::Style::EmptyLiteral::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#26 +# source://rubocop//lib/rubocop/cop/style/empty_literal.rb#29 RuboCop::Cop::Style::EmptyLiteral::STR_MSG = T.let(T.unsafe(nil), String) # Checks for the formatting of empty method definitions. @@ -36963,8 +37085,8 @@ RuboCop::Cop::Style::FormatString::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array # The reason is that _unannotated_ format is very similar # to encoded URLs or Date/Time formatting strings. # -# This cop can be customized allowed methods with `AllowedMethods`. -# By default, there are no methods to allowed. +# This cop's allowed methods can be customized with `AllowedMethods`. +# By default, there are no allowed methods. # # It is allowed to contain unannotated token # if the number of them is less than or equals to @@ -37478,12 +37600,12 @@ class RuboCop::Cop::Style::GuardClause < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/guard_clause.rb#283 + # source://rubocop//lib/rubocop/cop/style/guard_clause.rb#285 def accepted_if?(node, ending); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/guard_clause.rb#297 + # source://rubocop//lib/rubocop/cop/style/guard_clause.rb#299 def allowed_consecutive_conditionals?; end # @return [Boolean] @@ -37522,7 +37644,7 @@ class RuboCop::Cop::Style::GuardClause < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/guard_clause.rb#188 def register_offense(node, scope_exiting_keyword, conditional_keyword, guard = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/guard_clause.rb#293 + # source://rubocop//lib/rubocop/cop/style/guard_clause.rb#295 def remove_whole_lines(corrector, range); end # @return [Boolean] @@ -38841,25 +38963,42 @@ class RuboCop::Cop::Style::IfWithSemicolon < ::RuboCop::Cop::Base include ::RuboCop::Cop::OnNormalIfUnless extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#23 + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#24 def on_normal_if_unless(node); end private - # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#38 - def autocorrect(node); end + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#54 + def autocorrect(corrector, node); end - # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#56 + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#95 def build_else_branch(second_condition); end - # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#47 + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#85 + def build_expression(expr); end + + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#75 def correct_elsif(node); end + + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#40 + def message(node); end + + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#66 + def replacement(node); end + + # @return [Boolean] + # + # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#62 + def use_block_in_branches?(node); end end # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#20 RuboCop::Cop::Style::IfWithSemicolon::MSG_IF_ELSE = T.let(T.unsafe(nil), String) # source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#21 +RuboCop::Cop::Style::IfWithSemicolon::MSG_NEWLINE = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/style/if_with_semicolon.rb#22 RuboCop::Cop::Style::IfWithSemicolon::MSG_TERNARY = T.let(T.unsafe(nil), String) # Checks for `raise` or `fail` statements which do not specify an @@ -38916,6 +39055,9 @@ class RuboCop::Cop::Style::InPatternThen < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/in_pattern_then.rb#46 def alternative_pattern_source(pattern); end + + # source://rubocop//lib/rubocop/cop/style/in_pattern_then.rb#50 + def collect_alternative_patterns(pattern); end end # source://rubocop//lib/rubocop/cop/style/in_pattern_then.rb#27 @@ -39746,7 +39888,7 @@ end # # source://rubocop//lib/rubocop/cop/style/magic_comment_format.rb#107 class RuboCop::Cop::Style::MagicCommentFormat::CommentRange - extend ::Forwardable + extend ::RuboCop::SimpleForwardable # @return [CommentRange] a new instance of CommentRange # @@ -39764,11 +39906,11 @@ class RuboCop::Cop::Style::MagicCommentFormat::CommentRange # source://rubocop//lib/rubocop/cop/style/magic_comment_format.rb#125 def directives; end - # source://forwardable/1.3.3/forwardable.rb#231 - def loc(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def loc(*_arg0, **_arg1, &_arg2); end - # source://forwardable/1.3.3/forwardable.rb#231 - def text(*args, **_arg1, &block); end + # source://rubocop-ast/1.32.3/lib/rubocop/ast/utilities/simple_forwardable.rb#9 + def text(*_arg0, **_arg1, &_arg2); end # A magic comment can contain one value (normal style) or # multiple directives (emacs style) @@ -39930,7 +40072,7 @@ class RuboCop::Cop::Style::MapIntoArray < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#75 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#84 def after_leaving_scope(scope, _variable_table); end # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#57 @@ -39939,50 +40081,50 @@ class RuboCop::Cop::Style::MapIntoArray < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#66 def empty_array_asgn?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#69 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#78 def lvar_ref?(param0 = T.unsafe(nil), param1); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#79 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#88 def on_block(node); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#79 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#88 def on_numblock(node); end private - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#155 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#162 def correct_push_node(corrector, push_node); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#163 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#170 def correct_return_value_handling(corrector, block, dest_var); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#108 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#117 def dest_used_only_for_mapping?(block, dest_var, asgn); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#102 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#111 def find_closest_assignment(block, dest_var); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#94 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#103 def find_dest_var(block); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#127 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#136 def new_method_name; end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#116 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#125 def register_offense(block, dest_var, asgn); end - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#148 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#155 def remove_assignment(corrector, asgn); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#133 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#142 def return_value_used?(node); end class << self - # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#71 + # source://rubocop//lib/rubocop/cop/style/map_into_array.rb#80 def joining_forces; end end end @@ -40527,8 +40669,8 @@ RuboCop::Cop::Style::MethodCallWithArgsParentheses::RequireParentheses::REQUIRE_ # Checks for unwanted parentheses in parameterless method calls. # -# This cop can be customized allowed methods with `AllowedMethods`. -# By default, there are no methods to allowed. +# This cop's allowed methods can be customized with `AllowedMethods`. +# By default, there are no allowed methods. # # NOTE: This cop allows the use of `it()` without arguments in blocks, # as in `0.times { it() }`, following `Lint/ItWithoutArgumentsInBlock` cop. @@ -41781,58 +41923,53 @@ class RuboCop::Cop::Style::MultipleComparison < ::RuboCop::Cop::Base # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#62 def on_or(node); end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#88 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#86 def simple_comparison_lhs?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#93 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#91 def simple_comparison_rhs?(param0 = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#85 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#83 def simple_double_comparison?(param0 = T.unsafe(nil)); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#161 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#153 def allow_method_comparison?; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#136 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#134 def comparison?(node); end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#165 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#157 def comparisons_threshold; end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#128 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#126 def nested_comparison?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#97 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#95 def nested_variable_comparison?(node); end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#156 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#148 def reset_comparison; end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#140 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#138 def root_of_or_node(or_node); end - # @return [Boolean] - # - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#150 - def switch_comparison?(node); end - - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#124 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#122 def variable_name(node); end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#103 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#101 def variables_in_node(node); end - # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#111 + # source://rubocop//lib/rubocop/cop/style/multiple_comparison.rb#109 def variables_in_simple_node(node); end end @@ -43177,8 +43314,8 @@ RuboCop::Cop::Style::NumericLiterals::MSG = T.let(T.unsafe(nil), String) # These can be replaced by their respective predicate methods. # This cop can also be configured to do the reverse. # -# This cop can be customized allowed methods with `AllowedMethods`. -# By default, there are no methods to allowed. +# This cop's allowed methods can be customized with `AllowedMethods`. +# By default, there are no allowed methods. # # This cop disregards `#nonzero?` as its value is truthy or falsey, # but not `true` and `false`, and thus not always interchangeable with @@ -43860,14 +43997,14 @@ class RuboCop::Cop::Style::ParallelAssignment::GenericCorrector private - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#233 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#234 def cop_config; end - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#229 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#230 def extract_sources(node); end # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#219 - def source(node); end + def source(node, loc); end end # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#29 @@ -43876,37 +44013,37 @@ RuboCop::Cop::Style::ParallelAssignment::MSG = T.let(T.unsafe(nil), String) # An internal class for correcting parallel assignment # guarded by if, unless, while, or until # -# source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#275 +# source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#276 class RuboCop::Cop::Style::ParallelAssignment::ModifierCorrector < ::RuboCop::Cop::Style::ParallelAssignment::GenericCorrector - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#276 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#277 def correction; end - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#285 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#286 def correction_range; end private - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#291 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#292 def modifier_range(node); end end # An internal class for correcting parallel assignment # protected by rescue # -# source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#240 +# source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#241 class RuboCop::Cop::Style::ParallelAssignment::RescueCorrector < ::RuboCop::Cop::Style::ParallelAssignment::GenericCorrector - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#241 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#242 def correction; end - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#252 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#253 def correction_range; end private - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#263 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#264 def begin_correction(rescue_result); end - # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#258 + # source://rubocop//lib/rubocop/cop/style/parallel_assignment.rb#259 def def_correction(rescue_result); end end @@ -44349,7 +44486,7 @@ class RuboCop::Cop::Style::QuotedSymbols < ::RuboCop::Cop::Base private - # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#108 + # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#106 def alternative_style; end # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#71 @@ -44370,7 +44507,7 @@ class RuboCop::Cop::Style::QuotedSymbols < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#112 + # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#110 def quoted?(sym_node); end # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#99 @@ -44378,7 +44515,7 @@ class RuboCop::Cop::Style::QuotedSymbols < ::RuboCop::Cop::Base # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#116 + # source://rubocop//lib/rubocop/cop/style/quoted_symbols.rb#114 def wrong_quotes?(node); end end @@ -44957,7 +45094,7 @@ class RuboCop::Cop::Style::RedundantCondition < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#42 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#43 def on_if(node); end private @@ -44967,106 +45104,106 @@ class RuboCop::Cop::Style::RedundantCondition < ::RuboCop::Cop::Base # # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#166 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#167 def argument_with_operator?(argument); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#141 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#142 def asgn_type?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#131 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#132 def branches_have_assignment?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#145 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#146 def branches_have_method?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#239 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#240 def correct_ternary(corrector, node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#186 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#187 def else_source(else_branch, arithmetic_operation); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#212 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#213 def else_source_if_has_assignment(else_branch); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#202 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#203 def else_source_if_has_method(else_branch); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#174 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#175 def if_source(if_branch, arithmetic_operation); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#222 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#223 def make_ternary_form(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#63 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#64 def message(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#78 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#79 def offense?(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#71 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#72 def range_of_offense(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#87 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#88 def redundant_condition?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#254 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#255 def require_braces?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#247 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#248 def require_parentheses?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#160 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#161 def same_method?(if_branch, else_branch); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#154 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#155 def single_argument_method?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#103 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#104 def synonymous_condition_and_branch?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#258 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#259 def use_arithmetic_operation?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#99 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#100 def use_hash_key_access?(node); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#95 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#96 def use_hash_key_assignment?(else_branch); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#91 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#92 def use_if_branch?(else_branch); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#262 + # source://rubocop//lib/rubocop/cop/style/redundant_condition.rb#263 def without_argument_parentheses_method?(node); end end @@ -45926,6 +46063,37 @@ end # source://rubocop//lib/rubocop/cop/style/redundant_interpolation.rb#43 RuboCop::Cop::Style::RedundantInterpolation::MSG = T.let(T.unsafe(nil), String) +# Before Ruby 3.0, interpolated strings followed the frozen string literal +# magic comment which sometimes made it necessary to explicitly unfreeze them. +# Ruby 3.0 changed interpolated strings to always be unfrozen which makes +# unfreezing them redundant. +# +# @example +# # bad +# +"#{foo} bar" +# +# # bad +# "#{foo} bar".dup +# +# # good +# "#{foo} bar" +# +# source://rubocop//lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb#21 +class RuboCop::Cop::Style::RedundantInterpolationUnfreeze < ::RuboCop::Cop::Base + include ::RuboCop::Cop::FrozenStringLiteral + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRubyVersion + + # source://rubocop//lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb#32 + def on_send(node); end +end + +# source://rubocop//lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb#26 +RuboCop::Cop::Style::RedundantInterpolationUnfreeze::MSG = T.let(T.unsafe(nil), String) + +# source://rubocop//lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb#28 +RuboCop::Cop::Style::RedundantInterpolationUnfreeze::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + # Check for redundant line continuation. # # This cop marks a line continuation as redundant if removing the backslash @@ -46385,38 +46553,39 @@ RuboCop::Cop::Style::RedundantPercentQ::STRING_INTERPOLATION_REGEXP = T.let(T.un # # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#35 class RuboCop::Cop::Style::RedundantRegexpArgument < ::RuboCop::Cop::Base + include ::RuboCop::Cop::StringLiteralsHelp extend ::RuboCop::Cop::AutoCorrector - # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#47 + # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#48 def on_csend(node); end - # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#47 + # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#48 def on_send(node); end private # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#64 + # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#65 def determinist_regexp?(regexp_node); end - # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#68 + # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#69 def preferred_argument(regexp_node); end - # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#81 + # source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#84 def replacement(regexp_node); end end -# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#42 +# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#43 RuboCop::Cop::Style::RedundantRegexpArgument::DETERMINISTIC_REGEX = T.let(T.unsafe(nil), Regexp) -# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#38 +# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#39 RuboCop::Cop::Style::RedundantRegexpArgument::MSG = T.let(T.unsafe(nil), String) -# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#39 +# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#40 RuboCop::Cop::Style::RedundantRegexpArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) -# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#43 +# source://rubocop//lib/rubocop/cop/style/redundant_regexp_argument.rb#44 RuboCop::Cop::Style::RedundantRegexpArgument::STR_SPECIAL_CHARS = T.let(T.unsafe(nil), Array) # Checks for unnecessary single-element Regexp character classes. @@ -47886,9 +48055,9 @@ RuboCop::Cop::Style::ReturnNilInPredicateMethodDefinition::MSG = T.let(T.unsafe( # `foo&.bar` can start returning `nil` as well as what the method # returns. # -# The default for `MaxChainLength` is `2` +# The default for `MaxChainLength` is `2`. # We have limited the cop to not register an offense for method chains -# that exceed this option is set. +# that exceed this option's value. # # @example # # bad @@ -52319,57 +52488,57 @@ class RuboCop::Cop::Team private - # source://rubocop//lib/rubocop/cop/team.rb#129 + # source://rubocop//lib/rubocop/cop/team.rb#133 def autocorrect(processed_source, report, original:, offset:); end - # source://rubocop//lib/rubocop/cop/team.rb#193 + # source://rubocop//lib/rubocop/cop/team.rb#197 def autocorrect_report(report, offset:, original:); end - # source://rubocop//lib/rubocop/cop/team.rb#148 + # source://rubocop//lib/rubocop/cop/team.rb#152 def be_ready; end - # source://rubocop//lib/rubocop/cop/team.rb#199 + # source://rubocop//lib/rubocop/cop/team.rb#203 def collate_corrections(report, offset:, original:); end - # source://rubocop//lib/rubocop/cop/team.rb#215 + # source://rubocop//lib/rubocop/cop/team.rb#219 def each_corrector(report); end - # source://rubocop//lib/rubocop/cop/team.rb#267 + # source://rubocop//lib/rubocop/cop/team.rb#271 def handle_error(error, location, cop); end - # source://rubocop//lib/rubocop/cop/team.rb#259 + # source://rubocop//lib/rubocop/cop/team.rb#263 def handle_warning(error, location); end # @return [Commissioner::InvestigationReport] # - # source://rubocop//lib/rubocop/cop/team.rb#162 + # source://rubocop//lib/rubocop/cop/team.rb#166 def investigate_partial(cops, processed_source, offset:, original:); end - # source://rubocop//lib/rubocop/cop/team.rb#242 + # source://rubocop//lib/rubocop/cop/team.rb#246 def process_errors(file, errors); end - # source://rubocop//lib/rubocop/cop/team.rb#156 + # source://rubocop//lib/rubocop/cop/team.rb#160 def reset; end # @return [Array] # - # source://rubocop//lib/rubocop/cop/team.rb#168 + # source://rubocop//lib/rubocop/cop/team.rb#172 def roundup_relevant_cops(processed_source); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/team.rb#184 + # source://rubocop//lib/rubocop/cop/team.rb#188 def support_target_rails_version?(cop); end # @return [Boolean] # - # source://rubocop//lib/rubocop/cop/team.rb#178 + # source://rubocop//lib/rubocop/cop/team.rb#182 def support_target_ruby_version?(cop); end - # source://rubocop//lib/rubocop/cop/team.rb#230 + # source://rubocop//lib/rubocop/cop/team.rb#234 def suppress_clobbering; end - # source://rubocop//lib/rubocop/cop/team.rb#236 + # source://rubocop//lib/rubocop/cop/team.rb#240 def validate_config; end class << self @@ -55541,40 +55710,92 @@ end # This formatter formats the report data in JUnit format. # -# source://rubocop//lib/rubocop/formatter/junit_formatter.rb#17 +# source://rubocop//lib/rubocop/formatter/junit_formatter.rb#15 class RuboCop::Formatter::JUnitFormatter < ::RuboCop::Formatter::BaseFormatter # @return [JUnitFormatter] a new instance of JUnitFormatter # - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#18 + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#24 def initialize(output, options = T.unsafe(nil)); end - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#55 - def add_testcase_element_to_testsuite_element(file, target_offenses, cop); end - - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#64 - def classname_attribute_value(file); end - - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#29 + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#32 def file_finished(file, offenses); end - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#71 + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#51 def finished(_inspected_files); end - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#51 + private + + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#106 + def add_failure_to(testcase, offenses, cop_name); end + + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#85 + def add_testcase_element_to_testsuite_element(file, target_offenses, cop); end + + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#94 + def classname_attribute_value(file); end + + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#81 def offenses_for_cop(all_offenses, cop); end # @return [Boolean] # - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#47 + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#77 def relevant_for_output?(options, target_offenses); end - private + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#101 + def reset_count; end - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#83 - def add_failure_to(testcase, offenses, cop_name); end + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#118 + def xml_escape(string); end +end - # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#78 - def reset_count; end +# source://rubocop//lib/rubocop/formatter/junit_formatter.rb#16 +RuboCop::Formatter::JUnitFormatter::ESCAPE_MAP = T.let(T.unsafe(nil), Hash) + +# source://rubocop//lib/rubocop/formatter/junit_formatter.rb#132 +class RuboCop::Formatter::JUnitFormatter::FailureElement + # @return [FailureElement] a new instance of FailureElement + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#135 + def initialize(type:, message:, text:); end + + # Returns the value of attribute message. + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#133 + def message; end + + # Returns the value of attribute text. + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#133 + def text; end + + # Returns the value of attribute type. + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#133 + def type; end +end + +# source://rubocop//lib/rubocop/formatter/junit_formatter.rb#122 +class RuboCop::Formatter::JUnitFormatter::TestCaseElement + # @return [TestCaseElement] a new instance of TestCaseElement + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#125 + def initialize(classname:, name:); end + + # Returns the value of attribute classname. + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#123 + def classname; end + + # Returns the value of attribute failures. + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#123 + def failures; end + + # Returns the value of attribute name. + # + # source://rubocop//lib/rubocop/formatter/junit_formatter.rb#123 + def name; end end # This formatter displays the report data in markdown @@ -56252,17 +56473,17 @@ class RuboCop::Lockfile private - # @api private - # @return [Boolean] - # - # source://rubocop//lib/rubocop/lockfile.rb#85 - def bundler_lock_parser_defined?; end - # @api private # @return [Bundler::LockfileParser, nil] # # source://rubocop//lib/rubocop/lockfile.rb#72 def parser; end + + # @api private + # @return [Boolean] + # + # source://rubocop//lib/rubocop/lockfile.rb#85 + def use_bundler_lock_parser?; end end # Parse different formats of magic comments. @@ -57274,12 +57495,12 @@ class RuboCop::RemoteConfig # @api private # - # source://rubocop//lib/rubocop/remote_config.rb#19 + # source://rubocop//lib/rubocop/remote_config.rb#23 def file; end # @api private # - # source://rubocop//lib/rubocop/remote_config.rb#32 + # source://rubocop//lib/rubocop/remote_config.rb#36 def inherit_from_remote(file, path); end # @api private @@ -57291,46 +57512,46 @@ class RuboCop::RemoteConfig # @api private # - # source://rubocop//lib/rubocop/remote_config.rb#95 + # source://rubocop//lib/rubocop/remote_config.rb#99 def cache_name_from_uri; end # @api private # - # source://rubocop//lib/rubocop/remote_config.rb#78 + # source://rubocop//lib/rubocop/remote_config.rb#82 def cache_path; end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/remote_config.rb#82 + # source://rubocop//lib/rubocop/remote_config.rb#86 def cache_path_exists?; end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/remote_config.rb#86 + # source://rubocop//lib/rubocop/remote_config.rb#90 def cache_path_expired?; end # @api private # - # source://rubocop//lib/rubocop/remote_config.rb#101 + # source://rubocop//lib/rubocop/remote_config.rb#105 def cloned_url; end # @api private # @yield [request] # - # source://rubocop//lib/rubocop/remote_config.rb#53 + # source://rubocop//lib/rubocop/remote_config.rb#57 def generate_request(uri); end # @api private # - # source://rubocop//lib/rubocop/remote_config.rb#62 + # source://rubocop//lib/rubocop/remote_config.rb#66 def handle_response(response, limit, &block); end # @api private # @raise [ArgumentError] # - # source://rubocop//lib/rubocop/remote_config.rb#40 + # source://rubocop//lib/rubocop/remote_config.rb#44 def request(uri = T.unsafe(nil), limit = T.unsafe(nil), &block); end end @@ -57393,7 +57614,7 @@ class RuboCop::ResultCache # # @api private # - # source://rubocop//lib/rubocop/result_cache.rb#236 + # source://rubocop//lib/rubocop/result_cache.rb#229 def context_checksum(team, options); end # @api private @@ -57433,14 +57654,6 @@ class RuboCop::ResultCache # source://rubocop//lib/rubocop/result_cache.rb#142 def symlink_protection_triggered?(path); end - # The external dependency checksums are cached per RuboCop team so that - # the checksums don't need to be recomputed for each file. - # - # @api private - # - # source://rubocop//lib/rubocop/result_cache.rb#227 - def team_checksum(team); end - class << self # @api private # @return [Boolean] @@ -57960,34 +58173,34 @@ class RuboCop::TargetRuby # @api private # @return [TargetRuby] a new instance of TargetRuby # - # source://rubocop//lib/rubocop/target_ruby.rb#254 + # source://rubocop//lib/rubocop/target_ruby.rb#258 def initialize(config); end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#270 + # source://rubocop//lib/rubocop/target_ruby.rb#274 def rubocop_version_with_support; end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#258 + # source://rubocop//lib/rubocop/target_ruby.rb#262 def source; end # @api private # @return [Boolean] # - # source://rubocop//lib/rubocop/target_ruby.rb#266 + # source://rubocop//lib/rubocop/target_ruby.rb#270 def supported?; end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#262 + # source://rubocop//lib/rubocop/target_ruby.rb#266 def version; end class << self # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#240 + # source://rubocop//lib/rubocop/target_ruby.rb#244 def supported_versions; end end end @@ -57996,23 +58209,23 @@ end # # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#187 +# source://rubocop//lib/rubocop/target_ruby.rb#191 class RuboCop::TargetRuby::BundlerLockFile < ::RuboCop::TargetRuby::Source # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#188 + # source://rubocop//lib/rubocop/target_ruby.rb#192 def name; end private # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#221 + # source://rubocop//lib/rubocop/target_ruby.rb#225 def bundler_lock_file_path; end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#194 + # source://rubocop//lib/rubocop/target_ruby.rb#198 def find_version; end end @@ -58025,18 +58238,18 @@ RuboCop::TargetRuby::DEFAULT_VERSION = T.let(T.unsafe(nil), Float) # # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#228 +# source://rubocop//lib/rubocop/target_ruby.rb#232 class RuboCop::TargetRuby::Default < ::RuboCop::TargetRuby::Source # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#229 + # source://rubocop//lib/rubocop/target_ruby.rb#233 def name; end private # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#235 + # source://rubocop//lib/rubocop/target_ruby.rb#239 def find_version; end end @@ -58063,8 +58276,8 @@ class RuboCop::TargetRuby::GemspecFile < ::RuboCop::TargetRuby::Source # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#121 - def find_default_minimal_known_ruby(right_hand_side); end + # source://rubocop//lib/rubocop/target_ruby.rb#123 + def find_minimal_known_ruby(right_hand_side); end # @api private # @@ -58083,7 +58296,7 @@ class RuboCop::TargetRuby::GemspecFile < ::RuboCop::TargetRuby::Source # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#117 + # source://rubocop//lib/rubocop/target_ruby.rb#119 def version_from_array(array); end # @api private @@ -58093,7 +58306,7 @@ class RuboCop::TargetRuby::GemspecFile < ::RuboCop::TargetRuby::Source # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#105 + # source://rubocop//lib/rubocop/target_ruby.rb#107 def version_from_right_hand_side(right_hand_side); end end @@ -58135,49 +58348,49 @@ end # # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#133 +# source://rubocop//lib/rubocop/target_ruby.rb#137 class RuboCop::TargetRuby::RubyVersionFile < ::RuboCop::TargetRuby::Source # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#137 + # source://rubocop//lib/rubocop/target_ruby.rb#141 def name; end private # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#143 + # source://rubocop//lib/rubocop/target_ruby.rb#147 def filename; end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#151 + # source://rubocop//lib/rubocop/target_ruby.rb#155 def find_version; end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#147 + # source://rubocop//lib/rubocop/target_ruby.rb#151 def pattern; end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#158 + # source://rubocop//lib/rubocop/target_ruby.rb#162 def version_file; end end # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#134 +# source://rubocop//lib/rubocop/target_ruby.rb#138 RuboCop::TargetRuby::RubyVersionFile::RUBY_VERSION_FILENAME = T.let(T.unsafe(nil), String) # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#135 +# source://rubocop//lib/rubocop/target_ruby.rb#139 RuboCop::TargetRuby::RubyVersionFile::RUBY_VERSION_PATTERN = T.let(T.unsafe(nil), Regexp) # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#244 +# source://rubocop//lib/rubocop/target_ruby.rb#248 RuboCop::TargetRuby::SOURCES = T.let(T.unsafe(nil), Array) # A place where information about a target ruby version is found. @@ -58213,34 +58426,34 @@ end # # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#166 +# source://rubocop//lib/rubocop/target_ruby.rb#170 class RuboCop::TargetRuby::ToolVersionsFile < ::RuboCop::TargetRuby::RubyVersionFile # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#170 + # source://rubocop//lib/rubocop/target_ruby.rb#174 def name; end private # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#176 + # source://rubocop//lib/rubocop/target_ruby.rb#180 def filename; end # @api private # - # source://rubocop//lib/rubocop/target_ruby.rb#180 + # source://rubocop//lib/rubocop/target_ruby.rb#184 def pattern; end end # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#167 +# source://rubocop//lib/rubocop/target_ruby.rb#171 RuboCop::TargetRuby::ToolVersionsFile::TOOL_VERSIONS_FILENAME = T.let(T.unsafe(nil), String) # @api private # -# source://rubocop//lib/rubocop/target_ruby.rb#168 +# source://rubocop//lib/rubocop/target_ruby.rb#172 RuboCop::TargetRuby::ToolVersionsFile::TOOL_VERSIONS_PATTERN = T.let(T.unsafe(nil), Regexp) # source://rubocop//lib/rubocop/ast_aliases.rb#7 @@ -58338,7 +58551,7 @@ module RuboCop::YAMLDuplicationChecker # @api private # - # source://rubocop//lib/rubocop/yaml_duplication_checker.rb#21 + # source://rubocop//lib/rubocop/yaml_duplication_checker.rb#22 def traverse(tree, &on_duplicated); end end end diff --git a/sorbet/rbi/gems/simplecov-html@0.12.3.rbi b/sorbet/rbi/gems/simplecov-html@0.13.1.rbi similarity index 84% rename from sorbet/rbi/gems/simplecov-html@0.12.3.rbi rename to sorbet/rbi/gems/simplecov-html@0.13.1.rbi index c69f05a3ee..2cd96d315b 100644 --- a/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +++ b/sorbet/rbi/gems/simplecov-html@0.13.1.rbi @@ -147,71 +147,79 @@ class SimpleCov::Formatter::HTMLFormatter # source://simplecov-html//lib/simplecov-html.rb#19 def initialize; end - # @return [Boolean] - # - # source://simplecov-html//lib/simplecov-html.rb#38 - def branchable_result?; end - - # source://simplecov-html//lib/simplecov-html.rb#23 + # source://simplecov-html//lib/simplecov-html.rb#26 def format(result); end - # @return [Boolean] - # - # source://simplecov-html//lib/simplecov-html.rb#45 - def line_status?(source_file, line); end - - # source://simplecov-html//lib/simplecov-html.rb#34 - def output_message(result); end - private - # source://simplecov-html//lib/simplecov-html.rb#64 - def asset_output_path; end + # source://simplecov-html//lib/simplecov-html.rb#94 + def asset_inline(name); end # source://simplecov-html//lib/simplecov-html.rb#72 + def asset_output_path; end + + # source://simplecov-html//lib/simplecov-html.rb#80 def assets_path(name); end - # source://simplecov-html//lib/simplecov-html.rb#97 + # @return [Boolean] + # + # source://simplecov-html//lib/simplecov-html.rb#41 + def branchable_result?; end + + # source://simplecov-html//lib/simplecov-html.rb#125 def coverage_css_class(covered_percent); end - # source://simplecov-html//lib/simplecov-html.rb#93 + # source://simplecov-html//lib/simplecov-html.rb#121 def covered_percent(percent); end # Returns a table containing the given source files # - # source://simplecov-html//lib/simplecov-html.rb#84 + # source://simplecov-html//lib/simplecov-html.rb#112 def formatted_file_list(title, source_files); end # Returns the html for the given source_file # - # source://simplecov-html//lib/simplecov-html.rb#77 + # source://simplecov-html//lib/simplecov-html.rb#105 def formatted_source_file(source_file); end # Return a (kind of) unique id for the source file given. Uses SHA1 on path for the id # - # source://simplecov-html//lib/simplecov-html.rb#118 + # source://simplecov-html//lib/simplecov-html.rb#146 def id(source_file); end - # source://simplecov-html//lib/simplecov-html.rb#130 + # @return [Boolean] + # + # source://simplecov-html//lib/simplecov-html.rb#48 + def line_status?(source_file, line); end + + # source://simplecov-html//lib/simplecov-html.rb#158 def link_to_source_file(source_file); end - # source://simplecov-html//lib/simplecov-html.rb#60 + # source://simplecov-html//lib/simplecov-html.rb#56 + def output_message(result); end + + # source://simplecov-html//lib/simplecov-html.rb#68 def output_path; end - # source://simplecov-html//lib/simplecov-html.rb#126 + # source://simplecov-html//lib/simplecov-html.rb#154 def shortened_filename(source_file); end - # source://simplecov-html//lib/simplecov-html.rb#107 + # source://simplecov-html//lib/simplecov-html.rb#135 def strength_css_class(covered_strength); end # Returns the an erb instance for the template of given name # - # source://simplecov-html//lib/simplecov-html.rb#56 + # source://simplecov-html//lib/simplecov-html.rb#64 def template(name); end - # source://simplecov-html//lib/simplecov-html.rb#122 + # source://simplecov-html//lib/simplecov-html.rb#150 def timeago(time); end end +# Only have a few content types, just hardcode them +# +# source://simplecov-html//lib/simplecov-html.rb#87 +SimpleCov::Formatter::HTMLFormatter::CONTENT_TYPES = T.let(T.unsafe(nil), Hash) + # source://simplecov-html//lib/simplecov-html/version.rb#6 SimpleCov::Formatter::HTMLFormatter::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/spoom@1.4.2.rbi b/sorbet/rbi/gems/spoom@1.5.0.rbi similarity index 99% rename from sorbet/rbi/gems/spoom@1.4.2.rbi rename to sorbet/rbi/gems/spoom@1.5.0.rbi index 64c5a4b173..02d285b368 100644 --- a/sorbet/rbi/gems/spoom@1.4.2.rbi +++ b/sorbet/rbi/gems/spoom@1.5.0.rbi @@ -439,7 +439,7 @@ module Spoom::Context::Bundle # Returns `nil` if `gem` cannot be found in the Gemfile. # # source://spoom//lib/spoom/context/bundle.rb#62 - sig { params(gem: ::String).returns(T.nilable(::String)) } + sig { params(gem: ::String).returns(T.nilable(::Gem::Version)) } def gem_version_from_gemfile_lock(gem); end # source://spoom//lib/spoom/context/bundle.rb#51 @@ -1017,7 +1017,7 @@ class Spoom::Coverage::D3::ColorPalette < ::T::Struct prop :strong, ::String class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -1357,7 +1357,7 @@ class Spoom::Coverage::Snapshot < ::T::Struct sig { params(obj: T::Hash[::String, T.untyped]).returns(::Spoom::Coverage::Snapshot) } def from_obj(obj); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -1493,7 +1493,7 @@ class Spoom::Deadcode::Definition < ::T::Struct def to_json(*args); end class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2115,7 +2115,7 @@ class Spoom::Deadcode::Plugins::Ruby < ::Spoom::Deadcode::Plugins::Base private - # source://spoom//lib/spoom/deadcode/plugins/ruby.rb#43 + # source://spoom//lib/spoom/deadcode/plugins/ruby.rb#46 sig { params(send: ::Spoom::Deadcode::Send, node: ::Prism::Node).void } def reference_symbol_as_constant(send, node); end end @@ -2381,7 +2381,7 @@ class Spoom::Deadcode::Send < ::T::Struct def each_arg_assoc(&block); end class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2401,7 +2401,7 @@ class Spoom::ExecResult < ::T::Struct def to_s; end class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2599,7 +2599,7 @@ class Spoom::FileTree::Node < ::T::Struct def path; end class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2665,7 +2665,7 @@ class Spoom::Git::Commit < ::T::Struct def timestamp; end class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end # Parse a line formatted as `%h %at` into a `Commit` @@ -2777,7 +2777,7 @@ class Spoom::LSP::Diagnostic < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Diagnostic) } def from_json(json); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2810,7 +2810,7 @@ class Spoom::LSP::DocumentSymbol < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::DocumentSymbol) } def from_json(json); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2868,7 +2868,7 @@ class Spoom::LSP::Hover < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Hover) } def from_json(json); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2893,7 +2893,7 @@ class Spoom::LSP::Location < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Location) } def from_json(json); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2956,7 +2956,7 @@ class Spoom::LSP::Position < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Position) } def from_json(json); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -2994,7 +2994,7 @@ class Spoom::LSP::Range < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Range) } def from_json(json); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -3060,7 +3060,7 @@ class Spoom::LSP::SignatureHelp < ::T::Struct sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::SignatureHelp) } def from_json(json); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -3486,7 +3486,7 @@ class Spoom::Model::Reference < ::T::Struct sig { params(name: ::String, location: ::Spoom::Location).returns(::Spoom::Model::Reference) } def constant(name, location); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end # source://spoom//lib/spoom/model/reference.rb#29 diff --git a/sorbet/rbi/gems/stringio@3.1.0.rbi b/sorbet/rbi/gems/stringio@3.1.1.rbi similarity index 100% rename from sorbet/rbi/gems/stringio@3.1.0.rbi rename to sorbet/rbi/gems/stringio@3.1.1.rbi diff --git a/sorbet/rbi/gems/tapioca@0.16.2.rbi b/sorbet/rbi/gems/tapioca@0.16.3.rbi similarity index 97% rename from sorbet/rbi/gems/tapioca@0.16.2.rbi rename to sorbet/rbi/gems/tapioca@0.16.3.rbi index 7e4bdbec57..3ec07beb4a 100644 --- a/sorbet/rbi/gems/tapioca@0.16.2.rbi +++ b/sorbet/rbi/gems/tapioca@0.16.3.rbi @@ -55,7 +55,7 @@ module RBI; end # source://tapioca//lib/tapioca/rbi_ext/model.rb#5 class RBI::Tree < ::RBI::NodeWithComments - # source://rbi/0.2.0/lib/rbi/model.rb#121 + # source://rbi/0.2.1/lib/rbi/model.rb#121 sig do params( loc: T.nilable(::RBI::Loc), @@ -65,15 +65,15 @@ class RBI::Tree < ::RBI::NodeWithComments end def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end - # source://rbi/0.2.0/lib/rbi/model.rb#128 + # source://rbi/0.2.1/lib/rbi/model.rb#128 sig { params(node: ::RBI::Node).void } def <<(node); end - # source://rbi/0.2.0/lib/rbi/rewriters/add_sig_templates.rb#66 + # source://rbi/0.2.1/lib/rbi/rewriters/add_sig_templates.rb#66 sig { params(with_todo_comment: T::Boolean).void } def add_sig_templates!(with_todo_comment: T.unsafe(nil)); end - # source://rbi/0.2.0/lib/rbi/rewriters/annotate.rb#49 + # source://rbi/0.2.1/lib/rbi/rewriters/annotate.rb#49 sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void } def annotate!(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end @@ -138,35 +138,35 @@ class RBI::Tree < ::RBI::NodeWithComments end def create_type_variable(name, type:, variance: T.unsafe(nil), fixed: T.unsafe(nil), upper: T.unsafe(nil), lower: T.unsafe(nil)); end - # source://rbi/0.2.0/lib/rbi/rewriters/deannotate.rb#41 + # source://rbi/0.2.1/lib/rbi/rewriters/deannotate.rb#41 sig { params(annotation: ::String).void } def deannotate!(annotation); end - # source://rbi/0.2.0/lib/rbi/model.rb#134 + # source://rbi/0.2.1/lib/rbi/model.rb#134 sig { returns(T::Boolean) } def empty?; end - # source://rbi/0.2.0/lib/rbi/rewriters/filter_versions.rb#118 + # source://rbi/0.2.1/lib/rbi/rewriters/filter_versions.rb#118 sig { params(version: ::Gem::Version).void } def filter_versions!(version); end - # source://rbi/0.2.0/lib/rbi/rewriters/flatten_singleton_methods.rb#60 + # source://rbi/0.2.1/lib/rbi/rewriters/flatten_singleton_methods.rb#60 sig { void } def flatten_singleton_methods!; end - # source://rbi/0.2.0/lib/rbi/rewriters/flatten_visibilities.rb#60 + # source://rbi/0.2.1/lib/rbi/rewriters/flatten_visibilities.rb#60 sig { void } def flatten_visibilities!; end - # source://rbi/0.2.0/lib/rbi/rewriters/group_nodes.rb#81 + # source://rbi/0.2.1/lib/rbi/rewriters/group_nodes.rb#81 sig { void } def group_nodes!; end - # source://rbi/0.2.0/lib/rbi/index.rb#68 + # source://rbi/0.2.1/lib/rbi/index.rb#68 sig { returns(::RBI::Index) } def index; end - # source://rbi/0.2.0/lib/rbi/rewriters/merge_trees.rb#324 + # source://rbi/0.2.1/lib/rbi/rewriters/merge_trees.rb#324 sig do params( other: ::RBI::Tree, @@ -177,27 +177,27 @@ class RBI::Tree < ::RBI::NodeWithComments end def merge(other, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end - # source://rbi/0.2.0/lib/rbi/rewriters/nest_non_public_members.rb#46 + # source://rbi/0.2.1/lib/rbi/rewriters/nest_non_public_members.rb#46 sig { void } def nest_non_public_members!; end - # source://rbi/0.2.0/lib/rbi/rewriters/nest_singleton_methods.rb#36 + # source://rbi/0.2.1/lib/rbi/rewriters/nest_singleton_methods.rb#36 sig { void } def nest_singleton_methods!; end - # source://rbi/0.2.0/lib/rbi/rewriters/nest_top_level_members.rb#63 + # source://rbi/0.2.1/lib/rbi/rewriters/nest_top_level_members.rb#63 sig { void } def nest_top_level_members!; end - # source://rbi/0.2.0/lib/rbi/model.rb#112 + # source://rbi/0.2.1/lib/rbi/model.rb#112 sig { returns(T::Array[::RBI::Node]) } def nodes; end - # source://rbi/0.2.0/lib/rbi/rewriters/attr_to_methods.rb#53 + # source://rbi/0.2.1/lib/rbi/rewriters/attr_to_methods.rb#53 sig { void } def replace_attributes_with_methods!; end - # source://rbi/0.2.0/lib/rbi/rewriters/sort_nodes.rb#119 + # source://rbi/0.2.1/lib/rbi/rewriters/sort_nodes.rb#119 sig { void } def sort_nodes!; end @@ -218,7 +218,7 @@ class RBI::TypedParam < ::T::Struct const :type, ::String class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -1141,7 +1141,7 @@ class Tapioca::ConfigHelper::ConfigError < ::T::Struct const :message_parts, T::Array[::Tapioca::ConfigHelper::ConfigErrorMessagePart] class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -1152,7 +1152,7 @@ class Tapioca::ConfigHelper::ConfigErrorMessagePart < ::T::Struct const :colors, T::Array[::Symbol] class << self - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -1209,7 +1209,7 @@ class Tapioca::Dsl::Compiler ConstantType = type_member { { upper: Module } } - # source://tapioca//lib/tapioca/dsl/compiler.rb#74 + # source://tapioca//lib/tapioca/dsl/compiler.rb#107 sig do params( pipeline: ::Tapioca::Dsl::Pipeline, @@ -1222,11 +1222,11 @@ class Tapioca::Dsl::Compiler # NOTE: This should eventually accept an `Error` object or `Exception` rather than simply a `String`. # - # source://tapioca//lib/tapioca/dsl/compiler.rb#92 + # source://tapioca//lib/tapioca/dsl/compiler.rb#125 sig { params(error: ::String).void } def add_error(error); end - # source://tapioca//lib/tapioca/dsl/compiler.rb#83 + # source://tapioca//lib/tapioca/dsl/compiler.rb#116 sig { params(compiler_name: ::String).returns(T::Boolean) } def compiler_enabled?(compiler_name); end @@ -1236,7 +1236,7 @@ class Tapioca::Dsl::Compiler # @abstract # - # source://tapioca//lib/tapioca/dsl/compiler.rb#88 + # source://tapioca//lib/tapioca/dsl/compiler.rb#121 sig { abstract.void } def decorate; end @@ -1250,48 +1250,61 @@ class Tapioca::Dsl::Compiler private - # source://tapioca//lib/tapioca/dsl/compiler.rb#141 + # source://tapioca//lib/tapioca/dsl/compiler.rb#174 sig { params(method_def: T.any(::Method, ::UnboundMethod)).returns(T::Array[::RBI::TypedParam]) } def compile_method_parameters_to_rbi(method_def); end - # source://tapioca//lib/tapioca/dsl/compiler.rb#177 + # source://tapioca//lib/tapioca/dsl/compiler.rb#210 sig { params(method_def: T.any(::Method, ::UnboundMethod)).returns(::String) } def compile_method_return_type_to_rbi(method_def); end - # source://tapioca//lib/tapioca/dsl/compiler.rb#131 + # source://tapioca//lib/tapioca/dsl/compiler.rb#164 sig { params(scope: ::RBI::Scope, method_def: T.any(::Method, ::UnboundMethod), class_method: T::Boolean).void } def create_method_from_def(scope, method_def, class_method: T.unsafe(nil)); end # Get the types of each parameter from a method signature # - # source://tapioca//lib/tapioca/dsl/compiler.rb#105 + # source://tapioca//lib/tapioca/dsl/compiler.rb#138 sig { params(method_def: T.any(::Method, ::UnboundMethod), signature: T.untyped).returns(T::Array[::String]) } def parameters_types_from_signature(method_def, signature); end class << self # @abstract # - # source://tapioca//lib/tapioca/dsl/compiler.rb#37 + # source://tapioca//lib/tapioca/dsl/compiler.rb#39 sig { abstract.returns(T::Enumerable[::Module]) } def gather_constants; end - # source://tapioca//lib/tapioca/dsl/compiler.rb#32 + # source://tapioca//lib/tapioca/dsl/compiler.rb#34 sig { params(constant: ::Module).returns(T::Boolean) } def handles?(constant); end - # source://tapioca//lib/tapioca/dsl/compiler.rb#40 + # source://tapioca//lib/tapioca/dsl/compiler.rb#42 sig { returns(T::Set[::Module]) } def processable_constants; end + # source://tapioca//lib/tapioca/dsl/compiler.rb#50 + sig { params(constants: T::Array[::Module]).void } + def requested_constants=(constants); end + private - # source://tapioca//lib/tapioca/dsl/compiler.rb#50 + # source://tapioca//lib/tapioca/dsl/compiler.rb#75 sig { returns(T::Enumerable[T::Class[T.anything]]) } def all_classes; end - # source://tapioca//lib/tapioca/dsl/compiler.rb#58 + # source://tapioca//lib/tapioca/dsl/compiler.rb#87 sig { returns(T::Enumerable[::Module]) } def all_modules; end + + # source://tapioca//lib/tapioca/dsl/compiler.rb#61 + sig do + type_parameters(:U) + .params( + klass: T.all(T.type_parameter(:U), T::Class[T.anything]) + ).returns(T::Array[T.type_parameter(:U)]) + end + def descendants_of(klass); end end end @@ -1372,11 +1385,11 @@ class Tapioca::Dsl::Pipeline private - # source://tapioca//lib/tapioca/dsl/pipeline.rb#223 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#224 sig { void } def abort_if_pending_migrations!; end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#168 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#169 sig { params(constants: T::Set[::Module]).returns(T::Set[::Module]) } def filter_anonymous_and_reloaded_constants(constants); end @@ -1399,11 +1412,11 @@ class Tapioca::Dsl::Pipeline end def gather_constants(requested_constants, requested_paths, skipped_constants); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#197 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#198 sig { params(constant: ::Module).returns(T.nilable(::RBI::File)) } def rbi_for_constant(constant); end - # source://tapioca//lib/tapioca/dsl/pipeline.rb#216 + # source://tapioca//lib/tapioca/dsl/pipeline.rb#217 sig { params(error: ::String).returns(T.noreturn) } def report_error(error); end end @@ -2208,7 +2221,7 @@ class Tapioca::GemInfo < ::T::Struct sig { params(spec: ::Bundler::LazySpecification).returns(::Tapioca::GemInfo) } def from_spec(spec); end - # source://sorbet-runtime/0.5.11551/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11597/lib/types/struct.rb#13 def inherited(s); end end end @@ -3534,30 +3547,30 @@ Tapioca::VERSION = T.let(T.unsafe(nil), String) # source://tapioca//lib/tapioca/helpers/source_uri.rb#7 class URI::Source < ::URI::File - # source://tapioca//lib/tapioca/helpers/source_uri.rb#58 + # source://tapioca//lib/tapioca/helpers/source_uri.rb#65 sig { params(v: T.nilable(::String)).returns(T::Boolean) } def check_host(v); end # source://uri/0.13.0/uri/generic.rb#243 def gem_name; end - # source://tapioca//lib/tapioca/helpers/source_uri.rb#25 + # source://tapioca//lib/tapioca/helpers/source_uri.rb#32 sig { returns(T.nilable(::String)) } def gem_version; end # source://uri/0.13.0/uri/generic.rb#283 def line_number; end - # source://tapioca//lib/tapioca/helpers/source_uri.rb#51 + # source://tapioca//lib/tapioca/helpers/source_uri.rb#58 sig { params(v: T.nilable(::String)).void } def set_path(v); end - # source://tapioca//lib/tapioca/helpers/source_uri.rb#70 + # source://tapioca//lib/tapioca/helpers/source_uri.rb#77 sig { returns(::String) } def to_s; end class << self - # source://tapioca//lib/tapioca/helpers/source_uri.rb#38 + # source://tapioca//lib/tapioca/helpers/source_uri.rb#45 sig do params( gem_name: ::String, @@ -3572,3 +3585,12 @@ end # source://tapioca//lib/tapioca/helpers/source_uri.rb#10 URI::Source::COMPONENT = T.let(T.unsafe(nil), Array) + +# `uri` for Ruby 3.4 switched the default parser from RFC2396 to RFC3986. The new parser emits a deprecation +# warning on a few methods and delegates them to RFC2396, namely `extract`/`make_regexp`/`escape`/`unescape`. +# On earlier versions of the uri gem, the RFC2396_PARSER constant doesn't exist, so it needs some special +# handling to select a parser that doesn't emit deprecations. While it was backported to Ruby 3.1, users may +# have the uri gem in their own bundle and thus not use a compatible version. +# +# source://tapioca//lib/tapioca/helpers/source_uri.rb#26 +URI::Source::PARSER = T.let(T.unsafe(nil), URI::RFC2396_Parser) diff --git a/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi b/sorbet/rbi/gems/unicode-display_width@2.6.0.rbi similarity index 100% rename from sorbet/rbi/gems/unicode-display_width@2.5.0.rbi rename to sorbet/rbi/gems/unicode-display_width@2.6.0.rbi diff --git a/sorbet/rbi/gems/yard@0.9.36.rbi b/sorbet/rbi/gems/yard@0.9.37.rbi similarity index 97% rename from sorbet/rbi/gems/yard@0.9.36.rbi rename to sorbet/rbi/gems/yard@0.9.37.rbi index 3f22b574d1..b7622a23ca 100644 --- a/sorbet/rbi/gems/yard@0.9.36.rbi +++ b/sorbet/rbi/gems/yard@0.9.37.rbi @@ -3265,11 +3265,11 @@ YARD::CodeObjects::METHODNAMEMATCH = T.let(T.unsafe(nil), Regexp) # # Extra data added to docstring # property :bar # -# source://yard//lib/yard/code_objects/macro_object.rb#30 +# source://yard//lib/yard/code_objects/macro_object.rb#29 class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # @return [Boolean] whether this macro is attached to a method # - # source://yard//lib/yard/code_objects/macro_object.rb#149 + # source://yard//lib/yard/code_objects/macro_object.rb#148 def attached?; end # Expands the macro using @@ -3284,39 +3284,39 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # call, if there is a block. # @see expand # - # source://yard//lib/yard/code_objects/macro_object.rb#167 + # source://yard//lib/yard/code_objects/macro_object.rb#166 def expand(call_params = T.unsafe(nil), full_source = T.unsafe(nil), block_source = T.unsafe(nil)); end # @return [String] the macro data stored on the object # - # source://yard//lib/yard/code_objects/macro_object.rb#142 + # source://yard//lib/yard/code_objects/macro_object.rb#141 def macro_data; end # @return [String] the macro data stored on the object # - # source://yard//lib/yard/code_objects/macro_object.rb#142 + # source://yard//lib/yard/code_objects/macro_object.rb#141 def macro_data=(_arg0); end # @return [CodeObjects::Base] the method object that this macro is # attached to. # - # source://yard//lib/yard/code_objects/macro_object.rb#146 + # source://yard//lib/yard/code_objects/macro_object.rb#145 def method_object; end # @return [CodeObjects::Base] the method object that this macro is # attached to. # - # source://yard//lib/yard/code_objects/macro_object.rb#146 + # source://yard//lib/yard/code_objects/macro_object.rb#145 def method_object=(_arg0); end # Overrides {Base#path} so the macro path is ".macro.MACRONAME" # - # source://yard//lib/yard/code_objects/macro_object.rb#152 + # source://yard//lib/yard/code_objects/macro_object.rb#151 def path; end # Overrides the separator to be '.' # - # source://yard//lib/yard/code_objects/macro_object.rb#155 + # source://yard//lib/yard/code_objects/macro_object.rb#154 def sep; end class << self @@ -3334,7 +3334,7 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # @return [String] the expanded macro data # @see find_or_create # - # source://yard//lib/yard/code_objects/macro_object.rb#120 + # source://yard//lib/yard/code_objects/macro_object.rb#119 def apply(docstring, call_params = T.unsafe(nil), full_source = T.unsafe(nil), block_source = T.unsafe(nil), _method_object = T.unsafe(nil)); end # Applies a macro to a docstring, interpolating the macro's data on the @@ -3350,7 +3350,7 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # interpolating the block data as a variable. # @return [String] the expanded macro data # - # source://yard//lib/yard/code_objects/macro_object.rb#136 + # source://yard//lib/yard/code_objects/macro_object.rb#135 def apply_macro(macro, docstring, call_params = T.unsafe(nil), full_source = T.unsafe(nil), block_source = T.unsafe(nil)); end # Creates a new macro and fills in the relevant properties. @@ -3361,7 +3361,7 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # macro to. If supplied, {#attached?} will be true # @return [MacroObject] the newly created object # - # source://yard//lib/yard/code_objects/macro_object.rb#40 + # source://yard//lib/yard/code_objects/macro_object.rb#39 def create(macro_name, data, method_object = T.unsafe(nil)); end # Parses a given docstring and determines if the macro is "new" or @@ -3381,7 +3381,7 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # @return [nil] if the +data+ has no macro tag or if the macro is # not new and no macro by the macro name is found. # - # source://yard//lib/yard/code_objects/macro_object.rb#71 + # source://yard//lib/yard/code_objects/macro_object.rb#70 def create_docstring(macro_name, data, method_object = T.unsafe(nil)); end # Expands +macro_data+ using the interpolation parameters. @@ -3394,7 +3394,7 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # # @param macro_data [String] the macro data to expand (taken from {#macro_data}) # - # source://yard//lib/yard/code_objects/macro_object.rb#93 + # source://yard//lib/yard/code_objects/macro_object.rb#92 def expand(macro_data, call_params = T.unsafe(nil), full_source = T.unsafe(nil), block_source = T.unsafe(nil)); end # Finds a macro using +macro_name+ @@ -3403,7 +3403,7 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # @return [MacroObject] if a macro is found # @return [nil] if there is no registered macro by that name # - # source://yard//lib/yard/code_objects/macro_object.rb#51 + # source://yard//lib/yard/code_objects/macro_object.rb#50 def find(macro_name); end # Parses a given docstring and determines if the macro is "new" or @@ -3423,12 +3423,12 @@ class YARD::CodeObjects::MacroObject < ::YARD::CodeObjects::Base # @return [nil] if the +data+ has no macro tag or if the macro is # not new and no macro by the macro name is found. # - # source://yard//lib/yard/code_objects/macro_object.rb#71 + # source://yard//lib/yard/code_objects/macro_object.rb#70 def find_or_create(macro_name, data, method_object = T.unsafe(nil)); end end end -# source://yard//lib/yard/code_objects/macro_object.rb#31 +# source://yard//lib/yard/code_objects/macro_object.rb#30 YARD::CodeObjects::MacroObject::MACRO_MATCH = T.let(T.unsafe(nil), Regexp) # Represents a Ruby method in source @@ -4763,7 +4763,7 @@ YARD::Docstring::META_MATCH = T.let(T.unsafe(nil), Regexp) # @see #parse_content # @since 0.8.0 # -# source://yard//lib/yard/docstring_parser.rb#30 +# source://yard//lib/yard/docstring_parser.rb#29 class YARD::DocstringParser # Creates a new parser to parse docstring data # @@ -4772,7 +4772,7 @@ class YARD::DocstringParser # @return [DocstringParser] a new instance of DocstringParser # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#81 + # source://yard//lib/yard/docstring_parser.rb#80 def initialize(library = T.unsafe(nil)); end # Creates a new directive using the registered {#library} @@ -4780,14 +4780,14 @@ class YARD::DocstringParser # @return [Tags::Directive] the directive object that is created # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#232 + # source://yard//lib/yard/docstring_parser.rb#231 def create_directive(tag_name, tag_buf); end # Creates a {Tags::RefTag} # # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#226 + # source://yard//lib/yard/docstring_parser.rb#225 def create_ref_tag(tag_name, name, object_name); end # Creates a tag from the {Tags::DefaultFactory tag factory}. @@ -4799,7 +4799,7 @@ class YARD::DocstringParser # @return [Tags::Tag, Tags::RefTag] a tag # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#209 + # source://yard//lib/yard/docstring_parser.rb#208 def create_tag(tag_name, tag_buf = T.unsafe(nil)); end # @return [Array] a list of directives identified @@ -4807,7 +4807,7 @@ class YARD::DocstringParser # Docstring object. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#45 + # source://yard//lib/yard/docstring_parser.rb#44 def directives; end # @return [Array] a list of directives identified @@ -4815,7 +4815,7 @@ class YARD::DocstringParser # Docstring object. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#45 + # source://yard//lib/yard/docstring_parser.rb#44 def directives=(_arg0); end # @return [Handlers::Base, nil] the handler parsing this @@ -4823,7 +4823,7 @@ class YARD::DocstringParser # initialized through # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#66 + # source://yard//lib/yard/docstring_parser.rb#65 def handler; end # @return [Handlers::Base, nil] the handler parsing this @@ -4831,21 +4831,21 @@ class YARD::DocstringParser # initialized through # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#66 + # source://yard//lib/yard/docstring_parser.rb#65 def handler=(_arg0); end # @return [Tags::Library] the tag library being used to # identify registered tags in the docstring. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#70 + # source://yard//lib/yard/docstring_parser.rb#69 def library; end # @return [Tags::Library] the tag library being used to # identify registered tags in the docstring. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#70 + # source://yard//lib/yard/docstring_parser.rb#69 def library=(_arg0); end # @return [CodeObjects::Base, nil] the object associated with @@ -4853,7 +4853,7 @@ class YARD::DocstringParser # not attached to any object. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#56 + # source://yard//lib/yard/docstring_parser.rb#55 def object; end # @return [CodeObjects::Base, nil] the object associated with @@ -4861,7 +4861,7 @@ class YARD::DocstringParser # not attached to any object. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#56 + # source://yard//lib/yard/docstring_parser.rb#55 def object=(_arg0); end # Parses all content and returns itself. @@ -4878,7 +4878,7 @@ class YARD::DocstringParser # @see #to_docstring # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#113 + # source://yard//lib/yard/docstring_parser.rb#112 def parse(content, object = T.unsafe(nil), handler = T.unsafe(nil)); end # Parses a given block of text. @@ -4888,7 +4888,7 @@ class YARD::DocstringParser # @param content [String] the content to parse # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#129 + # source://yard//lib/yard/docstring_parser.rb#128 def parse_content(content); end # Call post processing callbacks on parser. @@ -4898,19 +4898,19 @@ class YARD::DocstringParser # @return [void] # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#196 + # source://yard//lib/yard/docstring_parser.rb#195 def post_process; end # @return [String] the complete input string to the parser. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#36 + # source://yard//lib/yard/docstring_parser.rb#35 def raw_text; end # @return [String] the complete input string to the parser. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#36 + # source://yard//lib/yard/docstring_parser.rb#35 def raw_text=(_arg0); end # @return [CodeObjects::Base, nil] the object referenced by @@ -4918,7 +4918,7 @@ class YARD::DocstringParser # refer to any object. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#61 + # source://yard//lib/yard/docstring_parser.rb#60 def reference; end # @return [CodeObjects::Base, nil] the object referenced by @@ -4926,7 +4926,7 @@ class YARD::DocstringParser # refer to any object. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#61 + # source://yard//lib/yard/docstring_parser.rb#60 def reference=(_arg0); end # @return [OpenStruct] any arbitrary state to be passed between @@ -4935,7 +4935,7 @@ class YARD::DocstringParser # used in a docstring). # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#51 + # source://yard//lib/yard/docstring_parser.rb#50 def state; end # @return [OpenStruct] any arbitrary state to be passed between @@ -4944,7 +4944,7 @@ class YARD::DocstringParser # used in a docstring). # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#51 + # source://yard//lib/yard/docstring_parser.rb#50 def state=(_arg0); end # Backward compatibility to detect old tags that should be specified @@ -4953,42 +4953,42 @@ class YARD::DocstringParser # @return [Boolean] # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#252 + # source://yard//lib/yard/docstring_parser.rb#251 def tag_is_directive?(tag_name); end # @return [Array] the list of meta-data tags identified # by the parser # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#40 + # source://yard//lib/yard/docstring_parser.rb#39 def tags; end # @return [Array] the list of meta-data tags identified # by the parser # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#40 + # source://yard//lib/yard/docstring_parser.rb#39 def tags=(_arg0); end # @return [String] the parsed text portion of the docstring, # with tags removed. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#33 + # source://yard//lib/yard/docstring_parser.rb#32 def text; end # @return [String] the parsed text portion of the docstring, # with tags removed. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#33 + # source://yard//lib/yard/docstring_parser.rb#32 def text=(_arg0); end # @return [Docstring] translates parsed text into # a Docstring object. # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#95 + # source://yard//lib/yard/docstring_parser.rb#94 def to_docstring; end private @@ -4997,7 +4997,7 @@ class YARD::DocstringParser # # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#324 + # source://yard//lib/yard/docstring_parser.rb#323 def call_after_parse_callbacks; end # Calls the {Tags::Directive#after_parse} callback on all the @@ -5005,17 +5005,17 @@ class YARD::DocstringParser # # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#319 + # source://yard//lib/yard/docstring_parser.rb#318 def call_directives_after_parse; end # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#305 + # source://yard//lib/yard/docstring_parser.rb#304 def detect_reference(content); end # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#301 + # source://yard//lib/yard/docstring_parser.rb#300 def namespace; end class << self @@ -5030,13 +5030,13 @@ class YARD::DocstringParser # with all directives and tags created. # @yieldreturn [void] # - # source://yard//lib/yard/docstring_parser.rb#266 + # source://yard//lib/yard/docstring_parser.rb#265 def after_parse(&block); end # @return [Array] the {after_parse} callback proc objects # @since 0.8.0 # - # source://yard//lib/yard/docstring_parser.rb#271 + # source://yard//lib/yard/docstring_parser.rb#270 def after_parse_callbacks; end end end @@ -5045,7 +5045,7 @@ end # # @since 0.8.0 # -# source://yard//lib/yard/docstring_parser.rb#73 +# source://yard//lib/yard/docstring_parser.rb#72 YARD::DocstringParser::META_MATCH = T.let(T.unsafe(nil), Regexp) # source://yard//lib/yard/gem_index.rb#6 @@ -5954,14 +5954,14 @@ end # # @see Handlers::Base # -# source://yard//lib/yard/handlers/processor.rb#20 +# source://yard//lib/yard/handlers/processor.rb#19 class YARD::Handlers::Processor # Creates a new Processor for a +file+. # # @param parser [Parser::SourceParser] the parser used to initialize the processor # @return [Processor] a new instance of Processor # - # source://yard//lib/yard/handlers/processor.rb#92 + # source://yard//lib/yard/handlers/processor.rb#91 def initialize(parser); end # Share state across different handlers inside of a file. @@ -5974,7 +5974,7 @@ class YARD::Handlers::Processor # @return [OpenStruct] an open structure that can store arbitrary data # @see #globals # - # source://yard//lib/yard/handlers/processor.rb#88 + # source://yard//lib/yard/handlers/processor.rb#87 def extra_state; end # Share state across different handlers inside of a file. @@ -5987,17 +5987,17 @@ class YARD::Handlers::Processor # @return [OpenStruct] an open structure that can store arbitrary data # @see #globals # - # source://yard//lib/yard/handlers/processor.rb#88 + # source://yard//lib/yard/handlers/processor.rb#87 def extra_state=(_arg0); end # @return [String] the filename # - # source://yard//lib/yard/handlers/processor.rb#41 + # source://yard//lib/yard/handlers/processor.rb#40 def file; end # @return [String] the filename # - # source://yard//lib/yard/handlers/processor.rb#41 + # source://yard//lib/yard/handlers/processor.rb#40 def file=(_arg0); end # Searches for all handlers in {Base.subclasses} that match the +statement+ @@ -6005,7 +6005,7 @@ class YARD::Handlers::Processor # @param statement the statement object to match. # @return [Array] a list of handlers to process the statement with. # - # source://yard//lib/yard/handlers/processor.rb#151 + # source://yard//lib/yard/handlers/processor.rb#150 def find_handlers(statement); end # Handlers can share state for the entire post processing stage through @@ -6025,7 +6025,7 @@ class YARD::Handlers::Processor # @return [OpenStruct] global shared state for post-processing stage # @see #extra_state # - # source://yard//lib/yard/handlers/processor.rb#77 + # source://yard//lib/yard/handlers/processor.rb#76 def globals; end # Handlers can share state for the entire post processing stage through @@ -6045,17 +6045,17 @@ class YARD::Handlers::Processor # @return [OpenStruct] global shared state for post-processing stage # @see #extra_state # - # source://yard//lib/yard/handlers/processor.rb#77 + # source://yard//lib/yard/handlers/processor.rb#76 def globals=(_arg0); end # @return [CodeObjects::NamespaceObject] the current namespace # - # source://yard//lib/yard/handlers/processor.rb#44 + # source://yard//lib/yard/handlers/processor.rb#43 def namespace; end # @return [CodeObjects::NamespaceObject] the current namespace # - # source://yard//lib/yard/handlers/processor.rb#44 + # source://yard//lib/yard/handlers/processor.rb#43 def namespace=(_arg0); end # @return [CodeObjects::Base, nil] unlike the namespace, the owner @@ -6063,7 +6063,7 @@ class YARD::Handlers::Processor # For instance, when parsing a method body, the {CodeObjects::MethodObject} # is set as the owner, in case any extra method information is processed. # - # source://yard//lib/yard/handlers/processor.rb#56 + # source://yard//lib/yard/handlers/processor.rb#55 def owner; end # @return [CodeObjects::Base, nil] unlike the namespace, the owner @@ -6071,7 +6071,7 @@ class YARD::Handlers::Processor # For instance, when parsing a method body, the {CodeObjects::MethodObject} # is set as the owner, in case any extra method information is processed. # - # source://yard//lib/yard/handlers/processor.rb#56 + # source://yard//lib/yard/handlers/processor.rb#55 def owner=(_arg0); end # Continue parsing the remainder of the files in the +globals.ordered_parser+ @@ -6081,17 +6081,17 @@ class YARD::Handlers::Processor # @return [void] # @see Parser::OrderedParser # - # source://yard//lib/yard/handlers/processor.rb#140 + # source://yard//lib/yard/handlers/processor.rb#139 def parse_remaining_files; end # @return [Symbol] the parser type (:ruby, :ruby18, :c) # - # source://yard//lib/yard/handlers/processor.rb#59 + # source://yard//lib/yard/handlers/processor.rb#58 def parser_type; end # @return [Symbol] the parser type (:ruby, :ruby18, :c) # - # source://yard//lib/yard/handlers/processor.rb#59 + # source://yard//lib/yard/handlers/processor.rb#58 def parser_type=(_arg0); end # Processes a list of statements by finding handlers to process each @@ -6100,27 +6100,27 @@ class YARD::Handlers::Processor # @param statements [Array] a list of statements # @return [void] # - # source://yard//lib/yard/handlers/processor.rb#110 + # source://yard//lib/yard/handlers/processor.rb#109 def process(statements); end # @return [Symbol] the current scope (class, instance) # - # source://yard//lib/yard/handlers/processor.rb#50 + # source://yard//lib/yard/handlers/processor.rb#49 def scope; end # @return [Symbol] the current scope (class, instance) # - # source://yard//lib/yard/handlers/processor.rb#50 + # source://yard//lib/yard/handlers/processor.rb#49 def scope=(_arg0); end # @return [Symbol] the current visibility (public, private, protected) # - # source://yard//lib/yard/handlers/processor.rb#47 + # source://yard//lib/yard/handlers/processor.rb#46 def visibility; end # @return [Symbol] the current visibility (public, private, protected) # - # source://yard//lib/yard/handlers/processor.rb#47 + # source://yard//lib/yard/handlers/processor.rb#46 def visibility=(_arg0); end private @@ -6129,7 +6129,7 @@ class YARD::Handlers::Processor # # @return [Base] the base class # - # source://yard//lib/yard/handlers/processor.rb#172 + # source://yard//lib/yard/handlers/processor.rb#171 def handler_base_class; end # The module holding the handlers to be loaded @@ -6137,12 +6137,12 @@ class YARD::Handlers::Processor # @return [Module] the module containing the handlers depending on # {#parser_type}. # - # source://yard//lib/yard/handlers/processor.rb#180 + # source://yard//lib/yard/handlers/processor.rb#179 def handler_base_namespace; end # @return [Boolean] # - # source://yard//lib/yard/handlers/processor.rb#161 + # source://yard//lib/yard/handlers/processor.rb#160 def handles?(handler, statement); end # Loads handlers from {#handler_base_namespace}. This ensures that @@ -6151,7 +6151,7 @@ class YARD::Handlers::Processor # # @return [void] # - # source://yard//lib/yard/handlers/processor.rb#188 + # source://yard//lib/yard/handlers/processor.rb#187 def load_handlers; end class << self @@ -6159,14 +6159,14 @@ class YARD::Handlers::Processor # @return [Hash] a list of registered parser type extensions # @since 0.6.0 # - # source://yard//lib/yard/handlers/processor.rb#33 + # source://yard//lib/yard/handlers/processor.rb#32 def namespace_for_handler; end # Registers a new namespace for handlers of the given type. # # @since 0.6.0 # - # source://yard//lib/yard/handlers/processor.rb#24 + # source://yard//lib/yard/handlers/processor.rb#23 def register_handler_namespace(type, ns); end end end @@ -6999,6 +6999,11 @@ end # source://yard//lib/yard/handlers/ruby/visibility_handler.rb#3 class YARD::Handlers::Ruby::VisibilityHandler < ::YARD::Handlers::Ruby::Base include ::YARD::Handlers::Ruby::DecoratorHandlerMethods + + # @return [Boolean] + # + # source://yard//lib/yard/handlers/ruby/visibility_handler.rb#31 + def is_attribute_method?(node); end end # Handles 'yield' calls @@ -7461,13 +7466,16 @@ end # Handles console logging for info, warnings and errors. # Uses the stdlib Logger class in Ruby for all the backend logic. # -# source://yard//lib/yard/logging.rb#9 -class YARD::Logger < ::Logger +# source://yard//lib/yard/logging.rb#8 +class YARD::Logger + include ::YARD::Logger::Severity + # Creates a new logger # + # @private # @return [Logger] a new instance of Logger # - # source://yard//lib/yard/logging.rb#43 + # source://yard//lib/yard/logging.rb#82 def initialize(pipe, *args); end # Displays an unformatted line to the logger output stream. @@ -7476,7 +7484,7 @@ class YARD::Logger < ::Logger # @return [void] # @since 0.8.2 # - # source://yard//lib/yard/logging.rb#143 + # source://yard//lib/yard/logging.rb#205 def <<(msg = T.unsafe(nil)); end # Prints the backtrace +exc+ to the logger as error data. @@ -7485,7 +7493,7 @@ class YARD::Logger < ::Logger # @param level_meth [Symbol] the level to log backtrace at # @return [void] # - # source://yard//lib/yard/logging.rb#154 + # source://yard//lib/yard/logging.rb#216 def backtrace(exc, level_meth = T.unsafe(nil)); end # Captures the duration of a block of code for benchmark analysis. Also @@ -7498,7 +7506,7 @@ class YARD::Logger < ::Logger # @todo Implement capture storage for reporting of benchmarks # @yield a block of arbitrary code to benchmark # - # source://yard//lib/yard/logging.rb#80 + # source://yard//lib/yard/logging.rb#234 def capture(msg, nontty_log = T.unsafe(nil)); end # Clears the progress indicator in the TTY display. @@ -7506,14 +7514,18 @@ class YARD::Logger < ::Logger # @return [void] # @since 0.8.2 # - # source://yard//lib/yard/logging.rb#121 + # source://yard//lib/yard/logging.rb#186 def clear_progress; end - # Changes the debug level to DEBUG if $DEBUG is set - # and writes a debugging message. + # Changes the debug level to DEBUG if $DEBUG is set and writes a debugging message. + # Logs a message with the debug severity level. # - # source://yard//lib/yard/logging.rb#59 - def debug(*args); end + # @param message [String] the message to log + # @return [void] + # @see #log + # + # source://yard//lib/yard/logging.rb#103 + def debug(message); end # Sets the logger level for the duration of the block # @@ -7525,17 +7537,65 @@ class YARD::Logger < ::Logger # values can be found in Ruby's Logger class. # @yield the block with the logger temporarily set to +new_level+ # - # source://yard//lib/yard/logging.rb#179 + # source://yard//lib/yard/logging.rb#142 def enter_level(new_level = T.unsafe(nil)); end + # Logs a message with the error severity level. + # + # @param message [String] the message to log + # @return [void] + # @see #log + # + # source://yard//lib/yard/logging.rb#103 + def error(message); end + + # Logs a message with the fatal severity level. + # + # @param message [String] the message to log + # @return [void] + # @see #log + # + # source://yard//lib/yard/logging.rb#103 + def fatal(message); end + + # Logs a message with the info severity level. + # + # @param message [String] the message to log + # @return [void] + # @see #log + # + # source://yard//lib/yard/logging.rb#103 + def info(message); end + # @return [IO] the IO object being logged to # @since 0.8.2 # - # source://yard//lib/yard/logging.rb#17 + # source://yard//lib/yard/logging.rb#49 def io; end - # source://yard//lib/yard/logging.rb#18 - def io=(pipe); end + # @return [IO] the IO object being logged to + # @since 0.8.2 + # + # source://yard//lib/yard/logging.rb#49 + def io=(_arg0); end + + # @return [DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN] the logging level + # + # source://yard//lib/yard/logging.rb#57 + def level; end + + # @return [DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN] the logging level + # + # source://yard//lib/yard/logging.rb#57 + def level=(_arg0); end + + # Logs a message with a given severity + # + # @param severity [DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN] the severity level + # @param message [String] the message to log + # + # source://yard//lib/yard/logging.rb#122 + def log(severity, message); end # Displays an unformatted line to the logger output stream. # @@ -7543,7 +7603,7 @@ class YARD::Logger < ::Logger # @return [void] # @since 0.8.2 # - # source://yard//lib/yard/logging.rb#143 + # source://yard//lib/yard/logging.rb#205 def print(msg = T.unsafe(nil)); end # Displays a progress indicator for a given message. This progress report @@ -7556,7 +7616,7 @@ class YARD::Logger < ::Logger # @return [void] # @since 0.8.2 # - # source://yard//lib/yard/logging.rb#96 + # source://yard//lib/yard/logging.rb#161 def progress(msg, nontty_log = T.unsafe(nil)); end # Displays an unformatted line to the logger output stream, adding @@ -7566,86 +7626,91 @@ class YARD::Logger < ::Logger # @return [void] # @since 0.8.2 # - # source://yard//lib/yard/logging.rb#132 + # source://yard//lib/yard/logging.rb#197 def puts(msg = T.unsafe(nil)); end # @return [Boolean] whether backtraces should be shown (by default # this is on). # - # source://yard//lib/yard/logging.rb#22 + # source://yard//lib/yard/logging.rb#53 def show_backtraces; end # Sets the attribute show_backtraces # # @param value the value to set the attribute show_backtraces to. # - # source://yard//lib/yard/logging.rb#23 + # source://yard//lib/yard/logging.rb#54 def show_backtraces=(_arg0); end # @return [Boolean] whether progress indicators should be shown when # logging CLIs (by default this is off). # - # source://yard//lib/yard/logging.rb#27 + # source://yard//lib/yard/logging.rb#64 def show_progress; end # Sets the attribute show_progress # # @param value the value to set the attribute show_progress to. # - # source://yard//lib/yard/logging.rb#34 + # source://yard//lib/yard/logging.rb#70 def show_progress=(_arg0); end + # Logs a message with the unknown severity level. + # + # @param message [String] the message to log + # @return [void] + # @see #log + # + # source://yard//lib/yard/logging.rb#103 + def unknown(message); end + # Remembers when a warning occurs and writes a warning message. + # Logs a message with the warn severity level. # - # source://yard//lib/yard/logging.rb#65 - def warn(*args); end + # @param message [String] the message to log + # @return [void] + # @see #log + # + # source://yard//lib/yard/logging.rb#103 + def warn(message); end # Warns that the Ruby environment does not support continuations. Applies # to JRuby, Rubinius and MacRuby. This warning will only display once # per Ruby process. # # @deprecated Continuations are no longer needed by YARD 0.8.0+. + # @private # @return [void] # - # source://yard//lib/yard/logging.rb#167 + # source://yard//lib/yard/logging.rb#250 def warn_no_continuations; end - # Returns the value of attribute warned. + # @return [Boolean] whether a warn message has been emitted. Used for status tracking. # - # source://yard//lib/yard/logging.rb#69 + # source://yard//lib/yard/logging.rb#60 def warned; end - # Sets the attribute warned + # @return [Boolean] whether a warn message has been emitted. Used for status tracking. # - # @param value the value to set the attribute warned to. - # - # source://yard//lib/yard/logging.rb#69 + # source://yard//lib/yard/logging.rb#60 def warned=(_arg0); end private - # Override this internal Logger method to clear line - # - # source://yard//lib/yard/logging.rb#190 - def add(*args); end - - # source://yard//lib/yard/logging.rb#195 + # source://yard//lib/yard/logging.rb#255 def clear_line; end - # Log format (from Logger implementation). Used by Logger internally - # - # source://yard//lib/yard/logging.rb#201 - def format_log(sev, _time, _prog, msg); end - - # source://logger/1.6.0/lib/logger.rb#684 - def print_no_newline(msg); end - class << self + # @private + # + # source://yard//lib/yard/logging.rb#101 + def create_log_method(name); end + # The logger instance # # @return [Logger] the logger instance # - # source://yard//lib/yard/logging.rb#38 + # source://yard//lib/yard/logging.rb#76 def instance(pipe = T.unsafe(nil)); end end end @@ -7655,9 +7720,97 @@ end # # @since 0.8.2 # -# source://yard//lib/yard/logging.rb#13 +# source://yard//lib/yard/logging.rb#45 YARD::Logger::PROGRESS_INDICATORS = T.let(T.unsafe(nil), Array) +# Log severity levels +# +# source://yard//lib/yard/logging.rb#10 +module YARD::Logger::Severity; end + +# Debugging log level +# +# source://yard//lib/yard/logging.rb#12 +YARD::Logger::Severity::DEBUG = T.let(T.unsafe(nil), Integer) + +# Error log level +# +# source://yard//lib/yard/logging.rb#21 +YARD::Logger::Severity::ERROR = T.let(T.unsafe(nil), Integer) + +# Fatal log level +# +# source://yard//lib/yard/logging.rb#24 +YARD::Logger::Severity::FATAL = T.let(T.unsafe(nil), Integer) + +# Information log level +# +# source://yard//lib/yard/logging.rb#15 +YARD::Logger::Severity::INFO = T.let(T.unsafe(nil), Integer) + +# @private +# +# source://yard//lib/yard/logging.rb#30 +YARD::Logger::Severity::SEVERITIES = T.let(T.unsafe(nil), Hash) + +# Unknown log level +# +# source://yard//lib/yard/logging.rb#27 +YARD::Logger::Severity::UNKNOWN = T.let(T.unsafe(nil), Integer) + +# Warning log level +# +# source://yard//lib/yard/logging.rb#18 +YARD::Logger::Severity::WARN = T.let(T.unsafe(nil), Integer) + +# An OpenStruct compatible struct class that allows for basic access of attributes +# via +struct.attr_name+ and +struct.attr_name = value+. +# +# source://yard//lib/yard/open_struct.rb#4 +class YARD::OpenStruct + # @return [OpenStruct] a new instance of OpenStruct + # + # source://yard//lib/yard/open_struct.rb#5 + def initialize(hash = T.unsafe(nil)); end + + # source://yard//lib/yard/open_struct.rb#25 + def ==(other); end + + # source://yard//lib/yard/open_struct.rb#41 + def [](key); end + + # source://yard//lib/yard/open_struct.rb#37 + def []=(key, value); end + + # source://yard//lib/yard/open_struct.rb#33 + def dig(*keys); end + + # source://yard//lib/yard/open_struct.rb#45 + def each_pair(&block); end + + # source://yard//lib/yard/open_struct.rb#29 + def hash; end + + # source://yard//lib/yard/open_struct.rb#49 + def marshal_dump; end + + # source://yard//lib/yard/open_struct.rb#53 + def marshal_load(data); end + + # @private + # + # source://yard//lib/yard/open_struct.rb#10 + def method_missing(name, *args); end + + # source://yard//lib/yard/open_struct.rb#21 + def to_h; end + + private + + # source://yard//lib/yard/open_struct.rb#59 + def __cache_lookup__(name); end +end + # Generalized options class for passing around large amounts of options between objects. # # The options class exists for better visibility and documentability of options being @@ -8209,7 +8362,7 @@ end # # @see Processor#parse_remaining_files # -# source://yard//lib/yard/parser/source_parser.rb#21 +# source://yard//lib/yard/parser/source_parser.rb#20 class YARD::Parser::OrderedParser # Creates a new OrderedParser with the global state and a list # of files to parse. @@ -8221,30 +8374,30 @@ class YARD::Parser::OrderedParser # @param files [Array] the list of files to parse # @return [OrderedParser] a new instance of OrderedParser # - # source://yard//lib/yard/parser/source_parser.rb#33 + # source://yard//lib/yard/parser/source_parser.rb#32 def initialize(global_state, files); end # @return [Array] the list of remaining files to parse # - # source://yard//lib/yard/parser/source_parser.rb#23 + # source://yard//lib/yard/parser/source_parser.rb#22 def files; end # @return [Array] the list of remaining files to parse # - # source://yard//lib/yard/parser/source_parser.rb#23 + # source://yard//lib/yard/parser/source_parser.rb#22 def files=(_arg0); end # Parses the remainder of the {#files} list. # # @see Processor#parse_remaining_files # - # source://yard//lib/yard/parser/source_parser.rb#42 + # source://yard//lib/yard/parser/source_parser.rb#41 def parse; end end # Raised when the parser sees a Ruby syntax error # -# source://yard//lib/yard/parser/source_parser.rb#13 +# source://yard//lib/yard/parser/source_parser.rb#12 class YARD::Parser::ParserSyntaxError < ::YARD::Parser::UndocumentableError; end # Ruby parsing components. @@ -8689,6 +8842,9 @@ class YARD::Parser::Ruby::Legacy::RubyLex # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#430 def continue; end + # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1116 + def dedent(str); end + # Returns the value of attribute exception_on_syntax_error. # # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#463 @@ -8713,7 +8869,7 @@ class YARD::Parser::Ruby::Legacy::RubyLex # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#488 def gets; end - # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1257 + # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1272 def identify_comment; end # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#945 @@ -8725,13 +8881,13 @@ class YARD::Parser::Ruby::Legacy::RubyLex # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#980 def identify_identifier; end - # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1130 + # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1145 def identify_number(start); end - # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1111 + # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1126 def identify_quotation(initial_char); end - # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1192 + # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1207 def identify_string(ltype, quoted = T.unsafe(nil), opener = T.unsafe(nil), initial_char = T.unsafe(nil)); end # Returns the value of attribute indent. @@ -8778,10 +8934,10 @@ class YARD::Parser::Ruby::Legacy::RubyLex # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#462 def read_auto_clean_up=(_arg0); end - # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1280 + # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1295 def read_escape; end - # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1242 + # source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb#1257 def skip_inner_expression; end # Returns the value of attribute skip_space. @@ -10970,7 +11126,7 @@ end # @see Handlers::Base # @see CodeObjects::Base # -# source://yard//lib/yard/parser/source_parser.rb#64 +# source://yard//lib/yard/parser/source_parser.rb#63 class YARD::Parser::SourceParser # @overload initialize # @return [SourceParser] a new instance of SourceParser @@ -11226,7 +11382,7 @@ class YARD::Parser::SourceParser # {YARD::Logger} # @return [void] # - # source://yard//lib/yard/parser/source_parser.rb#100 + # source://yard//lib/yard/parser/source_parser.rb#99 def parse(paths = T.unsafe(nil), excluded = T.unsafe(nil), level = T.unsafe(nil)); end # Parses a string +content+ @@ -11240,10 +11396,10 @@ class YARD::Parser::SourceParser # @return [Symbol] the default parser type (defaults to :ruby) # - # source://yard//lib/yard/parser/source_parser.rb#86 + # source://yard//lib/yard/parser/source_parser.rb#85 def parser_type; end - # source://yard//lib/yard/parser/source_parser.rb#88 + # source://yard//lib/yard/parser/source_parser.rb#87 def parser_type=(value); end # @private @@ -11324,30 +11480,30 @@ end # # @since 0.9.0 # -# source://yard//lib/yard/parser/source_parser.rb#71 +# source://yard//lib/yard/parser/source_parser.rb#70 YARD::Parser::SourceParser::DEFAULT_PATH_GLOB = T.let(T.unsafe(nil), Array) # Byte order marks for various encodings # # @since 0.7.0 # -# source://yard//lib/yard/parser/source_parser.rb#75 +# source://yard//lib/yard/parser/source_parser.rb#74 YARD::Parser::SourceParser::ENCODING_BYTE_ORDER_MARKS = T.let(T.unsafe(nil), Hash) -# source://yard//lib/yard/parser/source_parser.rb#66 +# source://yard//lib/yard/parser/source_parser.rb#65 YARD::Parser::SourceParser::ENCODING_LINE = T.let(T.unsafe(nil), Regexp) -# source://yard//lib/yard/parser/source_parser.rb#67 +# source://yard//lib/yard/parser/source_parser.rb#66 YARD::Parser::SourceParser::FROZEN_STRING_LINE = T.let(T.unsafe(nil), Regexp) -# source://yard//lib/yard/parser/source_parser.rb#65 +# source://yard//lib/yard/parser/source_parser.rb#64 YARD::Parser::SourceParser::SHEBANG_LINE = T.let(T.unsafe(nil), Regexp) # Raised when an object is recognized but cannot be documented. This # generally occurs when the Ruby syntax used to declare an object is # too dynamic in nature. # -# source://yard//lib/yard/parser/source_parser.rb#10 +# source://yard//lib/yard/parser/source_parser.rb#9 class YARD::Parser::UndocumentableError < ::RuntimeError; end # The root path for YARD source libraries @@ -14622,42 +14778,42 @@ module YARD::Tags; end # @see tag:!method # @since 0.7.0 # -# source://yard//lib/yard/tags/directives.rb#461 +# source://yard//lib/yard/tags/directives.rb#460 class YARD::Tags::AttributeDirective < ::YARD::Tags::MethodDirective # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#462 + # source://yard//lib/yard/tags/directives.rb#461 def after_parse; end protected # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#470 + # source://yard//lib/yard/tags/directives.rb#469 def method_name; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#476 + # source://yard//lib/yard/tags/directives.rb#475 def method_signature; end private # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#486 + # source://yard//lib/yard/tags/directives.rb#485 def create_attribute_data(object); end # @return [Boolean] # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#516 + # source://yard//lib/yard/tags/directives.rb#515 def readable?; end # @return [Boolean] # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#512 + # source://yard//lib/yard/tags/directives.rb#511 def writable?; end end @@ -14791,14 +14947,14 @@ end # @see Library.define_directive # @since 0.8.0 # -# source://yard//lib/yard/tags/directives.rb#23 +# source://yard//lib/yard/tags/directives.rb#22 class YARD::Tags::Directive # @param tag [Tag] the meta-data tag containing all input to the docstring # @param parser [DocstringParser] the docstring parser object # @return [Directive] a new instance of Directive # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#55 + # source://yard//lib/yard/tags/directives.rb#54 def initialize(tag, parser); end # Called after parsing all directives and tags in the docstring. Used @@ -14807,7 +14963,7 @@ class YARD::Tags::Directive # @return [void] # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#74 + # source://yard//lib/yard/tags/directives.rb#73 def after_parse; end # Called when processing the directive. Subclasses should implement @@ -14819,7 +14975,7 @@ class YARD::Tags::Directive # @return [void] # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#69 + # source://yard//lib/yard/tags/directives.rb#68 def call; end # Set this field to replace the directive definition inside of a docstring @@ -14831,7 +14987,7 @@ class YARD::Tags::Directive # @return [nil] if no expansion should take place for this directive # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#34 + # source://yard//lib/yard/tags/directives.rb#33 def expanded_text; end # Set this field to replace the directive definition inside of a docstring @@ -14843,7 +14999,7 @@ class YARD::Tags::Directive # @return [nil] if no expansion should take place for this directive # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#34 + # source://yard//lib/yard/tags/directives.rb#33 def expanded_text=(_arg0); end # @return [Handlers::Base, nil] the handler object the docstring parser @@ -14851,33 +15007,33 @@ class YARD::Tags::Directive # through {Parser::SourceParser}. # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#49 + # source://yard//lib/yard/tags/directives.rb#48 def handler; end # @return [CodeObjects::Base, nil] the object the parent docstring is # attached to. May be nil. # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#43 + # source://yard//lib/yard/tags/directives.rb#42 def object; end # @return [DocstringParser] the parser that is parsing all tag # information out of the docstring # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#38 + # source://yard//lib/yard/tags/directives.rb#37 def parser=(_arg0); end # @return [Tag] the meta-data tag containing data input to the directive # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#25 + # source://yard//lib/yard/tags/directives.rb#24 def tag; end # @return [Tag] the meta-data tag containing data input to the directive # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#25 + # source://yard//lib/yard/tags/directives.rb#24 def tag=(_arg0); end protected @@ -14885,14 +15041,14 @@ class YARD::Tags::Directive # @return [Boolean] # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#80 + # source://yard//lib/yard/tags/directives.rb#79 def inside_directive?; end # @return [DocstringParser] the parser that is parsing all tag # information out of the docstring # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#38 + # source://yard//lib/yard/tags/directives.rb#37 def parser; end end @@ -14916,11 +15072,11 @@ end # @see tag:!group # @since 0.6.0 # -# source://yard//lib/yard/tags/directives.rb#105 +# source://yard//lib/yard/tags/directives.rb#104 class YARD::Tags::EndGroupDirective < ::YARD::Tags::Directive # @since 0.6.0 # - # source://yard//lib/yard/tags/directives.rb#106 + # source://yard//lib/yard/tags/directives.rb#105 def call; end end @@ -14941,11 +15097,11 @@ end # @see tag:!endgroup # @since 0.6.0 # -# source://yard//lib/yard/tags/directives.rb#128 +# source://yard//lib/yard/tags/directives.rb#127 class YARD::Tags::GroupDirective < ::YARD::Tags::Directive # @since 0.6.0 # - # source://yard//lib/yard/tags/directives.rb#129 + # source://yard//lib/yard/tags/directives.rb#128 def call; end end @@ -15710,12 +15866,12 @@ end # end # @since 0.7.0 # -# source://yard//lib/yard/tags/directives.rb#258 +# source://yard//lib/yard/tags/directives.rb#257 class YARD::Tags::MacroDirective < ::YARD::Tags::Directive # @raise [TagFormatError] # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#259 + # source://yard//lib/yard/tags/directives.rb#258 def call; end private @@ -15723,40 +15879,40 @@ class YARD::Tags::MacroDirective < ::YARD::Tags::Directive # @return [Boolean] # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#288 + # source://yard//lib/yard/tags/directives.rb#287 def anonymous?; end # @return [Boolean] # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#277 + # source://yard//lib/yard/tags/directives.rb#276 def attach?; end # @return [Boolean] # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#283 + # source://yard//lib/yard/tags/directives.rb#282 def class_method?; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#292 + # source://yard//lib/yard/tags/directives.rb#291 def expand(macro_data); end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#308 + # source://yard//lib/yard/tags/directives.rb#307 def find_or_create; end # @return [Boolean] # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#272 + # source://yard//lib/yard/tags/directives.rb#271 def new?; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#332 + # source://yard//lib/yard/tags/directives.rb#331 def warn; end end @@ -15789,49 +15945,49 @@ end # @see tag:!attribute # @since 0.7.0 # -# source://yard//lib/yard/tags/directives.rb#368 +# source://yard//lib/yard/tags/directives.rb#367 class YARD::Tags::MethodDirective < ::YARD::Tags::Directive # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#373 + # source://yard//lib/yard/tags/directives.rb#372 def after_parse; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#371 + # source://yard//lib/yard/tags/directives.rb#370 def call; end protected # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#413 + # source://yard//lib/yard/tags/directives.rb#412 def create_object; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#381 + # source://yard//lib/yard/tags/directives.rb#380 def method_name; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#390 + # source://yard//lib/yard/tags/directives.rb#389 def method_signature; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#394 + # source://yard//lib/yard/tags/directives.rb#393 def sanitized_tag_signature; end # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#403 + # source://yard//lib/yard/tags/directives.rb#402 def use_indented_text; end end # @since 0.7.0 # -# source://yard//lib/yard/tags/directives.rb#369 +# source://yard//lib/yard/tags/directives.rb#368 YARD::Tags::MethodDirective::SCOPE_MATCH = T.let(T.unsafe(nil), Regexp) # source://yard//lib/yard/tags/option_tag.rb#4 @@ -15943,11 +16099,11 @@ end # # } # @since 0.8.0 # -# source://yard//lib/yard/tags/directives.rb#545 +# source://yard//lib/yard/tags/directives.rb#544 class YARD::Tags::ParseDirective < ::YARD::Tags::Directive # @since 0.8.0 # - # source://yard//lib/yard/tags/directives.rb#546 + # source://yard//lib/yard/tags/directives.rb#545 def call; end end @@ -16031,11 +16187,11 @@ end # def method2; end # @since 0.7.0 # -# source://yard//lib/yard/tags/directives.rb#579 +# source://yard//lib/yard/tags/directives.rb#578 class YARD::Tags::ScopeDirective < ::YARD::Tags::Directive # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#580 + # source://yard//lib/yard/tags/directives.rb#579 def call; end end @@ -16066,7 +16222,7 @@ class YARD::Tags::Tag # @param name [String] optional key name which the tag refers to # @return [Tag] a new instance of Tag # - # source://yard//lib/yard/tags/tag.rb#44 + # source://yard//lib/yard/tags/tag.rb#45 def initialize(tag_name, text, types = T.unsafe(nil), name = T.unsafe(nil)); end # Provides a plain English summary of the type specification, or nil @@ -16075,27 +16231,29 @@ class YARD::Tags::Tag # @return [String] a plain English description of the associated types # @return [nil] if no types are provided or not parsable # - # source://yard//lib/yard/tags/tag.rb#65 + # source://yard//lib/yard/tags/tag.rb#66 def explain_types; end # @return [String] a name associated with the tag + # @return [nil] if no tag name is supplied # - # source://yard//lib/yard/tags/tag.rb#26 + # source://yard//lib/yard/tags/tag.rb#27 def name; end # @return [String] a name associated with the tag + # @return [nil] if no tag name is supplied # - # source://yard//lib/yard/tags/tag.rb#26 + # source://yard//lib/yard/tags/tag.rb#27 def name=(_arg0); end # @return [CodeObjects::Base] the associated object # - # source://yard//lib/yard/tags/tag.rb#29 + # source://yard//lib/yard/tags/tag.rb#30 def object; end # @return [CodeObjects::Base] the associated object # - # source://yard//lib/yard/tags/tag.rb#29 + # source://yard//lib/yard/tags/tag.rb#30 def object=(_arg0); end # @return [String] the name of the tag @@ -16126,7 +16284,7 @@ class YARD::Tags::Tag # @return [String] the first of the list of specified types # @see #types # - # source://yard//lib/yard/tags/tag.rb#56 + # source://yard//lib/yard/tags/tag.rb#57 def type; end # @return [Array] a list of types associated with the tag @@ -16317,11 +16475,11 @@ end # def method2; end # @since 0.7.0 # -# source://yard//lib/yard/tags/directives.rb#611 +# source://yard//lib/yard/tags/directives.rb#610 class YARD::Tags::VisibilityDirective < ::YARD::Tags::Directive # @since 0.7.0 # - # source://yard//lib/yard/tags/directives.rb#612 + # source://yard//lib/yard/tags/directives.rb#611 def call; end end @@ -16337,7 +16495,7 @@ module YARD::Templates; end # * To render a template, call {render}. # * To register a template path in the lookup paths, call {register_template_path}. # -# source://yard//lib/yard/templates/engine.rb#12 +# source://yard//lib/yard/templates/engine.rb#11 module YARD::Templates::Engine class << self # Passes a set of objects to the +:fulldoc+ template for full documentation generation. @@ -16349,7 +16507,7 @@ module YARD::Templates::Engine # @param options [Hash] (see {render}) # @return [void] # - # source://yard//lib/yard/templates/engine.rb#101 + # source://yard//lib/yard/templates/engine.rb#100 def generate(objects, options = T.unsafe(nil)); end # Registers a new template path in {template_paths} @@ -16357,7 +16515,7 @@ module YARD::Templates::Engine # @param path [String] a new template path # @return [void] # - # source://yard//lib/yard/templates/engine.rb#21 + # source://yard//lib/yard/templates/engine.rb#20 def register_template_path(path); end # Renders a template on a {CodeObjects::Base code object} using @@ -16378,7 +16536,7 @@ module YARD::Templates::Engine # @param options [Hash] the options hash # @return [String] the rendered template # - # source://yard//lib/yard/templates/engine.rb#82 + # source://yard//lib/yard/templates/engine.rb#81 def render(options = T.unsafe(nil)); end # Creates a template module representing the path. Searches on disk @@ -16392,7 +16550,7 @@ module YARD::Templates::Engine # {template_paths} on disk. # @return [Template] the module representing the template # - # source://yard//lib/yard/templates/engine.rb#35 + # source://yard//lib/yard/templates/engine.rb#34 def template(*path); end # Forces creation of a template at +path+ within a +full_path+. @@ -16401,17 +16559,17 @@ module YARD::Templates::Engine # @param full_paths [Array] the full path on disk of the template # @return [Template] the template module representing the +path+ # - # source://yard//lib/yard/templates/engine.rb#53 + # source://yard//lib/yard/templates/engine.rb#52 def template!(path, full_paths = T.unsafe(nil)); end # @return [Array] the list of registered template paths # - # source://yard//lib/yard/templates/engine.rb#15 + # source://yard//lib/yard/templates/engine.rb#14 def template_paths; end # @return [Array] the list of registered template paths # - # source://yard//lib/yard/templates/engine.rb#15 + # source://yard//lib/yard/templates/engine.rb#14 def template_paths=(_arg0); end # Serializes the results of a block with a +serializer+ object. @@ -16422,7 +16580,7 @@ module YARD::Templates::Engine # @yield a block whose result will be serialize # @yieldreturn [String] the contents to serialize # - # source://yard//lib/yard/templates/engine.rb#115 + # source://yard//lib/yard/templates/engine.rb#114 def with_serializer(object, serializer); end private @@ -16437,7 +16595,7 @@ module YARD::Templates::Engine # @return [Array] a list of full paths that are existing # candidates for a template module # - # source://yard//lib/yard/templates/engine.rb#161 + # source://yard//lib/yard/templates/engine.rb#160 def find_template_paths(from_template, path); end # Sets default options on the options hash @@ -16448,7 +16606,7 @@ module YARD::Templates::Engine # @param options [Hash] the options hash # @return [void] # - # source://yard//lib/yard/templates/engine.rb#141 + # source://yard//lib/yard/templates/engine.rb#140 def set_default_options(options = T.unsafe(nil)); end # The name of the module that represents a +path+ @@ -16456,7 +16614,7 @@ module YARD::Templates::Engine # @param path [String] the path to generate a module name for # @return [String] the module name # - # source://yard//lib/yard/templates/engine.rb#176 + # source://yard//lib/yard/templates/engine.rb#175 def template_module_name(path); end end end @@ -17867,7 +18025,7 @@ end # # @see CLI::YardocOptions # -# source://yard//lib/yard/templates/template_options.rb#10 +# source://yard//lib/yard/templates/template_options.rb#9 class YARD::Templates::TemplateOptions < ::YARD::Options # @return [OpenStruct] an open struct containing any global state across all # generated objects in a template. @@ -17910,7 +18068,7 @@ class YARD::Templates::TemplateOptions < ::YARD::Options # @return [Boolean] whether a mixin matches the embed_mixins list # @return [nil] if the mixin is not a module object # - # source://yard//lib/yard/templates/template_options.rb#78 + # source://yard//lib/yard/templates/template_options.rb#77 def embed_mixins_match?(mixin); end # @return [Symbol] the template output format @@ -17957,12 +18115,12 @@ class YARD::Templates::TemplateOptions < ::YARD::Options # @return [Boolean] whether the page is the "index" # - # source://yard//lib/yard/templates/template_options.rb#64 + # source://yard//lib/yard/templates/template_options.rb#63 def index; end # @return [Boolean] whether the page is the "index" # - # source://yard//lib/yard/templates/template_options.rb#64 + # source://yard//lib/yard/templates/template_options.rb#63 def index=(_arg0); end # @return [Symbol] the markup format to use when parsing docstrings @@ -17977,51 +18135,51 @@ class YARD::Templates::TemplateOptions < ::YARD::Options # @return [Class] the markup provider class for the markup format # - # source://yard//lib/yard/templates/template_options.rb#30 + # source://yard//lib/yard/templates/template_options.rb#29 def markup_provider; end # @return [Class] the markup provider class for the markup format # - # source://yard//lib/yard/templates/template_options.rb#30 + # source://yard//lib/yard/templates/template_options.rb#29 def markup_provider=(_arg0); end # @deprecated use {#highlight} instead. # @return [Boolean] whether highlighting should be ignored # - # source://yard//lib/yard/templates/template_options.rb#57 + # source://yard//lib/yard/templates/template_options.rb#56 def no_highlight; end - # source://yard//lib/yard/templates/template_options.rb#58 + # source://yard//lib/yard/templates/template_options.rb#57 def no_highlight=(value); end # @return [CodeObjects::Base] the main object being generated in the template # - # source://yard//lib/yard/templates/template_options.rb#38 + # source://yard//lib/yard/templates/template_options.rb#37 def object; end # @return [CodeObjects::Base] the main object being generated in the template # - # source://yard//lib/yard/templates/template_options.rb#38 + # source://yard//lib/yard/templates/template_options.rb#37 def object=(_arg0); end # @return [CodeObjects::Base] the owner of the generated object # - # source://yard//lib/yard/templates/template_options.rb#41 + # source://yard//lib/yard/templates/template_options.rb#40 def owner; end # @return [CodeObjects::Base] the owner of the generated object # - # source://yard//lib/yard/templates/template_options.rb#41 + # source://yard//lib/yard/templates/template_options.rb#40 def owner=(_arg0); end # @return [String] the title of a given page # - # source://yard//lib/yard/templates/template_options.rb#61 + # source://yard//lib/yard/templates/template_options.rb#60 def page_title; end # @return [String] the title of a given page # - # source://yard//lib/yard/templates/template_options.rb#61 + # source://yard//lib/yard/templates/template_options.rb#60 def page_title=(_arg0); end # @return [Boolean] whether serialization should be performed @@ -18037,13 +18195,13 @@ class YARD::Templates::TemplateOptions < ::YARD::Options # @return [Serializers::Base] the serializer used to generate links and serialize # output. Serialization output only occurs if {#serialize} is +true+. # - # source://yard//lib/yard/templates/template_options.rb#51 + # source://yard//lib/yard/templates/template_options.rb#50 def serializer; end # @return [Serializers::Base] the serializer used to generate links and serialize # output. Serialization output only occurs if {#serialize} is +true+. # - # source://yard//lib/yard/templates/template_options.rb#51 + # source://yard//lib/yard/templates/template_options.rb#50 def serializer=(_arg0); end # @return [Symbol] the template name used to render output @@ -18058,22 +18216,22 @@ class YARD::Templates::TemplateOptions < ::YARD::Options # @return [Symbol] the template type used to generate output # - # source://yard//lib/yard/templates/template_options.rb#44 + # source://yard//lib/yard/templates/template_options.rb#43 def type; end # @return [Symbol] the template type used to generate output # - # source://yard//lib/yard/templates/template_options.rb#44 + # source://yard//lib/yard/templates/template_options.rb#43 def type=(_arg0); end # @return [Verifier] the verifier object # - # source://yard//lib/yard/templates/template_options.rb#89 + # source://yard//lib/yard/templates/template_options.rb#88 def verifier; end # @return [Verifier] the verifier object # - # source://yard//lib/yard/templates/template_options.rb#89 + # source://yard//lib/yard/templates/template_options.rb#88 def verifier=(_arg0); end end diff --git a/sorbet/rbi/shims/bundler.rbi b/sorbet/rbi/shims/bundler.rbi index 16b184e084..87408448fd 100644 --- a/sorbet/rbi/shims/bundler.rbi +++ b/sorbet/rbi/shims/bundler.rbi @@ -1,6 +1,32 @@ # typed: true -class Bundler::Settings - sig { params(name: String).returns(String) } - def self.key_for(name); end +module Bundler + class Settings + sig { params(name: String).returns(String) } + def self.key_for(name); end + end + + module CLI + class Install + sig { params(options: T::Hash[String, T.untyped]).void } + def initialize(options); end + + sig { void } + def run; end + end + + class Update + sig { params(options: T::Hash[String, T.untyped], gems: T::Array[String]).void } + def initialize(options, gems); end + + sig { void } + def run; end + end + end + + module Thor # rubocop:disable Style/ClassAndModuleChildren + module Shell + class Basic; end + end + end end diff --git a/sorbet/rbi/shims/rubygems.rbi b/sorbet/rbi/shims/rubygems.rbi new file mode 100644 index 0000000000..ee305f1416 --- /dev/null +++ b/sorbet/rbi/shims/rubygems.rbi @@ -0,0 +1,8 @@ +# typed: true + +class Gem::Specification + class << self + sig { params(block: T.proc.params(spec: Gem::Specification).returns(T::Boolean)).returns(T::Boolean) } + def any?(&block); end + end +end diff --git a/test/erb_document_test.rb b/test/erb_document_test.rb index c83b7f2714..29775bf2ad 100644 --- a/test/erb_document_test.rb +++ b/test/erb_document_test.rb @@ -52,7 +52,7 @@ def test_erb_document_handles_windows_newlines assert_equal(" \r\nbar ", document.parse_result.source.source) end - def test_erb_syntax_error_doesnt_cause_crash + def test_erb_syntax_error_does_not_cause_crash [ "<%=", "<%", diff --git a/test/expectations/document_highlight/class_declaration.exp.json b/test/expectations/document_highlight/class_declaration.exp.json index 3612b374b6..0d75315739 100644 --- a/test/expectations/document_highlight/class_declaration.exp.json +++ b/test/expectations/document_highlight/class_declaration.exp.json @@ -1,9 +1,36 @@ { "params": [ { - "line": 1, + "line": 0, "character": 2 } ], - "result": [] + "result": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 5 + } + }, + "kind": 1 + }, + { + "range": { + "start": { + "line": 4, + "character": 0 + }, + "end": { + "line": 4, + "character": 3 + } + }, + "kind": 1 + } + ] } diff --git a/test/expectations/semantic_highlighting/multibyte_characters.exp.json b/test/expectations/semantic_highlighting/multibyte_characters.exp.json index 14943888b8..180bfa1799 100644 --- a/test/expectations/semantic_highlighting/multibyte_characters.exp.json +++ b/test/expectations/semantic_highlighting/multibyte_characters.exp.json @@ -16,7 +16,7 @@ }, { "delta_line": 3, - "delta_start_char": 11, + "delta_start_char": 10, "length": 2, "token_type": 8, "token_modifiers": 0 @@ -24,7 +24,7 @@ { "delta_line": 1, "delta_start_char": 11, - "length": 2, + "length": 1, "token_type": 8, "token_modifiers": 0 } diff --git a/test/fixtures/prism b/test/fixtures/prism index 638e00956f..14a5e93d7a 160000 --- a/test/fixtures/prism +++ b/test/fixtures/prism @@ -1 +1 @@ -Subproject commit 638e00956f10789da2e18311b68eca735649016c +Subproject commit 14a5e93d7a5934b54c82f31275981563e369013b diff --git a/test/global_state_test.rb b/test/global_state_test.rb index a8d69ac8e2..c28fa8b184 100644 --- a/test/global_state_test.rb +++ b/test/global_state_test.rb @@ -97,7 +97,7 @@ def test_applying_auto_formatter_with_rubocop_as_transitive_dependency_without_c assert_equal("none", state.formatter) end - def test_applying_auto_formatter_with_rubocop_as_transitive_dependency_and_sytax_tree + def test_applying_auto_formatter_with_rubocop_as_transitive_dependency_and_syntax_tree state = GlobalState.new stub_direct_dependencies("syntax_tree" => "1.2.3") @@ -121,7 +121,7 @@ def test_watching_files_if_supported }, }, }) - assert(state.supports_watching_files) + assert(state.client_capabilities.supports_watching_files) end def test_watching_files_if_not_supported @@ -136,7 +136,7 @@ def test_watching_files_if_not_supported }, }, }) - refute(state.supports_watching_files) + refute(state.client_capabilities.supports_watching_files) end def test_watching_files_if_not_reported @@ -146,7 +146,7 @@ def test_watching_files_if_not_reported workspace: {}, }, }) - refute(state.supports_watching_files) + refute(state.client_capabilities.supports_watching_files) end def test_linter_specification @@ -223,6 +223,29 @@ def test_addon_settings_are_stored assert_equal({ runtimeServerEnabled: false }, global_state.settings_for_addon("Ruby LSP Rails")) end + def test_delegates_supports_watching_files_to_client_capabilities + global_state = GlobalState.new + global_state.client_capabilities.expects(:supports_watching_files).returns(true) + global_state.supports_watching_files + end + + def test_feature_flags_are_processed_by_apply_options + state = GlobalState.new + + state.apply_options({ + initializationOptions: { + enabledFeatureFlags: { + semantic_highlighting: true, + code_lens: false, + }, + }, + }) + + assert(state.enabled_feature?(:semantic_highlighting)) + refute(state.enabled_feature?(:code_lens)) + assert_nil(state.enabled_feature?(:unknown_flag)) + end + private def stub_direct_dependencies(dependencies) diff --git a/test/integration_test.rb b/test/integration_test.rb index 4ae7ae0038..f8670e401d 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -2,13 +2,16 @@ # frozen_string_literal: true require "test_helper" +require "open3" class IntegrationTest < Minitest::Test def setup - skip("CI only") unless ENV["CI"] + @root = Bundler.root end def test_ruby_lsp_doctor_works + skip("CI only") unless ENV["CI"] + in_isolation do system("bundle exec ruby-lsp --doctor") assert_equal(0, $CHILD_STATUS) @@ -16,36 +19,221 @@ def test_ruby_lsp_doctor_works end def test_ruby_lsp_check_works + skip("CI only") unless ENV["CI"] + in_isolation do system("bundle exec ruby-lsp-check") assert_equal(0, $CHILD_STATUS) end end + def test_adds_bundler_version_as_part_of_exec_command + in_temp_dir do |dir| + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gem "ruby-lsp", path: "#{Bundler.root}" + GEMFILE + + Bundler.with_unbundled_env do + capture_subprocess_io do + system("bundle install") + + Object.any_instance.expects(:exec).with do |env, command| + env.key?("BUNDLE_GEMFILE") && + env.key?("BUNDLER_VERSION") && + /bundle _[\d\.]+_ exec ruby-lsp/.match?(command) + end.once.raises(StandardError.new("stop")) + + # We raise intentionally to avoid continuing running the executable + assert_raises(StandardError) do + load(Gem.bin_path("ruby-lsp", "ruby-lsp")) + end + end + end + end + end + + def test_avoids_bundler_version_if_local_bin_is_in_path + in_temp_dir do |dir| + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gem "ruby-lsp", path: "#{Bundler.root}" + GEMFILE + + FileUtils.mkdir(File.join(dir, "bin")) + FileUtils.touch(File.join(dir, "bin", "bundle")) + + Bundler.with_unbundled_env do + capture_subprocess_io do + system("bundle install") + + Object.any_instance.expects(:exec).with do |env, command| + env.key?("BUNDLE_GEMFILE") && + !env.key?("BUNDLER_VERSION") && + "bundle exec ruby-lsp" == command + end.once.raises(StandardError.new("stop")) + + ENV["PATH"] = "./bin#{File::PATH_SEPARATOR}#{ENV["PATH"]}" + # We raise intentionally to avoid continuing running the executable + assert_raises(StandardError) do + load(Gem.bin_path("ruby-lsp", "ruby-lsp")) + end + end + end + end + end + + def test_launch_mode_with_no_gemfile + in_temp_dir do |dir| + Bundler.with_unbundled_env do + launch(dir) + end + end + end + + def test_launch_mode_with_missing_lockfile + in_temp_dir do |dir| + File.write(File.join(dir, "Gemfile"), <<~RUBY) + source "https://rubygems.org" + gem "stringio" + RUBY + + Bundler.with_unbundled_env do + launch(dir) + end + end + end + + def test_launch_mode_with_full_bundle + in_temp_dir do |dir| + File.write(File.join(dir, "Gemfile"), <<~RUBY) + source "https://rubygems.org" + gem "stringio" + RUBY + + lockfile_contents = <<~LOCKFILE + GEM + remote: https://rubygems.org/ + specs: + stringio (3.1.0) + + PLATFORMS + arm64-darwin-23 + ruby + + DEPENDENCIES + stringio + + BUNDLED WITH + 2.5.7 + LOCKFILE + File.write(File.join(dir, "Gemfile.lock"), lockfile_contents) + + Bundler.with_unbundled_env do + launch(dir) + end + end + end + + def test_launch_mode_with_no_gemfile_and_bundle_path + in_temp_dir do |dir| + Bundler.with_unbundled_env do + system("bundle config --local path #{File.join("vendor", "bundle")}") + assert_path_exists(File.join(dir, ".bundle", "config")) + launch(dir) + end + end + end + private - def in_isolation(&block) - gem_path = Bundler.root + def launch(workspace_path) + specification = Gem::Specification.find_by_name("ruby-lsp") + paths = [specification.full_gem_path] + paths.concat(specification.dependencies.map { |dep| dep.to_spec.full_gem_path }) + + load_path = $LOAD_PATH.filter_map do |path| + next unless paths.any? { |gem_path| path.start_with?(gem_path) } || !path.start_with?(Bundler.bundle_path.to_s) + + ["-I", File.expand_path(path)] + end.uniq.flatten + + stdin, stdout, stderr, wait_thr = T.unsafe(Open3).popen3( + Gem.ruby, + *load_path, + File.join(@root, "exe", "ruby-lsp-launcher"), + ) + stdin.sync = true + stdin.binmode + stdout.sync = true + stdout.binmode + stderr.sync = true + stderr.binmode + + send_message(stdin, { + id: 1, + method: "initialize", + params: { + initializationOptions: {}, + capabilities: { general: { positionEncodings: ["utf-8"] } }, + workspaceFolders: [{ uri: URI::Generic.from_path(path: workspace_path).to_s }], + }, + }) + send_message(stdin, { id: 2, method: "shutdown" }) + send_message(stdin, { method: "exit" }) + + # Wait until the process exits + wait_thr.join + + # If the child process failed, it is really difficult to diagnose what's happening unless we read what was printed + # to stderr + unless T.unsafe(wait_thr.value).success? + require "timeout" + + Timeout.timeout(5) do + flunk("Process failed\n#{stderr.read}") + end + end + + assert_path_exists(File.join(workspace_path, ".ruby-lsp", "Gemfile")) + assert_path_exists(File.join(workspace_path, ".ruby-lsp", "Gemfile.lock")) + refute_path_exists(File.join(workspace_path, ".ruby-lsp", "install_error")) + end + + def send_message(stdin, message) + json_message = message.to_json + stdin.write("Content-Length: #{json_message.bytesize}\r\n\r\n#{json_message}") + stdin.flush + end + + def in_temp_dir Dir.mktmpdir do |dir| Dir.chdir(dir) do - File.write(File.join(dir, "Gemfile"), <<~GEMFILE) - source "https://rubygems.org" - gem "ruby-lsp", path: "#{gem_path}" - GEMFILE - - Bundler.with_unbundled_env do - capture_subprocess_io do - system("bundle install") - - # Only do this after `bundle install` as to not change the lockfile - File.write(File.join(dir, "Gemfile"), <<~GEMFILE, mode: "a+") - # This causes ruby-lsp to run in its own directory without - # all the supplementary gems like rubocop - Dir.chdir("#{gem_path}") - GEMFILE - - yield - end + yield(dir) + end + end + end + + def in_isolation(&block) + gem_path = Bundler.root + in_temp_dir do |dir| + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gem "ruby-lsp", path: "#{gem_path}" + GEMFILE + + Bundler.with_unbundled_env do + capture_subprocess_io do + system("bundle install") + + # Only do this after `bundle install` as to not change the lockfile + File.write(File.join(dir, "Gemfile"), <<~GEMFILE, mode: "a+") + # This causes ruby-lsp to run in its own directory without + # all the supplementary gems like rubocop + Dir.chdir("#{gem_path}") + GEMFILE + + yield end end end diff --git a/test/requests/completion_test.rb b/test/requests/completion_test.rb index f1087c596a..245bc850be 100644 --- a/test/requests/completion_test.rb +++ b/test/requests/completion_test.rb @@ -1021,6 +1021,72 @@ def test_completion_addons end end + def test_completion_for_global_variables + source = <<~RUBY + $qar &&= 1 + $qaz += 1 + $qux ||= 1 + $quux, $qorge = 1 + $qoo = 1 + + $q + $LOAD + $ + RUBY + + with_server(source) do |server, uri| + index = server.instance_variable_get(:@global_state).index + RubyIndexer::RBSIndexer.new(index).index_ruby_core + + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 6, character: 2 }, + }) + + result = server.pop_response.response + assert_equal(["$qar", "$qaz", "$qux", "$quux", "$qorge", "$qoo"], result.map(&:label)) + + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 7, character: 5 }, + }) + + result = server.pop_response.response + assert_equal(["$LOADED_FEATURES", "$LOAD_PATH"], result.map(&:label)) + assert_equal(["global_variables.rbs", "global_variables.rbs"], result.map { _1.label_details.description }) + + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 8, character: 1 }, + }) + + result = server.pop_response.response + assert_operator(result.size, :>, 40) + end + end + + def test_completion_for_global_variables_show_only_uniq_entries + source = <<~RUBY + $qar &&= 1 + $qar += 1 + $qar ||= 1 + $q + RUBY + + with_server(source) do |server, uri| + index = server.instance_variable_get(:@global_state).index + RubyIndexer::RBSIndexer.new(index).index_ruby_core + + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 3, character: 2 }, + }) + + result = server.pop_response.response + assert_equal(["$qar"], result.map(&:label)) + end + end + def test_completion_for_instance_variables source = +<<~RUBY class Foo @@ -1431,6 +1497,78 @@ def test_guessed_type_name_is_only_included_for_guessed_types end end + def test_completion_for_private_methods + source = +<<~RUBY + class Foo + def bar + b + end + + private + + def baz + end + end + + foo = Foo.new + foo.b + RUBY + + with_server(source) do |server, uri| + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 2, character: 5 }, + }) + + result = server.pop_response.response + assert_includes(result.map(&:label), "baz") + + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 12, character: 5 }, + }) + + result = server.pop_response.response + refute_includes(result.map(&:label), "baz") + end + end + + def test_completion_for_protected_methods + source = +<<~RUBY + class Foo + def bar + b + end + + protected + + def baz + end + end + + foo = Foo.new + foo.b + RUBY + + with_server(source) do |server, uri| + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 2, character: 5 }, + }) + + result = server.pop_response.response + assert_includes(result.map(&:label), "baz") + + server.process_message(id: 1, method: "textDocument/completion", params: { + textDocument: { uri: uri }, + position: { line: 12, character: 5 }, + }) + + result = server.pop_response.response + refute_includes(result.map(&:label), "baz") + end + end + private def with_file_structure(server, &block) diff --git a/test/requests/definition_expectations_test.rb b/test/requests/definition_expectations_test.rb index 888d1871af..b74090c7bd 100644 --- a/test/requests/definition_expectations_test.rb +++ b/test/requests/definition_expectations_test.rb @@ -671,6 +671,86 @@ def baz end end + def test_definition_for_global_variables + source = <<~RUBY + $bar &&= 1 + $bar += 1 + $foo ||= 1 + $bar, $foo = 1 + $foo = 1 + $DEBUG + RUBY + + with_server(source) do |server, uri| + index = server.instance_variable_get(:@global_state).index + RubyIndexer::RBSIndexer.new(index).index_ruby_core + + server.process_message( + id: 1, + method: "textDocument/definition", + params: { textDocument: { uri: uri }, position: { character: 1, line: 0 } }, + ) + + response = server.pop_response.response + assert_equal(3, response.size) + assert_equal(0, response[0].range.start.line) + assert_equal(1, response[1].range.start.line) + assert_equal(3, response[2].range.start.line) + + server.process_message( + id: 1, + method: "textDocument/definition", + params: { textDocument: { uri: uri }, position: { character: 1, line: 2 } }, + ) + + response = server.pop_response.response + assert_equal(3, response.size) + assert_equal(2, response[0].range.start.line) + assert_equal(3, response[1].range.start.line) + assert_equal(4, response[2].range.start.line) + + server.process_message( + id: 1, + method: "textDocument/definition", + params: { textDocument: { uri: uri }, position: { character: 1, line: 5 } }, + ) + + response = server.pop_response.response.first + assert_match(%r{/gems/rbs-.*/core/global_variables.rbs}, response.uri) + assert_equal(response.range.start.line, response.range.end.line) + assert_operator(response.range.start.character, :<, response.range.end.character) + end + end + + def test_definition_apply_target_correction + source = <<~RUBY + $foo &&= 1 + $foo += 1 + $foo ||= 1 + $foo = 1 + class Foo + @foo &&= 1 + @foo += 1 + @foo ||= 1 + @foo = 1 + end + RUBY + + lines_with_target_correction = [0, 1, 2, 3, 5, 6, 7, 8] + + with_server(source) do |server, uri| + lines_with_target_correction.each do |line| + server.process_message( + id: 1, + method: "textDocument/definition", + params: { textDocument: { uri: uri }, position: { character: 7, line: line } }, + ) + + assert_empty(server.pop_response.response) + end + end + end + def test_definition_for_instance_variables source = <<~RUBY class Foo diff --git a/test/requests/hover_expectations_test.rb b/test/requests/hover_expectations_test.rb index a5f10b9df1..6b08c8d24c 100644 --- a/test/requests/hover_expectations_test.rb +++ b/test/requests/hover_expectations_test.rb @@ -60,6 +60,73 @@ def test_hovering_on_erb end end + def test_hovering_for_global_variables + source = <<~RUBY + # and write node + $bar &&= 1 + # operator write node + $baz += 1 + # or write node + $qux ||= 1 + # target write node + $quux, $corge = 1 + # write node + $foo = 1 + # read node + $DEBUG + RUBY + + expectations = [ + { line: 1, documentation: "and write node" }, + { line: 3, documentation: "operator write node" }, + { line: 5, documentation: "or write node" }, + { line: 7, documentation: "target write node" }, + { line: 9, documentation: "write node" }, + { line: 11, documentation: "The debug flag" }, + ] + + with_server(source) do |server, uri| + index = server.instance_variable_get(:@global_state).index + RubyIndexer::RBSIndexer.new(index).index_ruby_core + + expectations.each do |expectation| + server.process_message( + id: 1, + method: "textDocument/hover", + params: { textDocument: { uri: uri }, position: { line: expectation[:line], character: 1 } }, + ) + + assert_match(expectation[:documentation], server.pop_response.response.contents.value) + end + end + end + + def test_hover_apply_target_correction + source = <<~RUBY + $bar &&= 1 + $baz += 1 + $qux ||= 1 + $foo = 1 + RUBY + + lines_with_target_correction = [0, 1, 2, 3] + + with_server(source) do |server, uri| + lines_with_target_correction.each do |line| + server.process_message( + id: 1, + method: "textDocument/hover", + params: { + textDocument: { uri: uri }, + position: { line: line, character: 5 }, + }, + ) + + assert_nil(server.pop_response.response) + end + end + end + def test_hovering_precision source = <<~RUBY module Foo @@ -310,13 +377,13 @@ def bar end RUBY - # Going to definition on `argument` should not take you to the `foo` method definition with_server(source) do |server, uri| server.process_message( id: 1, method: "textDocument/hover", params: { textDocument: { uri: uri }, position: { character: 12, line: 5 } }, ) + # Hover on `argument` should not show you the `foo` documentation assert_nil(server.pop_response.response) server.process_message( diff --git a/test/requests/semantic_highlighting_expectations_test.rb b/test/requests/semantic_highlighting_expectations_test.rb index 52808842e2..48ec3059e3 100644 --- a/test/requests/semantic_highlighting_expectations_test.rb +++ b/test/requests/semantic_highlighting_expectations_test.rb @@ -67,7 +67,7 @@ class Post { delta_line: 1, delta_start_char: 2, length: 13, token_type: 13, token_modifiers: 0 }, decoded_response[1], ) - # This is the token modified by the addon + # This is the token modified by the add-on assert_equal( { delta_line: 1, delta_start_char: 2, length: 13, token_type: 15, token_modifiers: 1 }, decoded_response[2], diff --git a/test/server_test.rb b/test/server_test.rb index 29d6a6e1be..44e4696249 100644 --- a/test/server_test.rb +++ b/test/server_test.rb @@ -165,19 +165,6 @@ def test_server_info_includes_formatter assert_equal("rubocop", hash.dig("formatter")) end - def test_initialized_populates_index - capture_subprocess_io do - @server.process_message({ method: "initialized" }) - - assert_equal("$/progress", @server.pop_response.method) - assert_equal("$/progress", @server.pop_response.method) - assert_equal("$/progress", @server.pop_response.method) - assert_equal("$/progress", @server.pop_response.method) - - refute_empty(@server.global_state.index) - end - end - def test_initialized_recovers_from_indexing_failures @server.global_state.index.expects(:index_all).once.raises(StandardError, "boom!") capture_subprocess_io do @@ -670,6 +657,39 @@ def foo end end + def test_show_window_responses_are_redirected_to_addons + klass = Class.new(RubyLsp::Addon) do + def activate(global_state, outgoing_queue) + @activated = true + @settings = global_state.settings_for_addon(name) + end + + def deactivate; end + + def name + "My Add-on" + end + + def version + "0.1.0" + end + + def handle_window_show_message_response(title) + end + end + + begin + @server.load_addons + addon = RubyLsp::Addon.addons.find { |a| a.is_a?(klass) } + addon.expects(:handle_window_show_message_response).with("hello") + + @server.process_message(result: { method: "window/showMessageRequest", title: "hello", addon_name: "My Add-on" }) + ensure + RubyLsp::Addon.addons.clear + RubyLsp::Addon.addon_classes.clear + end + end + private def with_uninstalled_rubocop(&block) @@ -714,7 +734,7 @@ def version Class.new(RubyLsp::Addon) do def activate(global_state, outgoing_queue) - # simulates failed addon activation + # simulates failed add-on activation raise "boom" end diff --git a/test/setup_bundler_test.rb b/test/setup_bundler_test.rb index 4f4d742c0e..a9a3793dc7 100644 --- a/test/setup_bundler_test.rb +++ b/test/setup_bundler_test.rb @@ -5,14 +5,14 @@ require "ruby_lsp/setup_bundler" class SetupBundlerTest < Minitest::Test - def test_does_nothing_if_both_ruby_lsp_and_debug_are_in_the_bundle + def test_does_not_create_composed_gemfile_if_ruby_lsp_and_debug_are_in_the_bundle stub_bundle_with_env(bundle_env) Bundler::LockfileParser.any_instance.expects(:dependencies).returns({ "ruby-lsp" => true, "debug" => true }) run_script - refute_path_exists(".ruby-lsp") + refute_path_exists(".ruby-lsp/Gemfile") end - def test_does_nothing_if_both_ruby_lsp_and_debug_are_in_the_bundle2 + def test_does_not_create_composed_gemfile_if_all_gems_are_in_the_bundle_for_rails_apps stub_bundle_with_env(bundle_env) Bundler::LockfileParser.any_instance.expects(:dependencies).returns({ "ruby-lsp" => true, @@ -21,28 +21,7 @@ def test_does_nothing_if_both_ruby_lsp_and_debug_are_in_the_bundle2 "debug" => true, }) run_script - refute_path_exists(".ruby-lsp") - end - - def test_removes_ruby_lsp_folder_if_both_gems_were_added_to_the_bundle - stub_bundle_with_env(bundle_env) - Bundler::LockfileParser.any_instance.expects(:dependencies).returns({ "ruby-lsp" => true, "debug" => true }) - FileUtils.mkdir(".ruby-lsp") - run_script - refute_path_exists(".ruby-lsp") - ensure - FileUtils.rm_r(".ruby-lsp") if Dir.exist?(".ruby-lsp") - end - - def test_in_a_rails_app_removes_ruby_lsp_folder_if_all_gems_were_added_to_the_bundle - stub_bundle_with_env(bundle_env) - Bundler::LockfileParser.any_instance.expects(:dependencies) - .returns({ "ruby-lsp" => true, "ruby-lsp-rails" => true, "debug" => true }) - FileUtils.mkdir(".ruby-lsp") - run_script - refute_path_exists(".ruby-lsp") - ensure - FileUtils.rm_r(".ruby-lsp") if Dir.exist?(".ruby-lsp") + refute_path_exists(".ruby-lsp/Gemfile") end def test_creates_custom_bundle @@ -150,7 +129,7 @@ def test_does_not_copy_gemfile_lock_when_not_modified Bundler.with_unbundled_env do stub_bundle_with_env( bundle_env(dir, ".ruby-lsp/Gemfile"), - "((bundle check && bundle update ruby-lsp debug) || bundle install) 1>&2", + /((bundle _[\d\.]+_ check && bundle _[\d\.]+_ update ruby-lsp debug) || bundle _[\d\.]+_ install) 1>&2/, ) FileUtils.expects(:cp).never @@ -241,7 +220,7 @@ def test_raises_if_bundle_is_not_locked end end - def test_does_nothing_if_both_ruby_lsp_and_debug_are_gemspec_dependencies + def test_does_not_create_composed_gemfile_if_both_ruby_lsp_and_debug_are_gemspec_dependencies Dir.mktmpdir do |dir| Dir.chdir(dir) do # Write a fake Gemfile and gemspec @@ -279,7 +258,7 @@ def test_does_nothing_if_both_ruby_lsp_and_debug_are_gemspec_dependencies run_script(dir) end - refute_path_exists(".ruby-lsp") + refute_path_exists(".ruby-lsp/Gemfile") end end end @@ -416,6 +395,54 @@ def test_ensures_lockfile_remotes_are_relative_to_default_gemfile end end + def test_ensures_lockfile_remotes_are_absolute_in_projects_with_nested_gems + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + # frozen_string_literal: true + source "https://rubygems.org" + gem "nested", path: "gems/nested" + GEMFILE + + FileUtils.mkdir_p(File.join(dir, "gems", "nested", "lib")) + + File.write(File.join(dir, "gems", "nested", "nested.gemspec"), <<~GEMSPEC) + Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = "nested" + s.version = "1.0.0" + s.summary = "Nested gemspec" + s.description = "Nested gemspec" + s.license = "MIT" + s.author = "User" + s.email = "user@example.com" + s.homepage = "https://rubyonrails.org" + s.files = Dir[] + s.require_path = "lib" + end + GEMSPEC + + File.write(File.join(dir, "gems", "nested", "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gemspec + GEMFILE + + real_path = File.realpath(dir) + + Bundler.with_unbundled_env do + capture_subprocess_io do + system("bundle install") + run_script(real_path) + end + end + + assert_path_exists(".ruby-lsp") + assert_path_exists(".ruby-lsp/Gemfile.lock") + assert_match("remote: #{File.join(real_path, "gems", "nested")}", File.read(".ruby-lsp/Gemfile.lock")) + end + end + end + def test_ruby_lsp_rails_is_automatically_included_in_rails_apps Dir.mktmpdir do |dir| FileUtils.mkdir("#{dir}/config") @@ -593,6 +620,172 @@ def test_uses_correct_bundler_env_when_there_is_bundle_config end end + def test_sets_bundler_version_to_avoid_reloads + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + # Write the main Gemfile and lockfile with valid versions + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gem "stringio" + GEMFILE + + lockfile_contents = <<~LOCKFILE + GEM + remote: https://rubygems.org/ + specs: + stringio (3.1.0) + + PLATFORMS + arm64-darwin-23 + ruby + + DEPENDENCIES + stringio + + BUNDLED WITH + 2.5.7 + LOCKFILE + File.write(File.join(dir, "Gemfile.lock"), lockfile_contents) + + Bundler.with_unbundled_env do + env = run_script(dir) + assert_equal("2.5.7", env["BUNDLER_VERSION"]) + end + + lockfile_parser = Bundler::LockfileParser.new(File.read(File.join(dir, ".ruby-lsp", "Gemfile.lock"))) + assert_equal("2.5.7", lockfile_parser.bundler_version.to_s) + end + end + end + + def test_invoke_cli_calls_bundler_directly_for_install + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.write(File.join(dir, "gems.rb"), <<~GEMFILE) + source "https://rubygems.org" + gem "irb" + GEMFILE + + Bundler.with_unbundled_env do + capture_subprocess_io do + system("bundle install") + + mock_install = mock("install") + mock_install.expects(:run) + Bundler::CLI::Install.expects(:new).with({}).returns(mock_install) + RubyLsp::SetupBundler.new(dir, launcher: true).setup! + end + end + end + end + end + + def test_invoke_cli_calls_bundler_directly_for_update + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gem "rdoc" + GEMFILE + + capture_subprocess_io do + Bundler.with_unbundled_env do + # Run bundle install to generate the lockfile + system("bundle install") + + # Run the script once to generate a custom bundle + run_script(dir) + end + end + + capture_subprocess_io do + Bundler.with_unbundled_env do + mock_update = mock("update") + mock_update.expects(:run) + require "bundler/cli/update" + Bundler::CLI::Update.expects(:new).with( + { conservative: true }, + ["ruby-lsp", "debug", "prism"], + ).returns(mock_update) + RubyLsp::SetupBundler.new(dir, launcher: true).setup! + end + end + end + end + end + + def test_progress_is_printed_to_stderr + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gem "rdoc" + GEMFILE + + Bundler.with_unbundled_env do + capture_subprocess_io do + # Run bundle install to generate the lockfile + system("bundle install") + end + + stdout, stderr = capture_subprocess_io do + RubyLsp::SetupBundler.new(dir, launcher: true).setup! + end + + assert_match(/Bundle complete! [\d]+ Gemfile dependencies, [\d]+ gems now installed/, stderr) + assert_empty(stdout) + end + end + end + end + + def test_succeeds_when_using_ssh_git_sources_instead_of_https + Dir.mktmpdir do |dir| + Dir.chdir(dir) do + File.write(File.join(dir, "Gemfile"), <<~GEMFILE) + source "https://rubygems.org" + gem "rbi", git: "git@github.com:Shopify/rbi.git", branch: "main" + GEMFILE + + File.write(File.join(dir, "Gemfile.lock"), <<~LOCKFILE) + GIT + remote: git@github.com:Shopify/rbi.git + revision: d2e59a207c0b2f07d9bbaf1eb4b6d2500a4782ea + branch: main + specs: + rbi (0.2.1) + prism (~> 1.0) + sorbet-runtime (>= 0.5.9204) + + GEM + remote: https://rubygems.org/ + specs: + prism (1.2.0) + sorbet-runtime (0.5.11630) + + PLATFORMS + arm64-darwin-23 + ruby + + DEPENDENCIES + rbi! + + BUNDLED WITH + 2.5.22 + LOCKFILE + + Bundler.with_unbundled_env do + capture_subprocess_io do + stub_bundle_with_env(bundle_env(dir, ".ruby-lsp/Gemfile")) + run_script(dir) + end + end + + assert_match("remote: git@github.com:Shopify/rbi.git", File.read(".ruby-lsp/Gemfile.lock")) + end + end + end + private def with_default_external_encoding(encoding, &block) @@ -635,10 +828,13 @@ def run_script(path = Dir.pwd, expected_path: nil, **options) # This method needs to be called inside the `Bundler.with_unbundled_env` block IF the command you want to test is # inside it. - def stub_bundle_with_env(env, command = "(bundle check || bundle install) 1>&2") + def stub_bundle_with_env( + env, + command = /(bundle check _[\d\.]+_ || bundle _[\d\.]+_ install) 1>&2/ + ) Object.any_instance.expects(:system).with do |actual_env, actual_command| - actual_env.delete_if { |k, _v| k.start_with?("BUNDLE_PKGS") } - actual_env.all? { |k, v| env[k] == v } && actual_command == command + actual_env.delete_if { |k, _v| k.start_with?("BUNDLE_PKGS") || k == "BUNDLER_VERSION" } + actual_env.all? { |k, v| env[k] == v } && actual_command.match?(command) end.returns(true) end diff --git a/test/type_inferrer_test.rb b/test/type_inferrer_test.rb index 366e0363df..123786099c 100644 --- a/test/type_inferrer_test.rb +++ b/test/type_inferrer_test.rb @@ -249,7 +249,7 @@ class User assert_equal("Admin::User", @type_inferrer.infer_receiver_type(node_context).name) end - def test_infer_forwading_super_receiver + def test_infer_forwarding_super_receiver node_context = index_and_locate(<<~RUBY, { line: 2, character: 4 }) class Foo < Bar def initialize diff --git a/vscode/README.md b/vscode/README.md index b7eba49537..e6f6dff3c0 100644 --- a/vscode/README.md +++ b/vscode/README.md @@ -469,10 +469,9 @@ To configure indexing, pass a JSON hash as part of the Ruby LSP configuration, f // PROJECT/.vscode/settings.json { "rubyLsp.indexing": { - "excludedPatterns": ["**/test/**.rb"], - "includedPatterns": ["**/bin/**"], + "excludedPatterns": ["**/test/**/*.rb"], + "includedPatterns": ["**/bin/**/*"], "excludedGems": ["rubocop", "rubocop-performance"], - "includedPatterns": ["rake"], "excludedMagicComments": ["compiled:true"], }, } diff --git a/vscode/grammars/ruby.cson.json b/vscode/grammars/ruby.cson.json index 7be523fa86..2c7b83a0ca 100644 --- a/vscode/grammars/ruby.cson.json +++ b/vscode/grammars/ruby.cson.json @@ -109,20 +109,23 @@ "name": "keyword.operator.assignment.augmented.ruby" } }, - "match": "^\\s*([a-z]([A-Za-z0-9_])*)\\s*(&&=)", - "comment": "A local variable and assignment" + "match": "^\\s*([a-z]([A-Za-z0-9_])*)\\s*((&&|\\|\\|)=)", + "comment": "A local variable and/or assignment" }, { "captures": { "1": { - "name": "variable.ruby" + "name": "keyword.control.ruby" }, "3": { + "name": "variable.ruby" + }, + "5": { "name": "keyword.operator.assignment.augmented.ruby" } }, - "match": "^\\s*([a-z]([A-Za-z0-9_])*)\\s*(\\|\\|=)", - "comment": "A local variable or assignment" + "match": "(?>)=)", "comment": "A local variable operation assignment (+=, -=, *=, /=)" }, + { + "captures": { + "1": { + "name": "keyword.control.ruby" + }, + "3": { + "name": "variable.ruby" + }, + "5": { + "name": "keyword.operator.assignment.augmented.ruby" + } + }, + "match": "(?>)=)", + "comment": "A local variable operation assignment in a condition" + }, { "captures": { "1": { @@ -145,6 +163,18 @@ "match": "^\\s*([a-z]([A-Za-z0-9_])*)\\s*=[^=>]", "comment": "A local variable assignment" }, + { + "captures": { + "1": { + "name": "keyword.control.ruby" + }, + "3": { + "name": "variable.ruby" + } + }, + "match": "(?]", + "comment": "A local variable assignment in a condition" + }, { "captures": { "1": { diff --git a/vscode/package.json b/vscode/package.json index 5826c3eb48..a43474426b 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -2,7 +2,7 @@ "name": "ruby-lsp", "displayName": "Ruby LSP", "description": "VS Code plugin for connecting with the Ruby LSP", - "version": "0.8.2", + "version": "0.8.13", "publisher": "Shopify", "repository": { "type": "git", @@ -26,6 +26,9 @@ "workspaceContains:gems.locked", "onView:dependencies" ], + "extensionDependencies": [ + "vscode.git" + ], "main": "./out/extension.js", "contributes": { "chatParticipants": [ @@ -334,6 +337,10 @@ ], "default": "auto" }, + "asdfExecutablePath": { + "description": "The path to the asdf executable script, if not installed on one of the standard locations", + "type": "string" + }, "miseExecutablePath": { "description": "The path to the Mise executable, if not installed in ~/.local/bin/mise", "type": "string" @@ -466,6 +473,26 @@ "description": "Enable ERB support. This can only work with server versions v0.17.5 or above", "type": "boolean", "default": true + }, + "rubyLsp.useLauncher": { + "description": "[EXPERIMENTAL] Uses server launcher for gracefully handling missing dependencies.", + "type": "boolean", + "default": false + }, + "rubyLsp.featureFlags": { + "description": "Allows opting in or out of feature flags", + "type": "object", + "properties": { + "all": { + "description": "Opt-into all available feature flags", + "type": "boolean" + }, + "tapiocaAddon": { + "description": "Opt-in/out of the Tapioca add-on", + "type": "boolean" + } + }, + "default": {} } } }, @@ -700,29 +727,29 @@ "ws": ">= 7.4.6" }, "devDependencies": { - "@babel/core": "^7.25.2", + "@babel/core": "^7.26.0", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "^9.11.1", + "@eslint/js": "^9.14.0", "@shopify/eslint-plugin": "^46.0.0", "@shopify/prettier-config": "^1.1.2", "@types/glob": "^8.1.0", - "@types/mocha": "^10.0.8", + "@types/mocha": "^10.0.9", "@types/node": "22.x", "@types/sinon": "^17.0.3", "@types/vscode": "^1.91.0", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", "@vscode/test-electron": "^2.4.1", - "@vscode/vsce": "^3.1.0", + "@vscode/vsce": "^3.2.1", "esbuild": "^0.24.0", "eslint": "^8.57.0", "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-prettier": "^5.2.1", "glob": "^11.0.0", - "mocha": "^10.7.3", - "ovsx": "^0.9.5", + "mocha": "^10.8.2", + "ovsx": "^0.10.0", "prettier": "^3.3.3", - "typescript": "^5.6.2", + "typescript": "^5.6.3", "sinon": "^19.0.2", "vscode-oniguruma": "^2.0.1", "vscode-textmate": "^9.1.0" diff --git a/vscode/src/client.ts b/vscode/src/client.ts index c833dc0bf2..49263d4155 100644 --- a/vscode/src/client.ts +++ b/vscode/src/client.ts @@ -35,12 +35,31 @@ import { ClientInterface, Addon, SUPPORTED_LANGUAGE_IDS, + FEATURE_FLAGS, + featureEnabled, } from "./common"; import { Ruby } from "./ruby"; import { WorkspaceChannel } from "./workspaceChannel"; type EnabledFeatures = Record; +interface ServerErrorTelemetryEvent { + type: "error"; + errorMessage: string; + errorClass: string; + stack: string; +} + +type ServerTelemetryEvent = ServerErrorTelemetryEvent; + +function enabledFeatureFlags() { + const allKeys = Object.keys(FEATURE_FLAGS) as (keyof typeof FEATURE_FLAGS)[]; + + return allKeys.map((key) => { + return { [key]: featureEnabled(key) }; + }); +} + // Get the executables to start the server based on the user's configuration function getLspExecutables( workspaceFolder: vscode.WorkspaceFolder, @@ -53,6 +72,7 @@ function getLspExecutables( const customBundleGemfile: string = config.get("bundleGemfile")!; const useBundlerCompose: boolean = config.get("useBundlerCompose")!; const bypassTypechecker: boolean = config.get("bypassTypechecker")!; + const useLauncher: boolean = config.get("useLauncher")!; const executableOptions: ExecutableOptions = { cwd: workspaceFolder.uri.fsPath, @@ -89,17 +109,25 @@ function getLspExecutables( options: executableOptions, }; } else { - const argsWithBranch = branch.length > 0 ? ["--branch", branch] : []; + const args = []; + + if (branch.length > 0) { + args.push("--branch", branch); + } + + if (useLauncher) { + args.push("--use-launcher"); + } run = { command: "ruby-lsp", - args: argsWithBranch, + args, options: executableOptions, }; debug = { command: "ruby-lsp", - args: argsWithBranch.concat(["--debug"]), + args: args.concat(["--debug"]), options: executableOptions, }; } @@ -113,6 +141,7 @@ function collectClientOptions( outputChannel: WorkspaceChannel, ruby: Ruby, isMainWorkspace: boolean, + telemetry: vscode.TelemetryLogger, ): LanguageClientOptions { const pullOn: "change" | "save" | "both" = configuration.get("pullDiagnosticsOn")!; @@ -126,6 +155,11 @@ function collectClientOptions( const enabledFeatures = Object.keys(features).filter((key) => features[key]); const fsPath = workspaceFolder.uri.fsPath.replace(/\/$/, ""); + + // For each workspace, the language client is responsible for handling requests for: + // 1. Files inside of the workspace itself + // 2. Bundled gems + // 3. Default gems let documentSelector: DocumentSelector = SUPPORTED_LANGUAGE_IDS.map( (language) => { return { language, pattern: `${fsPath}/**/*` }; @@ -143,27 +177,28 @@ function collectClientOptions( }); } - // For each workspace, the language client is responsible for handling requests for: - // 1. Files inside of the workspace itself - // 2. Bundled gems - // 3. Default gems - - if (ruby.env.GEM_PATH) { - const parts = ruby.env.GEM_PATH.split(path.delimiter); + ruby.gemPath.forEach((gemPath) => { + documentSelector.push({ + language: "ruby", + pattern: `${gemPath}/**/*`, + }); - // Because of how default gems are installed, the entry in the `GEM_PATH` is actually not exactly where the files - // are located. With the regex, we are correcting the default gem path from this (where the files are not located) + // Because of how default gems are installed, the gemPath location is actually not exactly where the files are + // located. With the regex, we are correcting the default gem path from this (where the files are not located) // /opt/rubies/3.3.1/lib/ruby/gems/3.3.0 // // to this (where the files are actually stored) // /opt/rubies/3.3.1/lib/ruby/3.3.0 - parts.forEach((gemPath) => { + // + // Notice that we still need to add the regular path to the selector because some version managers will install gems + // under the non-corrected path + if (/lib\/ruby\/gems\/(?=\d)/.test(gemPath)) { documentSelector.push({ language: "ruby", pattern: `${gemPath.replace(/lib\/ruby\/gems\/(?=\d)/, "lib/ruby/")}/**/*`, }); - }); - } + } + }); // This is a temporary solution as an escape hatch for users who cannot upgrade the `ruby-lsp` gem to a version that // supports ERB @@ -180,7 +215,7 @@ function collectClientOptions( outputChannel, revealOutputChannelOn: RevealOutputChannelOn.Never, diagnosticPullOptions, - errorHandler: new ClientErrorHandler(workspaceFolder), + errorHandler: new ClientErrorHandler(workspaceFolder, telemetry), initializationOptions: { enabledFeatures, experimentalFeaturesEnabled: configuration.get( @@ -191,15 +226,21 @@ function collectClientOptions( linters: configuration.get("linters"), indexing: configuration.get("indexing"), addonSettings: configuration.get("addonSettings"), + enabledFeatureFlags: enabledFeatureFlags(), }, }; } class ClientErrorHandler implements ErrorHandler { private readonly workspaceFolder: vscode.WorkspaceFolder; + private readonly telemetry: vscode.TelemetryLogger; - constructor(workspaceFolder: vscode.WorkspaceFolder) { + constructor( + workspaceFolder: vscode.WorkspaceFolder, + telemetry: vscode.TelemetryLogger, + ) { this.workspaceFolder = workspaceFolder; + this.telemetry = telemetry; } error( @@ -211,6 +252,19 @@ class ClientErrorHandler implements ErrorHandler { } async closed(): Promise { + const label = vscode.workspace + .getConfiguration("rubyLsp") + .get("useLauncher") + ? "launcher" + : "direct"; + + this.telemetry.logUsage("ruby_lsp.launch_failure", { + type: "counter", + attributes: { + label, + }, + }); + const answer = await vscode.window.showErrorMessage( `Launching the Ruby LSP failed. This typically happens due to an error with version manager integration or Bundler issues. @@ -255,6 +309,7 @@ export default class Client extends LanguageClient implements ClientInterface { public readonly ruby: Ruby; public serverVersion?: string; public addons?: Addon[]; + public degraded = false; private readonly workingDirectory: string; private readonly telemetry: vscode.TelemetryLogger; private readonly createTestItems: (response: CodeLens[]) => void; @@ -285,6 +340,7 @@ export default class Client extends LanguageClient implements ClientInterface { outputChannel, ruby, isMainWorkspace, + telemetry, ), debugMode, ); @@ -313,11 +369,29 @@ export default class Client extends LanguageClient implements ClientInterface { params.textDocument.text, ); }); + + this.onTelemetry((event: ServerTelemetryEvent) => { + if (event.type === "error") { + this.telemetry.logError( + { + message: event.errorMessage, + name: event.errorClass, + stack: event.stack, + }, + { serverVersion: this.serverVersion }, + ); + } + }); } async afterStart() { this.#formatter = this.initializeResult?.formatter; this.serverVersion = this.initializeResult?.serverInfo?.version; + + if (this.initializeResult?.degraded_mode) { + this.degraded = this.initializeResult?.degraded_mode; + } + await this.fetchAddons(); } @@ -423,7 +497,13 @@ export default class Client extends LanguageClient implements ClientInterface { name: errorClass, stack, }, - { ...error.data, serverVersion: this.serverVersion }, + { + ...error.data, + serverVersion: this.serverVersion, + workspace: new vscode.TelemetryTrustedValue( + this.workingDirectory, + ), + }, ); } } diff --git a/vscode/src/common.ts b/vscode/src/common.ts index 0ac408dd97..61787bb06a 100644 --- a/vscode/src/common.ts +++ b/vscode/src/common.ts @@ -1,4 +1,5 @@ import { exec } from "child_process"; +import { createHash } from "crypto"; import { promisify } from "util"; import * as vscode from "vscode"; @@ -48,6 +49,7 @@ export interface ClientInterface { formatter: string; addons?: Addon[]; serverVersion?: string; + degraded: boolean; sendRequest( method: string, param: any, @@ -73,6 +75,15 @@ export const LOG_CHANNEL = vscode.window.createOutputChannel(LSP_NAME, { }); export const SUPPORTED_LANGUAGE_IDS = ["ruby", "erb"]; +// A list of feature flags where the key is the name and the value is the rollout percentage. +// +// Note: names added here should also be added to the `rubyLsp.optedOutFeatureFlags` enum in the `package.json` file +export const FEATURE_FLAGS = { + tapiocaAddon: 0.0, +}; + +type FeatureFlagConfigurationKey = keyof typeof FEATURE_FLAGS | "all"; + // Creates a debounced version of a function with the specified delay. If the function is invoked before the delay runs // out, then the previous invocation of the function gets cancelled and a new one is scheduled. // @@ -98,3 +109,37 @@ export function debounce(fn: (...args: any[]) => Promise, delay: number) { }); }; } + +// Check if the given feature is enabled for the current user given the configured rollout percentage +export function featureEnabled(feature: keyof typeof FEATURE_FLAGS): boolean { + const flagConfiguration = vscode.workspace + .getConfiguration("rubyLsp") + .get< + Record + >("featureFlags")!; + + // If the user opted out of this feature, return false. We explicitly check for `false` because `undefined` means + // nothing was configured + if (flagConfiguration[feature] === false || flagConfiguration.all === false) { + return false; + } + + // If the user opted-in to all features, return true + if (flagConfiguration.all) { + return true; + } + + const percentage = FEATURE_FLAGS[feature]; + const machineId = vscode.env.machineId; + // Create a digest of the concatenated machine ID and feature name, which will generate a unique hash for this + // user-feature combination + const hash = createHash("sha256") + .update(`${machineId}-${feature}`) + .digest("hex"); + + // Convert the first 8 characters of the hash to a number between 0 and 1 + const hashNum = parseInt(hash.substring(0, 8), 16) / 0xffffffff; + + // If that number is below the percentage, then the feature is enabled for this user + return hashNum < percentage; +} diff --git a/vscode/src/infoCollector.ts b/vscode/src/infoCollector.ts index 4198a79e8a..9efc46006a 100644 --- a/vscode/src/infoCollector.ts +++ b/vscode/src/infoCollector.ts @@ -53,7 +53,7 @@ async function gatherLspInfo( "Ruby LSP Addons": rubyLspAddons, "Ruby Version": workspace.ruby.rubyVersion ?? "Unknown", "Ruby Version Manager": workspace.ruby.versionManager.identifier, - "Installed Extensions": extensions, + "Installed Extensions": extensions.sort(), "Ruby LSP Settings": { Workspace: workspaceSpecificSettings, User: userSettings, diff --git a/vscode/src/ruby.ts b/vscode/src/ruby.ts index 8ba6d502fe..f06786d838 100644 --- a/vscode/src/ruby.ts +++ b/vscode/src/ruby.ts @@ -39,6 +39,7 @@ export class Ruby implements RubyInterface { // This property indicates that Ruby has been compiled with YJIT support and that we're running on a Ruby version // where it will be activated, either by the extension or by the server public yjitEnabled?: boolean; + readonly gemPath: string[] = []; private readonly workspaceFolder: vscode.WorkspaceFolder; #versionManager: ManagerConfiguration = vscode.workspace .getConfiguration("rubyLsp") @@ -50,15 +51,18 @@ export class Ruby implements RubyInterface { private readonly context: vscode.ExtensionContext; private readonly customBundleGemfile?: string; private readonly outputChannel: WorkspaceChannel; + private readonly telemetry: vscode.TelemetryLogger; constructor( context: vscode.ExtensionContext, workspaceFolder: vscode.WorkspaceFolder, outputChannel: WorkspaceChannel, + telemetry: vscode.TelemetryLogger, ) { this.context = context; this.workspaceFolder = workspaceFolder; this.outputChannel = outputChannel; + this.telemetry = telemetry; const customBundleGemfile: string = vscode.workspace .getConfiguration("rubyLsp") @@ -124,6 +128,10 @@ export class Ruby implements RubyInterface { try { await this.runManagerActivation(); } catch (error: any) { + this.telemetry.logError(error, { + versionManager: this.versionManager.identifier, + }); + // If an error occurred and a global Ruby path is configured, then we can try to fallback to that const globalRubyPath = vscode.workspace .getConfiguration("rubyLsp") @@ -201,7 +209,7 @@ export class Ruby implements RubyInterface { } private async runActivation(manager: VersionManager) { - const { env, version, yjit } = await manager.activate(); + const { env, version, yjit, gemPath } = await manager.activate(); const [major, minor, _patch] = version.split(".").map(Number); this.sanitizeEnvironment(env); @@ -211,6 +219,7 @@ export class Ruby implements RubyInterface { this._env = env; this.rubyVersion = version; this.yjitEnabled = (yjit && major > 3) || (major === 3 && minor >= 2); + this.gemPath.push(...gemPath); } // Fetch information related to the Ruby version. This can only be invoked after activation, so that `rubyVersion` is diff --git a/vscode/src/ruby/asdf.ts b/vscode/src/ruby/asdf.ts index 6ed9bbf89d..aabb7b1006 100644 --- a/vscode/src/ruby/asdf.ts +++ b/vscode/src/ruby/asdf.ts @@ -21,6 +21,7 @@ export class Asdf extends VersionManager { env: { ...process.env, ...parsedResult.env }, yjit: parsedResult.yjit, version: parsedResult.version, + gemPath: parsedResult.gemPath, }; } @@ -29,6 +30,24 @@ export class Asdf extends VersionManager { const scriptName = path.basename(vscode.env.shell) === "fish" ? "asdf.fish" : "asdf.sh"; + const config = vscode.workspace.getConfiguration("rubyLsp"); + const asdfPath = config.get( + "rubyVersionManager.asdfExecutablePath", + ); + + if (asdfPath) { + const configuredPath = vscode.Uri.file(asdfPath); + + try { + await vscode.workspace.fs.stat(configuredPath); + return configuredPath; + } catch (error: any) { + throw new Error( + `ASDF executable configured as ${configuredPath}, but that file doesn't exist`, + ); + } + } + // Possible ASDF installation paths as described in https://asdf-vm.com/guide/getting-started.html#_3-install-asdf. // In order, the methods of installation are: // 1. Git diff --git a/vscode/src/ruby/chruby.ts b/vscode/src/ruby/chruby.ts index 6048ca30a5..cabb26ee08 100644 --- a/vscode/src/ruby/chruby.ts +++ b/vscode/src/ruby/chruby.ts @@ -70,6 +70,7 @@ export class Chruby extends VersionManager { env: { ...process.env, ...rubyEnv }, yjit, version, + gemPath: [gemHome, defaultGems], }; } diff --git a/vscode/src/ruby/custom.ts b/vscode/src/ruby/custom.ts index 85e5e76747..d7126385cd 100644 --- a/vscode/src/ruby/custom.ts +++ b/vscode/src/ruby/custom.ts @@ -18,6 +18,7 @@ export class Custom extends VersionManager { env: { ...process.env, ...parsedResult.env }, yjit: parsedResult.yjit, version: parsedResult.version, + gemPath: parsedResult.gemPath, }; } diff --git a/vscode/src/ruby/mise.ts b/vscode/src/ruby/mise.ts index 6b01a4bbdb..3695b2677a 100644 --- a/vscode/src/ruby/mise.ts +++ b/vscode/src/ruby/mise.ts @@ -21,6 +21,7 @@ export class Mise extends VersionManager { env: { ...process.env, ...parsedResult.env }, yjit: parsedResult.yjit, version: parsedResult.version, + gemPath: parsedResult.gemPath, }; } diff --git a/vscode/src/ruby/none.ts b/vscode/src/ruby/none.ts index 0bc8607bdd..faea1690f7 100644 --- a/vscode/src/ruby/none.ts +++ b/vscode/src/ruby/none.ts @@ -32,6 +32,7 @@ export class None extends VersionManager { env: { ...process.env, ...parsedResult.env }, yjit: parsedResult.yjit, version: parsedResult.version, + gemPath: parsedResult.gemPath, }; } } diff --git a/vscode/src/ruby/rbenv.ts b/vscode/src/ruby/rbenv.ts index 6c09554466..b58d9cfeec 100644 --- a/vscode/src/ruby/rbenv.ts +++ b/vscode/src/ruby/rbenv.ts @@ -1,4 +1,5 @@ /* eslint-disable no-process-env */ +import * as vscode from "vscode"; import { VersionManager, ActivationResult } from "./versionManager"; @@ -7,12 +8,20 @@ import { VersionManager, ActivationResult } from "./versionManager"; // Learn more: https://github.com/rbenv/rbenv export class Rbenv extends VersionManager { async activate(): Promise { - const parsedResult = await this.runEnvActivationScript("rbenv exec ruby"); + const rbenvExec = await this.findExec( + [vscode.Uri.file("/opt/homebrew/bin"), vscode.Uri.file("/usr/local/bin")], + "rbenv", + ); + + const parsedResult = await this.runEnvActivationScript( + `${rbenvExec} exec ruby`, + ); return { env: { ...process.env, ...parsedResult.env }, yjit: parsedResult.yjit, version: parsedResult.version, + gemPath: parsedResult.gemPath, }; } } diff --git a/vscode/src/ruby/rvm.ts b/vscode/src/ruby/rvm.ts index 7a18b2d1f9..94c28c89cf 100644 --- a/vscode/src/ruby/rvm.ts +++ b/vscode/src/ruby/rvm.ts @@ -26,6 +26,7 @@ export class Rvm extends VersionManager { env: { ...process.env, ...parsedResult.env }, yjit: parsedResult.yjit, version: parsedResult.version, + gemPath: parsedResult.gemPath, }; } diff --git a/vscode/src/ruby/shadowenv.ts b/vscode/src/ruby/shadowenv.ts index e1dd5f4321..0f03cfcf06 100644 --- a/vscode/src/ruby/shadowenv.ts +++ b/vscode/src/ruby/shadowenv.ts @@ -22,49 +22,55 @@ export class Shadowenv extends VersionManager { ); } + const shadowenvExec = await this.findExec( + [vscode.Uri.file("/opt/homebrew/bin")], + "shadowenv", + ); + try { const parsedResult = await this.runEnvActivationScript( - "shadowenv exec -- ruby", + `${shadowenvExec} exec -- ruby`, ); return { env: { ...process.env, ...parsedResult.env }, yjit: parsedResult.yjit, version: parsedResult.version, + gemPath: parsedResult.gemPath, }; } catch (error: any) { - const { stdout } = await this.runScript("command -v shadowenv"); - - if (stdout.trim().length === 0) { - const answer = await vscode.window.showErrorMessage( - `Couldn't find shadowenv executable. Double-check that it's installed and that it's in your PATH.`, - "Reload window", - "Cancel", - ); - - if (answer === "Reload window") { - return vscode.commands.executeCommand( - "workbench.action.reloadWindow", - ); - } - } else { - // If running `shadowev exec` fails, it's typically because the workspace has not been trusted yet. Here we - // offer to trust it and fail it the user decides to not the trust the workspace (since in that case, we are - // unable to activate the Ruby environment). + // If the workspace is untrusted, offer to trust it for the user + if (error.message.includes("untrusted shadowenv program")) { const answer = await vscode.window.showErrorMessage( - `Failed to run shadowenv. Is ${this.bundleUri.fsPath} trusted? Run 'shadowenv trust --help' to know more`, + `Tried to activate Shadowenv, but the workspace is untrusted. + Workspaces must be trusted to before allowing Shadowenv to load the environment for security reasons.`, "Trust workspace", - "Cancel", + "Shutdown Ruby LSP", ); if (answer === "Trust workspace") { await asyncExec("shadowenv trust", { cwd: this.bundleUri.fsPath }); return this.activate(); } + + throw new Error( + "Cannot activate Ruby environment in an untrusted workspace", + ); + } + + try { + await asyncExec("shadowenv --version"); + } catch (_error: any) { + throw new Error( + `Shadowenv executable not found. Ensure it is installed and available in the PATH. + This error may happen if your shell configuration is failing to be sourced from the editor or if + another extension is mutating the process PATH.`, + ); } + // If it failed for some other reason, present the error to the user throw new Error( - "Cannot activate Ruby environment in an untrusted workspace", + `Failed to activate Ruby environment with Shadowenv: ${error.message}`, ); } } diff --git a/vscode/src/ruby/versionManager.ts b/vscode/src/ruby/versionManager.ts index a0bbe69e79..506fc8a0c0 100644 --- a/vscode/src/ruby/versionManager.ts +++ b/vscode/src/ruby/versionManager.ts @@ -11,6 +11,7 @@ export interface ActivationResult { env: NodeJS.ProcessEnv; yjit: boolean; version: string; + gemPath: string[]; } export const ACTIVATION_SEPARATOR = "RUBY_LSP_ACTIVATION_SEPARATOR"; @@ -18,7 +19,7 @@ export const ACTIVATION_SEPARATOR = "RUBY_LSP_ACTIVATION_SEPARATOR"; export abstract class VersionManager { public activationScript = [ `STDERR.print("${ACTIVATION_SEPARATOR}" + `, - "{ env: ENV.to_h, yjit: !!defined?(RubyVM:: YJIT), version: RUBY_VERSION }.to_json + ", + "{ env: ENV.to_h, yjit: !!defined?(RubyVM::YJIT), version: RUBY_VERSION, gemPath: Gem.path }.to_json + ", `"${ACTIVATION_SEPARATOR}")`, ].join(""); @@ -104,4 +105,23 @@ export abstract class VersionManager { env: process.env, }); } + + // Tries to find `execName` within the given directories. Prefers the executables found in the given directories over + // finding the executable in the PATH + protected async findExec(directories: vscode.Uri[], execName: string) { + for (const uri of directories) { + try { + const fullUri = vscode.Uri.joinPath(uri, execName); + await vscode.workspace.fs.stat(fullUri); + this.outputChannel.info( + `Found ${execName} executable at ${uri.fsPath}`, + ); + return fullUri.fsPath; + } catch (error: any) { + // continue searching + } + } + + return execName; + } } diff --git a/vscode/src/rubyLsp.ts b/vscode/src/rubyLsp.ts index 491666a638..4a055f7439 100644 --- a/vscode/src/rubyLsp.ts +++ b/vscode/src/rubyLsp.ts @@ -33,6 +33,7 @@ export class RubyLsp { // A URI => content map of virtual documents for delegate requests private readonly virtualDocuments = new Map(); + private readonly workspacesBeingLaunched: Set = new Set(); constructor( context: vscode.ExtensionContext, @@ -83,7 +84,10 @@ export class RubyLsp { document.uri, ); - if (!workspaceFolder) { + if ( + !workspaceFolder || + this.workspacesBeingLaunched.has(workspaceFolder.index) + ) { return; } @@ -91,6 +95,7 @@ export class RubyLsp { // If the workspace entry doesn't exist, then we haven't activated the workspace yet if (!workspace) { + this.workspacesBeingLaunched.add(workspaceFolder.index); await this.activateWorkspace(workspaceFolder, false); } }), @@ -137,9 +142,14 @@ export class RubyLsp { const workspaceFolder = vscode.workspace.getWorkspaceFolder( activeDocument.uri, ); + if (workspaceFolder) { + const existingWorkspace = this.workspaces.get( + workspaceFolder.uri.toString(), + ); - if (workspaceFolder && workspaceFolder !== firstWorkspace) { - await this.activateWorkspace(workspaceFolder, true); + if (workspaceFolder && !existingWorkspace) { + await this.activateWorkspace(workspaceFolder, false); + } } } @@ -218,6 +228,7 @@ export class RubyLsp { ); this.workspaces.set(workspaceFolder.uri.toString(), workspace); + await workspace.activate(); await workspace.start(); this.context.subscriptions.push(workspace); @@ -229,6 +240,7 @@ export class RubyLsp { true, ); await this.showFormatOnSaveModeWarning(workspace); + this.workspacesBeingLaunched.delete(workspaceFolder.index); } // Registers all extension commands. Commands can only be registered once, so this happens in the constructor. For diff --git a/vscode/src/status.ts b/vscode/src/status.ts index 427b35b8fd..ad53709d8c 100644 --- a/vscode/src/status.ts +++ b/vscode/src/status.ts @@ -92,8 +92,15 @@ export class ServerStatus extends StatusItem { this.item.text = workspace.lspClient.serverVersion ? `Ruby LSP v${workspace.lspClient.serverVersion}: Running` : "Ruby LSP: Running"; + + if (workspace.lspClient.degraded) { + this.item.text += " (degraded)"; + this.item.severity = vscode.LanguageStatusSeverity.Warning; + } else { + this.item.severity = vscode.LanguageStatusSeverity.Information; + } + this.item.command!.arguments = [STARTED_SERVER_OPTIONS]; - this.item.severity = vscode.LanguageStatusSeverity.Information; break; } case State.Starting: { diff --git a/vscode/src/test/suite/client.test.ts b/vscode/src/test/suite/client.test.ts index cc516ede6c..15dd1317de 100644 --- a/vscode/src/test/suite/client.test.ts +++ b/vscode/src/test/suite/client.test.ts @@ -138,7 +138,12 @@ async function launchClient(workspaceUri: vscode.Uri) { } } - const ruby = new Ruby(context, workspaceFolder, outputChannel); + const ruby = new Ruby( + context, + workspaceFolder, + outputChannel, + FAKE_TELEMETRY, + ); await ruby.activateRuby(); ruby.env.RUBY_LSP_BYPASS_TYPECHECKER = "true"; @@ -674,6 +679,7 @@ suite("Client", () => { workspaceRubyFilter, workspaceERBFilter, bundledGemsFilter, + defaultPathFilter, defaultGemsFilter, ] = client.clientOptions.documentSelector!; @@ -702,6 +708,11 @@ suite("Client", () => { new RegExp(`ruby\\/\\d\\.\\d\\.\\d\\/\\*\\*\\/\\*`), ); + assert.match( + (defaultPathFilter as TextDocumentFilter).pattern!, + /lib\/ruby\/gems\/\d\.\d\.\d\/\*\*\/\*/, + ); + assert.match( (defaultGemsFilter as TextDocumentFilter).pattern!, /lib\/ruby\/\d\.\d\.\d\/\*\*\/\*/, diff --git a/vscode/src/test/suite/common.test.ts b/vscode/src/test/suite/common.test.ts new file mode 100644 index 0000000000..cb1e99bdcb --- /dev/null +++ b/vscode/src/test/suite/common.test.ts @@ -0,0 +1,91 @@ +import * as assert from "assert"; + +import * as vscode from "vscode"; +import sinon from "sinon"; + +import { featureEnabled, FEATURE_FLAGS } from "../../common"; + +suite("Common", () => { + let sandbox: sinon.SinonSandbox; + + setup(() => { + sandbox = sinon.createSandbox(); + const number = 42; + sandbox.stub(vscode.env, "machineId").value(number.toString(16)); + }); + + teardown(() => { + sandbox.restore(); + }); + + test("returns consistent results for the same rollout percentage", () => { + const firstCall = featureEnabled("tapiocaAddon"); + + for (let i = 0; i < 50; i++) { + const result = featureEnabled("tapiocaAddon"); + + assert.strictEqual( + firstCall, + result, + "Feature flag should be deterministic", + ); + } + }); + + test("maintains enabled state when increasing rollout percentage", () => { + // For the fake machine of 42 in base 16 and the name `fakeFeature`, the feature flag activation percetange is + // 0.357. For every percetange below that, the feature should appear as disabled + [0.25, 0.3, 0.35].forEach((percentage) => { + (FEATURE_FLAGS as any).fakeFeature = percentage; + assert.strictEqual(featureEnabled("fakeFeature" as any), false); + }); + + // And for every percentage above that, the feature should appear as enabled + [0.36, 0.45, 0.55, 0.65, 0.75, 0.85, 0.9, 1].forEach((percentage) => { + (FEATURE_FLAGS as any).fakeFeature = percentage; + assert.strictEqual(featureEnabled("fakeFeature" as any), true); + }); + }); + + test("returns false if user opted out of specific feature", () => { + (FEATURE_FLAGS as any).fakeFeature = 1; + + const stub = sandbox.stub(vscode.workspace, "getConfiguration").returns({ + get: () => { + return { fakeFeature: false }; + }, + } as any); + + const result = featureEnabled("fakeFeature" as any); + stub.restore(); + assert.strictEqual(result, false); + }); + + test("returns false if user opted out of all features", () => { + (FEATURE_FLAGS as any).fakeFeature = 1; + + const stub = sandbox.stub(vscode.workspace, "getConfiguration").returns({ + get: () => { + return { all: false }; + }, + } as any); + + const result = featureEnabled("fakeFeature" as any); + stub.restore(); + assert.strictEqual(result, false); + }); + + test("returns true if user opted in to all features", () => { + (FEATURE_FLAGS as any).fakeFeature = 0.02; + + const stub = sandbox.stub(vscode.workspace, "getConfiguration").returns({ + get: () => { + return { all: true }; + }, + } as any); + + const result = featureEnabled("fakeFeature" as any); + stub.restore(); + assert.strictEqual(result, true); + }); +}); diff --git a/vscode/src/test/suite/debugger.test.ts b/vscode/src/test/suite/debugger.test.ts index efa1338e59..ac22c0c8a8 100644 --- a/vscode/src/test/suite/debugger.test.ts +++ b/vscode/src/test/suite/debugger.test.ts @@ -13,6 +13,8 @@ import { WorkspaceChannel } from "../../workspaceChannel"; import { LOG_CHANNEL, asyncExec } from "../../common"; import { RUBY_VERSION } from "../rubyVersion"; +import { FAKE_TELEMETRY } from "./fakeTelemetry"; + suite("Debugger", () => { test("Provide debug configurations returns the default configs", () => { const context = { subscriptions: [] } as unknown as vscode.ExtensionContext; @@ -203,7 +205,12 @@ suite("Debugger", () => { name: path.basename(tmpPath), index: 0, }; - const ruby = new Ruby(context, workspaceFolder, outputChannel); + const ruby = new Ruby( + context, + workspaceFolder, + outputChannel, + FAKE_TELEMETRY, + ); await ruby.activateRuby(); try { diff --git a/vscode/src/test/suite/grammars.test.ts b/vscode/src/test/suite/grammars.test.ts index 127f1e9631..6cc2065f4c 100644 --- a/vscode/src/test/suite/grammars.test.ts +++ b/vscode/src/test/suite/grammars.test.ts @@ -337,6 +337,66 @@ suite("Grammars", () => { const actualTokens = tokenizeRuby(ruby); assert.deepStrictEqual(actualTokens, expectedTokens); }); + test("or assignment", () => { + const ruby = "local ||= 1"; + const expectedTokens = [ + ["local", ["source.ruby", "variable.ruby"]], + [" ", ["source.ruby"]], + [ + "||=", + ["source.ruby", "keyword.operator.assignment.augmented.ruby"], + ], + [" ", ["source.ruby"]], + ["1", ["source.ruby", "constant.numeric.ruby"]], + ]; + const actualTokens = tokenizeRuby(ruby); + assert.deepStrictEqual(actualTokens, expectedTokens); + }); + test("and assignment in a condition", () => { + const ruby = "if local &&= 1"; + const expectedTokens = [ + ["if", ["source.ruby", "keyword.control.ruby"]], + [" ", ["source.ruby"]], + ["local", ["source.ruby", "variable.ruby"]], + [" ", ["source.ruby"]], + [ + "&&=", + ["source.ruby", "keyword.operator.assignment.augmented.ruby"], + ], + [" ", ["source.ruby"]], + ["1", ["source.ruby", "constant.numeric.ruby"]], + ]; + const actualTokens = tokenizeRuby(ruby); + assert.deepStrictEqual(actualTokens, expectedTokens); + }); + test("assignment in a condition", () => { + const ruby = "if (local = 1)"; + const expectedTokens = [ + ["if", ["source.ruby", "keyword.control.ruby"]], + [" (", ["source.ruby"]], + ["local", ["source.ruby", "variable.ruby"]], + [" = ", ["source.ruby"]], + ["1", ["source.ruby", "constant.numeric.ruby"]], + [")", ["source.ruby", "punctuation.section.function.ruby"]], + ]; + const actualTokens = tokenizeRuby(ruby); + assert.deepStrictEqual(actualTokens, expectedTokens); + }); + test("operation assignment in a condition", () => { + const ruby = "if (local += 1)"; + const expectedTokens = [ + ["if", ["source.ruby", "keyword.control.ruby"]], + [" (", ["source.ruby"]], + ["local", ["source.ruby", "variable.ruby"]], + [" ", ["source.ruby"]], + ["+=", ["source.ruby", "keyword.operator.assignment.augmented.ruby"]], + [" ", ["source.ruby"]], + ["1", ["source.ruby", "constant.numeric.ruby"]], + [")", ["source.ruby", "punctuation.section.function.ruby"]], + ]; + const actualTokens = tokenizeRuby(ruby); + assert.deepStrictEqual(actualTokens, expectedTokens); + }); }); function tokenizeRuby(ruby: string): [string, string[]][] { diff --git a/vscode/src/test/suite/ruby.test.ts b/vscode/src/test/suite/ruby.test.ts index 7da73e64cd..b3832b439d 100644 --- a/vscode/src/test/suite/ruby.test.ts +++ b/vscode/src/test/suite/ruby.test.ts @@ -8,6 +8,10 @@ import sinon from "sinon"; import { Ruby, ManagerIdentifier } from "../../ruby"; import { WorkspaceChannel } from "../../workspaceChannel"; import { LOG_CHANNEL } from "../../common"; +import * as common from "../../common"; +import { ACTIVATION_SEPARATOR } from "../../ruby/versionManager"; + +import { FAKE_TELEMETRY } from "./fakeTelemetry"; suite("Ruby environment activation", () => { const workspacePath = path.dirname( @@ -18,6 +22,14 @@ suite("Ruby environment activation", () => { name: path.basename(workspacePath), index: 0, }; + const context = { + extensionMode: vscode.ExtensionMode.Test, + workspaceState: { + get: () => undefined, + update: () => undefined, + }, + } as unknown as vscode.ExtensionContext; + const outputChannel = new WorkspaceChannel("fake", LOG_CHANNEL); test("Activate fetches Ruby information when outside of Ruby LSP", async () => { const manager = process.env.CI @@ -38,16 +50,12 @@ suite("Ruby environment activation", () => { }, } as unknown as vscode.WorkspaceConfiguration); - const context = { - extensionMode: vscode.ExtensionMode.Test, - workspaceState: { - get: () => undefined, - update: () => undefined, - }, - } as unknown as vscode.ExtensionContext; - const outputChannel = new WorkspaceChannel("fake", LOG_CHANNEL); - - const ruby = new Ruby(context, workspaceFolder, outputChannel); + const ruby = new Ruby( + context, + workspaceFolder, + outputChannel, + FAKE_TELEMETRY, + ); await ruby.activateRuby(); assert.ok(ruby.rubyVersion, "Expected Ruby version to be set"); @@ -79,16 +87,12 @@ suite("Ruby environment activation", () => { }, } as unknown as vscode.WorkspaceConfiguration); - const context = { - extensionMode: vscode.ExtensionMode.Test, - workspaceState: { - get: () => undefined, - update: () => undefined, - }, - } as unknown as vscode.ExtensionContext; - const outputChannel = new WorkspaceChannel("fake", LOG_CHANNEL); - - const ruby = new Ruby(context, workspaceFolder, outputChannel); + const ruby = new Ruby( + context, + workspaceFolder, + outputChannel, + FAKE_TELEMETRY, + ); process.env.VERBOSE = "1"; process.env.DEBUG = "WARN"; @@ -103,4 +107,47 @@ suite("Ruby environment activation", () => { delete process.env.RUBY_GC_HEAP_GROWTH_FACTOR; configStub.restore(); }); + + test("Sets gem path for version managers based on shims", async () => { + const configStub = sinon + .stub(vscode.workspace, "getConfiguration") + .returns({ + get: (name: string) => { + if (name === "rubyVersionManager") { + return { identifier: ManagerIdentifier.Rbenv }; + } else if (name === "bundleGemfile") { + return ""; + } + + return undefined; + }, + } as unknown as vscode.WorkspaceConfiguration); + + const envStub = { + env: { ANY: "true" }, + yjit: true, + version: "3.3.5", + gemPath: ["~/.gem/ruby/3.3.5", "/opt/rubies/3.3.5/lib/ruby/gems/3.3.0"], + }; + + const execStub = sinon.stub(common, "asyncExec").resolves({ + stdout: "", + stderr: `${ACTIVATION_SEPARATOR}${JSON.stringify(envStub)}${ACTIVATION_SEPARATOR}`, + }); + + const ruby = new Ruby( + context, + workspaceFolder, + outputChannel, + FAKE_TELEMETRY, + ); + await ruby.activateRuby(); + execStub.restore(); + configStub.restore(); + + assert.deepStrictEqual(ruby.gemPath, [ + "~/.gem/ruby/3.3.5", + "/opt/rubies/3.3.5/lib/ruby/gems/3.3.0", + ]); + }); }); diff --git a/vscode/src/test/suite/ruby/shadowenv.test.ts b/vscode/src/test/suite/ruby/shadowenv.test.ts index 2e2ab533e3..8d1666c8ec 100644 --- a/vscode/src/test/suite/ruby/shadowenv.test.ts +++ b/vscode/src/test/suite/ruby/shadowenv.test.ts @@ -212,23 +212,12 @@ suite("Shadowenv", () => { .onFirstCall() .rejects(new Error("shadowenv: command not found")) .onSecondCall() - .resolves({ stdout: "", stderr: "" }); - - const windowStub = sinon - .stub(vscode.window, "showErrorMessage") - .resolves("Cancel" as any); + .rejects(new Error("shadowenv: command not found")); await assert.rejects(async () => { await shadowenv.activate(); }); - assert.ok( - windowStub.calledOnceWith( - "Couldn't find shadowenv executable. Double-check that it's installed and that it's in your PATH.", - ), - ); - execStub.restore(); - windowStub.restore(); }); }); diff --git a/vscode/src/test/suite/status.test.ts b/vscode/src/test/suite/status.test.ts index b0dcc19076..7956ee5c87 100644 --- a/vscode/src/test/suite/status.test.ts +++ b/vscode/src/test/suite/status.test.ts @@ -41,6 +41,7 @@ suite("StatusItems", () => { formatter: "none", serverVersion: "1.0.0", sendRequest: () => Promise.resolve([] as T), + degraded: false, }, error: false, }; @@ -78,6 +79,7 @@ suite("StatusItems", () => { formatter: "none", serverVersion: "1.0.0", sendRequest: () => Promise.resolve([] as T), + degraded: false, }, error: false, }; @@ -128,6 +130,19 @@ suite("StatusItems", () => { ); assert.strictEqual(status.item.name, "Ruby LSP Server Status"); }); + + test("Refresh when server is in degraded mode", () => { + workspace.lspClient!.degraded = true; + status.refresh(workspace); + assert.strictEqual( + status.item.text, + "Ruby LSP v1.0.0: Running (degraded)", + ); + assert.strictEqual( + status.item.severity, + vscode.LanguageStatusSeverity.Warning, + ); + }); }); suite("ExperimentalFeaturesStatus", () => { @@ -141,6 +156,7 @@ suite("StatusItems", () => { formatter, serverVersion: "1.0.0", sendRequest: () => Promise.resolve([] as T), + degraded: false, }, error: false, }; @@ -170,6 +186,7 @@ suite("StatusItems", () => { formatter: "none", serverVersion: "1.0.0", sendRequest: () => Promise.resolve([] as T), + degraded: false, }, error: false, }; @@ -258,6 +275,7 @@ suite("StatusItems", () => { state: State.Running, formatter: "auto", serverVersion: "1.0.0", + degraded: false, sendRequest: () => Promise.resolve([] as T), }, error: false, @@ -283,6 +301,7 @@ suite("StatusItems", () => { addons: undefined, state: State.Running, formatter: "auto", + degraded: false, serverVersion: "1.0.0", sendRequest: () => Promise.resolve([] as T), }, diff --git a/vscode/src/test/suite/workspace.test.ts b/vscode/src/test/suite/workspace.test.ts new file mode 100644 index 0000000000..69b550019a --- /dev/null +++ b/vscode/src/test/suite/workspace.test.ts @@ -0,0 +1,80 @@ +/* eslint-disable no-process-env */ +import assert from "assert"; +import path from "path"; +import os from "os"; +import fs from "fs"; + +import sinon from "sinon"; +import * as vscode from "vscode"; +import { beforeEach, afterEach } from "mocha"; + +import { Workspace } from "../../workspace"; + +import { FAKE_TELEMETRY } from "./fakeTelemetry"; + +suite("Workspace", () => { + const context = { + extensionMode: vscode.ExtensionMode.Test, + subscriptions: [], + workspaceState: { + get: (_name: string) => undefined, + update: (_name: string, _value: any) => Promise.resolve(), + }, + } as unknown as vscode.ExtensionContext; + let workspacePath: string; + let workspaceUri: vscode.Uri; + let workspaceFolder: vscode.WorkspaceFolder; + + beforeEach(() => { + workspacePath = fs.mkdtempSync( + path.join(os.tmpdir(), "ruby-lsp-test-workspace-"), + ); + workspaceUri = vscode.Uri.file(workspacePath); + + workspaceFolder = { + uri: workspaceUri, + name: path.basename(workspacePath), + index: 0, + }; + }); + + afterEach(() => { + fs.rmSync(workspacePath, { recursive: true, force: true }); + }); + + test("repeated rebase steps don't trigger multiple restarts", async () => { + const gitDir = path.join(workspacePath, ".git"); + fs.mkdirSync(gitDir); + + const workspace = new Workspace( + context, + workspaceFolder, + FAKE_TELEMETRY, + () => {}, + new Map(), + ); + + const startStub = sinon.stub(workspace, "start"); + const restartSpy = sinon.spy(workspace, "restart"); + + await workspace.activate(); + + for (let i = 0; i < 5; i++) { + await new Promise((resolve) => setTimeout(resolve, 200)); + fs.writeFileSync(path.join(gitDir, "rebase-apply"), "1"); + await new Promise((resolve) => setTimeout(resolve, 200)); + fs.rmSync(path.join(gitDir, "rebase-apply")); + } + + // Give enough time for all watchers to fire and all debounces to run off + await new Promise((resolve) => setTimeout(resolve, 10000)); + + startStub.restore(); + restartSpy.restore(); + + // The start call only happens once because of the inhibitRestart flag + assert.strictEqual(startStub.callCount, 1); + // The restart call only happens once because of the debounce + assert.strictEqual(restartSpy.callCount, 1); + }).timeout(60000); +}); diff --git a/vscode/src/workspace.ts b/vscode/src/workspace.ts index 715aaa18f8..dc054a6b1a 100644 --- a/vscode/src/workspace.ts +++ b/vscode/src/workspace.ts @@ -1,3 +1,5 @@ +import { createHash } from "crypto"; + import * as vscode from "vscode"; import { CodeLens, State } from "vscode-languageclient/node"; @@ -22,10 +24,16 @@ export class Workspace implements WorkspaceInterface { private readonly isMainWorkspace: boolean; private readonly telemetry: vscode.TelemetryLogger; private readonly virtualDocuments = new Map(); + private readonly restartDocumentShas = new Map(); private needsRestart = false; #inhibitRestart = false; #error = false; + private readonly debouncedRestart = debounce(async (reason: string) => { + this.outputChannel.info(`Restarting the Ruby LSP because ${reason}`); + await this.restart(); + }, 5000); + constructor( context: vscode.ExtensionContext, workspaceFolder: vscode.WorkspaceFolder, @@ -41,18 +49,39 @@ export class Workspace implements WorkspaceInterface { LOG_CHANNEL, ); this.telemetry = telemetry; - this.ruby = new Ruby(context, workspaceFolder, this.outputChannel); + this.ruby = new Ruby( + context, + workspaceFolder, + this.outputChannel, + telemetry, + ); this.createTestItems = createTestItems; this.isMainWorkspace = isMainWorkspace; this.virtualDocuments = virtualDocuments; this.registerRestarts(context); + } + + // Activate this workspace. This method is intended to be invoked only once, unlikely `start` which may be invoked + // multiple times due to restarts + async activate() { + const gitExtension = vscode.extensions.getExtension("vscode.git"); + let rootGitUri = this.workspaceFolder.uri; + + // If the git extension is available, use that to find the root of the git repository + if (gitExtension) { + const api = gitExtension.exports.getAPI(1); + const repository = await api.openRepository(this.workspaceFolder.uri); + + if (repository) { + rootGitUri = repository.rootUri; + } + } + this.registerCreateDeleteWatcher( - context, - ".git/{rebase-merge,rebase-apply}", + rootGitUri, + ".git/{rebase-merge,rebase-apply,BISECT_START,CHERRY_PICK_HEAD}", ); - this.registerCreateDeleteWatcher(context, ".git/BISECT_START"); - this.registerCreateDeleteWatcher(context, ".git/CHERRY_PICK_HEAD"); } async start(debugMode?: boolean) { @@ -209,13 +238,24 @@ export class Workspace implements WorkspaceInterface { "rubyLsp.lastGemUpdate", ); - const { stdout } = await asyncExec("gem list ruby-lsp", { + // Theses are the Ruby LSP's own dependencies, listed in `ruby-lsp.gemspec` + const dependencies = [ + "ruby-lsp", + "language_server-protocol", + "prism", + "rbs", + "sorbet-runtime", + ]; + + const { stdout } = await asyncExec(`gem list ${dependencies.join(" ")}`, { cwd: this.workspaceFolder.uri.fsPath, env: this.ruby.env, }); - // If the gem is not yet installed, install it - if (!/^ruby-lsp[\s]/.exec(stdout)) { + // If any of the Ruby LSP's dependencies are missing, we need to install them. For example, if the user runs `gem + // uninstall prism`, then we must ensure it's installed or else rubygems will fail when trying to launch the + // executable + if (!dependencies.every((dep) => new RegExp(`${dep}\\s`).exec(stdout))) { await asyncExec("gem install ruby-lsp", { cwd: this.workspaceFolder.uri.fsPath, env: this.ruby.env, @@ -238,7 +278,7 @@ export class Workspace implements WorkspaceInterface { ); } catch (error) { this.outputChannel.info( - `Tried deleting ${vscode.Uri.joinPath(this.workspaceFolder.uri, ".ruby - lsp")}, but it doesn't exist`, + `Tried deleting ${vscode.Uri.joinPath(this.workspaceFolder.uri, ".ruby-lsp")}, but it doesn't exist`, ); } } @@ -322,6 +362,9 @@ export class Workspace implements WorkspaceInterface { await this.ruby.activateRuby(); } + this.outputChannel.info( + "Restarting the Ruby LSP because configuration changed", + ); await this.restart(); } }), @@ -336,38 +379,50 @@ export class Workspace implements WorkspaceInterface { new vscode.RelativePattern(this.workspaceFolder, pattern), ); - const debouncedRestart = debounce(this.restart.bind(this), 5000); + // Handler for only triggering restart if the contents of the file have been modified. If the file was just touched, + // but the contents are the same, we don't want to restart + const debouncedRestartWithHashCheck = async (uri: vscode.Uri) => { + const fileContents = await vscode.workspace.fs.readFile(uri); + const fsPath = uri.fsPath; + + const hash = createHash("sha256"); + hash.update(fileContents.toString()); + const currentSha = hash.digest("hex"); + + if (this.restartDocumentShas.get(fsPath) !== currentSha) { + this.restartDocumentShas.set(fsPath, currentSha); + await this.debouncedRestart(`${pattern} changed`); + } + }; + + const debouncedRestart = async () => { + await this.debouncedRestart(`${pattern} changed`); + }; context.subscriptions.push( watcher, - watcher.onDidChange(debouncedRestart), + watcher.onDidChange(debouncedRestartWithHashCheck), watcher.onDidCreate(debouncedRestart), watcher.onDidDelete(debouncedRestart), ); } - private registerCreateDeleteWatcher( - context: vscode.ExtensionContext, - glob: string, - ) { - const parentWatcher = vscode.workspace.createFileSystemWatcher( - new vscode.RelativePattern(this.workspaceFolder, `../${glob}`), - ); + private registerCreateDeleteWatcher(base: vscode.Uri, glob: string) { const workspaceWatcher = vscode.workspace.createFileSystemWatcher( - new vscode.RelativePattern(this.workspaceFolder, glob), + new vscode.RelativePattern(base, glob), ); const start = () => { this.#inhibitRestart = true; }; + const stop = async () => { this.#inhibitRestart = false; - await this.restart(); + await this.debouncedRestart(`${glob} changed`); }; - context.subscriptions.push( + this.context.subscriptions.push( workspaceWatcher, - parentWatcher, // When one of the 'inhibit restart' files are created, we set this flag to prevent restarting during that action workspaceWatcher.onDidCreate(start), // Once they are deleted and the action is complete, then we restart diff --git a/vscode/yarn.lock b/vscode/yarn.lock index b0cab2a002..146cefae8b 100644 --- a/vscode/yarn.lock +++ b/vscode/yarn.lock @@ -133,34 +133,35 @@ jsonwebtoken "^9.0.0" uuid "^8.3.0" -"@babel/code-frame@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" - integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== +"@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.0.tgz#9374b5cd068d128dac0b94ff482594273b1c2815" + integrity sha512-INCKxTtbXtcNbUZ3YXutwMpEleqttcswhAdee7dhuoVrD2cnuc3PqtERBtxkX5nziX9vnBL8WXmSGwv8CuPV6g== dependencies: - "@babel/highlight" "^7.24.7" + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/compat-data@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.2.tgz#e41928bd33475305c586f6acbbb7e3ade7a6f7f5" - integrity sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ== +"@babel/compat-data@^7.25.9": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.0.tgz#f02ba6d34e88fadd5e8861e8b38902f43cc1c819" + integrity sha512-qETICbZSLe7uXv9VE8T/RWOdIE5qqyTucOt4zLYMafj2MRO271VGgLd4RACJMeBO37UPWhXiKMBk7YlJ0fOzQA== -"@babel/core@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.25.2.tgz#ed8eec275118d7613e77a352894cd12ded8eba77" - integrity sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA== +"@babel/core@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.0.tgz#d78b6023cc8f3114ccf049eb219613f74a747b40" + integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.25.0" - "@babel/helper-compilation-targets" "^7.25.2" - "@babel/helper-module-transforms" "^7.25.2" - "@babel/helpers" "^7.25.0" - "@babel/parser" "^7.25.0" - "@babel/template" "^7.25.0" - "@babel/traverse" "^7.25.2" - "@babel/types" "^7.25.2" + "@babel/code-frame" "^7.26.0" + "@babel/generator" "^7.26.0" + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-module-transforms" "^7.26.0" + "@babel/helpers" "^7.26.0" + "@babel/parser" "^7.26.0" + "@babel/template" "^7.25.9" + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.26.0" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" @@ -183,92 +184,74 @@ dependencies: eslint-rule-composer "^0.3.0" -"@babel/generator@^7.25.0": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.0.tgz#f858ddfa984350bc3d3b7f125073c9af6988f18e" - integrity sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw== +"@babel/generator@^7.25.9", "@babel/generator@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.0.tgz#505cc7c90d92513f458a477e5ef0703e7c91b8d7" + integrity sha512-/AIkAmInnWwgEAJGQr9vY0c66Mj6kjkE2ZPB1PurTRaRAh3U+J45sAQMjQDJdh4WbR3l0x5xkimXBKyBXXAu2w== dependencies: - "@babel/types" "^7.25.0" + "@babel/parser" "^7.26.0" + "@babel/types" "^7.26.0" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" - jsesc "^2.5.1" + jsesc "^3.0.2" -"@babel/helper-compilation-targets@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz#e1d9410a90974a3a5a66e84ff55ef62e3c02d06c" - integrity sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw== +"@babel/helper-compilation-targets@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz#55af025ce365be3cdc0c1c1e56c6af617ce88875" + integrity sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ== dependencies: - "@babel/compat-data" "^7.25.2" - "@babel/helper-validator-option" "^7.24.8" - browserslist "^4.23.1" + "@babel/compat-data" "^7.25.9" + "@babel/helper-validator-option" "^7.25.9" + browserslist "^4.24.0" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-module-imports@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" - integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== - dependencies: - "@babel/traverse" "^7.24.7" - "@babel/types" "^7.24.7" - -"@babel/helper-module-transforms@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz#ee713c29768100f2776edf04d4eb23b8d27a66e6" - integrity sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ== - dependencies: - "@babel/helper-module-imports" "^7.24.7" - "@babel/helper-simple-access" "^7.24.7" - "@babel/helper-validator-identifier" "^7.24.7" - "@babel/traverse" "^7.25.2" - -"@babel/helper-simple-access@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz#bcade8da3aec8ed16b9c4953b74e506b51b5edb3" - integrity sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg== - dependencies: - "@babel/traverse" "^7.24.7" - "@babel/types" "^7.24.7" - -"@babel/helper-string-parser@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d" - integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ== - -"@babel/helper-validator-identifier@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" - integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== - -"@babel/helper-validator-option@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d" - integrity sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q== - -"@babel/helpers@^7.25.0": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.0.tgz#e69beb7841cb93a6505531ede34f34e6a073650a" - integrity sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw== - dependencies: - "@babel/template" "^7.25.0" - "@babel/types" "^7.25.0" - -"@babel/highlight@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" - integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== - dependencies: - "@babel/helper-validator-identifier" "^7.24.7" - chalk "^2.4.2" - js-tokens "^4.0.0" - picocolors "^1.0.0" +"@babel/helper-module-imports@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" + integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-module-transforms@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz#8ce54ec9d592695e58d84cd884b7b5c6a2fdeeae" + integrity sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw== + dependencies: + "@babel/helper-module-imports" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/helper-string-parser@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" + integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== + +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + +"@babel/helper-validator-option@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" + integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== + +"@babel/helpers@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.0.tgz#30e621f1eba5aa45fe6f4868d2e9154d884119a4" + integrity sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw== + dependencies: + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.0" -"@babel/parser@^7.25.0", "@babel/parser@^7.25.3": - version "7.25.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.3.tgz#91fb126768d944966263f0657ab222a642b82065" - integrity sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw== +"@babel/parser@^7.25.9", "@babel/parser@^7.26.0": + version "7.26.1" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.1.tgz#44e02499960df2cdce2c456372a3e8e0c3c5c975" + integrity sha512-reoQYNiAJreZNsJzyrDNzFQ+IQ5JFiIzAHJg9bn94S3l+4++J7RsIhNMoB+lgP/9tpmiAQqspv+xfdxTSzREOw== dependencies: - "@babel/types" "^7.25.2" + "@babel/types" "^7.26.0" "@babel/runtime@^7.23.2": version "7.23.9" @@ -277,36 +260,35 @@ dependencies: regenerator-runtime "^0.14.0" -"@babel/template@^7.25.0": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.0.tgz#e733dc3134b4fede528c15bc95e89cb98c52592a" - integrity sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q== - dependencies: - "@babel/code-frame" "^7.24.7" - "@babel/parser" "^7.25.0" - "@babel/types" "^7.25.0" - -"@babel/traverse@^7.24.7", "@babel/traverse@^7.25.2": - version "7.25.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" - integrity sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ== - dependencies: - "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.25.0" - "@babel/parser" "^7.25.3" - "@babel/template" "^7.25.0" - "@babel/types" "^7.25.2" +"@babel/template@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" + integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/traverse@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84" + integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/generator" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/template" "^7.25.9" + "@babel/types" "^7.25.9" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.2.tgz#55fb231f7dc958cd69ea141a4c2997e819646125" - integrity sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q== +"@babel/types@^7.25.9", "@babel/types@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.0.tgz#deabd08d6b753bc8e0f198f8709fb575e31774ff" + integrity sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA== dependencies: - "@babel/helper-string-parser" "^7.24.8" - "@babel/helper-validator-identifier" "^7.24.7" - to-fast-properties "^2.0.0" + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" "@esbuild/aix-ppc64@0.24.0": version "0.24.0" @@ -475,10 +457,10 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== -"@eslint/js@^9.11.1": - version "9.11.1" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.11.1.tgz#8bcb37436f9854b3d9a561440daf916acd940986" - integrity sha512-/qu+TWz8WwPWc7/HcIJKi+c+MOm46GdVaSlTTQcaqaL53+GsoA6MxWp5PtTx48qbSP7ylM1Kn7nhvkugfJvRSA== +"@eslint/js@^9.14.0": + version "9.14.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.14.0.tgz#2347a871042ebd11a00fd8c2d3d56a265ee6857e" + integrity sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg== "@humanwhocodes/config-array@^0.11.14": version "0.11.14" @@ -689,17 +671,17 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== -"@types/mocha@^10.0.8": - version "10.0.8" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.8.tgz#a7eff5816e070c3b4d803f1d3cd780c4e42934a1" - integrity sha512-HfMcUmy9hTMJh66VNcmeC9iVErIZJli2bszuXc6julh5YGuRb/W5OnkHjwLNYdFlMis0sY3If5SEAp+PktdJjw== +"@types/mocha@^10.0.9": + version "10.0.9" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.9.tgz#101e9da88d2c02e5ac8952982c23b224524d662a" + integrity sha512-sicdRoWtYevwxjOHNMPTl3vSfJM6oyW8o1wXeI7uww6b6xHg8eBznQDNSGBCDJmsE8UMxP05JgZRtsKbTqt//Q== "@types/node@*", "@types/node@22.x": - version "22.7.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.4.tgz#e35d6f48dca3255ce44256ddc05dee1c23353fcc" - integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg== + version "22.8.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.8.7.tgz#04ab7a073d95b4a6ee899f235d43f3c320a976f4" + integrity sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q== dependencies: - undici-types "~6.19.2" + undici-types "~6.19.8" "@types/sinon@^17.0.3": version "17.0.3" @@ -875,10 +857,10 @@ "@vscode/vsce-sign-win32-arm64" "2.0.2" "@vscode/vsce-sign-win32-x64" "2.0.2" -"@vscode/vsce@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@vscode/vsce/-/vsce-3.1.0.tgz#e21d49575469c735a94eb99bc4105b7be7349c9b" - integrity sha512-fwdfp1Ol+bZtlSGkpcd/nztfo6+SVsTOMWjZ/+a88lVtUn7gXNbSu7dbniecl5mz4vINl+oaVDVtVdGbJDApmw== +"@vscode/vsce@^3.1.0", "@vscode/vsce@^3.2.1": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@vscode/vsce/-/vsce-3.2.1.tgz#7bfa869ea43fe7d787f09e164f0f0e239df8fb1d" + integrity sha512-AY9vBjwExakK1c0cI/3NN2Ey0EgiKLBye/fxl/ue+o4q6RZ7N+xzd1jAD6eI6eBeMVANi617+V2rxIAkDPco2Q== dependencies: "@azure/identity" "^4.1.0" "@vscode/vsce-sign" "^2.0.0" @@ -1215,14 +1197,14 @@ browser-stdout@^1.3.1: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserslist@^4.23.1: - version "4.23.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.2.tgz#244fe803641f1c19c28c48c4b6ec9736eb3d32ed" - integrity sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA== +browserslist@^4.24.0: + version "4.24.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.0.tgz#a1325fe4bc80b64fda169629fc01b3d6cecd38d4" + integrity sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A== dependencies: - caniuse-lite "^1.0.30001640" - electron-to-chromium "^1.4.820" - node-releases "^2.0.14" + caniuse-lite "^1.0.30001663" + electron-to-chromium "^1.5.28" + node-releases "^2.0.18" update-browserslist-db "^1.1.0" buffer-crc32@~0.2.3: @@ -1280,10 +1262,10 @@ camelcase@^6.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001640: - version "1.0.30001642" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001642.tgz#6aa6610eb24067c246d30c57f055a9d0a7f8d05f" - integrity sha512-3XQ0DoRgLijXJErLSl+bLnJ+Et4KqV1PY6JJBGAFlsNsz31zeAIncyeZfLCabHK/jtSh+671RM9YMldxjUPZtA== +caniuse-lite@^1.0.30001663: + version "1.0.30001667" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001667.tgz#99fc5ea0d9c6e96897a104a8352604378377f949" + integrity sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw== capital-case@^1.0.4: version "1.0.4" @@ -1699,10 +1681,10 @@ ecdsa-sig-formatter@1.0.11: dependencies: safe-buffer "^5.0.1" -electron-to-chromium@^1.4.820: - version "1.4.827" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.827.tgz#76068ed1c71dd3963e1befc8ae815004b2da6a02" - integrity sha512-VY+J0e4SFcNfQy19MEoMdaIcZLmDCprqvBtkii1WTCTQHpRvf5N8+3kTYCgL/PcntvwQvmMJWTuDPsq+IlhWKQ== +electron-to-chromium@^1.5.28: + version "1.5.32" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.32.tgz#4a05ee78e29e240aabaf73a67ce9fe73f52e1bc7" + integrity sha512-M+7ph0VGBQqqpTT2YrabjNKSQ2fEl9PVx6AK3N558gDH9NO8O6XN9SXXFWRo9u9PbEg/bWq+tjXQr+eXmxubCw== emoji-regex@^10.2.1: version "10.3.0" @@ -3032,10 +3014,10 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +jsesc@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" + integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== json-buffer@3.0.1: version "3.0.1" @@ -3399,10 +3381,10 @@ mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== -mocha@^10.7.3: - version "10.7.3" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752" - integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A== +mocha@^10.8.2: + version "10.8.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.8.2.tgz#8d8342d016ed411b12a429eb731b825f961afb96" + integrity sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg== dependencies: ansi-colors "^4.1.3" browser-stdout "^1.3.1" @@ -3495,10 +3477,10 @@ node-domexception@^1.0.0: fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" -node-releases@^2.0.14: - version "2.0.14" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" - integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== +node-releases@^2.0.18: + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" @@ -3634,10 +3616,10 @@ ora@^7.0.1: string-width "^6.1.0" strip-ansi "^7.1.0" -ovsx@^0.9.5: - version "0.9.5" - resolved "https://registry.yarnpkg.com/ovsx/-/ovsx-0.9.5.tgz#7d9df63502ff939657602b228ea4432cdb1f250d" - integrity sha512-x8jaFQAA+KLxZ9HAQ8ZBbBxNsrrjjpEnVihfOhb/iuXWCso1n2oKaDJuLbA9O5FtBgtGCy0n23PKf728kOmX8g== +ovsx@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/ovsx/-/ovsx-0.10.0.tgz#85c75c5c1896d4d531722bd579bde27429789369" + integrity sha512-DSgNXGQ444nGKag+LZh92R/hM2PfRSu+6VKfVawoZ+JzFDiGX8yhMkAuyVlHrlxLCpfQOsqs80GcHje/h2SpmA== dependencies: "@vscode/vsce" "^3.1.0" commander "^6.2.1" @@ -3646,6 +3628,7 @@ ovsx@^0.9.5: leven "^3.1.0" semver "^7.6.0" tmp "^0.2.3" + yauzl "^3.1.3" p-limit@^3.0.2: version "3.1.0" @@ -4453,11 +4436,6 @@ tmp@^0.2.3: resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae" integrity sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w== -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== - to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" @@ -4584,10 +4562,10 @@ typed-rest-client@^1.8.4: tunnel "0.0.6" underscore "^1.12.1" -typescript@^5.6.2: - version "5.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" - integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== +typescript@^5.6.3: + version "5.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" + integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== uc.micro@^2.0.0, uc.micro@^2.1.0: version "2.1.0" @@ -4609,10 +4587,10 @@ underscore@^1.12.1: resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441" integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== -undici-types@~6.19.2: - version "6.19.6" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.6.tgz#e218c3df0987f4c0e0008ca00d6b6472d9b89b36" - integrity sha512-e/vggGopEfTKSvj4ihnOLTsqhrKRN3LeO6qSN/GxohhuRv8qH9bNQ4B8W7e/vFL+0XTnmHPB4/kegunZGA4Org== +undici-types@~6.19.8: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== update-browserslist-db@^1.1.0: version "1.1.0" @@ -4874,6 +4852,14 @@ yauzl@^2.3.1: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" +yauzl@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-3.1.3.tgz#f61c17ad1a09403bc7adb01dfb302a9e74bf4a50" + integrity sha512-JCCdmlJJWv7L0q/KylOekyRaUrdEoUxWkWVcgorosTROCFWiS9p2NNPE9Yb91ak7b1N5SxAZEliWpspbZccivw== + dependencies: + buffer-crc32 "~0.2.3" + pend "~1.2.0" + yazl@^2.2.2: version "2.5.1" resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.5.1.tgz#a3d65d3dd659a5b0937850e8609f22fffa2b5c35"