From eaa41a2a8ae3862ce82d40ee9d8bf41af938239d Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Fri, 9 May 2014 21:29:36 -0700 Subject: [PATCH] Add missing %s and corresponding unit tests. --- .../typed-racket-lib/typed-racket/infer/infer-unit.rkt | 8 ++++---- .../tests/typed-racket/unit-tests/infer-tests.rkt | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt index b2a719bf8a..eeacabe20c 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt @@ -426,7 +426,7 @@ [new-tys (for/list ([var (in-list vars)]) (-result (substitute (make-F var) dbound t-dty)))] [new-cset (cgen/list V (append vars X) Y ss (append ts new-tys))]) - (move-vars-to-dmap new-cset dbound vars))] + (% move-vars-to-dmap new-cset dbound vars))] ;; identical bounds - just unify pairwise [((ValuesDots: ss s-dty dbound) (ValuesDots: ts t-dty dbound)) @@ -585,10 +585,10 @@ [((ListDots: s-dty (? (λ (db) (memq db Y)) s-dbound)) (ListDots: t-dty t-dbound)) ;; What should we do if both are in Y? #:return-when (memq t-dbound Y) #f - (move-dotted-rest-to-dmap (cgen V (cons s-dbound X) Y s-dty t-dty) s-dbound t-dbound)] + (% move-dotted-rest-to-dmap (cgen V (cons s-dbound X) Y s-dty t-dty) s-dbound t-dbound)] [((ListDots: s-dty s-dbound) (ListDots: t-dty (? (λ (db) (memq db Y)) t-dbound))) ;; s-dbound can't be in Y, due to previous rule - (move-dotted-rest-to-dmap (cgen V (cons t-dbound X) Y s-dty t-dty) t-dbound s-dbound)] + (% move-dotted-rest-to-dmap (cgen V (cons t-dbound X) Y s-dty t-dty) t-dbound s-dbound)] ;; this constrains `dbound' to be |ts| - |ss| [((ListDots: s-dty dbound) (List: ts)) @@ -612,7 +612,7 @@ [new-tys (for/list ([var (in-list vars)]) (substitute (make-F var) dbound t-dty))] [new-cset (cgen/list V (append vars X) Y ss new-tys)]) - (move-vars-to-dmap new-cset dbound vars))] + (% move-vars-to-dmap new-cset dbound vars))] ;; if we have two mu's, we rename them to have the same variable ;; and then compare the bodies diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/infer-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/infer-tests.rkt index b296148498..691b13fc61 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/infer-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/infer-tests.rkt @@ -121,6 +121,12 @@ (list (-> -Symbol -Symbol -String) (-lst* -Symbol -Symbol)) #:vars '(b) #:indices '(a)] + + [infer-t (-values (list -String)) (-values-dots (list) -Symbol 'b) #:indices '(b) #:fail] + [infer-t (make-ListDots -String 'a) (make-ListDots -Symbol 'b) #:indices '(b) #:fail] + [infer-t (make-ListDots -String 'a) (make-ListDots -Symbol 'b) #:indices '(a) #:fail] + [infer-t (-lst* -String) (make-ListDots -Symbol 'b) #:indices '(b) #:fail] + ;; Currently Broken ;(infer-t (make-ListDots (-v b) 'b) (-lst -Symbol) #:indices '(b)) ;(infer-t (-lst -Symbol) (make-ListDots -Symbol 'b) #:indices '(b))