diff --git a/collects/tests/typed-scheme/succeed/logic.ss b/collects/tests/typed-scheme/succeed/logic.ss index 34f3fd0a..c21abe72 100644 --- a/collects/tests/typed-scheme/succeed/logic.ss +++ b/collects/tests/typed-scheme/succeed/logic.ss @@ -2,7 +2,6 @@ #lang typed-scheme (: f ((U Number #f) (cons Any Any) -> Number)) - (define (f x y) (cond [(and (number? x) (number? (car y))) (+ x (car y))] @@ -11,6 +10,5 @@ [else 0])) (: bool-to-0-or-1 (Boolean -> Number)) - (define (bool-to-0-or-1 b) (if b 1 0)) \ No newline at end of file diff --git a/collects/tests/typed-scheme/unit-tests/subtype-tests.ss b/collects/tests/typed-scheme/unit-tests/subtype-tests.ss index c84dcce5..bb3be770 100644 --- a/collects/tests/typed-scheme/unit-tests/subtype-tests.ss +++ b/collects/tests/typed-scheme/unit-tests/subtype-tests.ss @@ -126,7 +126,7 @@ ;; polymorphic function types should be subtypes of the function top [(-poly (a) (a . -> . a)) top-func] - [(cl->* (-Number . -> . -String) (-Boolean . -> . -String)) ((Un -Number -Boolean) . -> . -String)] + [(cl->* (-Number . -> . -String) (-Boolean . -> . -String)) ((Un -Boolean -Number) . -> . -String)] )) (define-go diff --git a/collects/typed-scheme/rep/filter-rep.ss b/collects/typed-scheme/rep/filter-rep.ss index 3c66be2a..56c0f41a 100644 --- a/collects/typed-scheme/rep/filter-rep.ss +++ b/collects/typed-scheme/rep/filter-rep.ss @@ -32,7 +32,7 @@ [#:fold-rhs (*NotTypeFilter (type-rec-id t) (map pathelem-rec-id p) v)]) ;; implication -(df ImpFilter ([a (listof Filter/c)] [c (listof Filter/c)]) +(df ImpFilter ([a (non-empty-listof Filter/c)] [c (non-empty-listof Filter/c)]) [#:frees (combine-frees (map free-vars* (append a c))) (combine-frees (map free-idxs* (append a c)))]) @@ -70,8 +70,8 @@ [#:fold-rhs (*LNotTypeFilter (type-rec-id t) (map pathelem-rec-id p) idx)]) ;; implication -(df LImpFilter ([a (listof LatentFilter/c)] [c (listof LatentFilter/c)]) - #;[#:frees (combine-frees (map free-vars* (append a c))) +(df LImpFilter ([a (non-empty-listof LatentFilter/c)] [c (non-empty-listof LatentFilter/c)]) + [#:frees (combine-frees (map free-vars* (append a c))) (combine-frees (map free-idxs* (append a c)))]) diff --git a/collects/typed-scheme/typecheck/tc-metafunctions.ss b/collects/typed-scheme/typecheck/tc-metafunctions.ss index 3d98e766..096f7a14 100644 --- a/collects/typed-scheme/typecheck/tc-metafunctions.ss +++ b/collects/typed-scheme/typecheck/tc-metafunctions.ss @@ -146,11 +146,12 @@ [((FilterSet: f1+ f1-) (T-FS:) (FilterSet: f3+ f3-)) (mk (combine null (append f1- f3-)))] ;; and [((FilterSet: f1+ f1-) (FilterSet: f2+ f2-) (F-FS:)) - (mk (combine (append f1+ f2+) - #;null - (append (for/list ([f f1-]) + (mk (combine (append f1+ f2+) + (append (for/list ([f f1-] + #:when (not (null? f2+))) (make-ImpFilter f2+ (list f))) - (for/list ([f f2-]) + (for/list ([f f2-] + #:when (not (null? f1+))) (make-ImpFilter f1+ (list f))))))] [(f f* f*) (mk f*)] [(_ _ _) diff --git a/collects/typed-scheme/types/abbrev.ss b/collects/typed-scheme/types/abbrev.ss index 04559f03..8d141416 100644 --- a/collects/typed-scheme/types/abbrev.ss +++ b/collects/typed-scheme/types/abbrev.ss @@ -261,7 +261,6 @@ (define true-filter (-FS (list) (list (make-Bot)))) (define false-filter (-FS (list (make-Bot)) (list))) - (define (opt-fn args opt-args result) (apply cl->* (for/list ([i (in-range (add1 (length opt-args)))]) (make-Function (list (make-arr* (append args (take opt-args i)) result)))))) diff --git a/collects/typed-scheme/types/printer.ss b/collects/typed-scheme/types/printer.ss index 33d6602b..beb0cad5 100644 --- a/collects/typed-scheme/types/printer.ss +++ b/collects/typed-scheme/types/printer.ss @@ -45,7 +45,8 @@ (fp")")] [(LNotTypeFilter: type path idx) (fp "(! ~a @ ~a ~a)" type path idx)] [(LTypeFilter: type path idx) (fp "(~a @ ~a ~a)" type path idx)] - [(LBot:) (fp "LBot")])) + [(LBot:) (fp "LBot")] + [(LImpFilter: a c) (fp "(LImpFilter ~a ~a)" a c)])) (define (print-filter c port write?) (define (fp . args) (apply fprintf port args)) @@ -57,7 +58,8 @@ [(NoFilter:) (fp "-")] [(NotTypeFilter: type path id) (fp "(! ~a @ ~a ~a)" type path (syntax-e id))] [(TypeFilter: type path id) (fp "(~a @ ~a ~a)" type path (syntax-e id))] - [(Bot:) (fp "Bot")])) + [(Bot:) (fp "Bot")] + [(ImpFilter: a c) (fp "(ImpFilter ~a ~a)" a c)])) (define (print-pathelem c port write?) (define (fp . args) (apply fprintf port args)) diff --git a/collects/typed-scheme/utils/utils.ss b/collects/typed-scheme/utils/utils.ss index 3fb7d363..ab40d625 100644 --- a/collects/typed-scheme/utils/utils.ss +++ b/collects/typed-scheme/utils/utils.ss @@ -145,7 +145,7 @@ at least theoretically. ;; - 1 printers have to be defined at the same time as the structs ;; - 2 we want to support things printing corectly even when the custom printer is off -(define-for-syntax printing? #f) +(define-for-syntax printing? #t) (define-syntax-rule (defprinter t ...) (begin