camlspotter avatar camlspotter committed c9770fc

added test tweak

Comments (0)

Files changed (1)

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.