Don't print the type at the REPL for Bottom

Closes PR 14829

original commit: 7725262771632dbd6078d03204ca24adaa66891f
This commit is contained in:
Asumu Takikawa 2014-11-12 17:08:41 -05:00
parent 24d43bffc5
commit c3997a5f35
2 changed files with 29 additions and 6 deletions

View File

@ -122,10 +122,14 @@
[else (set! did-I-suggest-:print-type-already? #t)
:print-type-message]))]
[x (int-err "bad type result: ~a" x)]))
(if ty-str
#`(begin (display '#,ty-str)
#,(if (unbox include-extra-requires?)
extra-requires
#'(begin))
#,(arm #'(begin transformed-body ...)))
(if (and ty-str
(not (null? (syntax-e #'(transformed-body ...)))))
(with-syntax ([(transformed-body ... transformed-last)
#'(transformed-body ...)])
#`(begin #,(if (unbox include-extra-requires?)
extra-requires
#'(begin))
#,(arm #'(begin transformed-body ...))
(begin0 #,(arm #'transformed-last)
(display '#,ty-str))))
(arm #'(begin transformed-body ...))))))]))

View File

@ -0,0 +1,19 @@
#lang racket/base
;; Test for PR 14829. Make sure the type is not printed
;; for expressions that return Bottom.
(require rackunit
racket/sandbox)
(define out (open-output-string))
(define tr-eval
(parameterize ([sandbox-output out])
(call-with-trusted-sandbox-configuration
(λ () (make-evaluator 'typed/racket)))))
(with-handlers ([exn? values])
(tr-eval '(error "foo")))
(check-equal? "" (get-output-string out))