Fix internal errors in error reporting.
svn: r11836
This commit is contained in:
parent
52b9740042
commit
e7a7036a48
|
@ -46,6 +46,7 @@
|
||||||
[else Univ]))
|
[else Univ]))
|
||||||
|
|
||||||
|
|
||||||
|
;; do-inst : syntax type -> type
|
||||||
(define (do-inst stx ty)
|
(define (do-inst stx ty)
|
||||||
(define inst (syntax-property stx 'type-inst))
|
(define inst (syntax-property stx 'type-inst))
|
||||||
(define (split-last l)
|
(define (split-last l)
|
||||||
|
@ -53,16 +54,16 @@
|
||||||
(values all-but (car last-list))))
|
(values all-but (car last-list))))
|
||||||
(cond [(not inst) ty]
|
(cond [(not inst) ty]
|
||||||
[(not (or (Poly? ty) (PolyDots? ty)))
|
[(not (or (Poly? ty) (PolyDots? ty)))
|
||||||
(tc-error/expr #:return (ret (Un)) "Cannot instantiate non-polymorphic type ~a" ty)]
|
(tc-error/expr #:return (Un) "Cannot instantiate non-polymorphic type ~a" ty)]
|
||||||
|
|
||||||
[(and (Poly? ty)
|
[(and (Poly? ty)
|
||||||
(not (= (length (syntax->list inst)) (Poly-n ty))))
|
(not (= (length (syntax->list inst)) (Poly-n ty))))
|
||||||
(tc-error/expr #:return (ret (Un))
|
(tc-error/expr #:return (Un)
|
||||||
"Wrong number of type arguments to polymorphic type ~a:~nexpected: ~a~ngot: ~a"
|
"Wrong number of type arguments to polymorphic type ~a:~nexpected: ~a~ngot: ~a"
|
||||||
ty (Poly-n ty) (length (syntax->list inst)))]
|
ty (Poly-n ty) (length (syntax->list inst)))]
|
||||||
[(and (PolyDots? ty) (not (>= (length (syntax->list inst)) (sub1 (PolyDots-n ty)))))
|
[(and (PolyDots? ty) (not (>= (length (syntax->list inst)) (sub1 (PolyDots-n ty)))))
|
||||||
;; we can provide 0 arguments for the ... var
|
;; we can provide 0 arguments for the ... var
|
||||||
(tc-error/expr #:return (ret (Un))
|
(tc-error/expr #:return (Un)
|
||||||
"Wrong number of type arguments to polymorphic type ~a:~nexpected at least: ~a~ngot: ~a"
|
"Wrong number of type arguments to polymorphic type ~a:~nexpected at least: ~a~ngot: ~a"
|
||||||
ty (sub1 (PolyDots-n ty)) (length (syntax->list inst)))]
|
ty (sub1 (PolyDots-n ty)) (length (syntax->list inst)))]
|
||||||
[(PolyDots? ty)
|
[(PolyDots? ty)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user