diff options
-rw-r--r-- | compiler/semcall.nim | 2 | ||||
-rw-r--r-- | tests/enum/tenumitems.nim | 2 | ||||
-rw-r--r-- | tests/misc/tissue710.nim | 10 |
3 files changed, 13 insertions, 1 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 65a2d7ab8..927b23cf2 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -81,6 +81,8 @@ proc notFoundError*(c: PContext, n: PNode, errors: seq[string]) = if c.inCompilesContext > 0: # fail fast: globalError(n.info, errTypeMismatch, "") + if errors.len == 0: + localError(n.info, errExprXCannotBeCalled, n[0].renderTree) var result = msgKindToString(errTypeMismatch) add(result, describeArgs(c, n, 1)) add(result, ')') diff --git a/tests/enum/tenumitems.nim b/tests/enum/tenumitems.nim index b6eee5ba8..b92cff6bf 100644 --- a/tests/enum/tenumitems.nim +++ b/tests/enum/tenumitems.nim @@ -1,6 +1,6 @@ discard """ line: 7 - errormsg: "type mismatch" + errormsg: "expression 'items' cannot be called" """ type a = enum b,c,d diff --git a/tests/misc/tissue710.nim b/tests/misc/tissue710.nim new file mode 100644 index 000000000..9e8735eb3 --- /dev/null +++ b/tests/misc/tissue710.nim @@ -0,0 +1,10 @@ +discard """ + file: "tissue710.nim" + line: 8 + errorMsg: "expression '||' cannot be called" +""" +var sum = 0 +for x in 3..1000: + if (x mod 3 == 0) || (x mod 5 == 0): + sum += x +echo(sum) |