From f23baef8aa92c8ba6af0b47a49c843147dff4cfe Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Fri, 9 Dec 2011 18:02:40 -0500 Subject: [PATCH] Opaque types may overlap with anything. Closes PR 12434. --- .../tests/typed-racket/fail/opaque-overlap.rkt | 16 ++++++++++++++++ collects/typed-racket/typecheck/tc-envops.rkt | 2 +- collects/typed-racket/typecheck/tc-if.rkt | 2 +- collects/typed-racket/types/remove-intersect.rkt | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 collects/tests/typed-racket/fail/opaque-overlap.rkt diff --git a/collects/tests/typed-racket/fail/opaque-overlap.rkt b/collects/tests/typed-racket/fail/opaque-overlap.rkt new file mode 100644 index 0000000000..e9c9f796b2 --- /dev/null +++ b/collects/tests/typed-racket/fail/opaque-overlap.rkt @@ -0,0 +1,16 @@ +#; +(exn-pred "'success") + +;; PR 12434 +(module B typed/racket + + (require/typed racket + [opaque NN number?] + [pi NN]) + + (define a string) + ;; => 'failure + (ann (match pi + [(list n) 'success] + [other 'failure]) + (U #;'success 'failure))) \ No newline at end of file diff --git a/collects/typed-racket/typecheck/tc-envops.rkt b/collects/typed-racket/typecheck/tc-envops.rkt index 14b51a96be..dc42572f6d 100644 --- a/collects/typed-racket/typecheck/tc-envops.rkt +++ b/collects/typed-racket/typecheck/tc-envops.rkt @@ -13,7 +13,7 @@ env? update-type/lexical env-map env-props replace-props) scheme/contract racket/match mzlib/trace unstable/struct - (typecheck tc-metafunctions) + "tc-metafunctions.rkt" (for-syntax scheme/base)) ;(trace replace-nth) diff --git a/collects/typed-racket/typecheck/tc-if.rkt b/collects/typed-racket/typecheck/tc-if.rkt index 1bb05576ef..0f0eda8817 100644 --- a/collects/typed-racket/typecheck/tc-if.rkt +++ b/collects/typed-racket/typecheck/tc-if.rkt @@ -7,7 +7,7 @@ (env lexical-env type-env-structs) (r:infer infer) (utils tc-utils) - (typecheck tc-envops tc-metafunctions) + "tc-envops.rkt" "tc-metafunctions.rkt" (types type-table) syntax/kerncase racket/trace diff --git a/collects/typed-racket/types/remove-intersect.rkt b/collects/typed-racket/types/remove-intersect.rkt index f5f7c4fa67..f15c69ac83 100644 --- a/collects/typed-racket/types/remove-intersect.rkt +++ b/collects/typed-racket/types/remove-intersect.rkt @@ -24,6 +24,8 @@ [(list _ (Univ:)) #t] [(list (F: _) _) #t] [(list _ (F: _)) #t] + [(list (Opaque: _ _) _) #t] + [(list _ (Opaque: _ _)) #t] [(list (Name: n) (Name: n*)) (or (free-identifier=? n n*) (overlap (resolve-once t1) (resolve-once t2)))]