summary refs log tree commit diff stats
path: root/tests/generics
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-09-21 19:37:14 +0800
committerGitHub <noreply@github.com>2020-09-21 13:37:14 +0200
commit40a868bccc6934aba99a9e490dad04296533b00f (patch)
treea20c8875064e4920cb65064219e77adf3bd77478 /tests/generics
parent6c83eb48c2686818a0527a64576e27f0dbb87560 (diff)
downloadNim-40a868bccc6934aba99a9e490dad04296533b00f.tar.gz
add testcase for #6060 (#15366)
* add testcase for #6060

* Remove overspecific testament spec

Co-authored-by: Clyybber <darkmine956@gmail.com>
Diffstat (limited to 'tests/generics')
-rw-r--r--tests/generics/t6060.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/generics/t6060.nim b/tests/generics/t6060.nim
new file mode 100644
index 000000000..6b1856f1c
--- /dev/null
+++ b/tests/generics/t6060.nim
@@ -0,0 +1,11 @@
+import tables
+
+type MyTab[A,B] = distinct TableRef[A,B]
+
+proc `$`[A,B](t: MyTab[A,B]): string =
+  "My special table " & $TableRef[A,B](t)
+
+proc create[A,B](): MyTab[A,B] = MyTab(newTable[A,B]())
+
+var a = create[int,int]()
+doAssert $a == "My special table {:}"