rubocop / rubocop-ast

RuboCop's AST extensions and NodePattern functionality
https://docs.rubocop.org/rubocop-ast
MIT License
104 stars 52 forks source link

Add `RuboCop::AST::RationalNode` #304

Closed koic closed 2 months ago

koic commented 3 months ago

This PR resolves the fundamental issue mentioned in https://github.com/rubocop/rubocop/issues/13051. Although rational literal (e.g., (0.2r) is a basic literal that return true for RuboCop::AST::Node#numeric_type? and RuboCop::AST::Node#literal?, their behavior was not sufficiently covered as a NumericNode.

This PR maps rational literal to RationalNode to enable expected node operations for rational literals.

koic commented 2 months ago

@marcandre Can you review this?

marcandre commented 2 months ago

Sorry, I missed the notification, thanks for the reminder.

Looks great, thanks.

koic commented 2 months ago

Thank you @marcandre!

marcandre commented 2 months ago

Released as 1.32.0