Fixing racket/match by removing errorneous optimization with test that shows it is broken

This commit is contained in:
Jay McCarthy 2011-10-05 16:29:04 -06:00
parent 9036e9ec61
commit 41307f1346
2 changed files with 18 additions and 1 deletions

View File

@ -447,7 +447,8 @@
;; and compile each block with a reference to its continuation ;; and compile each block with a reference to its continuation
[else [else
(let*-values (let*-values
([(rows vars) (reorder-columns rows vars)] (;; XXX This is broken.
#;[(rows vars) (reorder-columns rows vars)]
[(fns) [(fns)
(let loop ([blocks (reverse (split-rows rows))] [esc esc] [acc null]) (let loop ([blocks (reverse (split-rows rows))] [esc esc] [acc null])
(if (null? blocks) (if (null? blocks)

View File

@ -171,6 +171,22 @@
[_ #f]))) [_ #f])))
(test-case "app pattern" (test-case "app pattern"
(check = 4 (match 3 [(app add1 y) y]))) (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" (test-case "struct patterns"
(let () (let ()
(define-struct point (x y)) (define-struct point (x y))