diff options
author | Araq <rumpf_a@web.de> | 2015-04-11 02:54:20 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-04-11 10:01:12 +0200 |
commit | 06feaef64a2bb4fbff50091b2f15cb0736c849d3 (patch) | |
tree | 4972fd38410ed181bcca0ec3d77028d4cf54c12d | |
parent | a1b937ab33dc320208be405672ab12d88c92b4b1 (diff) | |
download | Nim-06feaef64a2bb4fbff50091b2f15cb0736c849d3.tar.gz |
fixes #1658
-rw-r--r-- | compiler/semtypes.nim | 2 | ||||
-rw-r--r-- | tests/objects/tobjloop.nim | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 664d54221..4a45da2f9 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -789,7 +789,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, @[newTypeS(paramType.kind, c)]) result = addImplicitGeneric(typ) else: - for i in 0 .. <paramType.sons.len: + for i in 0 .. <paramType.len: if paramType.sons[i] == paramType: globalError(info, errIllegalRecursionInTypeX, typeToString(paramType)) var lifted = liftingWalk(paramType.sons[i]) diff --git a/tests/objects/tobjloop.nim b/tests/objects/tobjloop.nim new file mode 100644 index 000000000..9fea1e2fb --- /dev/null +++ b/tests/objects/tobjloop.nim @@ -0,0 +1,15 @@ +discard """ + output: "is Nil false" +""" +# bug #1658 + +type + Loop* = ref object + onBeforeSelect*: proc (L: Loop) + +var L: Loop +new L +L.onBeforeSelect = proc (bar: Loop) = + echo "is Nil ", bar.isNil + +L.onBeforeSelect(L) |