Repository navigation
Conversation
On Lua the null string is "", but the hashtable emulation answered nil for a missing string, so LoadStr(h, p, c) == null was false where Jass says true. The in-place load and the helper answer "" now, and a concatenation of one adds no guard of its own.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Closing. Measured on the 3.0.0 client, Jass keeps the null string and "" apart: |
On Lua a missing hashtable string did not compare equal to
null, as it does on Jass:On Lua, Wurst writes the null string as
"":EliminateLocalTypesturns thenullliteral into"", and a native's nil guard answers""for a string (LuaNativeLowering). The hashtable emulation was the exception. Both its in-place load and its__wurst_LoadStrhelper answerednilfor a missing string, so the comparison above becamenil == "". A string passed on to a native wasniltoo. Only a concatenation was safe, because it guards a call's result withor "".What changes
""when nothing is stored, both in place ((h.__wurst_ht_str[p] or __wurst_htEmpty)[c] or "") and in the helper. Handle loads still answernil, which is the null handle.LuaNativeLowering.neverNilknows that a string load of the emulation is never nil, so a concatenation of one adds no secondor "". A concatenation prints the same as before.A native declared without the BJ flag (an own
@extern native LoadStr) still calls the game's native where the game has one; this changes only the emulation.Tests
hashtableOperationsBehaveAsTheNatives(Jass, interpreter and Lua) and its optimised variant now also checkLoadStr(...) == nullunder an absent parent key and an absent child key.anOperandWithAnEffectKeepsTheCallOfTheHelperchecks the same through the helper. All three fail on master on Lua only.hashtableOperationsArePrintedWhereTheyAreCalledchecks the in-place shape and that a concatenation adds no guard of its own.hashtableLoadsUseTypeSpecificBucketspinned the oldniland now pins""for strings andnilfor handles.