From ccfc8bfbe6f9cb79f0a1d84673a71051317cd3c0 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sun, 24 Nov 2024 10:18:45 -0800 Subject: [PATCH] Remove :final from Requirement#satisfied? sig --- Library/Homebrew/requirement.rb | 10 ++++++---- Library/Homebrew/test/requirement_spec.rb | 11 ----------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 9a25941df1..b469bcacda 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -60,8 +60,9 @@ class Requirement s end - # Pass a block or boolean to the satisfy DSL method instead of overriding. - sig(:final) { + # Overriding {#satisfied?} is unsupported. + # Pass a block or boolean to the satisfy DSL method instead. + sig { params( env: T.nilable(String), cc: T.nilable(String), @@ -82,8 +83,9 @@ class Requirement true end - # Pass a boolean to the fatal DSL method instead of overriding. - sig(:final) { returns(T::Boolean) } + # Overriding {#fatal?} is unsupported. + # Pass a boolean to the fatal DSL method instead. + sig { returns(T::Boolean) } def fatal? self.class.fatal || false end diff --git a/Library/Homebrew/test/requirement_spec.rb b/Library/Homebrew/test/requirement_spec.rb index 3666073894..67f5427397 100644 --- a/Library/Homebrew/test/requirement_spec.rb +++ b/Library/Homebrew/test/requirement_spec.rb @@ -59,17 +59,6 @@ RSpec.describe Requirement do describe "#fatal is omitted" do it { is_expected.not_to be_fatal } end - - describe "in subclasses" do - it "raises an error when instantiated" do - expect do - Class.new(described_class) do - def fatal? = false - end - end - .to raise_error(RuntimeError, /\AThe method `fatal\?` on #{described_class.name} was declared as final/) - end - end end describe "#satisfied?" do