Commits

camlspotter committed 8a822f7

cleanup

  • Participants
  • Parent commits fe4af9d
  • Branches gcaml

Comments (0)

Files changed (1)

File typing/typecore.ml

   let spatl = List.map (fun (spat, sexp) -> spat) spat_sexp_list in
   let (pat_list, new_env, force) = type_pattern_list env spatl scope in
 
-  (* CR jfuruse: damn, pat has a closed type but new_env has poly one *)
-  let _print_pat_list pat_list =
-    List.iter (fun (pat) ->
-      let rec f pat =
-        begin match pat.pat_desc with
-        | Tpat_var id | Tpat_alias (_, id) -> 
-            Format.eprintf "%s : %a (%a in new_env)@."
-              (Ident.name id)
-              Print.type_sch pat.pat_type
-              Print.type_sch 
-              (Env.find_value (Path.Pident id) new_env).val_type
-        | _ -> ()
-        end;
-        iter_pattern_desc f pat.pat_desc
-      in
-      f pat) pat_list
-  in
+(* DEBUG *)  (* CR jfuruse: damn, pat has a closed type but new_env has poly one *)
+(* DEBUG *)  let _print_pat_list pat_list =
+(* DEBUG *)    List.iter (fun (pat) ->
+(* DEBUG *)      let rec f pat =
+(* DEBUG *)        begin match pat.pat_desc with
+(* DEBUG *)        | Tpat_var id | Tpat_alias (_, id) -> 
+(* DEBUG *)            Format.eprintf "%s : %a (%a in new_env)@."
+(* DEBUG *)              (Ident.name id)
+(* DEBUG *)              Print.type_sch pat.pat_type
+(* DEBUG *)              Print.type_sch 
+(* DEBUG *)              (Env.find_value (Path.Pident id) new_env).val_type
+(* DEBUG *)        | _ -> ()
+(* DEBUG *)        end;
+(* DEBUG *)        iter_pattern_desc f pat.pat_desc
+(* DEBUG *)      in
+(* DEBUG *)      f pat) pat_list
+(* DEBUG *)  in
 
   (* recursive binding with $-abst
      let rec p = e[p]
         iter_pattern finalize_variant pat
       end)
     pat_list;
-
   (* Only bind pattern variables after generalizing *)
   List.iter (fun f -> f()) force;
   let exp_env =
     match rec_flag with Nonrecursive | Default -> env | Recursive -> new_env in
 
-  let defined_idents = 
-    List.map fst
-      (List.flatten (List.map pat_bound_idents_and_types pat_list))
-  in
-
   let spat_exp_dispatch_list =
+    let defined_idents = 
+      List.map fst
+        (List.flatten (List.map pat_bound_idents_and_types pat_list))
+    in
      List.map2
       (fun (spat, sexp) pat ->
         spat,
 
 let type_binding env rec_flag spat_sexp_list scope =
   Typetexp.reset_type_variables();
-  (* CR jfuruse: share code with [type_expression] *)
-  let (pat_exp_list, env as res) = type_let env rec_flag spat_sexp_list scope in
-(*
-  List.iter (fun (pat,_exp) ->
-    let rec f pat =
-      begin match pat.pat_desc with
-      | Tpat_var id ->
-          Format.eprintf "%s : %a@."
-            (Ident.name id)
-            Print.type_sch pat.pat_type
-      | _ -> ()
-      end;
-      iter_pattern_desc f pat.pat_desc
-    in
-    f pat) pat_exp_list;
-*)
-  res
+  type_let env rec_flag spat_sexp_list scope
+(* DEBUG *) (*
+(* DEBUG *)   (* CR jfuruse: share code with [type_expression] *)
+(* DEBUG *)   let (pat_exp_list, env as res) = type_let env rec_flag spat_sexp_list scope in
+(* DEBUG *)   List.iter (fun (pat,_exp) ->
+(* DEBUG *)     let rec f pat =
+(* DEBUG *)       begin match pat.pat_desc with
+(* DEBUG *)       | Tpat_var id ->
+(* DEBUG *)           Format.eprintf "%s : %a@."
+(* DEBUG *)             (Ident.name id)
+(* DEBUG *)             Print.type_sch pat.pat_type
+(* DEBUG *)       | _ -> ()
+(* DEBUG *)       end;
+(* DEBUG *)       iter_pattern_desc f pat.pat_desc
+(* DEBUG *)     in
+(* DEBUG *)     f pat) pat_exp_list;
+(* DEBUG *)     res
+(* DEBUG *) *)
 
 (* Typing of toplevel expressions *)