Closed vtomilov closed 7 months ago
I was playing around the KCL playground and found some inconsistent behavior. So each time I run my script I get different results, thats a very much unexpected behavior. This bug reproduces in your playground (just run it multiple times) http://101.42.3.224/-/play/index.html?id=4a07ca5a47983a5eca6541d36a144785eb5e4db6
a = { "foo": 1, "bar": 2, } _r = 0 inc = lambda v { _r += 1 v } _t = {k:inc(v) for k,v in a} r = _r
a: foo: 1 bar: 2 r: 2
a: foo: 1 bar: 2 r: 10
And r: 10 increases by 2 every time I hit the run button or change some code.
r: 10
run
0.8.0, 0.7.0
Hello @vtomilov Thank you for your feedback. This unexpected situation only occurs when the number 0 and function closure are captured. I opened a PR to fix it https://github.com/kcl-lang/kcl/pull/1206
Bug Report
I was playing around the KCL playground and found some inconsistent behavior. So each time I run my script I get different results, thats a very much unexpected behavior. This bug reproduces in your playground (just run it multiple times) http://101.42.3.224/-/play/index.html?id=4a07ca5a47983a5eca6541d36a144785eb5e4db6
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
And
r: 10
increases by 2 every time I hit therun
button or change some code.4. What is your KCL components version? (Required)
0.8.0, 0.7.0