Remove unnecessary class typechecking code

Also add a test for this part of TR. In particular, it
handles registering syntax definitions that are found in
a class body.

original commit: 92bdd84b079b23f91c0d6088dd5f3690d2d7f796
This commit is contained in:
Asumu Takikawa 2014-04-23 11:45:19 -04:00
parent ceb3a6d5ef
commit 63efae6fff
2 changed files with 13 additions and 7 deletions

View File

@ -274,7 +274,6 @@
;; this is mostly cribbed from class-internal.rkt
(define (expand-expressions stxs ctx def-ctx)
(define (class-expand stx)
;; try using syntax-local-expand-expression?
(local-expand stx ctx stop-forms def-ctx))
(let loop ([stxs stxs])
(cond [(null? stxs) null]
@ -288,12 +287,9 @@
;; i.e., macro definitions in the class body
;; see class-internal.rkt as well
[(define-syntaxes (name:id ...) rhs:expr)
(define/with-syntax expanded-rhs
(local-transformer-expand #'rhs 'expression null))
(syntax-local-bind-syntaxes
(syntax->list #'(name ...)) #'expanded-rhs def-ctx)
(cons #'(define-syntaxes (name ...) expanded-rhs)
(loop (cdr stxs)))]
(syntax->list #'(name ...)) #'rhs def-ctx)
(cons stx (loop (cdr stxs)))]
[(define-values (name:id ...) rhs:expr)
(syntax-local-bind-syntaxes
(syntax->list #'(name ...)) #f def-ctx)

View File

@ -1413,4 +1413,14 @@
(init x)))
#:ret (ret (-poly (A) (-class #:init ([x A #f]))))
#:expected (ret (-poly (A) (-class #:init ([x A #f]))) -no-filter -no-obj)]
))
;; test uses of a macro in the body of the class
[tc-e
(let ()
(define c%
(class object%
(super-new)
(define-syntax-rule (my-meth (m arg ...) . body)
(define/public (m arg ...) . body))
(my-meth (hello) (displayln "hello world"))))
(send (new c%) hello))
-Void]))