diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb index fc78720816..89fd30e568 100644 --- a/Library/Homebrew/development_tools.rb +++ b/Library/Homebrew/development_tools.rb @@ -108,7 +108,7 @@ class DevelopmentTools true end - sig { returns(T::Hash[String, T.untyped]) } + sig { returns(T::Hash[String, T.nilable(String)]) } def build_system_info { "os" => ENV["HOMEBREW_SYSTEM"], diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 47aaaf722a..4f3b153c84 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -75,6 +75,7 @@ module OS languages.first end + sig { returns(String) } def active_developer_dir @active_developer_dir ||= Utils.popen_read("/usr/bin/xcode-select", "-print-path").strip end diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index fb36eabcf3..4e8851d858 100755 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -91,6 +91,9 @@ module OS # directory or nil if Xcode.app is not installed. sig { returns(T.nilable(Pathname)) } def prefix + return @prefix if defined?(@prefix) + + @prefix = T.let(@prefix, T.nilable(Pathname)) @prefix ||= begin dir = MacOS.active_developer_dir diff --git a/Library/Homebrew/sorbet/rbi/upstream.rbi b/Library/Homebrew/sorbet/rbi/upstream.rbi index dbade1d0dc..28a1b9b5b6 100644 --- a/Library/Homebrew/sorbet/rbi/upstream.rbi +++ b/Library/Homebrew/sorbet/rbi/upstream.rbi @@ -21,3 +21,14 @@ class Module end def define_method(arg0, arg1=T.unsafe(nil), &blk); end end + +class Pathname + # https://github.com/sorbet/sorbet/pull/4660 + sig do + params( + consider_symlink: T::Boolean, + ) + .returns(Pathname) + end + def cleanpath(consider_symlink=T.unsafe(nil)); end +end