summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorCharlie Barto <barcharcraz@msn.com>2014-02-03 23:54:01 -0500
committerCharlie Barto <barcharcraz@msn.com>2014-02-03 23:54:01 -0500
commit51076a0be6900602e5fc092e52021370937a85f7 (patch)
tree3d5dea01ded94c3f40d007542f61dd0fbe0a8a55 /compiler
parent7b3f95d8103738c16cbc2442a8eff68d343f5e7e (diff)
downloadNim-51076a0be6900602e5fc092e52021370937a85f7.tar.gz
added good error for stuff like string[int] or int[int]
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtypes.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 408b1b62e..a434effed 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -885,6 +885,11 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
     for i in countup(1, sonsLen(n)-1):
       var elem = semGenericParamInInvokation(c, n.sons[i])
       addToResult(elem)
+  elif s.typ.kind != tyGenericBody:
+    #we likely got code of the form TypeA[TypeB] where TypeA is
+    #not generic.
+    localError(n.info, errNoGenericParamsAllowedForX, s.name.s)
+    return newOrPrevType(tyError, prev, c)
   else:
     internalAssert s.typ.kind == tyGenericBody