commit 5a4e27a7d886488631b3c6acb111955d636a0299
parent fbca467d01dc47ec53c73a3e31689243b673a22f
Author: Stephen Chang <stchang@ccs.neu.edu>
Date: Tue, 19 Aug 2014 16:06:27 -0400
cleanup old type-error usage
Diffstat:
2 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/stlc.rkt b/stlc.rkt
@@ -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 ----------------------------------------------------------------------
diff --git a/typecheck.rkt b/typecheck.rkt
@@ -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)