mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-17 08:34:20 +00:00
fixes #147
This commit is contained in:
@@ -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
|
||||
|
||||
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
|
||||
=============
|
||||
|
||||
- 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``
|
||||
|
||||
Reference in New Issue
Block a user