summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcompiler/semstmts.nim3
-rwxr-xr-xcompiler/types.nim28
2 files changed, 16 insertions, 15 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 253863697..63e632eca 100755
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -336,6 +336,9 @@ proc instFieldLoopBody(c: TFieldInstCtx, n: PNode, forLoop: PNode): PNode =
           result.add(newSymNode(c.field, n.info))
         break
   else:
+    if n.kind == nkContinueStmt:
+      localError(n.info, errGenerated,
+                 "'continue' not supported in a 'fields' loop")
     result = copyNode(n)
     newSons(result, sonsLen(n))
     for i in countup(0, sonsLen(n)-1):
diff --git a/compiler/types.nim b/compiler/types.nim
index f3c54e2c5..68a1b8056 100755
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -406,21 +406,16 @@ const
     "bignum", "const ",
     "!", "varargs[$1]", "iter[$1]", "Error Type", "TypeClass"]
 
+proc consToStr(t: PType): string =
+  if t.len > 0: result = t.typeToString
+  else: result = typeToStr[t.kind].strip
+
 proc constraintsToStr(t: PType): string =
-  proc consToStr(t: PType): string =
-    if t.len > 0: result = t.typeToString
-    else: result = typeToStr[t.kind].strip
-
-  # better error messages are nice:
-  case t.len
-  of 0: result = "constraint[]"
-  of 1: result = "constraint[" & consToStr(t.sons[0]) & "]"
-  else:
-    let sep = if tfAny in t.flags: " or " else: " and "
-    result = ""
-    for i in countup(0, t.len - 1):
-      if i > 0: result.add(sep)
-      result.add(t.sons[i].consToStr)
+  let sep = if tfAny in t.flags: " or " else: " and "
+  result = ""
+  for i in countup(0, t.len - 1):
+    if i > 0: result.add(sep)
+    result.add(t.sons[i].consToStr)
 
 proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string = 
   var t = typ
@@ -446,7 +441,10 @@ proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string =
     if t.len == 0: result = "typedesc"
     else: result = "typedesc[" & constraintsToStr(t) & "]"
   of tyTypeClass:
-    result = constraintsToStr(t)
+    case t.len
+    of 0: result = "typeclass[]"
+    of 1: result = "typeclass[" & consToStr(t.sons[0]) & "]"
+    else: result = constraintsToStr(t)
   of tyExpr:
     if t.len == 0: result = "expr"
     else: result = "expr[" & constraintsToStr(t) & "]"