improve the 'has to be discarded' error message
This commit is contained in:
parent
87ac28d19a
commit
7f1d2489ad
5 changed files with 6 additions and 6 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
const
|
const
|
||||||
errNoSymbolToBorrowFromFound = "no symbol to borrow from found"
|
errNoSymbolToBorrowFromFound = "no symbol to borrow from found"
|
||||||
errDiscardValueX = "value of type '$1' has to be discarded"
|
errDiscardValueX = "value of type '$1' has to be used (or discarded)"
|
||||||
errInvalidDiscard = "statement returns no value that can be discarded"
|
errInvalidDiscard = "statement returns no value that can be discarded"
|
||||||
errInvalidControlFlowX = "invalid control flow: $1"
|
errInvalidControlFlowX = "invalid control flow: $1"
|
||||||
errSelectorMustBeOfCertainTypes = "selector must be of an ordinal type, float or string"
|
errSelectorMustBeOfCertainTypes = "selector must be of an ordinal type, float or string"
|
||||||
|
|
@ -144,7 +144,7 @@ proc discardCheck(c: PContext, result: PNode, flags: TExprFlags) =
|
||||||
var n = result
|
var n = result
|
||||||
while n.kind in skipForDiscardable: n = n.lastSon
|
while n.kind in skipForDiscardable: n = n.lastSon
|
||||||
var s = "expression '" & $n & "' is of type '" &
|
var s = "expression '" & $n & "' is of type '" &
|
||||||
result.typ.typeToString & "' and has to be 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
|
||||||
result.info.fileIndex != n.info.fileIndex:
|
result.info.fileIndex != n.info.fileIndex:
|
||||||
s.add "; start of expression here: " & c.config$result.info
|
s.add "; start of expression here: " & c.config$result.info
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: '''expression 'open(f, "arg.txt", fmRead, -1)' is of type 'bool' and has to be discarded; start of expression here: tneedsdiscard.nim(7, 3)'''
|
errormsg: '''expression 'open(f, "arg.txt", fmRead, -1)' is of type 'bool' and has to be used (or discarded); start of expression here: tneedsdiscard.nim(7, 3)'''
|
||||||
line: 10
|
line: 10
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: '''expression 'premultiply(app.gradient[i])' is of type 'Rgba8' and has to be discarded'''
|
errormsg: '''expression 'premultiply(app.gradient[i])' is of type 'Rgba8' and has to be used (or discarded)'''
|
||||||
line: 22
|
line: 22
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: '''expression '"invalid"' is of type 'string' and has to be discarded'''
|
errormsg: '''expression '"invalid"' is of type 'string' and has to be used (or discarded)'''
|
||||||
line: 12
|
line: 12
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: "expression 'true' is of type 'bool' and has to be discarded"
|
errormsg: "expression 'true' is of type 'bool' and has to be used (or discarded)"
|
||||||
line: 13
|
line: 13
|
||||||
file: "tdont_show_system.nim"
|
file: "tdont_show_system.nim"
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue