Instances can have any Type as their class.
Fix some handling of tc-results as pertains to classes. Bottom is an ok Class. svn: r14938 original commit: 7d239a4dfaa5d44e2bdbb8ebc31b72bbd3f87b61
This commit is contained in:
parent
39eca53d55
commit
136f8c4f80
|
@ -298,7 +298,7 @@
|
|||
(map list mname (map type-rec-id mty)))])])
|
||||
|
||||
;; cls : Class
|
||||
(dt Instance ([cls Class?]) [#:key 'instance])
|
||||
(dt Instance ([cls Type/c]) [#:key 'instance])
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
(let loop ([t (tc-expr cl)])
|
||||
(match t
|
||||
[(tc-result1: (? Mu? t*)) (loop (ret (unfold t*)))]
|
||||
[(tc-result1: (Union: '())) (ret (Un))]
|
||||
[(tc-result1: (and c (Class: pos-tys (list (and tnflds (list tnames _ _)) ...) _)))
|
||||
(unless (= (length pos-tys)
|
||||
(length (syntax->list pos-args)))
|
||||
|
@ -109,7 +110,7 @@
|
|||
;; use for, since they might be different lengths in error case
|
||||
(for ([pa (in-syntax pos-args)]
|
||||
[pt (in-list pos-tys)])
|
||||
(tc-expr/check pa pt))
|
||||
(tc-expr/check pa (ret pt)))
|
||||
(for ([n names]
|
||||
#:when (not (memq n tnames)))
|
||||
(tc-error/delayed
|
||||
|
@ -124,7 +125,7 @@
|
|||
[else #f])])
|
||||
(if s
|
||||
;; this argument was present
|
||||
(tc-expr/check s tfty)
|
||||
(tc-expr/check s (ret tfty))
|
||||
;; this argument wasn't provided, and was optional
|
||||
#f))])
|
||||
tnflds)
|
||||
|
|
|
@ -362,7 +362,7 @@
|
|||
[else (tc-error/expr "send: method ~a not understood by class ~a" s c)])]
|
||||
[ret-ty (tc/funapp rcvr args (ret ftype) (map tc-expr (syntax->list args)) expected)])
|
||||
(if expected
|
||||
(begin (check-below ret-ty expected) (ret expected))
|
||||
(begin (check-below ret-ty expected) expected)
|
||||
ret-ty))]
|
||||
[(tc-result1: t) (int-err "non-symbol methods not supported by Typed Scheme: ~a" t)])]
|
||||
[(tc-result1: t) (tc-error/expr #:return (or expected (ret (Un))) "send: expected a class instance, got ~a" t)]))
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
(loop (cdr names) (cdr exprs) (apply append (cdr names)) (cdr clauses)))]
|
||||
[else
|
||||
;(for-each (lambda (vs) (for-each (lambda (v) (printf/log "Letrec Var: ~a~n" (syntax-e v))) vs)) names)
|
||||
(do-check (lambda (stx e t) (tc-expr/check/t e t))
|
||||
(do-check (lambda (stx e t) (tc-expr/check e t))
|
||||
names (map (lambda (l) (map get-type l)) names) form exprs body clauses expected)]))))
|
||||
|
||||
;; this is so match can provide us with a syntax property to
|
||||
|
|
Loading…
Reference in New Issue
Block a user