From 3ed6b464e718c22ef10635f87e7dc5599943de84 Mon Sep 17 00:00:00 2001 From: Andrew Kent Date: Tue, 6 Jan 2015 15:01:16 -0500 Subject: [PATCH] overlap tests for Seq and Evt, minor overlap fix --- .../typed-racket/types/remove-intersect.rkt | 3 +- .../unit-tests/typecheck-tests.rkt | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/typed-racket-lib/typed-racket/types/remove-intersect.rkt b/typed-racket-lib/typed-racket/types/remove-intersect.rkt index b8447630..2d2cb48e 100644 --- a/typed-racket-lib/typed-racket/types/remove-intersect.rkt +++ b/typed-racket-lib/typed-racket/types/remove-intersect.rkt @@ -34,8 +34,7 @@ (match (list t1 t2) [(list-no-order (Univ:) _) #t] [(list-no-order (F: _) _) #t] - [(list (Opaque: _) _) #t] - [(list-no-order _ (Opaque: _)) #t] + [(list-no-order (Opaque: _) _) #t] [(list (Name/simple: n) (Name/simple: n*)) (or (free-identifier=? n n*) (overlap (resolve-once t1) (resolve-once t2)))] diff --git a/typed-racket-test/unit-tests/typecheck-tests.rkt b/typed-racket-test/unit-tests/typecheck-tests.rkt index 06d8aaf8..33006173 100644 --- a/typed-racket-test/unit-tests/typecheck-tests.rkt +++ b/typed-racket-test/unit-tests/typecheck-tests.rkt @@ -1996,6 +1996,23 @@ (-seq (-val 0))] [tc-e (sequence-add-between (inst empty-sequence Integer) 'foo) (-seq (t:Un -Int (-val 'foo)))] + [tc-e (let () + (: foo ((Sequenceof Integer) -> (Sequenceof Any))) + (define foo + (λ (x) + (cond + [(boolean? x) (void)] + [(symbol? x) (void)] + [(char? x) (void)] + [(void? x) (void)] + [(string? x) x] + [(integer? x) x] + [(list? x) x] + [(input-port? x) x] + [(set? x) x] + [else 42]))) + (void)) + -Void] [tc-e (let () (define: x : Any (vector 1 2 3)) (if (vector? x) (vector-ref x 0) #f)) @@ -2321,6 +2338,19 @@ (place-channel-put c1 "a")) -Void] [tc-e (place-message-allowed? 'msg) -Boolean] + + [tc-e (let () + (: bar ((Evtof Any) -> (Evtof Any))) + (define bar + (λ (x) + (cond + [(boolean? x) "nope"] + [(symbol? x) "nope"] + [(char? x) "nope"] + [(void? x) "nope"] + [(evt? x) x]))) + (void)) + -Void] ;; fxvectors & flvectors [tc-e (let ()