Skip to content

Panic when exporting a top-level function that takes a resource as an argument #62

@rylev

Description

@rylev

Take a component with the following wit:

package component:comp;

world my-world {
    use my-interface.{my-resource};
    export my-func: func(r: my-resource);
}

interface my-interface {
    resource my-resource {}
}

And the following wac file:

package example:composition;

let comp = new example:comp {...};
export comp.my-func;

You will get the following panic:

thread 'main' panicked at crates/wac-parser/src/resolution/encoding.rs:191:38:
internal error: entered unreachable code: resource cannot be imported at the top-level

Importing resources is indeed not possible, but it seems the transitive dependency on my-interface gets lost along the way.

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