Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of -Infinity during json parsing #706

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shivaprasad-basavaraj
Copy link
Contributor

@shivaprasad-basavaraj shivaprasad-basavaraj commented Jul 16, 2024

Part of #703

The issue was that we were checking only against the leading character of the token in JSON to determine if a value was Infinity or Nan which led to us misidentifying -Infinity as not a Inf or Nan value. Changed the cheks to compare the whole token.

Added a via test for this case.

Comment on lines +1080 to +1083
ConstCStr specialIEEEVals[] = { "infinity", "-infinity", "inf", "-inf", "nan", nullptr};
ConstCStr* specValPtr = specialIEEEVals;
while (*specValPtr) {
if (token.ComparePrefixCStrIgnoreCase(*specValPtr)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior of the UnflattenFromJSON node should match LabVIEW's Unflatten From JSON which is stricter about the allowed representations:

image

The TDViaParser is used both for parsing VIA text content and for implementing the UnflattenFromJSON node. We kind of use Fmt().UseFieldNames() as a hint that we are doing the UnflattenFromJSON semantics for parsing. We should either use that as a hint to make sure that the UnflattenFromJSON node will align behavior with LabVIEW or add a new hint for this use-case, something like Fmt().LabVIEWJSONExtensions() since this is JSON extensions that are LabVIEW-specific.

image

@@ -1074,6 +1074,21 @@ Boolean TDViaParser::EatJSONItem(SubString* input)
return true;
Copy link
Member

@rajsite rajsite Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivaprasad-basavaraj Our PR workflow also includes making sure the squad workflow tests are run with the local changes and including a link to the CI build (Ideally also with some tests added on the ASW side as well). Example Vireo PR with referenced build links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants