summary refs log tree commit diff stats
path: root/tests/converter/tconvert.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/converter/tconvert.nim')
-rw-r--r--tests/converter/tconvert.nim26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/converter/tconvert.nim b/tests/converter/tconvert.nim
index a37140234..5eee2a92d 100644
--- a/tests/converter/tconvert.nim
+++ b/tests/converter/tconvert.nim
@@ -15,6 +15,30 @@ type TFoo = object
 converter toPtr*(some: var TFoo): ptr TFoo = (addr some)
 
 
-proc zoot(x: ptr TFoo) = nil
+proc zoot(x: ptr TFoo) = discard
 var x: Tfoo
 zoot(x)
+
+# issue #6544
+converter withVar(b: var string): int = ord(b[1])
+
+block:
+  var x = "101"
+  var y: int = x # instantiate withVar
+  doAssert(y == ord('0'))
+
+
+######################
+# bug #3503
+type Foo = object
+  r: float
+
+converter toFoo(r: float): Foo =
+  result.r = r
+
+proc `+=`*(x: var Foo, r: float) =
+  x.r += r
+
+var a: Foo
+a.r += 3.0
+