resyntax
resyntax copied to clipboard
New lint: unused syntax
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.