Skip to content

Commit

Permalink
Initialise pointers at declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
czgdp1807 committed Jun 20, 2022
1 parent 98a0a2e commit d42ec60
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions integration_tests/structs_03.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ def f(pa: Pointer[A]):
print(pa.y)

def g():
x: A = A(3, 3.5)
px: Pointer[A]
px = pointer(x)
px.x = 5
px.y = 5.5
f(px)
x: A = A(3, 3.25)
xp: Pointer[A] = pointer(x)
assert xp.x == 3
assert xp.y == 3.25
xp.x = 5
xp.y = 5.5
f(xp)

g()

0 comments on commit d42ec60

Please sign in to comment.