Merge pull request #18814 from Homebrew/revert-final-sig

Remove problematic :final from Requirement sigs
This commit is contained in:
Bo Anderson 2024-11-25 03:36:44 +00:00 committed by GitHub
commit a542ef9b7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 15 deletions

View File

@ -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

View File

@ -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