Skip to content

[TS] Normalize negative indices in Array.fill #437

Closed

Description

@CaelmBleidd

Resolution (2026-10-14)

Audited against usvm main at 19866c959d.

Array.fill normalizes negative/fractional/NaN/infinite bounds in the supported source-model domain and preserves runtime payloads. Implementation: usvm #443, usvm #449.

Validation: All 7 TsArrayMutationEtsIrModelTest regressions passed, including negative/fractional/infinite/NaN bounds.

Original report and acceptance context, retained for traceability

Problem

The Array.fill approximation explicitly leaves negative start and end indices unsupported.

Minimal TypeScript example

export function fill(): number[] {
  return [1, 2, 3].fill(9, -2);
}

Expected behavior

fill() returns [1, 9, 9]. Normalize negative indices relative to length and clamp to the valid interval, including symbolic indices in the supported domain.

Current source evidence

Fill negative-index TODO.

Checked against USVM main 53dce8f3bca2713642c783ba8308a6a360a9e516. This exact snippet is a proposed regression from source audit; it has not yet been run as a new end-to-end test. #368 audits the existing call approximations but does not implement these individual fixes.

Acceptance criteria

  • A focused test checks the symbolic outcome without reporting an approximation as exact semantics.
  • The supported case agrees with concrete TypeScript/Node.js replay.
  • Unsupported operand or environment cases remain explicit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions