diff options
-rw-r--r-- | compiler/semtypes.nim | 2 | ||||
-rw-r--r-- | tests/objects/tobject3.nim | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 3951c071f..867106b87 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -804,7 +804,7 @@ proc addInheritedFieldsAux(c: PContext, check: var IntSet, pos: var int, addInheritedFieldsAux(c, check, pos, lastSon(n[i])) else: internalError(c.config, n.info, "addInheritedFieldsAux(record case branch)") of nkRecList, nkRecWhen, nkElifBranch, nkElse: - for i in 0..<n.len: + for i in int(n.kind == nkElifBranch)..<n.len: addInheritedFieldsAux(c, check, pos, n[i]) of nkSym: incl(check, n.sym.name.id) diff --git a/tests/objects/tobject3.nim b/tests/objects/tobject3.nim index bec2582fe..9ff1743ce 100644 --- a/tests/objects/tobject3.nim +++ b/tests/objects/tobject3.nim @@ -82,3 +82,14 @@ proc newArrayAnimationSampler*[T](): ArrayAnimationSampler[T] = discard newArrayAnimationSampler[Foo6]() discard newArrayAnimationSampler[AnotherFoo]() + +type + DefaultIsNone* = pointer | ptr | ref | proc {.nimcall.} | cstring | cstringArray + OptionKind* {.pure.} = enum None, Some + OptionA* [T] = object of RootObj + when T is DefaultIsNone: + value: T + else: + value: T + kind: OptionKind + SomeA* [T] = object of OptionA[T] |