Skip to content

Spec test spec_ss04_8_unit_elision fails: §4.8 unit elision unimplemented #723

Closed

Description

@ehartford

Restated (2026-10-25 triage)

One spec test of the four remains non-compliant: test/spec/spec_ss04_8_unit_elision.w (§4.8 unit elision, unimplemented). The other three pass.


Original report

The native-spec-tests lane had never executed this session (masked behind earlier red lanes). After the batch fixes, 4 of its reds reproduce identically on the PRE-BATCH SEED — long-standing spec non-compliance, not batch regressions:

  • test/spec/spec_ss04_8_unit_elision.w
  • test/spec/spec_ss07_1_with_type_based_guard_inference.w
  • test/spec/spec_ss07_2_builder_block_return.w
  • test/spec/spec_ss13_2_iterator_borrowing.w

Per "the spec leads the implementation," each needs its own root-cause; ss13_2 (iterator borrowing) likely narrows further now that #716's fn iter(self: &Self) landed. Separate from: the 4 spec fixtures held red as #714 evidence (mandatory-move rejecting blessed §14 examples) and the 3 in-batch Class-B regressions.

Activity

  1. joshhickson commented on Sep 17, 2026

    @joshhickson
    Contributor

    A narrower read on spec_ss07_2_builder_block_return.w, in case it helps root-cause that one of the four.

    On v0.15.2.1 (Windows x86_64) the fixture fails 3 of 7, and the split is clean: the three tests that mutate the builder through a method call fail, and the rest pass, including test_assignment_tail_returns_builder.

    $ with test spec_ss07_2_builder_block_return.w
    panic at …:25:5: assertion failed          test: test_unit_call_tail_returns_builder
    panic at …:34:5: assertion failed          test: test_non_unit_tail_returns_builder
    panic at …:44:12: called unwrap on None    test: test_non_unit_hashmap_tail_returns_builder
    error: 3 of 7 tests failed
    

    A standalone repro shows the same boundary — field assignment survives, method-call mutation is dropped, whether the receiver is the builder itself or a field of it:

    type Cfg { port: i32, tags: Vec[i32] }
    
    fn main:
        let a: Vec[i32] = with Vec.new() as mut v:
            v.push(1)
            v.push(2)
        print(f"a={a.len()}")
        var seed: Vec[i32] = Vec.new()
        let b = with seed as mut v:
            v.push(7)
        print(f"b={b.len()}")
        let c = with Cfg { port: 1, tags: Vec.new() } as mut cfg:
            cfg.port = 8080
            cfg.tags.push(3)
        print(f"c.port={c.port} c.tags={c.tags.len()}")
    
    $ with run --debug-alloc builder.w
    a=0
    b=0
    c.port=8080 c.tags=0
    debug-alloc: leak count=0
    

    with check accepts it and it exits 0, so in user code the mutation is lost silently rather than reported. I haven't tested main; the fixture's known-issue: #723 directive is unchanged there.

  2. ehartford commented on Sep 22, 2026

    @ehartford
    ContributorAuthor

    Concrete repro of the class, found writing the #1298 test (installed with v0.15.2.1-g478b26481 and a fresh stage1 from bbb9c5b agree). A str field assigned inside a struct builder is lost on the builder's return; i32 fields survive:

    use std.builtins.print_i32
    type Changes { n: i32 = 0, last: str = "" }
    fn describe(x: i32) -> Changes:
        let changes = with Changes { } as mut c:
            c.n += 1
            c.last = "gt1"
            c.n += 1
        changes
    fn main:
        let a = describe(3)
        print_i32(a.n)     // 2
        print(a.last)      // "" — expected gt1
    

    Same shape with Vec[i32].new() / Vec[str].new() and push returns an empty vec (spec_ss07_2's red cases). MirLower.lower_with_binding returns OK_COPY of the builder local and then pops the scope, which drops the local — the heap-owning payload is freed under the copy. The #1298 behavior test observes the rule through i32 fields until this is fixed.

  3. ehartford commented on Oct 8, 2026

    @ehartford
    ContributorAuthor

    spec_ss13_2_iterator_borrowing passes on the D111 stack (str is a value, so the borrowed iteration no longer moves its source); its known-issue directive is removed in PR #2275. The other three tests this issue lists are unchanged.

  4. changed the title [-]4 spec tests fail on the seed too (pre-existing spec debt, surfaced when the lane first ran)[/-] [+]Spec test spec_ss04_8_unit_elision fails: §4.8 unit elision unimplemented[/+] on Oct 25, 2026
  5. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): one of the four still reproduces. spec_ss07_1_with_type_based_guard_inference and spec_ss07_2_builder_block_return now pass (2 and 7 tests), and spec_ss13_2_iterator_borrowing passed with D111. spec_ss04_8_unit_elision still carries //! known-issue: #723 unit elision unimplemented.

    post-release: §4.8 unit elision is a type-system feature; no user program depends on it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions