Skip to content

Commit 5b871e6

Browse files
authored
improve handling with-handlers (#1036)
closes #1028
1 parent 8d9cb49 commit 5b871e6

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

typed-racket-lib/typed-racket/typecheck/check-subforms-unit.rkt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@
6868
(loop (instantiate-poly t (map (λ (n) Univ) ns)))]
6969
;; This clause should raise an error via the check-below test
7070
[_
71-
(cond [;; a redundant test, but it ensures an error message below
72-
(not (subtype t (-> prop-type Univ)))
73-
(parameterize ([current-orig-stx stx])
74-
(check-below t (-> prop-type Univ)))]
75-
[else (int-err "get-range-result: should not happen. type ~a prop ~a"
71+
(cond
72+
[(subtype t -Bottom)]
73+
[;; a redundant test, but it ensures an error message below
74+
(not (subtype t (-> prop-type Univ)))
75+
(parameterize ([current-orig-stx stx])
76+
(check-below t (-> prop-type Univ)))]
77+
[else (int-err "get-range-result: should not happen. type ~a prop ~a"
7678
t prop-type)])
7779
(ret (Un))])))
7880

typed-racket-test/unit-tests/typecheck-tests.rkt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3673,6 +3673,13 @@
36733673
[symbol? (lambda (x) (symbol->string x))])
36743674
(raise 'foo))
36753675
#:ret (tc-ret -String)]
3676+
[tc-err
3677+
(with-handlers ([exn:fail? (values #f #f)]) (values #t #t))
3678+
#:ret (tc-ret (list -True -True))
3679+
#:msg #rx"expected single value, got multiple"]
3680+
[tc-e
3681+
(with-handlers ([exn:fail? (error 'hi "error")]) #t)
3682+
-True]
36763683

36773684
[tc-err
36783685
(raise (λ ([x : Number]) (add1 x)))]

0 commit comments

Comments
 (0)