diff --git a/tapl/mlish.rkt b/tapl/mlish.rkt index 508d515..18ee4ae 100644 --- a/tapl/mlish.rkt +++ b/tapl/mlish.rkt @@ -482,7 +482,7 @@ #:when (same-types? #'(ty_body ...)) #:with τ_out (stx-car #'(ty_body ...)) #:with [last-body- last-ty] (if (attribute else_body) - (infer+erase #'else_body) + (infer+erase #'(add-expected else_body ty-expected)) (infer+erase #'(void))) #:with ([last-b- last-b-ty] ...) (if (attribute else_body) (infers+erase #'(else_b ...)) diff --git a/tapl/tests/mlish/inst.mlish b/tapl/tests/mlish/inst.mlish index 21ff08c..f507370 100644 --- a/tapl/tests/mlish/inst.mlish +++ b/tapl/tests/mlish/inst.mlish @@ -32,3 +32,7 @@ (h)) (check-type i : (→/test (Result Int String))) + +(define (f/cond [b : Bool] -> (Result Int String)) + (cond [b (ok 1)] + [else (ok 0)]))