diff --git a/Library/Homebrew/sorbet/tapioca/compilers/cask/config.rb b/Library/Homebrew/sorbet/tapioca/compilers/cask/config.rb index 8886c150c5baf..0571cb4220e19 100644 --- a/Library/Homebrew/sorbet/tapioca/compilers/cask/config.rb +++ b/Library/Homebrew/sorbet/tapioca/compilers/cask/config.rb @@ -9,14 +9,21 @@ module Compilers class CaskConfig < Tapioca::Dsl::Compiler ConstantType = type_member { { fixed: T::Module[T.anything] } } + # Dirs defined in `OS::Linux::Cask::Config::ClassMethods::DEFAULT_DIRS` + # that aren't visible to `Cask::Config.defaults` when this compiler is + # run on macOS, but still need accessor methods generated in the RBI. + LINUX_ONLY_DIRS = T.let([:appimagedir].freeze, T::Array[Symbol]) + sig { override.returns(T::Enumerable[T::Module[T.anything]]) } def self.gather_constants = [Cask::Config] sig { override.void } def decorate + keys = Cask::Config.defaults.keys | LINUX_ONLY_DIRS + root.create_module("Cask") do |mod| mod.create_class("Config") do |klass| - Cask::Config.defaults.each do |key, value| + keys.each do |key| return_type = if key == :languages # :languages is a `LazyObject`, so it lazily evaluates to an # array of strings when a method is called on it. @@ -24,7 +31,7 @@ def decorate elsif key.end_with?("?") "T::Boolean" else - value.class.to_s + "String" end klass.create_method(key.to_s, return_type:, class_method: false)