commit c89aa1be195b85317ac79845c06586be06c6921f
parent 7f593b52c8b99e2a8a3d0541411423f85788c5eb
Author: Stephen Chang <stchang@ccs.neu.edu>
Date: Fri, 18 Mar 2016 11:57:46 -0400
fix expected-ty propagation in cond else; closes #3
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git 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
@@ -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)]))