Rubocop: Named wildcards don't work with pattern union

Created on 11 Jan 2020  路  1Comment  路  Source: rubocop-hq/rubocop

The following works just fine:

{
  (send (send nil? $:be) :== $_)
  (send nil? $:be $...)
  (send nil? $_ $_ ...)
}

but after naming captured wildcards ($_ => $_argument), it stops working:

{
  (send (send nil? $:be) :== $_argument)
  (send nil? $:be $...)
  (send nil? $_ $_argument ...)
}

More context: https://github.com/rubocop-hq/rubocop-rspec/pull/858/files#diff-b3d90344c521a6844303917bf666af07R45

Expected behavior

Named wildcards don't affect matching.

Actual behavior

Naming wildcards breaks matching.

Steps to reproduce the problem

Source for reproduction:

eq(1)

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:

$ [bundle exec] rubocop -V
0.79.0 (using Parser 2.7.0.2, running on ruby 2.5.5 x86_64-darwin18)
bug

Most helpful comment

Interesting.

There are a few scenarios that are interesting. I'll see what I can do.

>All comments

Interesting.

There are a few scenarios that are interesting. I'll see what I can do.

Was this page helpful?
0 / 5 - 0 ratings