Commit 336d06bb authored by Pietro Abate's avatar Pietro Abate
Browse files

Merge branch 'eval-test' of https://git.cduce.org/cduce into eval-test

parents 54c2ea99 9ce39e53
......@@ -31,12 +31,11 @@ let rec _to_typed env l expr =
| Abstr (_, fun_name, params, rtype, body) ->
parse_abstr env l [] loc (Some(0, fun_name)) params rtype body
| Match (_, e, t, b) ->
let b = parse_branches env l t [] b in
let b, btype = parse_branches env l t [] Types.empty b in
let t = type_of_ptype t in
let brs = { br_typ=t; br_accept=t; br_branches=b } in
let _, _, exp_descr = _to_typed env l e in
env, l, { exp_loc=loc; exp_typ=exp_descr.exp_typ;
exp_descr=Match(exp_descr, brs) }
env, l, { exp_loc=loc; exp_typ=btype; exp_descr=Match(exp_descr, brs) }
| Pair (_, e1, e2) ->
let _, _, e1 = _to_typed env l e1 in
let _, _, e2 = _to_typed env l e2 in
......@@ -162,7 +161,7 @@ and itype acc =
| (_, _, t) :: rest -> itype (arrow (cons acc) (cons (type_of_ptype t))) rest
| [] -> acc
and parse_branches env l toptype acc = function
and parse_branches env l toptype acc btype = function
| (loc, p, e) :: rest ->
let t, d, fv, br_locals, br_used = parse_match_value env l [] toptype p in
let line = Loc.start_line loc in
......@@ -187,8 +186,9 @@ and parse_branches env l toptype acc = function
br_pat = tpat;
br_body = br_body}
in
parse_branches env l toptype (acc @ [b]) rest
| [] -> acc
parse_branches env l toptype (acc @ [b])
(Types.cup btype br_body.Typed.exp_typ) rest
| [] -> acc, btype
and make_patterns t fv d =
incr Patterns.counter;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment