Commit 5032fcbd authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA] Solve environment problem; all tests pass

parent 08e8d89d
......@@ -42,7 +42,7 @@ let rec _to_typed env l expr =
let _, _, e2 = _to_typed env l e2 in
env, l, { exp_loc=loc; exp_typ=empty; exp_descr=Apply(e1, e2) }
| Abstr (_, fun_name, params, rtype, body) ->
parse_abstr env l loc (Some(0, 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 t = type_of_ptype t in
......@@ -73,27 +73,27 @@ let rec _to_typed env l expr =
env, l, { exp_loc=loc; exp_typ=(type_of_string "String");
exp_descr=Cst s }
and parse_abstr env l loc fun_name params rtype body =
let rec _parse_abstr env l loc fun_name params rtype body nb =
and parse_abstr env l fv loc fun_name params rtype body =
let rec _parse_abstr env l oldfv loc fun_name params rtype body nb =
let brloc = caml_loc_to_cduce (get_loc body) in
let empty, env, l, fv, iface, rest =
parse_iface env l params [] nb [] rtype in
let fun_typ = type_of_iface iface Types.empty in
let node = make_node fv in
let env, l, body = if empty
then let _, _, body = _to_typed env l body in env, l, body
else let env, l, body = _parse_abstr env l loc None rest rtype body
(nb + 1) in env, l, body
else let env, l, body = _parse_abstr env l (oldfv @ fv) loc None rest
rtype body (nb + 1) in env, l, body
in
let b = { br_loc=brloc; br_used=true; br_ghost=false; br_vars_empty=[];
br_pat=node; br_body=body } in
let brs = { br_typ=rtype; br_accept=any; br_branches=[b] } in
let fun_typ = type_of_iface iface Types.empty in
let abstr = { fun_name=fun_name; fun_iface=iface; fun_body=brs;
fun_typ=fun_typ; fun_fv=[] } in
fun_typ=fun_typ; fun_fv=oldfv } in
(* TODO: Fix exp_typ *)
env, l, { exp_loc=loc; exp_typ=any; exp_descr=Abstraction(abstr) }
in
_parse_abstr env l loc fun_name params (type_of_ptype rtype) body 0
_parse_abstr env l fv loc fun_name params (type_of_ptype rtype) body 0
and make_node fv =
let d = (match fv with
......
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