Skip to content

Commit

Permalink
Remove :final from Requirement#satisfied? sig
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Nov 24, 2024
1 parent 3b1d59d commit ccfc8bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
10 changes: 6 additions & 4 deletions Library/Homebrew/requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ def message
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),
Expand All @@ -82,8 +83,9 @@ def satisfied?(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
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
Expand Down
11 changes: 0 additions & 11 deletions Library/Homebrew/test/requirement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,6 @@
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
Expand Down

0 comments on commit ccfc8bf

Please sign in to comment.