Commit 0c1571ee authored by Pietro Abate's avatar Pietro Abate
Browse files

One more test. Minor changes

parent c53f95c9
......@@ -51,13 +51,14 @@ let rec _to_typed env l expr =
let line = Loc.start_line origloc in
let cbegin = Loc.start_off origloc - Loc.start_bol origloc in
let cend = Loc.stop_off origloc - Loc.start_bol origloc in
let index, vtype = (try Locals.find vname l with Not_found ->
Printf.eprintf
let index, vtype =
try Locals.find vname l
with Not_found -> Printf.eprintf
"File %s, line %d, characters %d-%d:\nUnbound identifier %s\n"
(Loc.file_name origloc) line cbegin cend vname; raise Error)
(Loc.file_name origloc) line cbegin cend vname;
raise Error
in
let t = (* Ident.Env.find index env.Compile.gamma *) vtype in
let v = if Types.no_var t then Var(index, vname) else TVar(index, vname)
let v = if Types.no_var vtype then Var(index, vname) else TVar(index, vname)
in env, l, { exp_loc=loc; exp_typ=t; exp_descr=v }
| Int (_, i) ->
let i = Big_int.big_int_of_int i in
......
......@@ -25,10 +25,18 @@ let tests_poly_abstr = [
"Test CDuce.lambda.const_abstr failed",
"Abstraction(Dummy,,,,Sel(,(Int -> Int),{}))",
"fun f x : Int : Int -> 2";
"Test CDuce.lambda.poly.identity failed",
"Abstraction(Dummy,,,,Sel(,([ Char* ] | Int -> [ Char* ] | Int),Comp({},{ { (`$A/
[ Char* ]) } ,{ (`$A/Int) } })))",
"(fun f x : 'A{A/Int;A/String} : 'A{A/Int;A/String} -> x) {A/Int;A/String}";
"Test CDuce.runtime.poly.tail failed",
"Abstraction(([ (`$A & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any \
| Arrow)* ], [ (`$A & Int | Char | Atom | (Any,Any) | <(Any) (Any)>Any | \
Arrow)* ]),{})",
"fun tail x : ['A{}] : ['A{}] -> match x : ['A{}] with | (el : 'A{}) :: (rest : ['A{}]) -> rest";
]
let tests_compile = "CDuce compile tests (Typed -> Lambda )" >:::
......
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