From 1842aaa2bd12da0b521e84e4e05d3dbf79bff6c6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 19 May 2015 19:56:43 -0600 Subject: [PATCH] fixes for some tests The `identifier-binding` function is now senstive to the "macro introduction" scope that's on an indentifier provided to a currently expanding macro. Unit tests for TR need to use `syntax-local-intorduce` to remove it, in the same way that `tc-setup` already does. Also, recognize a class expansion when it's wrapped with `#%expression`, since `class` now expands that way sometimes. --- .../typed-racket/typecheck/check-class-unit.rkt | 14 ++++++++++++-- typed-racket-test/unit-tests/typecheck-tests.rkt | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt b/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt index 48b87772..c4f5d770 100644 --- a/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt +++ b/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt @@ -153,8 +153,8 @@ (let-values ([(field-name:id) accessor-or-mutator] ...) :make-methods-body)))) -(define-syntax-class class-expansion - #:literals (#%plain-app quote) +(define-syntax-class core-class-expansion + #:literals (let-values letrec-syntaxes+values #%plain-app quote) #:attributes (superclass-expr make-methods initializer-body @@ -170,6 +170,16 @@ (quote :boolean) (quote #f)))) +(define-syntax-class class-expansion + #:literals (#%expression) + #:attributes (superclass-expr + make-methods + initializer-body + initializer-self-id + initializer-args-id) + (pattern :core-class-expansion) + (pattern (#%expression :core-class-expansion))) + ;; This is similar to `type-declaration` from "internal-forms.rkt", but ;; the expansion is slightly different in a class so we use this instead. (define-syntax-class class-type-declaration diff --git a/typed-racket-test/unit-tests/typecheck-tests.rkt b/typed-racket-test/unit-tests/typecheck-tests.rkt index c080ac22..2ce9a3a8 100644 --- a/typed-racket-test/unit-tests/typecheck-tests.rkt +++ b/typed-racket-test/unit-tests/typecheck-tests.rkt @@ -51,7 +51,7 @@ ;; tr-expand: syntax? -> syntax? ;; Expands out a form and annotates it with necesarry TR machinery. (define (tr-expand stx) - (define expanded-stx (local-expand stx 'expression '())) + (define expanded-stx (syntax-local-introduce (local-expand stx 'expression '()))) (find-mutated-vars expanded-stx mvar-env) expanded-stx)