Repository navigation
Conversation
HandleNode emitted a null event for a node with properties but no content only when the tag is the non-specific "?". An explicit tag:yaml.org,2002:null fell through to an empty scalar, so "test: !!null" loaded as an empty string. The core schema resolves empty content tagged null to null (yaml 1.2 spec 10.3.2), same as an untagged empty node, so emit OnNull for that tag too. Empty nodes with other explicit tags are unchanged. Regression test sits next to the null-tag tests from jbeder#897.
This branch has not been deployed
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.
fixes #1517
a node with properties but no content only becomes null when its tag is the
non-specific "?". an explicit !!null tag falls through to an empty scalar,
so
test: !!nullloads with IsNull() false and an empty string value. thecore schema resolves empty content tagged null to null (yaml 1.2 spec,
section 10.3.2), the same as an untagged empty node, so the parser should
emit the null event for it.
HandleNode now treats tag:yaml.org,2002:null like "?" and emits OnNull,
keeping the anchor. empty nodes carrying any other explicit tag (
!!str,!!int) still load as empty scalars, and quoted "null" or!!str nullstill stay strings, so #897 behavior is untouched.
added NodeTest.LoadNullWithNullTag in load_node_test.cpp, next to the
null-tag tests. it fails on current master and passes with this commit; the
rest of the suite is unaffected. whitespace and clang-format checks pass on
the changed lines.