You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nim js gives runtime error when appending an uninitialized string to an uninitialized string.
This works fine with nim c but gives runtime error with nim js:
reduced from a crash in a more complex program:
Example
procfun(): string=# return "" # this removes the crashdiscardvar ret: string# ret = "" # this removes the crash
ret.addfun()
Current Output
/Users/timothee/git_clone/nim/timn/tests/nim/all/t0549.js:39
if (ret_311230[0] != null) { ret_311230[0] = (ret_311230[0]).concat(fun_311214()); } else { ret_311230[0] = fun_311214().slice(); };
^
TypeError: Cannot read property 'slice' of null
at Object.<anonymous> (/Users/timothee/git_clone/nim/timn/tests/nim/all/t0549.js:39:121)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11
Expected Output
should work (and print nothing), just like it does with nim c
Additional Information
Your Nim version (output of nim -v).
latest devel f50e450
same bug with 0.19, 0.20
doesn't crash with 0.18, hence marking it as a regression, but not super sure 0.18 was 100% correct either, eg, i can make 0.18 crash by adding echo ret (but doesn't crash if i precede by ret.add "asdf")
The text was updated successfully, but these errors were encountered:
* many bugfixes for js
fixes#12672, fixes#14153, closes#14123, closes#11331, fixes#11783, fixes#13966, fixes#14087, fixes#14117, closes#12256.
mostly fixes the fact that it was allowed to assign to newly created temp variables. additionally attempts to get rid of null initialized seqs/strings (though they might pop up here and there); this simplifies a lot of things and makes code size smaller. even if null seqs/strings pop up here and there it's still better than all those bugs existing.
* formatting fixes
* CI fixes
* more CI fixes
* many bugfixes for js
fixesnim-lang#12672, fixesnim-lang#14153, closesnim-lang#14123, closesnim-lang#11331, fixesnim-lang#11783, fixesnim-lang#13966, fixesnim-lang#14087, fixesnim-lang#14117, closesnim-lang#12256.
mostly fixes the fact that it was allowed to assign to newly created temp variables. additionally attempts to get rid of null initialized seqs/strings (though they might pop up here and there); this simplifies a lot of things and makes code size smaller. even if null seqs/strings pop up here and there it's still better than all those bugs existing.
* formatting fixes
* CI fixes
* more CI fixes
nim js gives runtime error when appending an uninitialized string to an uninitialized string.
This works fine with
nim c
but gives runtime error withnim js
:reduced from a crash in a more complex program:
Example
Current Output
Expected Output
should work (and print nothing), just like it does with
nim c
Additional Information
nim -v
).latest devel f50e450
same bug with 0.19, 0.20
doesn't crash with 0.18, hence marking it as a regression, but not super sure 0.18 was 100% correct either, eg, i can make 0.18 crash by adding
echo ret
(but doesn't crash if i precede byret.add "asdf"
)The text was updated successfully, but these errors were encountered: