Unify types and filter behavior of not and false?.

original commit: 26541ffbbdccf7d27db1f1ae439430090fcb4b0b
This commit is contained in:
Vincent St-Amour 2011-06-16 17:37:13 -04:00
parent a431e7b5c7
commit 3face0ff46
3 changed files with 14 additions and 3 deletions

View File

@ -0,0 +1,11 @@
#;
(
false-huh-dead-code.rkt line 10 col 16 - (quote 1) - dead then branch
false-huh-dead-code.rkt line 11 col 13 - (quote 1) - dead then branch
2
2
)
#lang typed/racket
(if (false? #t) 1 2)
(if (not #t) 1 2)

View File

@ -208,7 +208,7 @@
;; 1 means predicate on second argument
(make-pred-ty (list (make-pred-ty (list a) c d) (-lst a)) c (-lst d) 1)
(->... (list (->... (list a) (b b) c) (-lst a)) ((-lst b) b) c)))]
[not (-> Univ B)]
[not (make-pred-ty (-val #f))]
[box (-poly (a) (a . -> . (-box a)))]
[unbox (-poly (a) (cl->*
((-box a) . -> . a)

View File

@ -261,7 +261,7 @@
(define (tc/app/internal form expected)
(syntax-parse form
#:literals (#%plain-app #%plain-lambda letrec-values quote
values apply k:apply not list list* call-with-values do-make-object make-object cons
values apply k:apply not false? list list* call-with-values do-make-object make-object cons
map andmap ormap reverse extend-parameterization
vector-ref unsafe-vector-ref unsafe-vector*-ref
vector-set! unsafe-vector-set! unsafe-vector*-set!
@ -513,7 +513,7 @@
[((tc-result1: t) (tc-result1: t* f o))
(ret t f o)])]
;; special-case for not - flip the filters
[(#%plain-app not arg)
[(#%plain-app (~or not false?) arg)
(match (single-value #'arg)
[(tc-result1: t (FilterSet: f+ f-) _)
(ret -Boolean (make-FilterSet f- f+))])]