Skip to content

Commit dce339c

Browse files
committed
fixed #195
When checking to see if a non-terminal is viable wrt to some unification problem, the old code didn't convert the pats to pat*s. I think it probably should have been, however, so this commit makes it do so.
1 parent 78dd453 commit dce339c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

redex-lib/redex/private/pat-unify.rkt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,11 @@
863863
(define npat (normalize-pat clang e pat))
864864
(hash-ref memo (list nt clang npat)
865865
(λ ()
866-
(define pat-ok?
867-
(for/or ([ntp (in-list (map (((curry normalize-pat) clang) e) (nt-pats nt clang)))])
868-
(not-failed? (unify* npat ntp empty-env clang))))
866+
(define pat-ok?
867+
(for/or ([pat (in-list (nt-pats nt clang))])
868+
(define ntp (normalize-pat clang e pat))
869+
(define ntp* (bind-names (fresh-pat-vars ntp (make-hash)) e clang))
870+
(not-failed? (unify* npat (p*e-p ntp*) (p*e-e ntp*) clang))))
869871
(hash-set! memo (list nt clang npat) pat-ok?)
870872
pat-ok?))))))
871873

redex-test/redex/tests/gen-test.rkt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,3 +974,24 @@
974974
(test (with-handlers ([exn:fail? exn-message])
975975
(redex-check let-nl e #t #:source eval))
976976
#rx"language of the metafunction does not"))
977+
978+
(let ()
979+
(define-language Boxy
980+
(e ::= x (e_1 e_2))
981+
(t ::= nat bool)
982+
(x u ::= variable-not-otherwise-mentioned))
983+
984+
(define-judgment-form
985+
Boxy
986+
#:mode (type I O)
987+
#:contract (type e t)
988+
989+
[-------------
990+
(type x bool)]
991+
992+
[(type e_1 bool)
993+
(type e_2 bool)
994+
---------------------
995+
(type (e_1 e_2) nat)])
996+
997+
(is-not-false (generate-term Boxy #:satisfying (type e nat) 10)))

0 commit comments

Comments
 (0)