File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -288,3 +288,41 @@ def b():
288288 c = get_contract (code )
289289 assert c .x () == 2
290290 assert c .d () == 2
291+
292+
293+ # GH issue 3292, test immutable read from both ctor and runtime
294+ def test_immutable_read_ctor_and_runtime (get_contract ):
295+ code = """
296+ d: public(uint256)
297+ x: public(immutable(uint256))
298+
299+ @external
300+ def __init__():
301+ self.d = 1
302+ x = 2
303+ self.a()
304+
305+ @internal
306+ def a():
307+ self.d = x
308+
309+ @external
310+ def thrash():
311+ self.d += 5
312+
313+ @external
314+ def fix():
315+ self.a()
316+ """
317+ c = get_contract (code )
318+ assert c .x () == 2
319+ assert c .d () == 2
320+
321+ c .thrash (transact = {})
322+
323+ assert c .x () == 2
324+ assert c .d () == 2 + 5
325+
326+ c .fix (transact = {})
327+ assert c .x () == 2
328+ assert c .d () == 2
You can’t perform that action at this time.
0 commit comments