From c495aa3e6309fecbac21b90a86a77b1deca02d4c Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:39:55 -0400 Subject: [PATCH] Cask::DSL::DependsOn: add empty?, present? methods `#present?` is called on a `DependsOn` object in `Cask::DSL` and this is seemingly deferred to the underlying hash object but Sorbet doesn't understand this kind of `SimpleDelegator` magic. This adds `empty?` and `present?` methods that explicitly interact with the hash in a way that Sorbet can understand. --- Library/Homebrew/cask/dsl/depends_on.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/cask/dsl/depends_on.rb b/Library/Homebrew/cask/dsl/depends_on.rb index 37cfb302d0..7a5756f9c0 100644 --- a/Library/Homebrew/cask/dsl/depends_on.rb +++ b/Library/Homebrew/cask/dsl/depends_on.rb @@ -82,6 +82,12 @@ module Cask @arch.concat(arches.map { |arch| VALID_ARCHES[arch] }) end + + sig { returns(T::Boolean) } + def empty? = T.let(__getobj__, T::Hash[Symbol, T.untyped]).empty? + + sig { returns(T::Boolean) } + def present? = !empty? end end end