set-mc[ad]r!, inference, printing, tests for mpairs
This commit is contained in:
parent
913179f2ed
commit
4cc86cc8c8
6
collects/tests/typed-scheme/succeed/mpair.rkt
Normal file
6
collects/tests/typed-scheme/succeed/mpair.rkt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#lang typed/racket
|
||||||
|
|
||||||
|
(define: x : (MPairof Integer Integer) (mcons 1 2))
|
||||||
|
(set-mcar! x -7)
|
||||||
|
(mcar x)
|
||||||
|
(mcdr x)
|
|
@ -414,6 +414,8 @@
|
||||||
(cset-meet (cg e e*) (cg e* e))]
|
(cset-meet (cg e e*) (cg e* e))]
|
||||||
[((Box: e) (Box: e*))
|
[((Box: e) (Box: e*))
|
||||||
(cset-meet (cg e e*) (cg e* 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*))
|
[((Channel: e) (Channel: e*))
|
||||||
(cset-meet (cg e e*) (cg e* e))]
|
(cset-meet (cg e e*) (cg e* e))]
|
||||||
[((Hashtable: s1 s2) (Hashtable: t1 t2))
|
[((Hashtable: s1 s2) (Hashtable: t1 t2))
|
||||||
|
|
|
@ -918,4 +918,6 @@
|
||||||
[mcons (-poly (a b) (-> a b (-mpair a b)))]
|
[mcons (-poly (a b) (-> a b (-mpair a b)))]
|
||||||
[mcar (-poly (a b) (-> (-mpair a b) a))]
|
[mcar (-poly (a b) (-> (-mpair a b) a))]
|
||||||
[mcdr (-poly (a b) (-> (-mpair a b) b))]
|
[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))]
|
[mpair? (make-pred-ty (make-MPairTop))]
|
||||||
|
|
|
@ -209,6 +209,7 @@
|
||||||
[(Result: t (FilterSet: (Top:) (Top:)) (Empty:)) (fp "~a" t)]
|
[(Result: t (FilterSet: (Top:) (Top:)) (Empty:)) (fp "~a" t)]
|
||||||
[(Result: t fs (Empty:)) (fp "(~a : ~a)" t fs)]
|
[(Result: t fs (Empty:)) (fp "(~a : ~a)" t fs)]
|
||||||
[(Result: t fs lo) (fp "(~a : ~a : ~a)" t fs lo)]
|
[(Result: t fs lo) (fp "(~a : ~a : ~a)" t fs lo)]
|
||||||
|
[(MPair: s t) (fp "(MPairof ~a ~a)" s t)]
|
||||||
[(Refinement: parent p? _)
|
[(Refinement: parent p? _)
|
||||||
(fp "(Refinement ~a ~a)" parent (syntax-e p?))]
|
(fp "(Refinement ~a ~a)" parent (syntax-e p?))]
|
||||||
[(Sequence: ts)
|
[(Sequence: ts)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user