diff --git a/stlc.rkt b/stlc.rkt index 6c2d49d..3039487 100644 --- 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 index dd45ba8..3c40935 100644 --- 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)