summary refs log tree commit diff stats
path: root/tests/implicit
diff options
context:
space:
mode:
authorSimon Hafner <hafnersimon@gmail.com>2015-03-05 14:44:54 -0600
committerSimon Hafner <hafnersimon@gmail.com>2015-03-05 14:44:54 -0600
commit70eaf92ff0493ed11c6e6c8887bca1b235371aff (patch)
tree530255b69df349728c76621e97bf40a11d63fe79 /tests/implicit
parentf592240c545506448e2bea78a2fa3404c7f46e69 (diff)
parent8f43979cf6308c9d7e14a0d87c0faf227e1c4afe (diff)
downloadNim-70eaf92ff0493ed11c6e6c8887bca1b235371aff.tar.gz
Merge branch 'devel' into warning-for-result
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[]