diff options
author | Araq <rumpf_a@web.de> | 2018-10-02 19:41:47 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-10-02 19:41:47 +0200 |
commit | 400a7ff1bbdfa166a2e4ee7da946aeecf17e0cef (patch) | |
tree | a2a0c46df77eb02221c627a091c1a2829afd46b3 /tests | |
parent | c3465e4379d1faf02949adf90d734cbbcd61ef01 (diff) | |
download | Nim-400a7ff1bbdfa166a2e4ee7da946aeecf17e0cef.tar.gz |
closes #6249
Diffstat (limited to 'tests')
-rw-r--r-- | tests/concepts/t976.nim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/concepts/t976.nim b/tests/concepts/t976.nim index cc0bbdc59..324219508 100644 --- a/tests/concepts/t976.nim +++ b/tests/concepts/t976.nim @@ -1,3 +1,7 @@ +discard """ + output: '''Printable''' +""" + import macros type @@ -30,3 +34,21 @@ template reject(e) = reject take[string](i2) reject take[int1](i2) +# bug #6249 +type + Obj1[T] = object + v: T + + Obj2 = ref object + + PrintAble = concept x + $x is string + +converter toObj1[T](t: T): Obj1[T] = + return Obj1[T](v: t) + +proc `$`[T](nt: Obj1[T]): string = + when T is PrintAble: result = "Printable" + else: result = "Non Printable" + +echo Obj2() |