wit-parser: inject package metadata when decoding component by rellfy · Pull Request #2443 · bytecodealliance/wasm-tools

Would it be possible to add a test for this? For example a WIT file in tests/cli/*.wit which is tested as a pipeline of wit -> wasm -> wit and the final wit is expected to preserve doc comments?

Good idea! I've added the test.

Note: I've noticed that it converts the regular (test) comment

// RUN: component wit % --wasm | component wit

into a doc comment:

/// RUN: component wit % --wasm | component wit

This also happens in wit-stability-in-binary-format.wit.stdout. I'm not sure if this is intended?