Skip to content

fuse --component emits an invalid component: every export lifted with an empty (func) type, so non-empty signatures fail wasm-tools validate #355

Description

@avrabe

Summary

meld fuse --component emits an invalid component for any export whose function signature is non-empty: every fused export is lifted with an empty component-level function type (func), regardless of the underlying core signature. wasm-tools validate rejects the output; the fused component cannot be instantiated. Silent — fusion prints "Fusion complete!" with no warning. The default core-module output for the same inputs is correct.

Repro

Inputs: two well-formed reloc-bearing components that validate and execute standalone (e.g. the two in harness/fixtures/meld_sleb/, exports get-b: [i32]→[i32], set-b: [i32,i32]→[], ptr-b: []→[i32]).

meld fuse --component a.wasm b.wasm -o out.wasm      # exit 0, "Fusion complete!"
wasm-tools validate --features all out.wasm
  → error: lowered parameter types `[]` do not match parameter types `[I32]` of core function 0

(A value-returning export gives the dual: lowered result types [] do not match result types [I32].)

The fused module's core types are correct — (type (func (param i32) (result i32))), (type (func (result i32))) — but the component-level lift is emitted as (type (;0;) (func)) + (func (canon lift (core func 0))), i.e. the component export type is not derived from the core function signature / the original component export type.

Reproduces under --memory multi, auto, and shared — independent of memory strategy. --component is documented as a plain option with no experimental caveat.

Fix direction

Derive each fused export's component-level function type from the core function signature (or carry through the original component export type) instead of emitting (func).

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