Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging wit is not commutative #1897

Open
karthik2804 opened this issue Nov 7, 2024 · 0 comments
Open

merging wit is not commutative #1897

karthik2804 opened this issue Nov 7, 2024 · 0 comments

Comments

@karthik2804
Copy link
Contributor

karthik2804 commented Nov 7, 2024

As the title states merging wit fails when trying to merge a non minimized package into a minimized package but the other way works. An example is the wit extracted from a component after it has passed through wit-component.

An example would
wit-1

package wasi:[email protected] {
  interface error {
    resource error;
  }
  interface streams {
    use error.{error};

    resource output-stream {
      check-write: func() -> result<u64, stream-error>;
      write: func(contents: list<u8>) -> result<_, stream-error>;
      blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>;
      blocking-flush: func() -> result<_, stream-error>;
    }

    variant stream-error {
      last-operation-failed(error),
      closed,
    }

    resource input-stream;
  }
}

wit-2

package wasi:[email protected] {
  interface error {
    resource error {
      to-debug-string: func() -> string;
    }
  }
  interface poll {
    resource pollable {
      ready: func() -> bool;
      block: func();
    }

    poll: func(in: list<borrow<pollable>>) -> list<u32>;
  }
  interface streams {
    use error.{error};
    use poll.{pollable};

    variant stream-error {
      last-operation-failed(error),
      closed,
    }

    resource input-stream {
      read: func(len: u64) -> result<list<u8>, stream-error>;
      blocking-read: func(len: u64) -> result<list<u8>, stream-error>;
      skip: func(len: u64) -> result<u64, stream-error>;
      blocking-skip: func(len: u64) -> result<u64, stream-error>;
      subscribe: func() -> pollable;
    }

    resource output-stream {
      check-write: func() -> result<u64, stream-error>;
      write: func(contents: list<u8>) -> result<_, stream-error>;
      blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>;
      flush: func() -> result<_, stream-error>;
      blocking-flush: func() -> result<_, stream-error>;
      subscribe: func() -> pollable;
      write-zeroes: func(len: u64) -> result<_, stream-error>;
      blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>;
      splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>;
      blocking-splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>;
    }
  }
  world imports {
    import error;
    import poll;
    import streams;
  }
}

Merging wit-1 into wit-2 works but not the other way around

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant