1. camlspotter
  2. mutated_ocaml

Commits

camlspotter  committed 2d103a7

printer and some updates

  • Participants
  • Parent commits 64b2725
  • Branches typeloc

Comments (0)

Files changed (2)

File typing/printtyp.ml

View file
 let differing_types ppf (t, t') =
   let typ ppf t = match t.tyloc with
     | Some loc -> 
-        fprintf ppf "@[<v2>%a : introduced at %a@]" 
+        fprintf ppf "@[<v2>  %a : introduced at %a@]" 
           type_expr t
-          Location.print loc
+          Location.print_loc loc
     | None -> 
-        fprintf ppf "@[<2>%a@]" 
+        fprintf ppf "@[<2>  %a : introduced at unknown place@]" 
           type_expr t
   in
   fprintf ppf "@[<v>The differing types are:@ %a@ %a@]"

File typing/typecore.ml

View file
       let (ty_args, ty_res) =
         instance_constructor ~in_pattern:(env, get_newtype_level ()) constr
       in
-      (* CR jfuruse: typeloc todo for args *)
+      (* CR jfuruse: typeloc todo for args. Probably unsafe (but why?) *)
       let ty_res = copy_with_loc loc ty_res in (* CR jfuruse: world ok, but not checked yet *)
       if constr.cstr_generalized && mode = Normal then
         unify_pat_types_gadt loc env ty_res expected_ty
   let separate = !Clflags.principal || Env.has_local_constraints env in
   if separate then (begin_def (); begin_def ());
   let (ty_args, ty_res) = instance_constructor constr in
-(* WRONG
-  let ty_args = List.map (copy_with_loc loc) ty_args in 
-  let ty_res = copy_with_loc loc ty_res in
-*)
+  (* CR jfuruse: todo how about the args? the following is not correct. *)
+  (* let ty_args = List.map (copy_with_loc loc) ty_args in *)
+  let ty_res = copy_with_loc loc ty_res in (* tyloc. this should be safe *)
   let texp =
     re {
       exp_desc = Texp_construct(path, lid, constr, [],explicit_arity);