class-internal: avoid wrapping "immediate" opt/kw defaults (#3182)

When expanding a method definition, do not wrap the default expression
 for optional and keyword args if it matches `immediate-default?`
This commit is contained in:
Ben Greenman 2020-05-13 18:02:40 -04:00 committed by GitHub
parent e8202b7fa3
commit 84f9126f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@
racket/unsafe/undefined
"class-undef.rkt"
(for-syntax racket/stxparam
racket/private/immediate-default
syntax/kerncase
syntax/stx
syntax/name
@ -528,7 +529,7 @@
[(pair? vars)
(syntax-case (car vars) ()
[(id expr)
(identifier? #'id)
(and (identifier? #'id) (not (immediate-default? #'expr)))
;; optional argument; need to wrap arg expression
(cons
(with-syntax ([expr (syntax/loc #'expr