summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-09-25 23:51:30 +0800
committerGitHub <noreply@github.com>2023-09-25 17:51:30 +0200
commit3979e83fcbf5e7bda9a1bad55fa9d594f36158de (patch)
tree8690aee2902bbd5af4af86a062778e9761a9f951
parentf0bf94e5311e851cba4370c2310c0be66e535a27 (diff)
downloadNim-3979e83fcbf5e7bda9a1bad55fa9d594f36158de.tar.gz
fixes #22706; turn "unknown hint" into a hint (#22755)
fixes #22706
-rw-r--r--compiler/commands.nim6
-rw-r--r--compiler/lineinfos.nim2
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index ac5366f10..8c1da3cd3 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -205,7 +205,11 @@ proc processSpecificNote*(arg: string, state: TSpecialWord, pass: TCmdLinePass,
     # unfortunately, hintUser and warningUser clash, otherwise implementation would simplify a bit
     let x = findStr(noteMin, noteMax, id, errUnknown)
     if x != errUnknown: notes = {TNoteKind(x)}
-    else: localError(conf, info, "unknown $#: $#" % [name, id])
+    else:
+      if isSomeHint:
+        message(conf, info, hintUnknownHint, id)
+      else:
+        localError(conf, info, "unknown $#: $#" % [name, id])
   case id.normalize
   of "all": # other note groups would be easy to support via additional cases
     notes = if isSomeHint: {hintMin..hintMax} else: {warnMin..warnMax}
diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim
index 7cc9c68f5..544c5295c 100644
--- a/compiler/lineinfos.nim
+++ b/compiler/lineinfos.nim
@@ -107,6 +107,7 @@ type
     hintUser = "User", hintUserRaw = "UserRaw", hintExtendedContext = "ExtendedContext",
     hintMsgOrigin = "MsgOrigin", # since 1.3.5
     hintDeclaredLoc = "DeclaredLoc", # since 1.5.1
+    hintUnknownHint = "UnknownHint"
 
 const
   MsgKindToStr*: array[TMsgKind, string] = [
@@ -229,6 +230,7 @@ const
     hintExtendedContext: "$1",
     hintMsgOrigin: "$1",
     hintDeclaredLoc: "$1",
+    hintUnknownHint: "unknown hint: $1"
   ]
 
 const