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

New lint: unused syntax #361

Open
jackfirth opened this issue Oct 10, 2024 · 0 comments
Open

New lint: unused syntax #361

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

Comments

@jackfirth
Copy link
Owner

Resyntax should be able to remove unused local define-syntax bindings, like it can define bindings:

#lang resyntax/private/refactoring-test

--------------------
#lang racket
(define (foo)
  (define-syntax m (syntax-rules () [(m) (void)]))
  (+ 1 2 3))
--------------------
--------------------
#lang racket
(define (foo)
  (+ 1 2 3))
--------------------

The trouble is that local syntax bindings become uses of let-syntax, which disappear during macro expansion. Resyntax's identifier usage analysis relies on analyzing the expanded code, so it won't see disappearing let-syntax bindings or disappeared uses of macros. This can be fixed by making Resyntax look at the 'disappeared-binding and 'disappeared-use syntax properties on all syntax objects within the expanded code.

@jackfirth jackfirth added the new lint Issues suggesting new lints or pull requests implementing new lints label Oct 10, 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