summary refs log tree commit diff stats
path: root/tests/method/tcompilegenerics.nim
blob: d0732895bd118979c23fcc5503e477fda906cf7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
discard """
  matrix: "--mm:arc; --mm:refc"
  output: '''
newDNode base
'''
"""

type
  SNodeAny = ref object of RootObj
  SNode[T] = ref object of SNodeAny
    m: T
  DNode[T] = ref object

method getStr(s: SNode[float]): string {.base.} = "blahblah"

method newDNode(s: SNodeAny) {.base.} =
  echo "newDNode base"

method newDNode[T](s: SNode[T]) =
  echo "newDNode generic"

let m = SNode[float]()
let s = SNodeAny(m)
newDnode(s)