summary refs log tree commit diff stats
path: root/tests/errmsgs/tnested_generic_instantiation2.nim
blob: c2ec31af84e909c13dec141f2c1511636d5e065b (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
25
26
27
discard """
action: compile
"""

#[
bug #4766
see also: tnested_generic_instantiation.nim
]#

proc toString*[T](x: T) =
  for name, value in fieldPairs(x):
    when compiles(toString(value)):
      discard
    toString(value)

type
  Plain = ref object
    discard

  Wrapped[T] = object
    value: T

converter toWrapped[T](value: T): Wrapped[T] =
  Wrapped[T](value: value)

let result = Plain()
toString(result)