From dbcb1414dadd6fb125b5527d9b0d8853dd1ce616 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 6 Apr 2013 12:43:16 -0700 Subject: [PATCH] Allow requiring functions with filters in contravariant positions. --- .../succeed/require-typed-contravariant-filter.rkt | 12 ++++++++++++ collects/typed-racket/private/type-contract.rkt | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 collects/tests/typed-racket/succeed/require-typed-contravariant-filter.rkt diff --git a/collects/tests/typed-racket/succeed/require-typed-contravariant-filter.rkt b/collects/tests/typed-racket/succeed/require-typed-contravariant-filter.rkt new file mode 100644 index 0000000000..ab777642f5 --- /dev/null +++ b/collects/tests/typed-racket/succeed/require-typed-contravariant-filter.rkt @@ -0,0 +1,12 @@ +#lang racket/load + +(module untyped racket + (provide f) + (define (f g) 'g)) + + +(module typed typed/racket + (require/typed 'untyped + [f ((Any -> Boolean : Symbol) -> Symbol)])) + +(require 'typed) diff --git a/collects/typed-racket/private/type-contract.rkt b/collects/typed-racket/private/type-contract.rkt index 55baec28e8..3a8c9f269b 100644 --- a/collects/typed-racket/private/type-contract.rkt +++ b/collects/typed-racket/private/type-contract.rkt @@ -205,7 +205,7 @@ (and rst (t->c/neg rst))))] ;; functions with filters or objects [(arr: dom (Values: (list (Result: rngs _ _) ...)) rst #f '()) - (if (and from-typed? pos?) + (if from-typed? (values (map t->c/neg dom) null (map t->c rngs)