Resolved Sorbet type bug

Related to sorbet/sorbet#498

Had to change the call to caller_locations to filter out
sorbet runtime checking.
This commit is contained in:
apainintheneck 2022-04-22 18:57:27 -07:00
parent ce5cb9b745
commit 9c4402a049

View File

@ -107,9 +107,7 @@ module Homebrew
] ]
end end
# FIXME: Block should be `T.nilable(T.proc.bind(Parser).void)`. sig { params(block: T.nilable(T.proc.bind(Parser).void)).void }
# See https://github.com/sorbet/sorbet/issues/498.
sig { params(block: T.proc.bind(Parser).void).void.checked(:never) }
def initialize(&block) def initialize(&block)
@parser = OptionParser.new @parser = OptionParser.new
@ -123,7 +121,9 @@ module Homebrew
@args = Homebrew::CLI::Args.new @args = Homebrew::CLI::Args.new
@command_name = caller_locations(2, 1).first.label.chomp("_args").tr("_", "-") # Filter out Sorbet runtime type checking method calls.
@command_name = caller_locations.select { |location| location.path.exclude?("/gems/sorbet-runtime-") }
.second.label.chomp("_args").tr("_", "-")
@constraints = [] @constraints = []
@conflicts = [] @conflicts = []