From ac4fb05f0cebd371ddbc4a041a07499c860cfaf2 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 28 Oct 2010 11:11:23 -0600 Subject: [PATCH] Correct error in mutator quote --- collects/plai/mutator.rkt | 6 ++-- .../tests/plai/gc/other-mutators/quote.rkt | 29 +++++++++++++++++++ collects/tests/plai/gc/run-test.rkt | 3 ++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 collects/tests/plai/gc/other-mutators/quote.rkt diff --git a/collects/plai/mutator.rkt b/collects/plai/mutator.rkt index 5513d7982c..34f636960e 100644 --- a/collects/plai/mutator.rkt +++ b/collects/plai/mutator.rkt @@ -229,13 +229,13 @@ (define-syntax mutator-quote (syntax-rules () [(_ (a . d)) - (mutator-anf-app collector:cons (mutator-quote a) (mutator-quote d))] + (mutator-app collector:cons (mutator-quote a) (mutator-quote d))] [(_ s) - (mutator-anf-app collector:alloc-flat 's)])) + (mutator-app collector:alloc-flat 's)])) (define-syntax (mutator-datum stx) (syntax-case stx () [(_ . e) - (quasisyntax/loc stx (mutator-anf-app collector:alloc-flat (#%datum . e)))])) + (quasisyntax/loc stx (mutator-app collector:alloc-flat (#%datum . e)))])) (define-syntax (mutator-top-interaction stx) (syntax-case stx (require provide mutator-define mutator-define-values test/value=? import-primitives) diff --git a/collects/tests/plai/gc/other-mutators/quote.rkt b/collects/tests/plai/gc/other-mutators/quote.rkt new file mode 100644 index 0000000000..1aeb456492 --- /dev/null +++ b/collects/tests/plai/gc/other-mutators/quote.rkt @@ -0,0 +1,29 @@ +#lang plai/mutator +(allocator-setup "../good-collectors/good-collector.rkt" 28) + +1 2 +(define x + (cons 'apple-pie ; 2 + 3 + (cons 'pumpkin-pie ; 2 + 3 + empty))) ; 2 +; Need 12 cells +1 2 +(define y + '(apple-pie pumpkin-pie)) +; Need 24 cells + +(define (equal? l r) + (cond + [(and (empty? l) (empty? r)) + #t] + [(and (cons? l) (cons? r)) + (and (equal? (first l) (first r)) + (equal? (rest l) (rest r)))] + [(and (symbol? l) (symbol? r)) + (symbol=? l r)] + [else + #f])) +; Need 2 more for the proc + +; Need 2 more for the ans +(equal? x y) \ No newline at end of file diff --git a/collects/tests/plai/gc/run-test.rkt b/collects/tests/plai/gc/run-test.rkt index 3ca88fc62b..eb0d42ef0c 100644 --- a/collects/tests/plai/gc/run-test.rkt +++ b/collects/tests/plai/gc/run-test.rkt @@ -52,4 +52,7 @@ (bad (heap-loc head) 62 47 "at line 19") END + + (test-mutator (build-path here "other-mutators" "quote.rkt")) + =error> "alloc: out of space" ) \ No newline at end of file