From 7a48646c0f7123f57f5aed78b1b82b8bf99a4676 Mon Sep 17 00:00:00 2001 From: Lydia Duncan Date: Tue, 19 Sep 2023 12:14:10 -0700 Subject: [PATCH 1/2] Limit int->uint conversion unstable warnings to user code (without other flags) Prior to this change, 3 tests in `release/examples` included these for code that was within the standard/internal modules (ChapelRange, IO). We want unstable warnings to only fire in user code unless `--warn-unstable-internal` or `--warn-unstable-standard` are also passed, so limit this message. ---- Signed-off-by: Lydia Duncan --- compiler/resolution/functionResolution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/resolution/functionResolution.cpp b/compiler/resolution/functionResolution.cpp index ad7dca02062e..82fffc9b0d14 100644 --- a/compiler/resolution/functionResolution.cpp +++ b/compiler/resolution/functionResolution.cpp @@ -8129,7 +8129,7 @@ void warnForIntUintConversion(BaseAST* context, Type* formalType, Type* actualType, Symbol* actual) { - if (fWarnIntUint || fWarnUnstable) { + if (fWarnIntUint || shouldWarnUnstableFor(actual)) { Type* formalVt = formalType->getValType(); Type* actualVt = actualType->getValType(); if (is_uint_type(formalVt) && is_int_type(actualVt)) { From cd89522c509d2a0531fb6165487d8635621276ce Mon Sep 17 00:00:00 2001 From: Lydia Duncan Date: Tue, 19 Sep 2023 12:52:56 -0700 Subject: [PATCH 2/2] Check the context instead of the actual When the actual is a param, it accidentally triggers the "shouldn't warn for just user code" condition. But the context should always be accurate to whether we are in user code or not ---- Signed-off-by: Lydia Duncan --- compiler/resolution/functionResolution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/resolution/functionResolution.cpp b/compiler/resolution/functionResolution.cpp index 82fffc9b0d14..5b6e0f135c9b 100644 --- a/compiler/resolution/functionResolution.cpp +++ b/compiler/resolution/functionResolution.cpp @@ -8129,7 +8129,7 @@ void warnForIntUintConversion(BaseAST* context, Type* formalType, Type* actualType, Symbol* actual) { - if (fWarnIntUint || shouldWarnUnstableFor(actual)) { + if (fWarnIntUint || shouldWarnUnstableFor(context)) { Type* formalVt = formalType->getValType(); Type* actualVt = actualType->getValType(); if (is_uint_type(formalVt) && is_int_type(actualVt)) {