Skip to content

Commit f5d1ede

Browse files
authored
Fix no-op require tidying issue (#360)
Closes #355.
1 parent bb3ef8b commit f5d1ede

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

default-recommendations/require-and-provide-suggestions-test.rkt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ test: "require tidying should move non-phase spec forms before relative paths"
127127
----------------------------------------
128128

129129

130+
test: "require tidying of only non-phase spec forms should do nothing"
131+
----------------------------------------
132+
(require (only-in racket/list first)
133+
(only-in racket/hash hash-union))
134+
----------------------------------------
135+
136+
130137
test: "require tidying shouldn't trigger when require transformers are imported and used"
131138
----------------------------------------
132139
(require racket/require

default-recommendations/require-and-provide-suggestions.rkt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@
200200

201201

202202
(define (simple-spec? spec)
203-
(not (equal? (parsed-simple-import-kind spec) 'other)))
203+
(define kind (parsed-simple-import-kind spec))
204+
(and (not (equal? kind 'other-known)) (not (equal? kind 'other-unknown))))
204205

205206

206207
(define (import-specs-all-known? specs)
@@ -212,6 +213,7 @@
212213
(and (sorted? specs parsed-import-spec<=>)
213214
(sorted? (filter simple-spec? specs) parsed-import-spec<=> #:strictly? #true)))
214215

216+
215217
(define (import-specs-tidy specs)
216218
(transduce specs
217219
(indexing parsed-simple-import-phase)

0 commit comments

Comments
 (0)