struct: disallow #:extra-name
with #:omit-define-syntaxes
This commit is contained in:
parent
ed2381ee59
commit
f94fba12da
|
@ -180,7 +180,8 @@ If @racket[name-id] is supplied via @racket[#:extra-name] and it is
|
||||||
not @racket[id], then both @racket[name-id] and @racket[id] are bound
|
not @racket[id], then both @racket[name-id] and @racket[id] are bound
|
||||||
to information about the structure type. Only one of
|
to information about the structure type. Only one of
|
||||||
@racket[#:extra-name] and @racket[#:name] can be provided within a
|
@racket[#:extra-name] and @racket[#:name] can be provided within a
|
||||||
@racket[struct] form.
|
@racket[struct] form, and @racket[#:extra-name] cannot be combined
|
||||||
|
with @racket[#:omit-define-syntaxes].
|
||||||
|
|
||||||
@examples[#:eval posn-eval
|
@examples[#:eval posn-eval
|
||||||
(struct ghost (color name) #:prefab #:extra-name GHOST)
|
(struct ghost (color name) #:prefab #:extra-name GHOST)
|
||||||
|
|
|
@ -1193,6 +1193,9 @@
|
||||||
(test 'blinky ghost-name (struct-copy GHOST (ghost 'red 'blinky)))
|
(test 'blinky ghost-name (struct-copy GHOST (ghost 'red 'blinky)))
|
||||||
(syntax-test #'GHOST)
|
(syntax-test #'GHOST)
|
||||||
|
|
||||||
|
(syntax-test #'(struct ghost (color name) #:extra-name GHOST #:omit-define-syntaxes)
|
||||||
|
"cannot be combined")
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
;; Check `#:authentic`:
|
;; Check `#:authentic`:
|
||||||
|
|
||||||
|
|
|
@ -741,6 +741,8 @@
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(cond
|
(cond
|
||||||
[(and info-name (not name-only?))
|
[(and info-name (not name-only?))
|
||||||
|
(when omit-define-syntaxes?
|
||||||
|
(raise-syntax-error #f "#:extra-name cannot be combined with #:omit-define-syntaxes" stx))
|
||||||
; reuse existing value
|
; reuse existing value
|
||||||
(list #`(define-syntaxes (#,info-name) (syntax-local-value #'#,id)))]
|
(list #`(define-syntaxes (#,info-name) (syntax-local-value #'#,id)))]
|
||||||
[else null]))])
|
[else null]))])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user