summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2014-02-20 23:33:58 +0200
committerZahary Karadjov <zahary@gmail.com>2014-02-20 23:33:58 +0200
commit1a6d05515ff96e8bba294b352493cb7da2794a96 (patch)
tree1c085be2fc034c47f3632b98eb5c667b3938c847 /compiler
parent0bbf6081d00e83329021a0051d92c3433fc8a00f (diff)
downloadNim-1a6d05515ff96e8bba294b352493cb7da2794a96.tar.gz
fix #945
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semstmts.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index a9a907953..6c4e29f29 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -143,10 +143,11 @@ proc discardCheck(c: PContext, result: PNode) =
       while n.kind in skipForDiscardable:
         n = n.lastSon
         n.typ = nil
-    elif c.inTypeClass > 0 and result.typ.kind == tyBool:
-      let verdict = semConstExpr(c, result)
-      if verdict.intVal == 0:
-        localError(result.info, "type class predicate failed")
+    elif c.inTypeClass > 0:
+      if result.typ.kind == tyBool:
+        let verdict = semConstExpr(c, result)
+        if verdict.intVal == 0:
+          localError(result.info, "type class predicate failed")
     elif result.typ.kind != tyError and gCmd != cmdInteractive:
       if result.typ.kind == tyNil:
         fixNilType(result)