Skip to content

Commit

Permalink
Don't refactor let at module level (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfirth authored Sep 14, 2024
1 parent cc0bd32 commit ba08e82
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
15 changes: 15 additions & 0 deletions default-recommendations/let-binding-suggestions-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,21 @@ test: "let forms inside for loop bodies"
------------------------------


test: "let forms at module level not refactorable to define"
------------------------------
(let ([x 1])
(* x 2))
------------------------------


test: "let forms at submodule level not refactorable to define"
------------------------------
(module+ test
(let ([x 1])
(* x 2)))
------------------------------


test: "named lets which don't refer to the name are refactorable to unnamed lets"
------------------------------
(let loop ([x 1]) x)
Expand Down
18 changes: 6 additions & 12 deletions default-recommendations/private/definition-context.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
(define-splicing-syntax-class header-form-allowing-internal-definitions
#:attributes ([original 1])
#:literals (block
#%module-begin
module
module*
module+
let
let*
let-values
Expand Down Expand Up @@ -100,14 +96,13 @@


(define-syntax-class header-id-with-no-header-forms
#:literals (block #%module-begin)
(pattern (~or block #%module-begin)))
#:literals (block)
(pattern block))


(define-syntax-class header-id-with-one-header-form
#:literals (module+
let*
let-values
#:literals (let*
let-values
let*-values
when
unless
Expand Down Expand Up @@ -138,7 +133,6 @@
for*/first
for*/last)
(pattern (~or :lambda-by-any-name
module+
let*
let-values
let*-values
Expand Down Expand Up @@ -173,8 +167,8 @@


(define-syntax-class header-id-with-two-header-forms
#:literals (module module* for/fold for*/fold)
(pattern (~or module module* for/fold for*/fold)))
#:literals (for/fold for*/fold)
(pattern (~or for/fold for*/fold)))


(define-splicing-syntax-class branching-form-allowing-internal-definitions-within-clauses
Expand Down

0 comments on commit ba08e82

Please sign in to comment.