Skip to content

Commit 2cabb9a

Browse files
committed
Also fix (!) annotations in variable declarations
1 parent 7895ea6 commit 2cabb9a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/syntax/syntax-check.rkt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,20 @@
157157
(define (check-program* stx vars props body error!)
158158
(unless (list? vars)
159159
(error! stx "Invalid arguments list ~a; must be a list" stx))
160-
(define vars* (filter identifier? vars))
161-
(when (list? vars)
162-
(for ([var vars]
163-
#:unless (identifier? var))
164-
(error! stx "Argument ~a is not a variable name" var))
165-
(when (check-duplicate-identifier vars*)
166-
(error! stx "Duplicate argument name ~a" (check-duplicate-identifier vars*))))
167160
(define deprecated-ops (mutable-set))
161+
(define vars*
162+
(reap [sow]
163+
(when (list? vars)
164+
(for ([var (in-list vars)])
165+
(match var
166+
[(? identifier? x) (sow var)]
167+
[#`(! #,props ... #,name)
168+
(check-properties* props (immutable-bound-id-set '()) error! deprecated-ops)
169+
(cond
170+
[(identifier? name) (sow name)]
171+
[else (error! var "Annotated argument ~a is not a variable name" name)])])))))
172+
(when (check-duplicate-identifier vars*)
173+
(error! stx "Duplicate argument name ~a" (check-duplicate-identifier vars*)))
168174
(check-properties* props (immutable-bound-id-set vars*) error! deprecated-ops)
169175
(check-expression* body (immutable-bound-id-set vars*) error! deprecated-ops)
170176
(for ([op (in-set deprecated-ops)])

0 commit comments

Comments
 (0)