Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set valid ref range when regexp is matched in Lint/OutOfRangeRegexpRef #8463

Merged

Commits on Aug 5, 2020

  1. Set valid ref range when regexp is matched

    Last match global variables are set when the regexp is matched, not when
    it's defined. This meant that the previous implementation gave incorrect
    results when those things happened separately, e.g. when a regexp was
    assigned to a local variable or a constant and then matched elsewhere.
    
    This change means that the cop only handles matching on regexp literals,
    but that was the only case where it worked correctly before anyway. It
    should be possible to improve the cop to handle more complex cases with
    `VariableForce`, but that can be done as a separate change.
    eugeneius committed Aug 5, 2020
    Copy the full SHA
    8a12e5c View commit details
    Browse the repository at this point in the history