Commit 385e678c authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA] Small fix on environment; add test for recursive call (fails)

parent 07c734d6
......@@ -85,6 +85,9 @@ and parse_abstr env l fv loc fun_name params rtype body =
parse_iface env l params [] nb [] rtype in
let fun_typ = type_of_iface params rtype in
let node = make_node fv in
let l = (match fun_name with
| None -> l
| Some (id, name) -> Locals.add name id l) 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 (oldfv @ fv) loc None rest
......
......@@ -103,6 +103,11 @@ let tests = "CDuce runtime tests" >:::
~printer:(fun x -> x) "(2, 5)"
(run_test "(fun f x : [Int] : [Int] -> match x : [Int] with
| (el : Int) :: (rest : [Int]) -> rest).[1; 2; 5]");
assert_equal ~msg:"Test CDuce.runtime.list.last failed"
~printer:(fun x -> x) "4"
(run_test "(fun f x : [Int] : [Int] -> match x : [Int] with
| el : Int -> el
| (el : Int) :: (rest : [Int]) -> f.rest).[1; 2; 5; 4]");
);
]
......
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