summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2003-10-28 15:26:48 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2003-10-28 15:26:48 +0000
commit9e46ceb9e22e16bd3625a880f432278bb9f01ae3 (patch)
tree05ffdc690f05b22dd498946ac5c28e6684697e38
parentfa91038ef297495eb935b62f5eb606ac61309943 (diff)
cannot List.assoc on label_description
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5889 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--typing/typecore.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/typing/typecore.ml b/typing/typecore.ml
index fa647aba7..774469305 100644
--- a/typing/typecore.ml
+++ b/typing/typecore.ml
@@ -252,11 +252,12 @@ let rec build_as_type env p =
| Tpat_record lpl ->
let lbl = fst(List.hd lpl) in
let ty = newvar () in
+ let ppl = List.map (fun (l,p) -> l.lbl_pos, p) lpl in
let do_label lbl =
let _, ty_arg, ty_res = instance_label false lbl in
unify_pat env {p with pat_type = ty} ty_res;
- if lbl.lbl_mut = Immutable && List.mem_assoc lbl lpl then begin
- let arg = List.assoc lbl lpl in
+ if lbl.lbl_mut = Immutable && List.mem_assoc lbl.lbl_pos ppl then begin
+ let arg = List.assoc lbl.lbl_pos ppl in
unify_pat env {arg with pat_type = build_as_type env arg} ty_arg
end else begin
let _, ty_arg', ty_res' = instance_label false lbl in