From d8ba8c807ae1f433dd6135c253cac7fdeeea774f Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Thu, 2 Mar 2023 14:39:55 -0800 Subject: [PATCH] Fix type errors --- Library/Homebrew/extend/array.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/extend/array.rb b/Library/Homebrew/extend/array.rb index 1d91c99b52..21b282a6f5 100644 --- a/Library/Homebrew/extend/array.rb +++ b/Library/Homebrew/extend/array.rb @@ -32,11 +32,12 @@ class Array when 0 +"" when 1 - +(self[0]).to_s + # This is not typesafe, if the array contains a BasicObject + +T.unsafe(self[0]).to_s when 2 +"#{self[0]}#{two_words_connector}#{self[1]}" else - +"#{self[0...-1].join(words_connector)}#{last_word_connector}#{self[-1]}" + +"#{T.must(self[0...-1]).join(words_connector)}#{last_word_connector}#{self[-1]}" end end end