From 556f71d7bb7065360d985780068b75487d37b10c Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sun, 7 Sep 2025 18:32:01 -0700 Subject: [PATCH] Add the remaining ones --- Library/Homebrew/dev-cmd/bottle.rb | 7 +-- .../Homebrew/extend/os/linux/cask/config.rb | 2 +- Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/standalone/sorbet.rb | 54 +++++++++++++++++++ Library/Homebrew/test/cask/info_spec.rb | 3 +- Library/Homebrew/test/spec_helper.rb | 18 ------- 6 files changed, 61 insertions(+), 25 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index ef039ce4b9..48b4505573 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -410,7 +410,7 @@ module Homebrew bottle_tag, rebuild = if local_bottle_json _, tag_string, rebuild_string = Utils::Bottles.extname_tag_rebuild(formula.local_bottle_path.to_s) - [T.must(tag_string).to_sym, rebuild_string.to_i] + [tag_string.to_sym, rebuild_string.to_i] end bottle_tag = if bottle_tag @@ -506,7 +506,7 @@ module Homebrew tab.time = nil tab.changed_files = changed_files.dup if args.only_json_tab? - tab.changed_files.delete(Pathname.new(AbstractTab::FILENAME)) + tab.changed_files&.delete(Pathname.new(AbstractTab::FILENAME)) tab.tabfile.unlink else tab.write @@ -861,7 +861,8 @@ module Homebrew end sig { - params(formula: Formula, formula_ast: Utils::AST::FormulaAST, bottle_hash: T::Hash[String, T.untyped]) + params(formula: Formula, formula_ast: Utils::AST::FormulaAST, + bottle_hash: T::Hash[String, T.untyped]) .returns(T.nilable(T::Array[T::Hash[Symbol, T.any(String, Symbol)]])) } def old_checksums(formula, formula_ast, bottle_hash) diff --git a/Library/Homebrew/extend/os/linux/cask/config.rb b/Library/Homebrew/extend/os/linux/cask/config.rb index 756cc7bae1..c9184fea82 100644 --- a/Library/Homebrew/extend/os/linux/cask/config.rb +++ b/Library/Homebrew/extend/os/linux/cask/config.rb @@ -15,7 +15,7 @@ module OS appdir: "~/.config/apps", }.freeze, T::Hash[Symbol, String]) - sig { returns(T::Hash[Symbol, String]) } + sig { returns(T::Hash[Symbol, T.any(LazyObject, String)]) } def defaults { languages: LazyObject.new { Linux.languages }, diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 8138be383c..5e78cec393 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1593,7 +1593,7 @@ on_request: installed_on_request?, options:) keg = Keg.new(formula.prefix) skip_linkage = formula.bottle_specification.skip_relocation? - keg.replace_placeholders_with_locations(tab.changed_files, skip_linkage:) + keg.replace_placeholders_with_locations(tab.changed_files&.map { Pathname(_1) }, skip_linkage:) cellar = formula.bottle_specification.tag_to_cellar(Utils::Bottles.tag) return if [:any, :any_skip_relocation].include?(cellar) diff --git a/Library/Homebrew/standalone/sorbet.rb b/Library/Homebrew/standalone/sorbet.rb index e810fee45c..ae492f8a77 100644 --- a/Library/Homebrew/standalone/sorbet.rb +++ b/Library/Homebrew/standalone/sorbet.rb @@ -50,6 +50,24 @@ end module T module Types + class FixedArray < Base + def valid?(obj) + recursively_valid?(obj) + end + end + + class FixedHash < Base + def valid?(obj) + recursively_valid?(obj) + end + end + + class Intersection < Base + def valid?(obj) + recursively_valid?(obj) + end + end + class TypedArray < TypedEnumerable # overrides Base def valid?(obj) @@ -57,11 +75,47 @@ module T end end + class TypedEnumerable < Base + def valid?(obj) + recursively_valid?(obj) + end + end + + class TypedEnumeratorChain < TypedEnumerable + def valid?(obj) + recursively_valid?(obj) + end + end + + class TypedEnumeratorLazy < TypedEnumerable + def valid?(obj) + recursively_valid?(obj) + end + end + class TypedHash < TypedEnumerable # overrides Base def valid?(obj) recursively_valid?(obj) end end + + class TypedRange < TypedEnumerable + def valid?(obj) + recursively_valid?(obj) + end + end + + class TypedSet < TypedEnumerable + def valid?(obj) + recursively_valid?(obj) + end + end + + class Union < Base + def valid?(obj) + recursively_valid?(obj) + end + end end end diff --git a/Library/Homebrew/test/cask/info_spec.rb b/Library/Homebrew/test/cask/info_spec.rb index f342b961cf..ea41b57d94 100644 --- a/Library/Homebrew/test/cask/info_spec.rb +++ b/Library/Homebrew/test/cask/info_spec.rb @@ -169,8 +169,7 @@ RSpec.describe Cask::Info, :cask do cask = Cask::CaskLoader.load("local-transmission") time = 1_720_189_863 - tab = Cask::Tab.new("loaded_from_api" => true, "tabfile" => TEST_FIXTURE_DIR/"cask_receipt.json", - "time" => time) + tab = Cask::Tab.new(loaded_from_api: true, tabfile: TEST_FIXTURE_DIR/"cask_receipt.json", time:) expect(cask).to receive(:installed?).and_return(true) expect(cask).to receive(:caskroom_path).and_return(caskroom) expect(cask).to receive(:installed_version).and_return("2.61") diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 0f7da6eaa6..8bf8ea63d0 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -25,24 +25,6 @@ end require_relative "../standalone" require_relative "../warnings" -module T - module Types - class TypedArray < TypedEnumerable - # overrides Base - def valid?(obj) - recursively_valid?(obj) - end - end - - class TypedHash < TypedEnumerable - # overrides Base - def valid?(obj) - recursively_valid?(obj) - end - end - end -end - Warnings.ignore :parser_syntax do require "rubocop" end