cleanup old type-error usage

This commit is contained in:
Stephen Chang 2014-08-19 16:06:27 -04:00
parent fbca467d01
commit 5a4e27a7d8
2 changed files with 3 additions and 16 deletions

View File

@ -78,8 +78,6 @@
[(_ . b:boolean) ( (syntax/loc stx (#%datum . b)) #'Bool)]
[(_ x)
#:when (type-error #:src #'x #:msg "~a has unknown type" #'x)
#;(error 'TYPE-ERROR "~a (~a:~a) has unknown type"
#'x (syntax-line #'x) (syntax-column #'x))
(syntax/loc stx (#%datum . x))]))
(define-syntax (begin/tc stx)
@ -170,12 +168,7 @@
(type-error #:src stx
#:msg "IF branches have differing types: branch ~a has type ~a and branch ~a has type ~a"
#'e1 (typeof #'e1+)
#'e2 (typeof #'e2+))
#;(error 'TYPE-ERROR
"(~a:~a) if branches have differing types: ~a has type ~a and ~a has type ~a"
(syntax-line stx) (syntax-column stx)
(syntax->datum #'e1) (typeof #'e1+)
(syntax->datum #'e2) (typeof #'e2+)))
#'e2 (typeof #'e2+)))
( (syntax/loc stx (if e_test+ e1+ e2+)) (typeof #'e1+))]))
;; lists ----------------------------------------------------------------------

View File

@ -39,12 +39,7 @@
; (printf "~a has type ~a; expected: ~a\n" (syntax->datum e) (syntax->datum (typeof e)) (syntax->datum τ))
(or (type=? (typeof e) τ)
(type-error #:src e
#:msg "~a has type ~a, but should have type ~a" e (typeof e) τ)
#;(error 'TYPE-ERROR "~a (~a:~a) has type ~a, but should have type ~a"
(syntax->datum e)
(syntax-line e) (syntax-column e)
(syntax->datum (typeof e))
(syntax->datum τ))))
#:msg "~a has type ~a, but should have type ~a" e (typeof e) τ)))
;; attaches type τ to e (as syntax property)
(define-for-syntax ( e τ) (syntax-property e 'type τ))
@ -67,8 +62,7 @@
(hash-ref (Γ) (syntax->datum x)
(λ ()
(type-error #:src x
#:msg "Could not find type for variable ~a" x)
#;(error 'TYPE-ERROR "Could not find type for variable ~a." (syntax->datum x)))))
#:msg "Could not find type for variable ~a" x))))
;; returns a new hash table extended with type associations x:τs
(define (type-env-extend x:τs)