Skip to content

codegen: structural miscompile — region + let-bound String.new/String.len emits invalid wasm (type mismatch, empty stack) #348

Description

@hyperpolymath

Found while building the #251 seam-conformance test (2026-07-07). This program:

module seam_access

fn main(): I32 = region r {
    let s = String.new@r("hi") in String.len(s)
}

fails ephapax compile with:

Error: emitted wasm failed structural validation: type mismatch: expected i32 but nothing on stack (at offset 0x2b2)

i.e. the pipeline parses and typechecks it, then codegen emits structurally invalid wasm — caught only by the in-process wasmparser assertion. fn echo(s: String): String = s compiles fine, so the trigger is somewhere in the region + let-bound String.new@r/String.len combination on the v2 surface path.

Note the corpus ratchet gate (#343) records that no conformance/valid string program currently compiles, so this codegen path has no green coverage; whichever fix lands should flip at least one string fixture into tests/eph-corpus-compiles.txt.

🤖 Generated with Claude Code

Activity

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 capability or improvement to existing behaviourfeeds:valence-shellFeeds valence-shell's proofs/engineering (D127): judge progress by what it contributes therepriority:p2Normal - queue itscope:repoConfined to this repositorystatus:readyFully specified and ready to be picked up

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions