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 Lua handling of decimal values with zero mantissa #2355
Conversation
…ua 5.1/5.2 drop the .0 part when serializing (but not Lua 5.3 for some reason).
} | ||
} // namespace | ||
|
||
// TODO: sweet jesus add more tests of this class! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do have a test suite of lua tag transforms. we just do it through the parsing stage so that it makes a whole round trip (osm.pbf -> valhalla::osmdata . see test/graphparser.cc
…lhalla into danpat_fix_lua_zero_mantissa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
Issue
Fixes #2032
Deprecates #2066
Unblocks #2352
Fixes a bug where decimal numbers with a zero-sized mantissa don't serialize to the same original string in Lua 5.1/5.2, leading to incorrect string offsets being calculated when looking for string suffixes.
Ultimately, the bug manifests in tags like
maxheight: 2.0
being incorrectly transformed intomaxheight: 0.611
, instead ofmaxheight: 2
.The fix is to continue treating "numeric_prefix" as a string up until it needs to be converted to a number (e.g. for multiplication), but not before.
Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?