From 5b642ef79df0c213829ae72a8a9a7459f48c13dc Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Tue, 18 Feb 2014 22:58:58 -0500 Subject: [PATCH] Fix TR double cast bug In some cases, TR tried to typecheck the contents of a quote-syntax form that contains unexpanded syntax. Closes PR 14355 original commit: 26204cf505f885827854908391d2842476728c8b --- .../typed-racket/typecheck/check-subforms-unit.rkt | 4 ++++ .../tests/typed-racket/succeed/pr14355.rkt | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/pr14355.rkt diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-subforms-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-subforms-unit.rkt index 70ae21dc..3d4efb8d 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-subforms-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-subforms-unit.rkt @@ -9,6 +9,7 @@ (private syntax-properties) (utils tc-utils) (for-syntax racket/base syntax/parse) + (for-template racket/base) (rep type-rep)) (import tc-if^ tc-lambda^ tc-app^ tc-let^ tc-expr^) @@ -41,7 +42,10 @@ #'(let loop ([form init-form]) (parameterize ([current-orig-stx form]) (syntax-parse form + #:literals (quote-syntax) [clause bodies ...] ... + ;; avoid going under quote-syntax, nothing to typecheck + [(quote-syntax . rst) (void)] [(a . b) (loop #'a) (loop #'b) ] diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/pr14355.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/pr14355.rkt new file mode 100644 index 00000000..aa87a9b6 --- /dev/null +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/pr14355.rkt @@ -0,0 +1,8 @@ +#lang typed/racket + +;; Test for PR 14355. Ideally would be a unit test, but +;; the bug could not be triggered via the harness + +;; make sure this doesn't result in an internal error +(cast (cast "x" String) String) +