summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcompiler/semexprs.nim3
-rw-r--r--tests/compile/timplictderef.nim18
-rwxr-xr-xtodo.txt3
3 files changed, 21 insertions, 3 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index aea1227d0..803dcdcfe 100755
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -762,10 +762,11 @@ proc makeDeref(n: PNode): PNode =
     result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
     addSon(result, n)
     t = skipTypes(t.sons[0], {tyGenericInst})
-  if t.kind in {tyPtr, tyRef}: 
+  while t.kind in {tyPtr, tyRef}:
     var a = result
     result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
     addSon(result, a)
+    t = skipTypes(t.sons[0], {tyGenericInst})
 
 proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
   ## returns nil if it's not a built-in field access
diff --git a/tests/compile/timplictderef.nim b/tests/compile/timplictderef.nim
new file mode 100644
index 000000000..99b0b645b
--- /dev/null
+++ b/tests/compile/timplictderef.nim
@@ -0,0 +1,18 @@
+discard """
+  output: "2"
+"""
+
+type
+  TValue* {.pure, final.} = object of TObject
+    a: int
+  PValue = ref TValue
+  PPValue = ptr PValue
+
+
+var x: PValue
+new x
+var sp: PPValue = addr x
+
+sp.a = 2
+if sp.a == 2: echo 2  # with sp[].a the error is gone
+
diff --git a/todo.txt b/todo.txt
index 0ac006851..a685965d7 100755
--- a/todo.txt
+++ b/todo.txt
@@ -1,7 +1,7 @@
 version 0.9.0
 =============
 
-- change overloading resolution
+- change overloading resolution: toop.nim test
 - implicit ref/ptr->var conversion
 - deprecate ``var x, y = 0`` as it's confusing for tuple consistency
 - finish support for unsigned ints:
@@ -106,7 +106,6 @@ Library
 Low priority
 ------------
 
-- bignums
 - change how comments are part of the AST
 - ``with proc `+`(x, y: T): T`` for generic code
 - new feature: ``distinct T with operations``