From 8f15f04bd50eb2ee70671b07115bd39c1208833f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 20 Jul 2010 10:33:55 -0600 Subject: [PATCH] fix error message for (cons [else]) Closes PR 10910 Merge to 5.0.1 --- collects/racket/private/cond.rkt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/collects/racket/private/cond.rkt b/collects/racket/private/cond.rkt index 6f5a074137..c727a4b915 100644 --- a/collects/racket/private/cond.rkt +++ b/collects/racket/private/cond.rkt @@ -54,10 +54,7 @@ (free-identifier=? (stx-car value) =>-stx)) (if (and (stx-pair? (stx-cdr value)) (stx-null? (stx-cdr (stx-cdr value)))) - (let ([test (if else? - #t - test)] - [gen (gen-temp-id 'c)]) + (let ([gen (gen-temp-id 'c)]) `(,(quote-syntax let-values) ([(,gen) ,test]) (,(quote-syntax if) ,gen (,(stx-car (stx-cdr value)) ,gen) @@ -66,11 +63,15 @@ "bad syntax (bad clause form with =>)" line)) (if else? - (if first? - ;; first => be careful not to introduce a splicable begin... - `(,(quote-syntax if) #t ,(cons (quote-syntax begin) value) (void)) - ;; we're in an `if' branch already... - (cons (quote-syntax begin) value)) + (if (stx-null? value) + (serror + "missing expressions in `else' clause" + line) + (if first? + ;; first => be careful not to introduce a splicable begin... + `(,(quote-syntax if) #t ,(cons (quote-syntax begin) value) (void)) + ;; we're in an `if' branch already... + (cons (quote-syntax begin) value))) (if (stx-null? value) (let ([gen (gen-temp-id 'c)]) `(,(quote-syntax let-values) ([(,gen) ,test])