Repository navigation
fix(core): make ValueKind.Int32 coercion follow the device integer rule (#1271) - #1305
Merged
Merged
Conversation
…le (#1271) tryCoerce built Integer values with new Int32(value), so a NaN Float/Double stayed NaN and neighbouring built-in methods read the same argument differently from the Dynamic + toIntegerArg ones. Use toArrayIndex so Float/Double are truncated (NaN as 0) and a LongInteger keeps its low 32 bits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
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.



Closes #1271.
tryCoercebuiltIntegervalues withnew Int32(value), so a NaNFloat/Doublestayed NaN, unlike theValueKind.Dynamic+toIntegerArgparameters. TheInt32target now usestoArrayIndex:Float/Doubleare truncated (NaN as 0) and aLongIntegerkeeps its low 32 bits.tryCoerceis shared, so this also applies tox%assignments and typed function returns (NaN becomes 0 instead of staying NaN).Tests: NaN and negative-fraction cases added to
test/brsTypes/TypeCoercion.test.js; full suite passes. Not re-checked against a device.🤖 Generated with Claude Code