Improve errors.
original commit: 8df7a464931969dd782f3efe6db7e322643be2f4
This commit is contained in:
parent
8701782f17
commit
53e3814a54
|
@ -27,8 +27,8 @@
|
|||
(define var-table (make-weak-hasheq))
|
||||
;; maps Type to List[Cons[Symbol,Variance]]
|
||||
|
||||
(define (free-idxs* t) (hash-ref index-table t (lambda _ (error "type not in index-table" (syntax-e t)))))
|
||||
(define (free-vars* t) (hash-ref var-table t (lambda _ (error "type not in var-table" (syntax-e t)))))
|
||||
(define (free-idxs* t) (hash-ref index-table t (lambda _ (int-err "type ~a not in index-table" (syntax-e t)))))
|
||||
(define (free-vars* t) (hash-ref var-table t (lambda _ (int-err "type ~a not in var-table" (syntax-e t)))))
|
||||
|
||||
|
||||
(define empty-hash-table (make-immutable-hasheq null))
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
;(printf "found a type name ~a~n" #'id)
|
||||
(make-Name #'id)]
|
||||
[else
|
||||
(tc-error/delayed "unbound type ~a" (syntax-e #'id))
|
||||
(tc-error/delayed "unbound type name ~a" (syntax-e #'id))
|
||||
Univ])]
|
||||
|
||||
[(All . rest) (eq? (syntax-e #'All) 'All) (tc-error "All: bad syntax")]
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
(define (tc-error/delayed msg #:stx [stx* (current-orig-stx)] . rest)
|
||||
(let ([stx (locate-stx stx*)])
|
||||
(unless (syntax? stx)
|
||||
(error "syntax was not syntax" stx (syntax->datum stx*)))
|
||||
(int-err "erroneous syntax was not a syntax object: ~a ~a" stx (syntax->datum stx*)))
|
||||
(if (delay-errors?)
|
||||
(set! delayed-errors (cons (make-err (apply format msg rest) (list stx)) delayed-errors))
|
||||
(raise-typecheck-error (apply format msg rest) (list stx)))))
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
[(Latent-Remove-Effect: t) (make-Remove-Effect t v)]
|
||||
[(True-Effect:) eff]
|
||||
[(False-Effect:) eff]
|
||||
[_ (error 'internal-tc-error "can't add var to effect ~a" eff)]))
|
||||
[_ (int-err "can't add var ~a to effect ~a" v eff)]))
|
||||
|
||||
(define-syntax (-> stx)
|
||||
(syntax-case* stx (:) (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
|
||||
|
|
|
@ -422,7 +422,7 @@
|
|||
(match t
|
||||
[(Poly: n scope)
|
||||
(unless (= (length names) n)
|
||||
(error "Wrong number of names"))
|
||||
(int-err "Wrong number of names: expected ~a got ~a" n (length names)))
|
||||
(instantiate-many (map *F names) scope)]))
|
||||
|
||||
;; the 'smart' constructor
|
||||
|
@ -437,7 +437,7 @@
|
|||
(match t
|
||||
[(PolyDots: n scope)
|
||||
(unless (= (length names) n)
|
||||
(error "Wrong number of names"))
|
||||
(int-err "Wrong number of names: expected ~a got ~a" n (length names)))
|
||||
(instantiate-many (map *F names) scope)]))
|
||||
|
||||
(print-struct #t)
|
||||
|
|
Loading…
Reference in New Issue
Block a user