Commits

camlspotter  committed 908b080

more typeloc

  • Participants
  • Parent commits 0783860
  • Branches typeloc

Comments (0)

Files changed (1)

File typing/typecore.ml

       let type_label_pat (label_path, label_lid, label, sarg) =
         begin_def ();
         let (vars, ty_arg, ty_res) = instance_label false label in
+        let ty_res = copy_with_loc loc ty_res in
         if vars = [] then end_def ();
         let ty_arg = copy_with_loc loc ty_arg in
         begin try
       let arg = type_exp env sarg in
       let (label_path,label) = Typetexp.find_label env loc lid.txt in
       let (_, ty_arg, ty_res) = instance_label false label in
+      let ty_res = copy_with_loc lid.Location.loc ty_res in
 (* WRONG
       let ty_arg = copy_with_loc loc ty_arg 
-      and ty_res = copy_with_loc loc ty_res
       in
 *)
       unify_exp env arg ty_res;
         exp_extra = (Texp_constraint (cty, cty'), loc) :: arg.exp_extra;
       }
   | Pexp_when(scond, sbody) ->
-      let cond = type_expect env scond (copy_with_loc scond.pexp_loc Predef.type_bool) in
+      let cond = type_expect env scond (copy_with_loc loc Predef.type_bool) in (* CR jfuruse: bad location *)
       let body = type_expect env sbody ty_expected in
       re {
         exp_desc = Texp_when(cond, body);