rubocop-ast icon indicating copy to clipboard operation
rubocop-ast copied to clipboard

Documentation for named `_` and backreferences in node pattern

Open dvandersluis opened this issue 4 years ago • 3 comments

(block _ $(args (arg _var)) (send (lvar _var) $_))

I was not aware that in a pattern like this, _var acts as a backreference when repeated (ie. the second _var has to match the first _var), which caused the issue in rubocop-hq/rubocop#9257.

It'd be great to have something in the node pattern docs to explain that.

dvandersluis avatar Dec 19 '20 15:12 dvandersluis

Oh, indeed, it seems to be missing in the main doc 😅

PR welcome, or I'll handle it after Xmas

marcandre avatar Dec 19 '20 15:12 marcandre

My fault btw, I was tired of the repetition between the source code's doc and the official doc, so I removed the code's doc in 2ca9c08 but didn't notice that was missing.

marcandre avatar Dec 19 '20 15:12 marcandre

Thanks @marcandre! I’ll take a look if I get a chance. Happy holidays!!

dvandersluis avatar Dec 19 '20 15:12 dvandersluis