Untyped top-level variables are not an internal error.

Handle latent filter of LBot in values->tc-results when there are no formals.
Use check-below properly in tc/mono-lambda/type

svn: r14935
This commit is contained in:
Sam Tobin-Hochstadt 2009-05-22 20:07:36 +00:00
parent 23a735ee2f
commit 2ee1d2b596
3 changed files with 20 additions and 8 deletions

View File

@ -209,7 +209,7 @@
(define (tc/mono-lambda/type formals bodies expected)
(define t (make-Function (map lam-result->type (tc/mono-lambda formals bodies expected))))
(if expected
(check-below t expected)
(and (check-below (ret t true-filter) expected) t)
t))
;; tc/plambda syntax syntax-list syntax-list type -> Poly

View File

@ -149,9 +149,15 @@
[(ValuesDots: (list (Result: ts lfs los) ...) dty dbound)
(ret ts
(for/list ([lf lfs])
(merge-filter-sets
(for/list ([x formals] [i (in-naturals)])
(apply-filter (split-lfilters lf i) Univ (make-Path null x)))))
(or
(and (null? formals)
(match lf
[(LFilterSet: lf+ lf-)
(combine (if (memq (make-LBot) lf+) (list (make-Bot)) (list))
(if (memq (make-LBot) lf-) (list (make-Bot)) (list)))]))
(merge-filter-sets
(for/list ([x formals] [i (in-naturals)])
(apply-filter (split-lfilters lf i) Univ (make-Path null x))))))
(for/list ([lo los])
(or
(for/or ([x formals] [i (in-naturals)])
@ -163,9 +169,15 @@
[(Values: (list (Result: ts lfs los) ...))
(ret ts
(for/list ([lf lfs])
(merge-filter-sets
(for/list ([x formals] [i (in-naturals)])
(apply-filter (split-lfilters lf i) Univ (make-Path null x)))))
(or
(and (null? formals)
(match lf
[(LFilterSet: lf+ lf-)
(combine (if (memq (make-LBot) lf+) (list (make-Bot)) (list))
(if (memq (make-LBot) lf-) (list (make-Bot)) (list)))]))
(merge-filter-sets
(for/list ([x formals] [i (in-naturals)])
(apply-filter (split-lfilters lf i) Univ (make-Path null x))))))
(for/list ([lo los])
(or
(for/or ([x formals] [i (in-naturals)])

View File

@ -290,7 +290,7 @@
(define (lookup-fail e)
(match (identifier-binding e)
['lexical (int-err "untyped lexical variable ~a" (syntax-e e))]
[#f (int-err "untyped top-level variable ~a" (syntax-e e))]
[#f (tc-error/expr "untyped top-level identifier ~a" (syntax-e e))]
[(list _ _ nominal-source-mod nominal-source-id _ _ _)
(let-values ([(x y) (module-path-index-split nominal-source-mod)])
(cond [(and (not x) (not y))