diff --git a/collects/typed-scheme/private/tc-utils.ss b/collects/typed-scheme/private/tc-utils.ss index ce37874adb..1c62123d02 100644 --- a/collects/typed-scheme/private/tc-utils.ss +++ b/collects/typed-scheme/private/tc-utils.ss @@ -85,9 +85,12 @@ (let ([stx (locate-stx (current-orig-stx))]) ;; If this isn't original syntax, then we can get some pretty bogus error messages. Note ;; that this is from a macro expansion, so that introduced vars and such don't confuse the user. - (if (eq? (syntax-source (current-orig-stx)) (syntax-source (orig-module-stx))) - (raise-typecheck-error (apply format msg rest) (list stx)) - (raise-typecheck-error (apply format (string-append "Error in macro expansion -- " msg) rest) (list stx))))) + (cond + [(not (orig-module-stx)) + (raise-typecheck-error (apply format msg rest) (list stx))] + [(eq? (syntax-source (current-orig-stx)) (syntax-source (orig-module-stx))) + (raise-typecheck-error (apply format msg rest) (list stx))] + [else (raise-typecheck-error (apply format (string-append "Error in macro expansion -- " msg) rest) (list stx))]))) ;; produce a type error, given a particular syntax (define (tc-error/stx stx msg . rest)