summary refs log tree commit diff stats
path: root/tests/overload/tconverter_to_string.nim
blob: 1960372d8ae93921b9eb57bab05219fd6f9bfb7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
discard """
  output: '''123
c is not nil'''
"""

# bug #9149

type
  Container = ref object
    data: int

converter containerToString*(x: Container): string = $x.data

var c = Container(data: 123)
var str = string c
echo str

if c == nil: # this line can compile on v0.18, but not on 0.19
  echo "c is nil"

if not c.isNil:
  echo "c is not nil"