struct: syntax error for #:prefab plus #:authentic

Prior to this change, the combination was documented as a syntax
error, but it was only a run-time error --- and not even that as of
v8.0 for Racket CS (but it was always a run-time error for BC).

Closes #3700
This commit is contained in:
Matthew Flatt 2021-02-26 16:58:31 -07:00
parent 6ae0417468
commit be7c7755b2
2 changed files with 6 additions and 0 deletions

View File

@ -499,6 +499,8 @@
(syntax-test #'(define-struct a (b c) #:property 1 10 #:prefab))
(syntax-test #'(define-struct a (b c) #:sealed #:prefab))
(syntax-test #'(define-struct a (b c) #:prefab #:sealed))
(syntax-test #'(define-struct a (b c) #:prefab #:authentic))
(syntax-test #'(define-struct a (b c) #:authentic #:prefab))
(define-struct base0 ())
(define-struct base1 (a))

View File

@ -350,6 +350,8 @@
(extend-config config '#:inspector #'#f)
nongen?)]
[(eq? '#:authentic (syntax-e (car p)))
(when nongen?
(bad "cannot use" (car p) " for prefab structure type"))
(when (lookup config '#:authentic)
(bad "multiple" "#:authentic" "s" (car p)))
(loop (cdr p)
@ -403,6 +405,8 @@
(bad "cannot use" (car p) " for a sealed structure type"))
(when (lookup config '#:guard)
(bad "cannot use" (car p) " for a structure type with a guard"))
(when (lookup config '#:authentic)
(bad "cannot use" (car p) " for an authentic structure type"))
(loop (cdr p)
(extend-config config '#:inspector #''prefab)
#t)]