Merge pull request #8774 from reitermarkus/sorbet-fixes
Fix some typechecking errors.
This commit is contained in:
commit
cb027474f5
@ -18,11 +18,11 @@ module Cask
|
|||||||
|
|
||||||
attr_reader :token, :sourcefile_path, :config
|
attr_reader :token, :sourcefile_path, :config
|
||||||
|
|
||||||
def self.each
|
def self.each(&block)
|
||||||
return to_enum unless block_given?
|
return to_enum unless block_given?
|
||||||
|
|
||||||
Tap.flat_map(&:cask_files).each do |f|
|
Tap.flat_map(&:cask_files).each do |f|
|
||||||
yield CaskLoader::FromTapPathLoader.new(f).load
|
block.call CaskLoader::FromTapPathLoader.new(f).load
|
||||||
rescue CaskUnreadableError => e
|
rescue CaskUnreadableError => e
|
||||||
opoo e.message
|
opoo e.message
|
||||||
end
|
end
|
||||||
|
|||||||
@ -166,10 +166,12 @@ module SharedEnvExtension
|
|||||||
# end</pre>
|
# end</pre>
|
||||||
def compiler
|
def compiler
|
||||||
@compiler ||= if (cc = @cc)
|
@compiler ||= if (cc = @cc)
|
||||||
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP
|
warn_about_non_apple_gcc(cc) if cc.match?(GNU_GCC_REGEXP)
|
||||||
|
|
||||||
fetch_compiler(cc, "--cc")
|
fetch_compiler(cc, "--cc")
|
||||||
elsif (cc = homebrew_cc)
|
elsif (cc = homebrew_cc)
|
||||||
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP
|
warn_about_non_apple_gcc(cc) if cc.match?(GNU_GCC_REGEXP)
|
||||||
|
|
||||||
compiler = fetch_compiler(cc, "HOMEBREW_CC")
|
compiler = fetch_compiler(cc, "HOMEBREW_CC")
|
||||||
|
|
||||||
if @formula
|
if @formula
|
||||||
|
|||||||
@ -46,9 +46,9 @@ module Stdenv
|
|||||||
|
|
||||||
send(compiler)
|
send(compiler)
|
||||||
|
|
||||||
return unless cc =~ GNU_GCC_REGEXP
|
return unless cc.match?(GNU_GCC_REGEXP)
|
||||||
|
|
||||||
gcc_formula = gcc_version_formula($&)
|
gcc_formula = gcc_version_formula(cc)
|
||||||
append_path "PATH", gcc_formula.opt_bin.to_s
|
append_path "PATH", gcc_formula.opt_bin.to_s
|
||||||
end
|
end
|
||||||
alias generic_setup_build_environment setup_build_environment
|
alias generic_setup_build_environment setup_build_environment
|
||||||
|
|||||||
@ -111,7 +111,7 @@ module Superenv
|
|||||||
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
|
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
|
||||||
|
|
||||||
begin
|
begin
|
||||||
path.append(gcc_version_formula($&).opt_bin) if homebrew_cc =~ GNU_GCC_REGEXP
|
path.append(gcc_version_formula(homebrew_cc).opt_bin) if homebrew_cc.match?(GNU_GCC_REGEXP)
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
# Don't fail and don't add these formulae to the path if they don't exist.
|
# Don't fail and don't add these formulae to the path if they don't exist.
|
||||||
nil
|
nil
|
||||||
|
|||||||
@ -1459,9 +1459,9 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def self.each
|
def self.each(&block)
|
||||||
files.each do |file|
|
files.each do |file|
|
||||||
yield Formulary.factory(file)
|
block.call Formulary.factory(file)
|
||||||
rescue FormulaUnavailableError, FormulaUnreadableError => e
|
rescue FormulaUnavailableError, FormulaUnreadableError => e
|
||||||
# Don't let one broken formula break commands. But do complain.
|
# Don't let one broken formula break commands. But do complain.
|
||||||
onoe "Failed to import: #{file}"
|
onoe "Failed to import: #{file}"
|
||||||
|
|||||||
@ -3,9 +3,8 @@
|
|||||||
module Utils::Inreplace
|
module Utils::Inreplace
|
||||||
include Kernel
|
include Kernel
|
||||||
|
|
||||||
sig { params(paths: T::Array[T.untyped], before: T.nilable(String), after: T.nilable(String), audit_result: T::Boolean).void }
|
sig { params(paths: T::Array[T.untyped], before: T.nilable(String), after: T.nilable(T.any(String, Symbol)), audit_result: T::Boolean).void }
|
||||||
def inreplace(paths, before = nil, after = nil, audit_result = true); end
|
def inreplace(paths, before = nil, after = nil, audit_result = true); end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class StringInreplaceExtension
|
class StringInreplaceExtension
|
||||||
|
|||||||
@ -552,14 +552,14 @@ class Tap
|
|||||||
self.class == other.class && name == other.name
|
self.class == other.class && name == other.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.each
|
def self.each(&block)
|
||||||
return unless TAP_DIRECTORY.directory?
|
return unless TAP_DIRECTORY.directory?
|
||||||
|
|
||||||
return to_enum unless block_given?
|
return to_enum unless block_given?
|
||||||
|
|
||||||
TAP_DIRECTORY.subdirs.each do |user|
|
TAP_DIRECTORY.subdirs.each do |user|
|
||||||
user.subdirs.each do |repo|
|
user.subdirs.each do |repo|
|
||||||
yield fetch(user.basename.to_s, repo.basename.to_s)
|
block.call fetch(user.basename.to_s, repo.basename.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -28,6 +28,8 @@ module Utils
|
|||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter
|
def inreplace(paths, before = nil, after = nil, audit_result = true) # rubocop:disable Style/OptionalBooleanParameter
|
||||||
|
after = after.to_s if after.is_a? Symbol
|
||||||
|
|
||||||
errors = {}
|
errors = {}
|
||||||
|
|
||||||
errors["`paths` (first) parameter"] = ["`paths` was empty"] if paths.blank?
|
errors["`paths` (first) parameter"] = ["`paths` was empty"] if paths.blank?
|
||||||
@ -39,7 +41,6 @@ module Utils
|
|||||||
if before.nil? && after.nil?
|
if before.nil? && after.nil?
|
||||||
yield s
|
yield s
|
||||||
else
|
else
|
||||||
after = after.to_s if after.is_a? Symbol
|
|
||||||
s.gsub!(before, after, audit_result)
|
s.gsub!(before, after, audit_result)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user