summary refs log tree commit diff stats
path: root/tests/implicit
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-09 15:12:31 +0100
committerAraq <rumpf_a@web.de>2015-02-10 20:19:46 +0100
commit865d341b3230f235765705fca156e286b7b6b43b (patch)
treef8c28d01108883a6aeb5e7b2b2519a654454b817 /tests/implicit
parente371bb3e26e8042e131b1c07c187251688c35946 (diff)
downloadNim-865d341b3230f235765705fca156e286b7b6b43b.tar.gz
unsigned array indexes work better; minor cleanups
Diffstat (limited to 'tests/implicit')
-rw-r--r--tests/implicit/timplictderef.nim21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/implicit/timplictderef.nim b/tests/implicit/timplictderef.nim
index 99b0b645b..fcb647217 100644
--- a/tests/implicit/timplictderef.nim
+++ b/tests/implicit/timplictderef.nim
@@ -1,9 +1,10 @@
 discard """
-  output: "2"
+  output: '''2
+88'''
 """
 
 type
-  TValue* {.pure, final.} = object of TObject
+  TValue* {.pure, final.} = object of RootObj
     a: int
   PValue = ref TValue
   PPValue = ptr PValue
@@ -16,3 +17,19 @@ var sp: PPValue = addr x
 sp.a = 2
 if sp.a == 2: echo 2  # with sp[].a the error is gone
 
+# Test the new auto-deref a little
+
+{.experimental.}
+
+proc p(x: var int; y: int) = x += y
+
+block:
+  var x: ref int
+  new(x)
+
+  x.p(44)
+
+  var indirect = p
+  x.indirect(44)
+
+  echo x[]