From 2ec51940b9b51a808cb81f5066f29ece277fd5a7 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Sun, 2 May 2021 06:00:09 -0400 Subject: [PATCH] [Fixes #179] Have `ast_with_comments` distinguish nodes with same content --- lib/rubocop/ast/processed_source.rb | 2 +- rubocop-ast.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rubocop/ast/processed_source.rb b/lib/rubocop/ast/processed_source.rb index 566e5d343..66656d71e 100644 --- a/lib/rubocop/ast/processed_source.rb +++ b/lib/rubocop/ast/processed_source.rb @@ -41,7 +41,7 @@ def initialize(source, ruby_version, path = nil) def ast_with_comments return if !ast || !comments - @ast_with_comments ||= Parser::Source::Comment.associate(ast, comments) + @ast_with_comments ||= Parser::Source::Comment.associate_by_identity(ast, comments) end # Returns the source lines, line break characters removed, excluding a diff --git a/rubocop-ast.gemspec b/rubocop-ast.gemspec index 2d755b4b8..6fdd0d9e1 100644 --- a/rubocop-ast.gemspec +++ b/rubocop-ast.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |s| 'bug_tracker_uri' => 'https://github.com/rubocop-hq/rubocop-ast/issues' } - s.add_runtime_dependency('parser', '>= 2.7.1.5') + s.add_runtime_dependency('parser', '>= 3.0.1.1') s.add_development_dependency('bundler', '>= 1.15.0', '< 3.0')