Repository navigation
Description
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-5882andsrc/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
- For each traceability ID, add or extend the smallest behavior/compile-error test that proves the exact requirement.
- Keep tests grouped by language feature, not by implementation file, so failures point to the spec concept.
- Prefer behavior tests for accepted syntax/semantics and compile-error tests for rejected implicit conversions or invalid operations.
- If a test exposes a missing implementation, stop and fix the root cause or split the implementation bug; do not weaken the requirement.
- Update requirement comments only if the test file names change from the issue plan; do not edit
docs/requirements.mdin this enrichment task.
Test plan
- Numeric literals: suffix/default type cases for the IDs
4.2.1.21and4.2.1.22. - Primitive operators: explicit coverage for the
@/primitive operation requirement tracked as4.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, supplementingtest/behavior/behav_tuple_ops.wrather than duplicating it. - Run
with build,with build :fixpoint, andwith 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
ehartford commentedon Jul 3, 2026
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.
Fix #530 tailrec verifier + coverage-sweep batch 3 (#498 #508 #517 #523