Browse Source

ignore `-D warn-var-shadowing` in std (closes #8041)

Aleksandr Kuzmenko 6 years ago
parent
commit
6676d47511
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/context/typecore.ml

+ 5 - 2
src/context/typecore.ml

@@ -202,8 +202,11 @@ let add_local ctx k n t p =
 	if Define.defined ctx.com.defines Define.WarnVarShadowing && n <> "_" then begin
 		try
 			let v' = PMap.find n ctx.locals in
-			ctx.com.warning "This variable shadows a previously declared variable" p;
-			ctx.com.warning "Previous variable was here" v'.v_pos
+			(* ignore std lib *)
+			if not (List.exists (ExtLib.String.starts_with p.pfile) ctx.com.std_path) then begin
+				ctx.com.warning "This variable shadows a previously declared variable" p;
+				ctx.com.warning "Previous variable was here" v'.v_pos
+			end
 		with Not_found ->
 			()
 	end;