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

Unnecessary root-level and patterns #388

Open
jackfirth opened this issue Nov 8, 2024 · 0 comments
Open

Unnecessary root-level and patterns #388

jackfirth opened this issue Nov 8, 2024 · 0 comments
Labels
new lint Issues suggesting new lints or pull requests implementing new lints

Comments

@jackfirth
Copy link
Owner

jackfirth commented Nov 8, 2024

Encountered here:

#lang resyntax/test

test: "root-level and pattern can be removed when matching on a variable"
--------------------
#lang racket
(define (f xs)
  (match xs
    [(and foo (list x y ...))
     (cons x (reverse foo))]))
--------------------
--------------------
#lang racket
(define (f xs)
  (match xs
    [(list x y ...)
     (cons x (reverse xs))]))
--------------------

This applies whenever match is used on a variable and has an and pattern with an identifier as the outermost pattern in any branch.

@jackfirth jackfirth added the new lint Issues suggesting new lints or pull requests implementing new lints label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new lint Issues suggesting new lints or pull requests implementing new lints
Projects
None yet
Development

No branches or pull requests

1 participant