Fix a bug suggested by Robby and add a test case

svn: r15718
This commit is contained in:
Jay McCarthy 2009-08-12 20:43:10 +00:00
parent 50b7a0b190
commit 829c8416b6
2 changed files with 24 additions and 13 deletions

View File

@ -6,12 +6,27 @@
[E hole
(v ... E)])
(define the-test
(define test1
(reduction-relation
tl-grammar
[--> (in-hole E_1 (explode))
(in-hole E_1 1)]))
(test--> the-test
(test--> test1
(term ((cont hole) (explode)))
(term ((cont hole) 1)))
(term ((cont hole) 1)))
(define test2
(reduction-relation
tl-grammar
[--> (in-hole E_1 (explode))
(asplode E_1)]))
(define-metafunction tl-grammar
asplode : E -> any
[(asplode ((cont hole) hole))
okay])
(test--> test2
(term ((cont hole) (explode)))
(term okay))

View File

@ -1557,16 +1557,12 @@ before the pattern compiler is invoked.
|#
(define (context? x) #t)
(define-values (the-hole hole?)
(define-values (the-hole the-not-hole hole?)
(let ()
(define-struct hole () #:inspector #f)
(define the-hole (make-hole))
(values the-hole hole?)))
(define-values (the-not-hole not-hole?)
(let ()
(define-struct not-hole () #:inspector #f)
(define the-not-hole (make-not-hole))
(values the-not-hole not-hole?)))
(define the-not-hole (make-hole))
(values the-hole the-not-hole hole?)))
(define hole->not-hole
(match-lambda
@ -1592,11 +1588,11 @@ before the pattern compiler is invoked.
[(pair? exp)
(cons (loop (car exp))
(loop (cdr exp)))]
[(not-hole? exp)
[(eq? the-not-hole exp)
the-hole]
[(hole? exp)
[(eq? the-hole exp)
(if done?
the-hole
exp
(begin (set! done? #t)
hole-stuff))]
[else exp])))]))