Repository navigation
Conversation
Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
fix(ast): 查找空字符串 key 时不再匹配已 Unset 的槽位
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
Unsetzeroes the removed pair, and a zeroedPair{}has the key"".linkedPairs.Getcompared only the key, so on{"a":1,"":2}afterUnset("a"),Get("")matched the removed slot and reported the key as missing, andSet("", v)appended a duplicate""pair ({"":2,"":3}).The linear search now skips zeroed slots. A slot is treated as removed only when its hash is 0, its key is empty and its value is
V_NONE; pairs built byNewPair(parser,Set) always have a non zero hash, so a real""key, and a key explicitly set to an emptyNode{}(relied on byTestNodeAny), still match.Added
TestGetEmptyKeyAfterUnsetinast/node_test.go; it fails on main and passes with this change.go test ./ast(default and withSONIC_USE_OPTDEC=1 SONIC_USE_FASTMAP=1 SONIC_ENCODER_USE_VM=1),go test ./issue_test ./generic_test .pass.(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation:
Fixes #1004