summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-04-22 14:08:56 +0800
committerGitHub <noreply@github.com>2021-04-22 08:08:56 +0200
commit53c898de4105049c767804d0d2c520f31a86b874 (patch)
tree4303c3f00dc522dcbcc33dafaff7737b07f5d8f1 /tests
parentfb32fff8dcf2b15a469e5cce07b10d88aa6352ee (diff)
downloadNim-53c898de4105049c767804d0d2c520f31a86b874.tar.gz
fix #17812 (repr fails to compile with ARC/ORC) (#17816)
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/t17812.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/arc/t17812.nim b/tests/arc/t17812.nim
new file mode 100644
index 000000000..bcd5f3a93
--- /dev/null
+++ b/tests/arc/t17812.nim
@@ -0,0 +1,29 @@
+discard """
+  targets: "c js"
+  matrix: "--gc:refc; --gc:arc"
+"""
+
+import std/times
+
+block: # bug #17812
+  block:
+    type
+      Task = object
+        cb: proc ()
+
+    proc hello() = discard
+
+
+    let t = Task(cb: hello)
+
+    doAssert t.repr.len > 0
+
+
+  block:
+    type MyObj = object
+      field: DateTime
+
+
+    proc `$`(o: MyObj): string = o.repr
+
+    doAssert ($MyObj()).len > 0