From bffb470c57422a6922afaec41cf5c595b9d8495c Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 11 Jul 2024 19:37:46 +0100 Subject: [PATCH] unpack_strategy: Fix `ref_type` type (Symbol, not String) - I put a debugger call in the test that was failing. - Running the install command at that debug prompt and lo, the typing bug was staring me in the face: ``` Error: An exception occurred within a child process: TypeError: Parameter 'ref_type': Expected type T.nilable(String), got type Symbol with value :branch Caller: /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11471/lib/types/private/methods/call_validation.rb:215 Definition: /opt/homebrew/Library/Homebrew/unpack_strategy.rb:102 (UnpackStrategy.detect) ``` --- Library/Homebrew/unpack_strategy.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/unpack_strategy.rb b/Library/Homebrew/unpack_strategy.rb index e4190f10f6..b3581c8ad7 100644 --- a/Library/Homebrew/unpack_strategy.rb +++ b/Library/Homebrew/unpack_strategy.rb @@ -96,7 +96,7 @@ module UnpackStrategy end sig { - params(path: Pathname, prioritize_extension: T::Boolean, type: T.nilable(Symbol), ref_type: T.nilable(String), + params(path: Pathname, prioritize_extension: T::Boolean, type: T.nilable(Symbol), ref_type: T.nilable(Symbol), ref: T.nilable(String), merge_xattrs: T::Boolean).returns(T.untyped) } def self.detect(path, prioritize_extension: false, type: nil, ref_type: nil, ref: nil, merge_xattrs: false) @@ -123,14 +123,14 @@ module UnpackStrategy attr_reader :merge_xattrs sig { - params(path: T.any(String, Pathname), ref_type: T.nilable(String), ref: T.nilable(String), + params(path: T.any(String, Pathname), ref_type: T.nilable(Symbol), ref: T.nilable(String), merge_xattrs: T::Boolean).void } def initialize(path, ref_type: nil, ref: nil, merge_xattrs: false) @path = T.let(Pathname(path).expand_path, Pathname) - @ref_type = ref_type - @ref = ref - @merge_xattrs = merge_xattrs + @ref_type = T.let(ref_type, T.nilable(Symbol)) + @ref = T.let(ref, T.nilable(String)) + @merge_xattrs = T.let(merge_xattrs, T::Boolean) end sig { abstract.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).void }