diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cli/args.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/cli/args.rbi deleted file mode 100644 index 9a9a2e18ef..0000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cli/args.rbi +++ /dev/null @@ -1,8 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Homebrew::CLI::Args`. -# Please instead update this file by running `bin/tapioca dsl Homebrew::CLI::Args`. - - -class Homebrew::CLI::Args; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi index c2ca3e00e6..d8e7fbb8b2 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi @@ -190,7 +190,7 @@ module Homebrew::EnvConfig sig { returns(String) } def livecheck_watchlist; end - sig { returns(String) } + sig { returns(T.nilable(::String)) } def lock_context; end sig { returns(String) } diff --git a/Library/Homebrew/sorbet/tapioca/compilers/args.rb b/Library/Homebrew/sorbet/tapioca/compilers/args.rb index 474eeaac21..5a533d73f8 100644 --- a/Library/Homebrew/sorbet/tapioca/compilers/args.rb +++ b/Library/Homebrew/sorbet/tapioca/compilers/args.rb @@ -21,31 +21,22 @@ module Tapioca sig { override.returns(T::Enumerable[Parsable]) } def self.gather_constants - # require all the commands to ensure the _arg methods are defined + # require all the commands to ensure the command subclasses are defined ["cmd", "dev-cmd"].each do |dir| Dir[File.join(__dir__, "../../../#{dir}", "*.rb")].each { require(_1) } end - [Homebrew::CLI::Args] + Homebrew::AbstractCommand.subclasses + Homebrew::AbstractCommand.subclasses end sig { override.void } def decorate - if constant == Homebrew::CLI::Args - root.create_path(Homebrew::CLI::Args) do |klass| - Homebrew.methods(false).select { _1.end_with?("_args") }.each do |args_method_name| - parser = Homebrew.method(args_method_name).call - create_args_methods(klass, parser) - end - end - else - cmd = T.cast(constant, T.class_of(Homebrew::AbstractCommand)) - args_class_name = T.must(T.must(cmd.args_class).name) - root.create_class(args_class_name, superclass_name: "Homebrew::CLI::Args") do |klass| - create_args_methods(klass, cmd.parser) - end - root.create_path(constant) do |klass| - klass.create_method("args", return_type: args_class_name) - end + cmd = T.cast(constant, T.class_of(Homebrew::AbstractCommand)) + args_class_name = T.must(T.must(cmd.args_class).name) + root.create_class(args_class_name, superclass_name: "Homebrew::CLI::Args") do |klass| + create_args_methods(klass, cmd.parser) + end + root.create_path(constant) do |klass| + klass.create_method("args", return_type: args_class_name) end end @@ -80,8 +71,6 @@ module Tapioca args_table(parser).each do |method_name, value| method_name_str = method_name.to_s next if GLOBAL_OPTIONS.include?(method_name_str) - # some args are used in multiple commands (this is ok as long as they have the same type) - next if klass.nodes.any? { T.cast(_1, RBI::Method).name == method_name_str } return_type = get_return_type(method_name, value, comma_array_methods) klass.create_method(method_name_str, return_type:)