Commit 4c407dda authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-05-13 14:05:38 by cvscast] Bug in type-checking for records

Original author: cvscast
Date: 2003-05-13 14:05:38+00:00
parent 53aae79f
......@@ -677,6 +677,8 @@ and type_check' loc env e constr precise = match e with
| RecordLitt r ->
(* try to get rid of precise = true for values of fields *)
(* also: the use equivalent of need_second to optimize... *)
let precise = true in
if not (Types.Record.has_record constr) then
raise_loc loc (ShouldHave (constr,"but it is a record."));
let (rconstr,res) =
......@@ -700,9 +702,16 @@ and type_check' loc env e constr precise = match e with
if not (Types.Record.has_empty_record rconstr) then
raise_loc loc
(ShouldHave (constr,"More field should be present"));
let t =
Types.record' (false, LabelMap.from_list (fun _ _ -> assert false) res)
in
check loc t constr "";
t
(*
if precise then
Types.record' (false, LabelMap.from_list (fun _ _ -> assert false) res)
else constr
*)
| Map (e,b) ->
let t = type_check env e (Sequence.star b.br_accept) true in
......
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