tc39 / test262

Official ECMAScript Conformance Test Suite
Other
2.31k stars 459 forks source link

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

Open gibson042 opened 2 years ago

gibson042 commented 2 years ago

Discovered by an XS bug: https://github.com/Moddable-OpenSource/moddable/issues/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 commented 2 years ago

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