From e224865b3b1a45a1575fd62ec902ae4715659487 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Fri, 7 May 2021 21:43:52 -0700 Subject: add astmsgs; add `declared in` msg for usage lint errors (#17961) * add astmsgs; add `declared in` msg for usage lint errors * fix test * fix tests/tools/tlinter.nim * std prefix --- compiler/linter.nim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'compiler/linter.nim') diff --git a/compiler/linter.nim b/compiler/linter.nim index 7059689cf..5fb646051 100644 --- a/compiler/linter.nim +++ b/compiler/linter.nim @@ -9,9 +9,10 @@ ## This module implements the style checker. -import strutils +import std/strutils +from std/sugar import dup -import options, ast, msgs, idents, lineinfos, wordrecg +import options, ast, msgs, idents, lineinfos, wordrecg, astmsgs const Letters* = {'a'..'z', 'A'..'Z', '0'..'9', '\x80'..'\xFF', '_'} @@ -129,7 +130,7 @@ proc styleCheckUse*(conf: ConfigRef; info: TLineInfo; s: PSym) = if badName.len > 0: # special rules for historical reasons let forceHint = badName == "nnkArgList" and newName == "nnkArglist" or badName == "nnkArglist" and newName == "nnkArgList" - lintReport(conf, info, newName, badName, forceHint = forceHint) + lintReport(conf, info, newName, badName, forceHint = forceHint, extraMsg = "".dup(addDeclaredLoc(conf, s))) proc checkPragmaUse*(conf: ConfigRef; info: TLineInfo; w: TSpecialWord; pragmaName: string) = let wanted = $w -- cgit 1.4.1-2-gfad0