Generic RuboCop::AST::Node for stanza method nodes

- These can be either BlockNode, SendNode or AsgnNode,
  which are all a type of Node.
- This causes errors in other places because we call
  BlockNode or SendNode methods on a Node now. Still TODO.
This commit is contained in:
Issy Long 2025-01-25 21:07:44 +00:00
parent 9a97456767
commit 06441f1337
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -14,16 +14,16 @@ module RuboCop
sig {
params(
method_node: T.any(RuboCop::AST::SendNode, RuboCop::AST::BlockNode),
method_node: RuboCop::AST::Node,
all_comments: T::Array[T.any(String, Parser::Source::Comment)],
).void
}
def initialize(method_node, all_comments)
@method_node = T.let(method_node, T.any(RuboCop::AST::SendNode, RuboCop::AST::BlockNode))
@method_node = T.let(method_node, RuboCop::AST::Node)
@all_comments = T.let(all_comments, T::Array[T.any(String, Parser::Source::Comment)])
end
sig { returns(T.any(RuboCop::AST::SendNode, RuboCop::AST::BlockNode)) }
sig { returns(RuboCop::AST::Node) }
attr_reader :method_node
alias stanza_node method_node

View File

@ -6,7 +6,7 @@ module RuboCop
class Discontinued < Base
sig {
params(
base_node: T.any(RuboCop::AST::BlockNode, RuboCop::AST::SendNode),
base_node: RuboCop::AST::Node,
block: T.nilable(T.proc.params(node: RuboCop::AST::SendNode).void),
).returns(T::Boolean)
}
@ -14,7 +14,7 @@ module RuboCop
sig {
params(
base_node: T.any(RuboCop::AST::BlockNode, RuboCop::AST::SendNode),
base_node: RuboCop::AST::Node,
block: T.proc.params(node: RuboCop::AST::SendNode).void,
).void
}