From 779f2fc6ef536e48e60a5539b84c1774738f1280 Mon Sep 17 00:00:00 2001 From: Seeker Date: Wed, 20 Jan 2021 10:32:34 -0800 Subject: [PATCH] os/mac/version: update method signatures --- Library/Homebrew/os/mac/version.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index e3d35aed6a..0244607383 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -13,6 +13,7 @@ module OS class Version < ::Version extend T::Sig + sig { returns(Symbol) } attr_reader :arch SYMBOLS = { @@ -33,7 +34,7 @@ module OS new(str, arch: arch) end - sig { params(value: T.any(String, Symbol)).returns(T::Array[String]) } + sig { params(value: T.any(String, Symbol)).returns(T.any([], [String, T.nilable(String)])) } def self.version_arch(value) @all_archs_regex ||= begin all_archs = Hardware::CPU::ALL_ARCHS.map(&:to_s) @@ -43,7 +44,7 @@ module OS (-(?#{Regexp.union(all_archs)}))?$ /x end - match = @all_archs_regex.match(value) + match = @all_archs_regex.match(value.to_s) return [] unless match version = match[:version] @@ -65,6 +66,7 @@ module OS @comparison_cache = {} end + sig { override.params(other: T.untyped).returns(T.nilable(Integer)) } def <=>(other) @comparison_cache.fetch(other) do if SYMBOLS.key?(other) && to_sym == other