formulary: fix type of alias_path

`Formulary.from_rack` only allows `alias_path` to be a `Pathname`. Make
it happy with `String`s too.

Fixes:

    $ brew test openssl
    Error: Parameter 'alias_path': Expected type Pathname, got type String with value "/usr/local/Homebrew/Librar...homebrew-core/Aliases/openssl"
    Caller: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/sorbet-runtime-0.5.10461/lib/types/private/methods/call_validation.rb:113
    Definition: /usr/local/Homebrew/Library/Homebrew/formulary.rb:787

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
This commit is contained in:
Ruoyu Zhong 2023-08-02 22:49:39 +08:00
parent d2863d05b3
commit 26f8f27b3c
No known key found for this signature in database
GPG Key ID: DCAF462CAB59907D

View File

@ -779,7 +779,7 @@ module Formulary
rack: Pathname,
# Automatically resolves the formula's spec if not specified.
spec: Symbol,
alias_path: Pathname,
alias_path: T.any(Pathname, String),
force_bottle: T::Boolean,
flags: T::Array[String],
).returns(Formula)
@ -819,7 +819,7 @@ module Formulary
keg: Keg,
# Automatically resolves the formula's spec if not specified.
spec: Symbol,
alias_path: Pathname,
alias_path: T.any(Pathname, String),
force_bottle: T::Boolean,
flags: T::Array[String],
).returns(Formula)