Skip to content

t27b: a typed list local of numeric literals that the reference prints as a tuple (formats.t27:628) #8175

Open

Description

@gHashTag

Refs #6063

Boundary

User Scenarios

  • An author writes a typed list of float constants inside an invariant and loops over it. The reference prints it as .{ -1.0, 0.0, 1.0 }, a tuple of comptime_float. t27b should either run it with the same result or refuse it with a named reason, and never guess.

Requirements

  • The reference drops the declared element type, so t27b may lower the local as [N]T only when every element literal is exactly representable in T. Then reading an element as T and reading it as comptime_float give the same value. Any element that is not exactly representable stays refused with its own reason.
  • t27b: an untyped list local that the code indexes lowers as a tuple, from a t27 plan (Closes #8050) #8055's plan currently answers NOT_MINE for bare comptime_int / comptime_float elements. This issue changes that answer only for the exactly-representable case.
  • A conformance spec under specs/tri/t27b/conformance/ covers the representable case (-1.0, 0.0, 1.0, 0.5) and a refused non-representable case (0.1 in f16 or f32). It passes t27c test-report, and t27b passes it with runtime asserts.

Success Criteria

Requirements

FR-001: t27b MUST lower a typed list local declared with an explicit array type whose elements are all bare numeric literals as [N]T only when every element literal is exactly representable in T; reading an element as T and as comptime_float MUST give the same value.

FR-002: Any element that is not exactly representable in the declared type T MUST be refused with its own named reason.

FR-003: The plan in specs/tri/t27b/tuple_local_plan.t27 MUST answer the exactly-representable case for bare comptime_int / comptime_float elements instead of NOT_MINE.

FR-004: A conformance spec under specs/tri/t27b/conformance/ MUST cover the representable case (-1.0, 0.0, 1.0, 0.5) and a refused non-representable case (0.1 in f16 or f32); it MUST pass t27c test-report, and t27b MUST pass it with runtime asserts.

Success Criteria

  • t27c test-report on the new conformance spec exits 0 with all tests passing and 0 vacuous; t27b test --check on the same spec exits 0 with the same test count and runtime asserts > 0.
  • Assert-flip mutants of the new conformance spec are all killed (exit 0 on mutation run).
  • Lab receipt compare against master yields IMPROVED_ONLY, EQUIVALENT, or NEUTRAL with 0 mismatch.
  • The ExprArrayLiteral row for specs/numeric/formats.t27 is absent from the ledger.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions