--- typing/typer.ml 2007/07/10 16:59:02 25 +++ typing/typer.ml 2007/07/10 16:59:08 26 @@ -8,6 +8,7 @@ exception NonExhaustive of Types.descr exception Constraint of Types.descr * Types.descr * string exception ShouldHave of Types.descr * string +exception WrongLabel of Types.descr * Types.label let raise_loc loc exn = raise (Location (loc,exn)) @@ -327,6 +328,9 @@ | Pair (e1,e2) -> let (fv1,e1) = expr e1 and (fv2,e2) = expr e2 in (Fv.union fv1 fv2, Typed.Pair (e1,e2)) + | Dot (e,l) -> + let (fv,e) = expr e in + (Fv.union Fv.empty fv, Typed.Dot (e,l)) | RecordLitt r -> (* XXX TODO: check that no label appears twice *) let fv = ref Fv.empty in @@ -447,6 +451,10 @@ else (ignore (type_check env e2 dom false); Types.Arrow.apply_noarg t1) | Cst c -> Types.constant c + | Dot (e,l) -> + let t = type_check env e Types.Record.any true in + (try (Types.Record.project t l) + with Not_found -> raise_loc loc (WrongLabel(t,l))) | RecordLitt r -> List.fold_left (fun accu (l,e) ->