diff --git a/lib/rubocop/ast/node.rb b/lib/rubocop/ast/node.rb index f1ada86dc..f37e5e74f 100644 --- a/lib/rubocop/ast/node.rb +++ b/lib/rubocop/ast/node.rb @@ -425,7 +425,7 @@ def loop_keyword? end def keyword? - return true if special_keyword? || send_type? && prefix_not? + return true if special_keyword? || (send_type? && prefix_not?) return false unless KEYWORDS.include?(type) !OPERATOR_KEYWORDS.include?(type) || loc.operator.is?(type.to_s) diff --git a/spec/rubocop/ast/node_pattern/lexer_spec.rb b/spec/rubocop/ast/node_pattern/lexer_spec.rb index 0d81f0270..fb232c5ce 100644 --- a/spec/rubocop/ast/node_pattern/lexer_spec.rb +++ b/spec/rubocop/ast/node_pattern/lexer_spec.rb @@ -67,7 +67,7 @@ it 'distinguishes them' do types = tokens.map(&:first) - expect(types).to eq [:tNODE_TYPE] * 2 + [:tPARAM_CONST] * 7 + expect(types).to eq ([:tNODE_TYPE] * 2) + ([:tPARAM_CONST] * 7) zz, percent_zz = tokens.last(2).map(&:last).map(&:first) expect(zz).to eq 'Zz' expect(percent_zz).to eq 'Zz'