From 09b0ca2ef3b1c7848191d56c4924a7fc73a747ee Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Thu, 16 Jan 2014 17:34:11 -0500 Subject: [PATCH] Fix type inference helper on AnyValues range This bug allows a test to be written for the previous commit. Previously, it would throw a match error. original commit: b5d4333d2c52d0103eb7d508b41726836d292c24 --- .../typed-racket/infer/promote-demote.rkt | 3 +++ .../typed-racket/unit-tests/typecheck-tests.rkt | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/promote-demote.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/promote-demote.rkt index a0615b47..c498d357 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/promote-demote.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/promote-demote.rkt @@ -13,8 +13,11 @@ (for/or ([e (in-list (append* (map fv ts)))]) (memq e V))) +;; get-filters : SomeValues -> FilterSet +;; extract filters out of the range of a function type (define (get-filters rng) (match rng + [(AnyValues:) null] [(Values: (list (Result: _ lf _) ...)) lf] [(ValuesDots: (list (Result: _ lf _) ...) _ _) lf])) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt index e43f97d3..331b7331 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -148,6 +148,7 @@ racket/sequence racket/set racket/string + racket/system racket/tcp racket/udp racket/vector @@ -1366,9 +1367,6 @@ -Output-Port -Input-Port)) - - - (tc-e (subprocess (current-output-port) (current-input-port) (current-error-port) (string->path "/usr/bin/echo") 'exact "arg") (list -Subprocess @@ -1386,6 +1384,10 @@ (subprocess? p)) #:ret (ret -Boolean (-FS -top -bot))) + (tc-e (car (process "hello")) + -Input-Port) + (tc-e (car (process* "hello")) + -Input-Port) #; (tc-e (let () @@ -1417,10 +1419,6 @@ proc-id) -Nat) - - - - ;Compilation (tc-e (compile-syntax #'(+ 1 2)) -Compiled-Expression) (tc-e (let: ((e : Compiled-Expression (compile #'(+ 1 2))))