diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index f878f60f83..8ea2c98f85 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "keg_relocate" @@ -524,8 +524,8 @@ class Keg end def delete_pyc_files! - find { |pn| pn.delete if PYC_EXTENSIONS.include?(pn.extname) } - find { |pn| FileUtils.rm_rf pn if pn.basename.to_s == "__pycache__" } + path.find { |pn| pn.delete if PYC_EXTENSIONS.include?(pn.extname) } + path.find { |pn| FileUtils.rm_rf pn if pn.basename.to_s == "__pycache__" } end def binary_executable_or_library_files diff --git a/Library/Homebrew/mktemp.rb b/Library/Homebrew/mktemp.rb index 8e6e9b0883..159c0b88df 100644 --- a/Library/Homebrew/mktemp.rb +++ b/Library/Homebrew/mktemp.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true # Performs {Formula#mktemp}'s functionality, and tracks the results. @@ -70,7 +70,7 @@ class Mktemp begin chown(nil, group_id, @tmpdir) rescue Errno::EPERM - opoo "Failed setting group \"#{Etc.getgrgid(group_id).name}\" on #{@tmpdir}" + opoo "Failed setting group \"#{T.must(Etc.getgrgid(group_id)).name}\" on #{@tmpdir}" end begin diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb index 727a72cfa5..e1877729a0 100644 --- a/Library/Homebrew/options.rb +++ b/Library/Homebrew/options.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true # A formula option. diff --git a/Library/Homebrew/options.rbi b/Library/Homebrew/options.rbi new file mode 100644 index 0000000000..b11d6cd088 --- /dev/null +++ b/Library/Homebrew/options.rbi @@ -0,0 +1,8 @@ +# typed: strict + +class Options + # This is a workaround to enable `alias to_ary to_a` + # @see https://github.com/sorbet/sorbet/issues/2378#issuecomment-569474238 + sig { returns(T::Array[Option]) } + def to_a; end +end diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index cdfc602fba..ca7d078b89 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true # {Pathname} extension for dealing with ELF files. diff --git a/Library/Homebrew/os/linux/elf.rbi b/Library/Homebrew/os/linux/elf.rbi new file mode 100644 index 0000000000..2c99175895 --- /dev/null +++ b/Library/Homebrew/os/linux/elf.rbi @@ -0,0 +1,5 @@ +# typed: strict + +module ELFShim + requires_ancestor { Pathname } +end diff --git a/Library/Homebrew/os/mac/mach.rb b/Library/Homebrew/os/mac/mach.rb index abadcf8fd6..b421103de7 100644 --- a/Library/Homebrew/os/mac/mach.rb +++ b/Library/Homebrew/os/mac/mach.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "macho" diff --git a/Library/Homebrew/os/mac/mach.rbi b/Library/Homebrew/os/mac/mach.rbi new file mode 100644 index 0000000000..54bb844d78 --- /dev/null +++ b/Library/Homebrew/os/mac/mach.rbi @@ -0,0 +1,5 @@ +# typed: strict + +module MachOShim + include Kernel +end