Commits

camlspotter committed c9770fc

added test tweak

  • Participants
  • Parent commits b819dbf
  • Branches local-poly-test

Comments (0)

Files changed (1)

File typing/typecore.ml

 
 (* Typing of let bindings *)
 
-and type_let ?(check = fun s -> Warnings.Unused_var s)
+and type_let ?(top=false)
+             ?(check = fun s -> Warnings.Unused_var s)
              ?(check_strict = fun s -> Warnings.Unused_var_strict s)
     env rec_flag spat_sexp_list scope allow =
   begin_def();
     (fun pat exp -> ignore(Parmatch.check_partial pat.pat_loc [pat, exp]))
     pat_list exp_list;
   end_def();
+  let top = 
+    top || 
+      match String.capitalize(Filename.basename(chop_extension_if_any !Location.input_name)) with
+      | "Scanf" | "Printf" -> true
+      | _ -> false
+  in
+  if top then begin
   List.iter2
     (fun pat exp ->
        if not (is_nonexpansive exp) then
   List.iter
     (fun pat -> iter_pattern (fun pat -> generalize pat.pat_type) pat)
     pat_list;
+
+  end;
   (List.combine pat_list exp_list, new_env, unpacks)
 
 (* Typing of toplevel bindings *)
   Typetexp.reset_type_variables();
   let (pat_exp_list, new_env, unpacks) =
     type_let
+      ~top:true
       ~check:(fun s -> Warnings.Unused_value_declaration s)
       ~check_strict:(fun s -> Warnings.Unused_value_declaration s)
       env rec_flag spat_sexp_list scope false