Fix error handling when non-poly Name is applied.
svn: r9607
This commit is contained in:
parent
a521d279e3
commit
ac1acc7bf6
|
@ -162,11 +162,13 @@
|
|||
[(lookup-type-alias #'id parse-type (lambda () #f))
|
||||
=>
|
||||
(lambda (t)
|
||||
;(printf "found a type alias ~a~n" #'id)
|
||||
(add-type-name-reference #'id)
|
||||
t)]
|
||||
;; if it's a type name, we just use the name
|
||||
[(lookup-type-name #'id (lambda () #f))
|
||||
(add-type-name-reference #'id)
|
||||
;(printf "found a type name ~a~n" #'id)
|
||||
(make-Name #'id)]
|
||||
[else
|
||||
(tc-error/delayed "unbound type ~a" (syntax-e #'id))
|
||||
|
|
|
@ -223,12 +223,14 @@
|
|||
;(printf "subtype - hierarchy : ~a ~a ~a~n" nm parent other)
|
||||
(subtype* A0 parent other)]
|
||||
;; applications and names are structs too
|
||||
[(list (App: (Name: n) args _) other)
|
||||
[(list (App: (Name: n) args stx) other)
|
||||
(let ([t (lookup-type-name n)])
|
||||
(unless (Type? t)
|
||||
(fail! s t))
|
||||
#;(printf "subtype: app-name: name: ~a type: ~a other: ~a ~ninst: ~a~n" (syntax-e n) t other
|
||||
(instantiate-poly t args))
|
||||
(unless (Poly? t)
|
||||
(tc-error/stx stx "cannot apply non-polymorphic type ~a" t))
|
||||
(let ([v (subtype* A0 (instantiate-poly t args) other)])
|
||||
#;(printf "val: ~a~n" v)
|
||||
v))]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
(require syntax/boundmap
|
||||
"tc-utils.ss"
|
||||
mzlib/trace
|
||||
mzlib/plt-match)
|
||||
scheme/match)
|
||||
|
||||
(provide register-type-alias
|
||||
lookup-type-alias
|
||||
|
@ -30,6 +30,8 @@
|
|||
(mapping-put! id (make-unresolved stx #f)))
|
||||
|
||||
(define (register-resolved-type-alias id ty)
|
||||
#;(when (eq? 'Number (syntax-e id))
|
||||
(printf "registering type ~a ~a~n~a~n" id (syntax-e id) ty))
|
||||
(mapping-put! id (make-resolved ty)))
|
||||
|
||||
(define (lookup-type-alias id parse-type [k (lambda () (tc-error "Unknown type alias: ~a" (syntax-e id)))])
|
||||
|
|
Loading…
Reference in New Issue
Block a user