give a better error message for some template expansions (#19871)
This commit is contained in:
parent
836b95c896
commit
25d89269eb
1 changed files with 4 additions and 2 deletions
|
|
@ -140,7 +140,9 @@ proc discardCheck(c: PContext, result: PNode, flags: TExprFlags) =
|
||||||
n[0] = result
|
n[0] = result
|
||||||
elif result.typ.kind != tyError and c.config.cmd != cmdInteractive:
|
elif result.typ.kind != tyError and c.config.cmd != cmdInteractive:
|
||||||
var n = result
|
var n = result
|
||||||
while n.kind in skipForDiscardable: n = n.lastSon
|
while n.kind in skipForDiscardable:
|
||||||
|
if n.kind == nkTryStmt: n = n[0]
|
||||||
|
else: n = n.lastSon
|
||||||
var s = "expression '" & $n & "' is of type '" &
|
var s = "expression '" & $n & "' is of type '" &
|
||||||
result.typ.typeToString & "' and has to be used (or discarded)"
|
result.typ.typeToString & "' and has to be used (or discarded)"
|
||||||
if result.info.line != n.info.line or
|
if result.info.line != n.info.line or
|
||||||
|
|
@ -483,7 +485,7 @@ proc semVarMacroPragma(c: PContext, a: PNode, n: PNode): PNode =
|
||||||
for i in 0 ..< pragmas.len:
|
for i in 0 ..< pragmas.len:
|
||||||
let it = pragmas[i]
|
let it = pragmas[i]
|
||||||
let key = if it.kind in nkPragmaCallKinds and it.len >= 1: it[0] else: it
|
let key = if it.kind in nkPragmaCallKinds and it.len >= 1: it[0] else: it
|
||||||
|
|
||||||
when false:
|
when false:
|
||||||
let lhs = b[0]
|
let lhs = b[0]
|
||||||
let clash = strTableGet(c.currentScope.symbols, lhs.ident)
|
let clash = strTableGet(c.currentScope.symbols, lhs.ident)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue