From 670ecdacdb9d6cf7c6e8d44cbbc3db20609ded6d Mon Sep 17 00:00:00 2001 From: Rudy Ges Date: Sat, 15 Feb 2025 22:52:56 +0100 Subject: [PATCH 1/2] Always check var shadowing, disable associated warning by default --- src-json/warning.json | 3 ++- src/context/typecore.ml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src-json/warning.json b/src-json/warning.json index 763e6e80b05..0db09c76a01 100644 --- a/src-json/warning.json +++ b/src-json/warning.json @@ -76,7 +76,8 @@ { "name": "WVarShadow", "doc": "A local variable hides another by using the same name", - "parent": "WTyper" + "parent": "WTyper", + "enabled": false }, { "name": "WExternWithExpr", diff --git a/src/context/typecore.ml b/src/context/typecore.ml index 43e197ea079..1dfdb2630a5 100644 --- a/src/context/typecore.ml +++ b/src/context/typecore.ml @@ -416,7 +416,7 @@ let save_locals ctx = let add_local ctx k n t p = let v = alloc_var k n t p in - if Define.defined ctx.com.defines Define.WarnVarShadowing && n <> "_" then begin + if n <> "_" then begin match k with | VUser _ -> begin try From 4d78be486aba9627dadf19fe77fab593d1660627 Mon Sep 17 00:00:00 2001 From: Rudy Ges Date: Sat, 15 Feb 2025 22:53:07 +0100 Subject: [PATCH 2/2] Deprecate some warnings related defines --- src-json/define.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src-json/define.json b/src-json/define.json index 85559c57aed..8c9e66cbbb2 100644 --- a/src-json/define.json +++ b/src-json/define.json @@ -554,7 +554,8 @@ { "name": "NoDeprecationWarnings", "define": "no-deprecation-warnings", - "doc": "Do not warn if fields annotated with `@:deprecated` are used." + "doc": "Do not warn if fields annotated with `@:deprecated` are used.", + "deprecated": "Use -w to configure warnings. See https://haxe.org/manual/cr-warnings.html for more information." }, { "name": "NoFlashOverride", @@ -791,7 +792,8 @@ { "name": "WarnVarShadowing", "define": "warn-var-shadowing", - "doc": "Warn about shadowing variable declarations." + "doc": "Warn about shadowing variable declarations.", + "deprecated": "Use -w to configure warnings. See https://haxe.org/manual/cr-warnings.html for more information." }, { "name": "NoTre",