summary refs log tree commit diff stats
path: root/tests/overload/tconverter_to_string.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-01-29 14:31:43 +0100
committerAraq <rumpf_a@web.de>2019-01-29 14:31:43 +0100
commit07a0a61875f4f5c7ac74acfd0c7dd4e4eb333dce (patch)
tree274cffecbae0c7e2f55b5fafa1d8c347ce1307f8 /tests/overload/tconverter_to_string.nim
parenta58f5b6023744da9f44e6ab8b1c748002b2bbcc0 (diff)
downloadNim-07a0a61875f4f5c7ac74acfd0c7dd4e4eb333dce.tar.gz
fixes #9149 [backport]
Diffstat (limited to 'tests/overload/tconverter_to_string.nim')
-rw-r--r--tests/overload/tconverter_to_string.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/overload/tconverter_to_string.nim b/tests/overload/tconverter_to_string.nim
new file mode 100644
index 000000000..1960372d8
--- /dev/null
+++ b/tests/overload/tconverter_to_string.nim
@@ -0,0 +1,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"