From 8047e32662207ceddf9fb04dddd8d96c9ea00a17 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Mon, 26 Apr 2010 11:42:48 -0400 Subject: [PATCH] Treat static struct info as pattern constructor. --- collects/racket/match/parse.ss | 3 +++ collects/tests/match/examples.ss | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/collects/racket/match/parse.ss b/collects/racket/match/parse.ss index 0fbfc04b6a..54dc1b86b1 100644 --- a/collects/racket/match/parse.ss +++ b/collects/racket/match/parse.ss @@ -153,6 +153,9 @@ [(mcons e1 e2) (make-MPair (parse #'e1) (parse #'e2))] [(struct s pats) (parse-struct stx cert parse #'s #'pats)] + [(s . pats) + (struct-info? (syntax-local-value #'s (lambda () #f))) + (parse-struct stx cert parse #'s #'pats)] [(? p q1 qs ...) (make-And (cons (make-Pred (cert #'p)) (map parse (syntax->list #'(q1 qs ...)))))] diff --git a/collects/tests/match/examples.ss b/collects/tests/match/examples.ss index 2348230173..bbb4f1643f 100644 --- a/collects/tests/match/examples.ss +++ b/collects/tests/match/examples.ss @@ -113,6 +113,16 @@ [(box a) a] [(cons x y) (+ x y)] [_ 0]))) + + (comp + 6 + (let () + (match (make-X 1 2 3) + [(X a b c) (+ a b c)] + [(box a) a] + [(cons x y) (+ x y)] + [_ 0]))) + (comp 6