Fixed objects being erroneously zeroed out before object construction (#12814) [backport]
This commit is contained in:
parent
3fbb3bfd3f
commit
1db21721ec
2 changed files with 25 additions and 0 deletions
|
|
@ -193,4 +193,7 @@ proc isPartOf*(a, b: PNode): TAnalysisResult =
|
||||||
if res != arNo:
|
if res != arNo:
|
||||||
result = res
|
result = res
|
||||||
if res == arYes: break
|
if res == arYes: break
|
||||||
|
of nkBracket:
|
||||||
|
if b.len > 0:
|
||||||
|
result = isPartOf(a, b[0])
|
||||||
else: discard
|
else: discard
|
||||||
|
|
|
||||||
22
tests/objects/t12753.nim
Normal file
22
tests/objects/t12753.nim
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
discard """
|
||||||
|
output: '''
|
||||||
|
(v: [(v: [0.0, 1.1]), (v: [2.2, 3.3])])
|
||||||
|
(v: [(v: [0.0, 1.1]), (v: [2.2, 3.3])])
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
type
|
||||||
|
V = object
|
||||||
|
v:array[2,float]
|
||||||
|
M = object
|
||||||
|
v:array[2,V]
|
||||||
|
|
||||||
|
var
|
||||||
|
a = M(v:[ V(v:[0.0,1.0]), V(v:[2.0,3.0]) ])
|
||||||
|
b = M(v:[ V(v:[0.0,0.1]), V(v:[0.2,0.3]) ])
|
||||||
|
|
||||||
|
echo M(v: [V(v: [b.v[0].v[0] + a.v[0].v[0], b.v[0].v[1] + a.v[0].v[1]]),
|
||||||
|
V(v: [b.v[1].v[0] + a.v[1].v[0], b.v[1].v[1] + a.v[1].v[1]])])
|
||||||
|
b = M(v: [V(v: [b.v[0].v[0] + a.v[0].v[0], b.v[0].v[1] + a.v[0].v[1]]),
|
||||||
|
V(v: [b.v[1].v[0] + a.v[1].v[0], b.v[1].v[1] + a.v[1].v[1]])])
|
||||||
|
echo b
|
||||||
Loading…
Add table
Add a link
Reference in a new issue