diff options
Diffstat (limited to 'csc')
| -rw-r--r-- | csc/match-test.csc | 8 | ||||
| -rw-r--r-- | csc/match.csc | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/csc/match-test.csc b/csc/match-test.csc index d4da153..bcd0d35 100644 --- a/csc/match-test.csc +++ b/csc/match-test.csc @@ -101,3 +101,11 @@ 2 (match (make-test-record-type 1 2 3) ((% %test-record-type a b c) b)))) + + +(test match-record-type-any + (assert-equal + #t + (match '(1 2 3) + ((% %test-record-type . _) #f) + ((! '(1 2 3)) #t)))) diff --git a/csc/match.csc b/csc/match.csc index 116204f..96ec4d3 100644 --- a/csc/match.csc +++ b/csc/match.csc @@ -51,7 +51,8 @@ (match-pattern (car y) pattern result result* ...) (raise *no-match*)))) ((match-pattern x (% record-matcher . patterns) result result* ...) - (match-pattern (map cdr (cdr (record-matcher x))) patterns result result* ...)) + (let ((x* (record-matcher x))) + (match-pattern (map cdr (cdr (record-matcher x))) patterns result result* ...))) ((match-pattern x (pattern . rest) result result* ...) (let ((y x)) (if (pair? y) |
