mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-22 23:35:22 +00:00
closes #6249
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
discard """
|
||||||
|
output: '''Printable'''
|
||||||
|
"""
|
||||||
|
|
||||||
import macros
|
import macros
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -30,3 +34,21 @@ template reject(e) =
|
|||||||
reject take[string](i2)
|
reject take[string](i2)
|
||||||
reject take[int1](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()
|
||||||
|
|||||||
Reference in New Issue
Block a user