From 41307f13461bb61e48ee75c776e646212f1770fb Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Wed, 5 Oct 2011 16:29:04 -0600 Subject: [PATCH] Fixing racket/match by removing errorneous optimization with test that shows it is broken --- collects/racket/match/compiler.rkt | 3 ++- collects/tests/match/plt-match-tests.rkt | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/collects/racket/match/compiler.rkt b/collects/racket/match/compiler.rkt index 0c54406f20..1300140ef0 100644 --- a/collects/racket/match/compiler.rkt +++ b/collects/racket/match/compiler.rkt @@ -447,7 +447,8 @@ ;; and compile each block with a reference to its continuation [else (let*-values - ([(rows vars) (reorder-columns rows vars)] + (;; XXX This is broken. + #;[(rows vars) (reorder-columns rows vars)] [(fns) (let loop ([blocks (reverse (split-rows rows))] [esc esc] [acc null]) (if (null? blocks) diff --git a/collects/tests/match/plt-match-tests.rkt b/collects/tests/match/plt-match-tests.rkt index 9a77411425..053c7a2187 100644 --- a/collects/tests/match/plt-match-tests.rkt +++ b/collects/tests/match/plt-match-tests.rkt @@ -171,6 +171,22 @@ [_ #f]))) (test-case "app pattern" (check = 4 (match 3 [(app add1 y) y]))) + (test-case "app pattern (step 1)" + (check = 2 (match (list 1 3) + [(list 0 (app add1 y)) y] + [(list 1 (app sub1 y)) y]))) + (test-case "app pattern (step 2a)" + (check = 2 (match (cons 1 3) + [(cons 0 (app error y)) y] + [(cons 1 (app sub1 y)) y]))) + (test-case "app pattern (step 2a)" + (check = 2 (match (vector 1 3) + [(vector 0 (app error y)) y] + [(vector 1 (app sub1 y)) y]))) + (test-case "app pattern (step 2)" + (check = 2 (match (list 1 3) + [(list 0 (app error y)) y] + [(list 1 (app sub1 y)) y]))) (test-case "struct patterns" (let () (define-struct point (x y))