diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-03-27 02:28:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 10:28:11 +0100 |
commit | a65189a739c59fcc0d7b3f8fdcb2cf8bed432f68 (patch) | |
tree | 079934acdaad7f51edd35b54e2390c3c2f08daed /compiler | |
parent | 8ed6de4fe6517dc4db38ab5dea898c0016d1c08a (diff) | |
download | Nim-a65189a739c59fcc0d7b3f8fdcb2cf8bed432f68.tar.gz |
nnkArglist => nnkArgList + special case stylecheck:error (#17529)
* nnkArglist => nnkArgList * special case stylecheck:error
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/linter.nim | 8 | ||||
-rw-r--r-- | compiler/msgs.nim | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/compiler/linter.nim b/compiler/linter.nim index 1ae1fb097..9af4f468e 100644 --- a/compiler/linter.nim +++ b/compiler/linter.nim @@ -125,9 +125,11 @@ proc styleCheckUse*(conf: ConfigRef; info: TLineInfo; s: PSym) = return let newName = s.name.s - let oldName = differs(conf, info, newName) - if oldName.len > 0: - lintReport(conf, info, newName, oldName) + let badName = differs(conf, info, newName) + 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) proc checkPragmaUse*(conf: ConfigRef; info: TLineInfo; w: TSpecialWord; pragmaName: string) = let wanted = $w diff --git a/compiler/msgs.nim b/compiler/msgs.nim index bbe40507f..24855ae18 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -612,9 +612,9 @@ template internalAssert*(conf: ConfigRef, e: bool) = let arg = info2.toFileLineCol internalErrorImpl(conf, unknownLineInfo, arg, info2) -template lintReport*(conf: ConfigRef; info: TLineInfo, beau, got: string) = - let m = "'$2' should be: '$1'" % [beau, got] - let msg = if optStyleError in conf.globalOptions: errGenerated else: hintName +template lintReport*(conf: ConfigRef; info: TLineInfo, beau, got: string, forceHint = false) = + let m = "'$1' should be: '$2'" % [got, beau] + let msg = if optStyleError in conf.globalOptions and not forceHint: errGenerated else: hintName liMessage(conf, info, msg, m, doNothing, instLoc()) proc quotedFilename*(conf: ConfigRef; i: TLineInfo): Rope = |