Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended side effect error messages #18418

Merged
merged 11 commits into from
Jul 15, 2021
4 changes: 2 additions & 2 deletions compiler/sempass2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ proc listGcUnsafety(s: PSym; onlyWarning: bool; conf: ConfigRef) =
proc listSideEffects(result: var string; s: PSym; cycleCheck: var IntSet;
conf: ConfigRef; context: PContext; indentLevel: int) =
template addHint(msg; lineInfo; sym; level = indentLevel) =
result.addf "$# $# Hint: '$#' $#\n" % [repeat(">", level), conf $ lineInfo, sym, msg]
result.addf("$# $# Hint: '$#' $#\n", repeat(">", level), conf $ lineInfo, sym, msg)
if context.sideEffects.hasKey(s.id):
for (useLineInfo, u) in context.sideEffects[s.id]:
if u != nil and not cycleCheck.containsOrIncl(u.id):
Expand All @@ -289,7 +289,7 @@ proc listSideEffects(result: var string; s: PSym; cycleCheck: var IntSet;

proc listSideEffects(result: var string; s: PSym; conf: ConfigRef; context: PContext) =
var cycleCheck = initIntSet()
result.addf "'$#' can have side effects\n" % s.name.s
result.addf("'$#' can have side effects\n", s.name.s)
timotheecour marked this conversation as resolved.
Show resolved Hide resolved
listSideEffects(result, s, cycleCheck, conf, context, 1)

proc useVarNoInitCheck(a: PEffects; n: PNode; s: PSym) =
Expand Down