Skip to content

Tests: sec4 misc gaps coverage (§4) #523

Closed

Description

@ehartford

Tests: sec4 misc gaps coverage (§4)

Summary

The requirements campaign identified a set of smaller §4 coverage gaps that are better handled together as focused tests, not as new language features. Add coverage for numeric literal suffix/default behavior, explicit primitive operators, same-width sign conversion behavior, tuple/slice details, enum variant shorthand, and related edge cases listed in the traceability IDs.

Spec

The affected requirements live across §4.2 primitive operations, §4.3 aggregate basics, §4.4 enum shorthand, §4.5 pattern/typing basics, and §4.8 tuple/slice behavior. Relevant verified anchors include primitive type/literal rules in docs/with-specification.md:755-843, numeric operator rules in docs/with-specification.md:869-921, tuple and slice rules in docs/with-specification.md:1971-2055, and enum shorthand rules in §4.4.

Current state

  • Numeric operator Sema checks are centralized around src/SemaCheck.w:4168-4230, including the saturating-float rejection covered separately by Tests: saturating ops coverage (§4) #522.
  • Array literal and indexing support exists in src/SemaCheck.w:5848-5882 and src/CodegenDispatch.w:1133-1191; bounds-check behavior is a separate implementation issue (Debug-mode bounds checks for array/slice indexing (§4.3a, §4.8a) #428).
  • Tuple behavior has existing coverage in test/behavior/behav_tuple_ops.w, but the campaign still flags specific §4 tuple/slice requirements.
  • Same-width signedness conversion already has at least one compile-error fixture in test/compile_errors/err_sign_conversion.w, but the campaign IDs need direct spec-mapped coverage.
  • The issue is test-enrichment first: add narrowly named tests for each requirement ID and only change implementation when a test exposes a real bug.

Implementation plan

  1. For each traceability ID, add or extend the smallest behavior/compile-error test that proves the exact requirement.
  2. Keep tests grouped by language feature, not by implementation file, so failures point to the spec concept.
  3. Prefer behavior tests for accepted syntax/semantics and compile-error tests for rejected implicit conversions or invalid operations.
  4. If a test exposes a missing implementation, stop and fix the root cause or split the implementation bug; do not weaken the requirement.
  5. Update requirement comments only if the test file names change from the issue plan; do not edit docs/requirements.md in this enrichment task.

Test plan

  • Numeric literals: suffix/default type cases for the IDs 4.2.1.21 and 4.2.1.22.
  • Primitive operators: explicit coverage for the @/primitive operation requirement tracked as 4.2.2.4.
  • Conversions: same-width signed/unsigned negative cases for 4.2.5.3.
  • Compound assignment/drop or side-effect behavior for 4.2.6.9, using a type with an observable drop if supported.
  • Array/slice detail for 4.3.2.5, avoiding the bounds-check issue owned by Debug-mode bounds checks for array/slice indexing (§4.3a, §4.8a) #428.
  • Enum variant shorthand expected-type case for 4.4.1.9.
  • Tuple/slice behavior for 4.8.1.3, supplementing test/behavior/behav_tuple_ops.w rather than duplicating it.
  • Run with build, with build :fixpoint, and with build :test.

Acceptance criteria

  • Each traceability ID has a named test or an explicit split issue if implementation is missing.
  • Tests are minimal and spec-oriented.
  • Existing behavior tests are extended only where that keeps the suite clearer.
  • No implementation workaround is introduced solely to make a test pass.
  • Full build/fixpoint/test evidence is available after changes.

Dependencies

Coordinate with #428 for bounds-check-specific cases and #522 for saturating arithmetic. This issue should avoid duplicating those dedicated tests.

Traceability

From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 4.2.1.21, 4.2.1.22, 4.2.2.4, 4.2.5.3, 4.2.6.9, 4.2.7.5, 4.3.2.5, 4.4.1.9, 4.5.1.1, 4.8.1.3.

Activity

  1. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    Closing the concrete gap this campaign found: numeric literal suffixes (42u8/100i64) pinned by behav_numeric_literal_suffix (bfe7865). Already-covered §4 IDs: enum shorthand (spec_ss04_4_enum_variant_shorthand), tuple .0/.1/.2 (spec_ss04_8_tuples), same-width sign conversion (err_sign_conversion). §4.

  2. added a commit that references this issue on Jul 4, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions