Files
Nim/tests/generics/twrong_generic_object.nim
ringabout 173b8a8c58 fixes #3011; handles meta fields defined in the ref object (#23818)
fixes #3011

In https://github.com/nim-lang/Nim/pull/23532, meta fields that defined
in the object are handled.

In this PR, RefObjectTy is handled as well:
```nim
type
  Type = ref object 
    context: ref object
```
Ref alias won't trigger mata fields checking so there won't have
cascaded errors on `TypeBase`.

```nim
type
  TypeBase = object 
    context: ref object
  Type = ref TypeBase 
    context: ref object
```
2024-07-11 15:39:44 +02:00

22 lines
420 B
Nim

discard """
errormsg: "'Node' is not a concrete type"
line: 11
"""
# bug #2509
type
GenericNodeObj[T] = ref object
obj: T
Node* = ref object
children*: seq[Node]
parent*: Node
nodeObj*: GenericNodeObj # [int]
proc newNode*(nodeObj: GenericNodeObj): Node =
result = Node(nodeObj: nodeObj)
newSeq(result.children, 10)
var genericObj = GenericNodeObj[int]()
var myNode = newNode(genericObj)