As of Second Life Server 2022-09-09.574921, STATUS_DIE_AT_EDGE and STATUS_DIE_AT_NO_ENTRY return their corresponding settings rather than always FALSE.
Regression/coverage tests are clearly lacking in this area, as the change didn't trigger any test breakage, therefore add some unit tests.
llDumpList2String has changed its behaviour with respect to minus zero. Now it converts -0.0 to a string without the minus sign.
While testing this, we noticed several mismatches in the float to string conversions; the existing routine did not properly convert some values because as we discovered later, it is subject to double rounding; one of them is the built-in round-to-nearest-or-even while getting the first 7 significant digits, and the other is just an increment when the digit is a 5 or more, so round to nearest, ties away from zero, and is performed on the digit past the five or six visible digits that LSL shows.
The new code is a tad easier to understand and more robust.
A first variant of the new code is left commented out for history's sake, and will be removed in the next commit.
This annoyance and discrepancy with LSO was finally fixed by Linden Lab. The change has prompted some modifications to the test suite to accommodate for the new results. A further improvement has been to make these tests more friendly to be run in SL, making it easier to verify the results.
Fixes#17.
Reported by SaladDais@users.noreply.github.com - thanks!
They are transformed by the scanner to the identifier `inline`, which is how the parser identifies it. This solves the comment problem, but it results in a funny side effect. Now, in inline mode, /*pragma inline*/ will always be the identifier `inline`, therefore this is valid:
integer /*pragma inline*/ = 5;
llOwnerSay((string)inline); // will say 5
Not overly elegant, but better than making up a specific token or declaring comments as tokens or the like.
It's unlikely to hit this one (requires more than 10,000 identifiers to trigger) but it's a bug nevertheless.
While touching the file, try to explain the situation better in the first comment.
1. When the last statement of a function is a RETURN statement which is syntactically required, it could still be deleted.
2. The child of a RETURN statement could be removed if the statement was not executed.
This commit fixes both issues.
Bug report and test case provided by @Tonaie. Fixes#14.
E.g. llSubStringIndex(...) > -1 was converted into !~llSubStringIndex(...) which is incorrect. We even had a test case for it... with a wrong expected response file.
Bug report and test case by Sinha Hynes (thanks!)
vector * quaternion: Simplified by precalculating the repeated products and removing math.fsum.
quaternion * quaternion: Add more F32's to get a result closer to SL's (still not there, but we're definitively closer now).
We left out quaternion/quaternion in the tests, and the q*q test was not general enough (had many zeros). Remedied that.
The algorithm for adding parentheses around unary operators was not working properly. It converted a * (-b) * c into a * -b * c, which LSL handles as a * -(b * c).
Fix and add test cases for that. One of the test cases shows an example where the difference matters: 0 * (-1e20) * 1e20 should result in 0.0, but if wrongly parenthesized, it gives NaN, because 1e20*1e20 gives infinity due to float overflow, and minus infinity times 0 is indeterminate.
The addition of parentheses has been improved, but it still does not eliminate every redundant parenthesis.
Also fix the horrendous typo of using "operands" where it should be "operators".
In the same places as state changes are allowed, i.e. in places where a parent of the AST node is a WHILE/DO/FOR or an IF without ELSE, it's allowed to use return statements with expressions that return void, e.g. llDie(), provided the function itself is declared as returning void.
The construction, when found, is rewritten to '{<void expression>; return;}' because the optimizer is not designed to deal with these monsters.
We've renamed the variable SuspiciousStSw to PruneBug, because it's used for both purposes now, though a better name might have been PruneBugPendingChecks, because these are only errors if the IF has an ELSE. We've also added the exception to raise as part of the data stored in the list.
Per report by Tonaie Resident.