From 1b84c5c8c2dd6fbc9ff0731b46feea5e96bc638d Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Fri, 9 Feb 2024 11:40:35 -0800 Subject: [PATCH] Add upstream JSON generator modules --- Library/Homebrew/dev-cmd/determine-test-runners.rb | 2 +- Library/Homebrew/requirements/macos_requirement.rb | 4 ++-- Library/Homebrew/sorbet/rbi/upstream.rbi | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 68639819e8..9a94f20ca9 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -55,7 +55,7 @@ module Homebrew github_output = ENV.fetch("GITHUB_OUTPUT") File.open(github_output, "a") do |f| - f.puts("runners=#{T.unsafe(runners).to_json}") + f.puts("runners=#{runners.to_json}") f.puts("runners_present=#{runners.present?}") end end diff --git a/Library/Homebrew/requirements/macos_requirement.rb b/Library/Homebrew/requirements/macos_requirement.rb index 3371ca25b3..b58a3ce50d 100644 --- a/Library/Homebrew/requirements/macos_requirement.rb +++ b/Library/Homebrew/requirements/macos_requirement.rb @@ -118,8 +118,8 @@ class MacOSRequirement < Requirement def to_json(options) comp = @comparator.to_s - return T.unsafe({ comp => @version.map(&:to_s) }).to_json(options) if @version.is_a?(Array) + return { comp => @version.map(&:to_s) }.to_json(options) if @version.is_a?(Array) - T.unsafe({ comp => [@version.to_s] }).to_json(options) + { comp => [@version.to_s] }.to_json(options) end end diff --git a/Library/Homebrew/sorbet/rbi/upstream.rbi b/Library/Homebrew/sorbet/rbi/upstream.rbi index 877921e54f..1c15b292f8 100644 --- a/Library/Homebrew/sorbet/rbi/upstream.rbi +++ b/Library/Homebrew/sorbet/rbi/upstream.rbi @@ -3,6 +3,14 @@ # This file contains temporary definitions for fixes that have # been submitted upstream to https://github.com/sorbet/sorbet. +# https://github.com/sorbet/sorbet/pull/7682 +class Array + include JSON::Ext::Generator::GeneratorMethods::Array +end +class Hash + include JSON::Ext::Generator::GeneratorMethods::Hash +end + # https://github.com/sorbet/sorbet/pull/7650 class Etc::Group < Struct sig { returns(Integer) }