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)
```
This commit is contained in:
Issy Long 2024-07-11 19:37:46 +01:00
parent 9c6430954b
commit bffb470c57
No known key found for this signature in database

View File

@ -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 }