jackfirth / jackfirth/resyntax

New lint: unused syntax

Open
#361 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

new lint
Dominant language
Racket
Stars
70
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the refactoring test shown in the issue and Resyntax’s expanded-code identifier usage analysis. Inspect how the 'disappeared-binding and 'disappeared-use syntax properties are represented on expanded syntax objects. Done means the shown unused local define-syntax binding is removed without breaking existing macro and identifier-usage behavior.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.