From c4deb8e5e71f945b6b31ebb457c28cb838e3bd20 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Thu, 6 Nov 2008 20:23:40 +0000 Subject: [PATCH] Fix handling of wrong size vectors. Add tests. Fixes PR9885. svn: r12334 --- collects/scheme/match/compiler.ss | 3 ++- collects/tests/match/examples.ss | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/collects/scheme/match/compiler.ss b/collects/scheme/match/compiler.ss index 7d29608569..8a5683484e 100644 --- a/collects/scheme/match/compiler.ss +++ b/collects/scheme/match/compiler.ss @@ -108,7 +108,8 @@ body)]))))])]) #`[(vector? #,x) (case (vector-length #,x) - clauses ...)])] + clauses ... + [else (#,esc)])])] ;; it's a structure [(box? k) ;; all the rows are structures with the same predicate diff --git a/collects/tests/match/examples.ss b/collects/tests/match/examples.ss index bb4e69b2b6..b09c703191 100644 --- a/collects/tests/match/examples.ss +++ b/collects/tests/match/examples.ss @@ -571,6 +571,11 @@ [(or (and x 2) (and x 3) (and x 4)) 3] [_ (values 4 5)])]) (list x y))) + + (comp 'bad + (match #(1) + [(vector a b) a] + [else 'bad])) ))