From 7f911c3da7ed05ae06bf0093a781c5e1fdbe5dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Tue, 26 Sep 2017 13:48:02 +0200 Subject: [PATCH] Rollback improvements to typecheck-fail, as they cause errors (due to scoping issues, most likely) --- .../examples/tests/rackunit-typechecking.rkt | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/turnstile/examples/tests/rackunit-typechecking.rkt b/turnstile/examples/tests/rackunit-typechecking.rkt index abc26bf..ea65511 100644 --- a/turnstile/examples/tests/rackunit-typechecking.rkt +++ b/turnstile/examples/tests/rackunit-typechecking.rkt @@ -76,29 +76,21 @@ (if (attribute msg-pat) (eval-syntax (datum->stx #'h (stx->datum #'msg-pat))) (eval-syntax (datum->stx #'h `(add-escs ,(stx->datum #'vmsg))))) - #:with transformer-proc #`(λ (_stx) - (with-check-info* - ;; Most of these are actually ignored by rackunit's define-check. - (list (make-check-expected (syntax-e #'msg)) - (make-check-expression (syntax->datum #'stx)) - (make-check-location (build-source-location-list #'stx)) - (make-check-name 'typecheck-fail) - (make-check-params (list (syntax->datum #'e) (syntax-e #'msg)))) - (λ () - #,(syntax/loc stx - (check-exn - (λ (ex) - (and (or (exn:fail? ex) (exn:test:check? ex)) - ; check err msg matches - (regexp-match? (syntax-e #'msg) (exn-message ex)))) - (λ () - (expand/df #'e)))))) - #'(void)) - (if (eq? (syntax-local-context) 'expression) - #'(let-syntax ([chk transformer-proc]) - chk) - #'(begin (define-syntax chk transformer-proc) - chk))])) + #:when (with-check-info* + (list (make-check-expected (syntax-e #'msg)) + (make-check-expression (syntax->datum stx)) + (make-check-location (build-source-location-list stx)) + (make-check-name 'typecheck-fail) + (make-check-params (list (syntax->datum #'e) (syntax-e #'msg)))) + (λ () + (check-exn + (λ (ex) + (and (or (exn:fail? ex) (exn:test:check? ex)) + ; check err msg matches + (regexp-match? (syntax-e #'msg) (exn-message ex)))) + (λ () + (expand/df #'e))))) + #'(void)])) (define-syntax (typecheck-fail/toplvl stx) (syntax-parse stx #:datum-literals (:)