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

Missing tests for interacting with TypedArray non-integer canonical numeric properties #3444

Open
gibson042 opened this issue Mar 24, 2022 · 1 comment

Comments

@gibson042
Copy link
Contributor

gibson042 commented Mar 24, 2022

Discovered by an XS bug: Moddable-OpenSource/moddable#886

Integer-Indexed Exotic Objects internal methods) ([[Get]], [[Set]], [[Delete]], [[Has]], etc.) require special treatment for any string-valued property recognized as a canonical numeric string by CanonicalNumericIndexString that includes silent failure when the property name is out of bounds or non-integer. Non-integer canonical numeric strings include "Infinity", "-Infinity", "NaN", "0.5", "1.2000000000000001", etc.

@gibson042 gibson042 changed the title Missing tests for interacting with TypedArray "NaN" properties Missing tests for interacting with TypedArray non-integer canonical numeric properties Mar 24, 2022
@gibson042
Copy link
Contributor Author

There should also be coverage for edge cases like "1.2000000000000001" vs. "1.2000000000000002", which are numerically equal but only one of which is a canonical numeric string in any given implementation (although which has canonical status is implementation-defined because Number::toString step 5 does not uniquely define the least significant digit of s) and therefore the other can be used as the name of properties not subject to special treatment. For example, the following expression is required to be true:

Object.keys(
  Object.assign(new Int8Array(), {"1.2000000000000001": 1, "1.2000000000000002": 2})
).length === 1

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

No branches or pull requests

1 participant