diff options
-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) |