Actually typecheck actuals even when there's a type annotation.

This commit is contained in:
Sam Tobin-Hochstadt 2010-06-11 19:35:56 -04:00
parent 7ece2a4872
commit 1cff0a1f85
2 changed files with 8 additions and 4 deletions

View File

@ -808,7 +808,10 @@
(vector-ref #("a" "b") (- x 1)))
-String]
[tc-err (string-append "bar" (if (zero? (ann 0.0 Float)) #f "foo"))]
)
[tc-err (do: : Void
([j : Natural (+ i 'a) (+ j i)])
((>= j 10))
#f)])
(test-suite
"check-type tests"
(test-exn "Fails correctly" exn:fail:syntax? (lambda () (parameterize ([orig-module-stx #'here])

View File

@ -238,9 +238,10 @@
[_
(let ([ts (for/list ([ac (syntax->list actuals)]
[f (syntax->list args)])
(or
(type-annotation f #:infer #t)
(generalize (tc-expr/t ac))))])
(let ([infer-t (type-annotation f #:infer #t)])
(if infer-t
(check-below (tc-expr/t ac) infer-t)
(generalize (tc-expr/t ac)))))])
(tc/rec-lambda/check form args body lp ts expected)
expected)]))