Skip to content

Commit

Permalink
Formula: Update type signatures
Browse files Browse the repository at this point in the history
We're seeing type errors when building formulae that use something
like `xcodebuild ..., "-arch", Hardware::CPU.arch`, since `CPU.arch`
is a symbol. We've been addressing these issues by calling `#to_s` on
the value but there was some talk about simply expanding the type
signatures to accommodate anything that will be cast to a `String`.

There's maybe still an argument to be made for doing string conversion
in formulae but expanding the type signatures will resolve a number of
existing type errors if we simply want to rely on implicit type
casting.
  • Loading branch information
samford committed Sep 13, 2023
1 parent c953076 commit c0d0d14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2629,7 +2629,7 @@ def undeclared_runtime_dependencies
#
# # If there is a "make install" available, please use it!
# system "make", "install"</pre>
sig { params(cmd: T.any(String, Pathname), args: T.any(String, Pathname, Integer)).void }
sig { params(cmd: T.any(String, Pathname), args: T.any(String, Integer, Pathname, Symbol)).void }
def system(cmd, *args)
verbose_using_dots = Homebrew::EnvConfig.verbose_using_dots?

Expand Down Expand Up @@ -2794,7 +2794,7 @@ def mkdir(name, &block)
end

# Runs `xcodebuild` without Homebrew's compiler environment variables set.
sig { params(args: T.any(String, Pathname)).void }
sig { params(args: T.any(String, Pathname, Symbol)).void }
def xcodebuild(*args)
removed = ENV.remove_cc_etc

Expand Down

0 comments on commit c0d0d14

Please sign in to comment.