generated from foxglove/template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 5
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Description
Infinity / NaN default value not resolved in IDL definition
- Version: 1.1.0 (likely in 1.2.0)
- Platform: Web(V8) / node.js v22.15.0 via Jest
Steps To Reproduce
import { parseIDL } from "@foxglove/omgidl-parser";
const x = parseIDL(`module test_msgs {
module msg {
struct Test {
@default (value=NaN)
float foo;
};
};
};`);
console.log(x);This throws the following error:
Could not find node NaN in test_msgs::msg::Test referenced by test_msgs::msg::Test::foo
Expected Behavior
Parse succesfully and not throwing error.
For reference, if I quote NaN to "NaN", then it parses and logs the following array:
[
{
"name": "test_msgs::msg::Test",
"definitions": [
{
"name": "foo",
"type": "float32",
"isComplex": false,
"annotations": {
"default": {
"type": "named-params",
"name": "default",
"namedParams": {
"value": "NaN"
}
}
},
"defaultValue": "NaN"
}
],
"aggregatedKind": "struct"
}
]This also parses correctly if the default value is normal number literal, e.g. 1.0. But not Infinity and NaN.