Skip to content

Commit 322dd03

Browse files
committed
Fix require tidying for sneaky imports
Closes #383.
1 parent 2ae6fc3 commit 322dd03

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,17 @@ test: "require tidying of only non-phase spec forms should do nothing"
134134
----------------------------------------
135135

136136

137-
test: "require tidying shouldn't trigger when require transformers are imported and used"
137+
test: "require tidying shouldn't trigger when transformers are imported and used"
138138
----------------------------------------
139139
(require racket/require
140140
(multi-in racket (list set dict))
141141
racket/hash)
142142
----------------------------------------
143+
144+
145+
test: "require tidying shouldn't trigger when transformers are imported and used in nested specs"
146+
----------------------------------------
147+
(require racket/require
148+
(prefix-in racket: (multi-in racket (list set dict)))
149+
racket/hash)
150+
----------------------------------------

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

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,35 +91,21 @@
9191
except-in
9292
prefix-in
9393
rename-in
94-
combine-in
95-
relative-in
96-
only-meta-in
97-
only-space-in
9894
for-syntax
9995
for-template
10096
for-label
10197
for-meta)
102-
(pattern mod:collection-module-path #:attr parsed (parsed-simple-import 0 'plain 'collection #'mod))
103-
(pattern mod:file-module-path #:attr parsed (parsed-simple-import 0 'plain 'file #'mod))
104-
(pattern ((~or only-in
105-
except-in
106-
prefix-in
107-
rename-in
108-
combine-in
109-
relative-in
110-
only-meta-in
111-
only-space-in)
112-
subspec ...)
98+
99+
(pattern :simple-module-import-spec)
100+
101+
(pattern (~or (only-in _:simple-module-import-spec _ ...)
102+
(except-in _:simple-module-import-spec _ ...)
103+
(prefix-in _ _:simple-module-import-spec)
104+
(rename-in _:simple-module-import-spec _ ...))
105+
#:cut
113106
#:attr parsed (parsed-simple-import 0 'plain 'other-known this-syntax))
107+
114108
(pattern ((~and form
115-
(~not only-in)
116-
(~not except-in)
117-
(~not prefix-in)
118-
(~not rename-in)
119-
(~not combine-in)
120-
(~not relative-in)
121-
(~not only-meta-in)
122-
(~not only-space-in)
123109
(~not for-syntax)
124110
(~not for-template)
125111
(~not for-label)
@@ -128,6 +114,12 @@
128114
#:attr parsed (parsed-simple-import 0 'plain 'other-unknown this-syntax)))
129115

130116

117+
(define-syntax-class simple-module-import-spec
118+
#:attributes (parsed)
119+
(pattern mod:collection-module-path #:attr parsed (parsed-simple-import 0 'plain 'collection #'mod))
120+
(pattern mod:file-module-path #:attr parsed (parsed-simple-import 0 'plain 'file #'mod)))
121+
122+
131123
(define-syntax-class collection-module-path
132124
(pattern :id))
133125

0 commit comments

Comments
 (0)