Skip to content

Panic on instantiation with resource with implicit use dependency #99

@rylev

Description

@rylev

This is a bit complicated of a repro, but here's a failing test to follow along with: [repro].

Take the following package that we want to instantiate:

package foo:baz;

world my-world {
    use foo:dependency/types.{x};
    import my-func: func() -> x;
    import foo:dependency/types;
}

And here's the wit for the foo:dependency package:

package foo:dependency;

interface types {
    resource x;
}

world dependency-world {
    export types;
}

If when instantiation my-world, the foo:dependency/types and my-func imports are satisfied directly, a panic happens here:

instance: state.current.instances[iid],

Presumably, this happens because the my-func import still has a dependency on foo:dependency/types (because of the use of resource x) but this dependency gets lost along the way.

This is no longer error when we no longer explicitly provide the foo:dependency/types import when instantiating my-world. Then the instantiation some how knows that it depends on foo:dependency/types and it needs to be imported.

I imagine what's happening here is that the explicit import is assumed to satisfy my-func's dependency on foo:dependency/types but this assumption (which seems to be written as a comment here) is violated.

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