diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-08-20 04:24:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-19 16:24:09 -0400 |
commit | 641381e3d47afba95f99efc77bb9a5ed65d07b3a (patch) | |
tree | 00b9392f142af032e92337cd3cc84cc127084003 /compiler | |
parent | c9c1c97f1ec394cc5e7638825d806413b874c080 (diff) | |
download | Nim-641381e3d47afba95f99efc77bb9a5ed65d07b3a.tar.gz |
fixes #20149; fixes #16762; hintAsError and warningAsError now ignore foreign packages (#20151)
* fixes #20149; hintAsError/warningAsError ignores foreign packages * add changelog * fixes the test * remove * fixes tests again * fix * I'm careless Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/msgs.nim | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim index ed65e0342..50bd94cda 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -418,12 +418,12 @@ To create a stacktrace, rerun compilation with './koch temp $1 <file>', see $2 f [conf.command, "intern.html#debugging-the-compiler".createDocLink], conf.unitSep) quit 1 -proc handleError(conf: ConfigRef; msg: TMsgKind, eh: TErrorHandling, s: string) = +proc handleError(conf: ConfigRef; msg: TMsgKind, eh: TErrorHandling, s: string, ignoreMsg: bool) = if msg in fatalMsgs: if conf.cmd == cmdIdeTools: log(s) quit(conf, msg) if msg >= errMin and msg <= errMax or - (msg in warnMin..hintMax and msg in conf.warningAsErrors): + (msg in warnMin..hintMax and msg in conf.warningAsErrors and not ignoreMsg): inc(conf.errorCounter) conf.exitcode = 1'i8 if conf.errorCounter >= conf.errorMax: @@ -531,8 +531,7 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string, of warnMin..warnMax: sev = Severity.Warning ignoreMsg = not conf.hasWarn(msg) - if msg in conf.warningAsErrors: - ignoreMsg = false + if not ignoreMsg and msg in conf.warningAsErrors: title = ErrorTitle else: title = WarningTitle @@ -542,8 +541,7 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string, of hintMin..hintMax: sev = Severity.Hint ignoreMsg = not conf.hasHint(msg) - if msg in conf.warningAsErrors: - ignoreMsg = false + if not ignoreMsg and msg in conf.warningAsErrors: title = ErrorTitle else: title = HintTitle @@ -569,7 +567,7 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string, " compiler msg initiated here", KindColor, KindFormat % $hintMsgOrigin, resetStyle, conf.unitSep) - handleError(conf, msg, eh, s) + handleError(conf, msg, eh, s, ignoreMsg) if msg in fatalMsgs: # most likely would have died here but just in case, we restore state conf.m.errorOutputs = errorOutputsOld |