From 531da9ccd12387de7bd23bd329778ac3d4813f59 Mon Sep 17 00:00:00 2001 From: Rudy Ges Date: Sun, 16 Feb 2025 07:23:05 +0100 Subject: [PATCH] [warnings] use -w instead of defines (#12013) * Always check var shadowing, disable associated warning by default * Deprecate some warnings related defines --- src-json/define.json | 6 ++++-- src-json/warning.json | 3 ++- src/context/typecore.ml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src-json/define.json b/src-json/define.json index 49718ab8f92..4c3504b46a9 100644 --- a/src-json/define.json +++ b/src-json/define.json @@ -503,7 +503,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", @@ -758,7 +759,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", diff --git a/src-json/warning.json b/src-json/warning.json index 38a6474deee..6157f41b372 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 3e949be844b..e3afa45deea 100644 --- a/src/context/typecore.ml +++ b/src/context/typecore.ml @@ -288,7 +288,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