set-mc[ad]r!, inference, printing, tests for mpairs

This commit is contained in:
Sam Tobin-Hochstadt 2010-06-15 16:02:16 -04:00
parent 913179f2ed
commit 4cc86cc8c8
4 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#lang typed/racket
(define: x : (MPairof Integer Integer) (mcons 1 2))
(set-mcar! x -7)
(mcar x)
(mcdr x)

View File

@ -414,6 +414,8 @@
(cset-meet (cg e e*) (cg e* e))]
[((Box: e) (Box: e*))
(cset-meet (cg e e*) (cg e* e))]
[((MPair: s t) (MPair: s* t*))
(cset-meet* (list (cg s s*) (cg s* s) (cg t t*) (cg t* t)))]
[((Channel: e) (Channel: e*))
(cset-meet (cg e e*) (cg e* e))]
[((Hashtable: s1 s2) (Hashtable: t1 t2))

View File

@ -918,4 +918,6 @@
[mcons (-poly (a b) (-> a b (-mpair a b)))]
[mcar (-poly (a b) (-> (-mpair a b) a))]
[mcdr (-poly (a b) (-> (-mpair a b) b))]
[set-mcar! (-poly (a b) (-> (-mpair a b) a -Void))]
[set-mcdr! (-poly (a b) (-> (-mpair a b) b -Void))]
[mpair? (make-pred-ty (make-MPairTop))]

View File

@ -209,6 +209,7 @@
[(Result: t (FilterSet: (Top:) (Top:)) (Empty:)) (fp "~a" t)]
[(Result: t fs (Empty:)) (fp "(~a : ~a)" t fs)]
[(Result: t fs lo) (fp "(~a : ~a : ~a)" t fs lo)]
[(MPair: s t) (fp "(MPairof ~a ~a)" s t)]
[(Refinement: parent p? _)
(fp "(Refinement ~a ~a)" parent (syntax-e p?))]
[(Sequence: ts)