compiler: better error messages (#5613)
This commit is contained in:
parent
481d8ba24a
commit
d02486aa48
8 changed files with 37 additions and 29 deletions
|
|
@ -160,10 +160,11 @@ proc discardCheck(c: PContext, result: PNode) =
|
|||
else:
|
||||
var n = result
|
||||
while n.kind in skipForDiscardable: n = n.lastSon
|
||||
var s = "expression '" & $n & "' is of type '" &
|
||||
result.typ.typeToString & "' and has to be discarded"
|
||||
if result.typ.kind == tyProc:
|
||||
localError(n.info, "value of type '" & result.typ.typeToString & "' has to be discarded; for a function call use ()")
|
||||
else:
|
||||
localError(n.info, errDiscardValueX, result.typ.typeToString)
|
||||
s.add "; for a function call use ()"
|
||||
localError(n.info, s)
|
||||
|
||||
proc semIf(c: PContext, n: PNode): PNode =
|
||||
result = n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue