fixes #147
This commit is contained in:
parent
607f46a61a
commit
483f28d1cf
3 changed files with 21 additions and 3 deletions
|
|
@ -762,10 +762,11 @@ proc makeDeref(n: PNode): PNode =
|
||||||
result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
|
result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
|
||||||
addSon(result, n)
|
addSon(result, n)
|
||||||
t = skipTypes(t.sons[0], {tyGenericInst})
|
t = skipTypes(t.sons[0], {tyGenericInst})
|
||||||
if t.kind in {tyPtr, tyRef}:
|
while t.kind in {tyPtr, tyRef}:
|
||||||
var a = result
|
var a = result
|
||||||
result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
|
result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
|
||||||
addSon(result, a)
|
addSon(result, a)
|
||||||
|
t = skipTypes(t.sons[0], {tyGenericInst})
|
||||||
|
|
||||||
proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
## returns nil if it's not a built-in field access
|
## returns nil if it's not a built-in field access
|
||||||
|
|
|
||||||
18
tests/compile/timplictderef.nim
Normal file
18
tests/compile/timplictderef.nim
Normal file
|
|
@ -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
|
||||||
|
|
||||||
3
todo.txt
3
todo.txt
|
|
@ -1,7 +1,7 @@
|
||||||
version 0.9.0
|
version 0.9.0
|
||||||
=============
|
=============
|
||||||
|
|
||||||
- change overloading resolution
|
- change overloading resolution: toop.nim test
|
||||||
- implicit ref/ptr->var conversion
|
- implicit ref/ptr->var conversion
|
||||||
- deprecate ``var x, y = 0`` as it's confusing for tuple consistency
|
- deprecate ``var x, y = 0`` as it's confusing for tuple consistency
|
||||||
- finish support for unsigned ints:
|
- finish support for unsigned ints:
|
||||||
|
|
@ -106,7 +106,6 @@ Library
|
||||||
Low priority
|
Low priority
|
||||||
------------
|
------------
|
||||||
|
|
||||||
- bignums
|
|
||||||
- change how comments are part of the AST
|
- change how comments are part of the AST
|
||||||
- ``with proc `+`(x, y: T): T`` for generic code
|
- ``with proc `+`(x, y: T): T`` for generic code
|
||||||
- new feature: ``distinct T with operations``
|
- new feature: ``distinct T with operations``
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue