diff --git a/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt b/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt index 1807e64d..a125db5e 100644 --- a/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt +++ b/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt @@ -52,7 +52,7 @@ (match e-r [(list (tc-result: e-ts (FilterSet: fs+ fs-) os) ...) (values e-ts - os + (map (λ (o n) (if (is-var-mutated? n) -empty-obj o)) os names) (apply append (for/list ([n (in-list names)] [t (in-list e-ts)] diff --git a/typed-racket-test/unit-tests/typecheck-tests.rkt b/typed-racket-test/unit-tests/typecheck-tests.rkt index b28136ed..63eafd48 100644 --- a/typed-racket-test/unit-tests/typecheck-tests.rkt +++ b/typed-racket-test/unit-tests/typecheck-tests.rkt @@ -3392,6 +3392,16 @@ (void)) -Void] + [tc-err (let () + (: foo (-> Any Number)) + (define foo + (λ (x) (let ([x* x]) + (begin + (set! x* "sneaky string") + (if (number? x) + x* + 42))))))] + ;; tests looking up path-types into unions [tc-e (let () (: foo ((U (Pairof Number Number) (Pairof Number String)) -> Number))