diff --git a/typed-racket-lib/typed-racket/infer/infer-unit.rkt b/typed-racket-lib/typed-racket/infer/infer-unit.rkt index 57e6a528..b0499638 100644 --- a/typed-racket-lib/typed-racket/infer/infer-unit.rkt +++ b/typed-racket-lib/typed-racket/infer/infer-unit.rkt @@ -521,6 +521,10 @@ ;; constrain b1 to be below T, but don't mention the new vars [((Poly: v1 b1) T) (cgen (context-add context #:bounds v1) b1 T)] + ;; Mu's just get unfolded + [((? Mu? s) t) (cg (unfold s) t)] + [(s (? Mu? t)) (cg s (unfold t))] + ;; constrain *each* element of es to be below T, and then combine the constraints [((Union: es) T) (define cs (for/list/fail ([e (in-list es)]) (cg e T))) @@ -622,10 +626,6 @@ [((Set: t) (Sequence: (list t*))) (cg t t*)] - ;; Mu's just get unfolded - ;; We unfold S first so that unions are handled in S before T - [((? Mu? s) t) (cg (unfold s) t)] - [(s (? Mu? t)) (cg s (unfold t))] ;; resolve applications [((App: _ _ _) _) diff --git a/typed-racket-test/unit-tests/infer-tests.rkt b/typed-racket-test/unit-tests/infer-tests.rkt index e394eb6d..660528b8 100644 --- a/typed-racket-test/unit-tests/infer-tests.rkt +++ b/typed-racket-test/unit-tests/infer-tests.rkt @@ -257,6 +257,11 @@ #:vars '(a) #:result [(-seq (-v a)) (-seq (-val 'b))]] + [infer-t + (-lst (-val (-v a))) + (Un (-pair (-v a) Univ) -Null) + #:vars '(a)] + ;; Currently Broken ;(infer-t (make-ListDots -Symbol 'b) (-pair -Symbol (-lst -Symbol)) #:indices '(b)) [i2-t (-v a) N ('a N)]