Repository: bytecodealliance/wasm-tools
Pull request #1295 (2023-11-16 19:02:58)

Bump crate versions


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 90971d22..182b3eb5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1702,7 +1702,7 @@ checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b"
 
 [[package]]
 name = "wasm-compose"
-version = "0.4.13"
+version = "0.4.14"
 dependencies = [
  "anyhow",
  "glob",
@@ -1716,9 +1716,9 @@ dependencies = [
  "serde_derive",
  "serde_yaml",
  "smallvec",
- "wasm-encoder 0.36.2",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasm-encoder 0.37.0",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wat",
  "wit-component",
 ]
@@ -1734,17 +1734,17 @@ dependencies = [
 
 [[package]]
 name = "wasm-encoder"
-version = "0.36.2"
+version = "0.37.0"
 dependencies = [
  "anyhow",
  "leb128",
  "tempfile",
- "wasmparser 0.116.1",
+ "wasmparser 0.117.0",
 ]
 
 [[package]]
 name = "wasm-metadata"
-version = "0.10.11"
+version = "0.10.12"
 dependencies = [
  "anyhow",
  "clap 4.4.8",
@@ -1753,14 +1753,14 @@ dependencies = [
  "serde_derive",
  "serde_json",
  "spdx",
- "wasm-encoder 0.36.2",
- "wasmparser 0.116.1",
+ "wasm-encoder 0.37.0",
+ "wasmparser 0.117.0",
  "wat",
 ]
 
 [[package]]
 name = "wasm-mutate"
-version = "0.2.40"
+version = "0.2.41"
 dependencies = [
  "anyhow",
  "clap 4.4.8",
@@ -1769,9 +1769,9 @@ dependencies = [
  "log",
  "rand",
  "thiserror",
- "wasm-encoder 0.36.2",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasm-encoder 0.37.0",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wat",
 ]
 
@@ -1788,14 +1788,14 @@ dependencies = [
  "num_cpus",
  "rand",
  "wasm-mutate",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wasmtime",
 ]
 
 [[package]]
 name = "wasm-shrink"
-version = "0.1.41"
+version = "0.1.42"
 dependencies = [
  "anyhow",
  "blake3",
@@ -1804,14 +1804,14 @@ dependencies = [
  "log",
  "rand",
  "wasm-mutate",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wat",
 ]
 
 [[package]]
 name = "wasm-smith"
-version = "0.12.23"
+version = "0.12.24"
 dependencies = [
  "arbitrary",
  "criterion",
@@ -1822,15 +1822,15 @@ dependencies = [
  "rand",
  "serde",
  "serde_derive",
- "wasm-encoder 0.36.2",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasm-encoder 0.37.0",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wat",
 ]
 
 [[package]]
 name = "wasm-tools"
-version = "1.0.51"
+version = "1.0.52"
 dependencies = [
  "addr2line 0.21.0",
  "anyhow",
@@ -1852,13 +1852,13 @@ dependencies = [
  "tempfile",
  "termcolor",
  "wasm-compose",
- "wasm-encoder 0.36.2",
+ "wasm-encoder 0.37.0",
  "wasm-metadata",
  "wasm-mutate",
  "wasm-shrink",
  "wasm-smith",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wast",
  "wat",
  "wit-component",
@@ -1874,8 +1874,8 @@ dependencies = [
  "wasm-mutate",
  "wasm-shrink",
  "wasm-smith",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wast",
  "wat",
 ]
@@ -1890,11 +1890,11 @@ dependencies = [
  "libfuzzer-sys",
  "log",
  "tempfile",
- "wasm-encoder 0.36.2",
+ "wasm-encoder 0.37.0",
  "wasm-mutate",
  "wasm-smith",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wasmtime",
  "wast",
  "wat",
@@ -1916,6 +1916,16 @@ dependencies = [
 [[package]]
 name = "wasmparser"
 version = "0.116.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50"
+dependencies = [
+ "indexmap 2.1.0",
+ "semver",
+]
+
+[[package]]
+name = "wasmparser"
+version = "0.117.0"
 dependencies = [
  "anyhow",
  "criterion",
@@ -1926,44 +1936,34 @@ dependencies = [
  "once_cell",
  "rayon",
  "semver",
- "wasm-encoder 0.36.2",
+ "wasm-encoder 0.37.0",
  "wast",
  "wat",
 ]
 
 [[package]]
-name = "wasmparser"
-version = "0.116.1"
+name = "wasmprinter"
+version = "0.2.72"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50"
+checksum = "9aff4df0cdf1906ec040e97d78c3fc8fd26d3f8d70adaac81f07f80957b63b54"
 dependencies = [
- "indexmap 2.1.0",
- "semver",
+ "anyhow",
+ "wasmparser 0.116.1",
 ]
 
 [[package]]
 name = "wasmprinter"
-version = "0.2.72"
+version = "0.2.73"
 dependencies = [
  "anyhow",
  "diff",
  "rayon",
  "tempfile",
- "wasmparser 0.116.1",
+ "wasmparser 0.117.0",
  "wast",
  "wat",
 ]
 
-[[package]]
-name = "wasmprinter"
-version = "0.2.72"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9aff4df0cdf1906ec040e97d78c3fc8fd26d3f8d70adaac81f07f80957b63b54"
-dependencies = [
- "anyhow",
- "wasmparser 0.116.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "wasmtime"
 version = "12.0.2"
@@ -2085,7 +2085,7 @@ dependencies = [
  "thiserror",
  "wasm-encoder 0.31.1",
  "wasmparser 0.110.0",
- "wasmprinter 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wasmprinter 0.2.72",
  "wasmtime-component-util",
  "wasmtime-types",
 ]
@@ -2217,21 +2217,21 @@ dependencies = [
 
 [[package]]
 name = "wast"
-version = "67.0.1"
+version = "68.0.0"
 dependencies = [
  "anyhow",
  "leb128",
  "memchr",
  "rayon",
  "unicode-width",
- "wasm-encoder 0.36.2",
- "wasmparser 0.116.1",
+ "wasm-encoder 0.37.0",
+ "wasmparser 0.117.0",
  "wat",
 ]
 
 [[package]]
 name = "wat"
-version = "1.0.79"
+version = "1.0.80"
 dependencies = [
  "wast",
 ]
@@ -2361,7 +2361,7 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
 
 [[package]]
 name = "wit-component"
-version = "0.18.0"
+version = "0.18.1"
 dependencies = [
  "anyhow",
  "bitflags 2.4.1",
@@ -2373,10 +2373,10 @@ dependencies = [
  "serde",
  "serde_derive",
  "serde_json",
- "wasm-encoder 0.36.2",
+ "wasm-encoder 0.37.0",
  "wasm-metadata",
- "wasmparser 0.116.1",
- "wasmprinter 0.2.72",
+ "wasmparser 0.117.0",
+ "wasmprinter 0.2.73",
  "wasmtime",
  "wast",
  "wat",
@@ -2425,13 +2425,13 @@ dependencies = [
  "env_logger",
  "libfuzzer-sys",
  "log",
- "wasmprinter 0.2.72",
+ "wasmprinter 0.2.73",
  "wit-parser 0.13.0",
 ]
 
 [[package]]
 name = "wit-smith"
-version = "0.1.21"
+version = "0.1.22"
 dependencies = [
  "arbitrary",
  "clap 4.4.8",
diff --git a/Cargo.toml b/Cargo.toml
index b4b8e4f0..f94b94be 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-tools"
-version = "1.0.51"
+version = "1.0.52"
 authors = ["The Wasmtime Project Developers"]
 edition.workspace = true
 description = "CLI tools for interoperating with WebAssembly files"
@@ -46,19 +46,19 @@ pretty_assertions = "1.3.0"
 semver = "1.0.0"
 smallvec = "1.11.1"
 
-wasm-compose = { version = "0.4.13", path = "crates/wasm-compose" }
-wasm-encoder = { version = "0.36.2", path = "crates/wasm-encoder" }
-wasm-metadata = { version = "0.10.11", path = "crates/wasm-metadata" }
-wasm-mutate = { version = "0.2.40", path = "crates/wasm-mutate" }
-wasm-shrink = { version = "0.1.41", path = "crates/wasm-shrink" }
-wasm-smith = { version = "0.12.23", path = "crates/wasm-smith" }
-wasmparser = { version = "0.116.1", path = "crates/wasmparser" }
-wasmprinter = { version = "0.2.72", path = "crates/wasmprinter" }
-wast = { version = "67.0.1", path = "crates/wast" }
-wat = { version = "1.0.79", path = "crates/wat" }
-wit-component = { version = "0.18.0", path = "crates/wit-component" }
+wasm-compose = { version = "0.4.14", path = "crates/wasm-compose" }
+wasm-encoder = { version = "0.37.0", path = "crates/wasm-encoder" }
+wasm-metadata = { version = "0.10.12", path = "crates/wasm-metadata" }
+wasm-mutate = { version = "0.2.41", path = "crates/wasm-mutate" }
+wasm-shrink = { version = "0.1.42", path = "crates/wasm-shrink" }
+wasm-smith = { version = "0.12.24", path = "crates/wasm-smith" }
+wasmparser = { version = "0.117.0", path = "crates/wasmparser" }
+wasmprinter = { version = "0.2.73", path = "crates/wasmprinter" }
+wast = { version = "68.0.0", path = "crates/wast" }
+wat = { version = "1.0.80", path = "crates/wat" }
+wit-component = { version = "0.18.1", path = "crates/wit-component" }
 wit-parser = { version = "0.13.0", path = "crates/wit-parser" }
-wit-smith = { version = "0.1.21", path = "crates/wit-smith" }
+wit-smith = { version = "0.1.22", path = "crates/wit-smith" }
 
 [dependencies]
 anyhow = { workspace = true }
diff --git a/crates/wasm-compose/Cargo.toml b/crates/wasm-compose/Cargo.toml
index 9981af1c..a680e245 100644
--- a/crates/wasm-compose/Cargo.toml
+++ b/crates/wasm-compose/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-compose"
-version = "0.4.13"
+version = "0.4.14"
 edition.workspace = true
 authors = ["Peter Huene <peter@huene.dev>"]
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wasm-compose/src/encoding.rs b/crates/wasm-compose/src/encoding.rs
index 18cf7945..749548c2 100644
--- a/crates/wasm-compose/src/encoding.rs
+++ b/crates/wasm-compose/src/encoding.rs
@@ -408,14 +408,16 @@ impl<'a> TypeEncoder<'a> {
             }
             wasmparser::types::ComponentEntityType::Type {
                 created: created @ ComponentAnyTypeId::Resource(_),
-                ..
-            } if AnyTypeId::from(created).peel_alias(&self.0.types).is_none() => {
-                ComponentTypeRef::Type(TypeBounds::SubResource)
+                referenced,
+            } => {
+                if created == referenced {
+                    log::trace!("creation of a new resource");
+                    ComponentTypeRef::Type(TypeBounds::SubResource)
+                } else {
+                    log::trace!("alias of an existing resource");
+                    ComponentTypeRef::Type(TypeBounds::Eq(self.ty(state, referenced.into())))
+                }
             }
-            wasmparser::types::ComponentEntityType::Type {
-                created: created @ ComponentAnyTypeId::Resource(_),
-                ..
-            } => ComponentTypeRef::Type(TypeBounds::Eq(self.ty(state, created.into()))),
             wasmparser::types::ComponentEntityType::Type { referenced, .. } => {
                 ComponentTypeRef::Type(TypeBounds::Eq(self.ty(state, referenced.into())))
             }
@@ -616,22 +618,23 @@ impl<'a> TypeEncoder<'a> {
 
     // Inner version of `ty` above which is a separate method to make it easier
     // to use `return` and not thwart the caching above.
-    fn _ty(&self, state: &mut TypeState<'a>, id: AnyTypeId) -> u32 {
-        // Before encoding the type or looking for something to alias, first
-        // determine if the type has already been created but under a different
-        // name. This can happen where one component's view of an imported
-        // instance may be partial and then unioned with another component's
-        // view of an imported instance. The second instance should reuse all
-        // the types defined/exported by the first.
-        //
-        // Here the reverse-export map is consulted where if `key` is an
-        // exported type from this instance (which is registered in "parallel"
-        // when one of those is encountered for all components) then search
-        // with the exported name if any other component has a type definition
-        // for their own version of our `id`.
-        let mut cur = id;
+    fn _ty(&self, state: &mut TypeState<'a>, mut id: AnyTypeId) -> u32 {
+        // This loop will walk the "alias chain" starting at `id` which will
+        // eventually reach the definition of `id`.
         loop {
-            let key = (PtrKey(self.0), cur);
+            let key = (PtrKey(self.0), id);
+
+            // First see if this `id` has already been defined under a different
+            // name. This can happen where one component's view of an imported
+            // instance may be partial and then unioned with another component's
+            // view of an imported instance. The second instance should reuse
+            // all the types defined/exported by the first.
+            //
+            // Here the reverse-export map is consulted where if `key` as an
+            // exported type from this instance (which is registered in
+            // "parallel" when one of those is encountered for all components)
+            // then search with the exported name if any other component has a
+            // type definition for their own version of our `id`.
             if let Some(name) = state.cur.type_exports.get(&key) {
                 for key in state.cur.type_exports_rev[name].iter() {
                     if let Some(ret) = state.cur.type_defs.get(key) {
@@ -641,41 +644,10 @@ impl<'a> TypeEncoder<'a> {
                 }
             }
 
-            if let Some(next) = cur.peel_alias(&self.0.types) {
-                cur = next;
-            } else {
-                break;
-            }
-        }
-
-        // If `id` is not an alias to anything else then it's a defined type in
-        // this scope meaning that it needs to be translated and represented
-        // here.
-        if id.peel_alias(&self.0.types).is_none() {
-            return match id {
-                AnyTypeId::Core(ComponentCoreTypeId::Sub(_)) => unreachable!(),
-                AnyTypeId::Core(ComponentCoreTypeId::Module(id)) => self.module_type(state, id),
-                AnyTypeId::Component(id) => match id {
-                    ComponentAnyTypeId::Resource(_) => unreachable!(
-                        "should have been handled in `TypeEncoder::component_entity_type`"
-                    ),
-                    ComponentAnyTypeId::Defined(id) => self.defined_type(state, id),
-                    ComponentAnyTypeId::Func(id) => self.component_func_type(state, id),
-                    ComponentAnyTypeId::Instance(id) => self.component_instance_type(state, id),
-                    ComponentAnyTypeId::Component(id) => self.component_type(state, id),
-                },
-            };
-        }
-
-        // Failing all that it seems that this type is defined elsewhere and
-        // no one has created an alias yet for it. That's our job so follow the
-        // alias chain and search all our outer scopes for one that has an
-        // instance that exports `id`. When found it's aliased out from
-        // that instance and then aliased into the current scope.
-        let mut cur = id;
-        loop {
+            // Otherwise see if this type is defined elsewhere and if an alias
+            // hasn't previously been created then one is done so here. This
+            // will search all outer scopes for an instance that exports `id`.
             for (i, scope) in state.scopes.iter_mut().rev().enumerate() {
-                let key = (PtrKey(self.0), cur);
                 let (instance, name) = match scope.instance_exports.get(&key) {
                     Some(pair) => *pair,
                     None => continue,
@@ -701,16 +673,28 @@ impl<'a> TypeEncoder<'a> {
                 return ret;
             }
 
-            // If the end of the alias chain has been reached then that's a bug
-            // in this type translation. It should be the case that we know
-            // how to find all types at this point, so reaching the end means
-            // there's a missing case one way or another.
-            let next = cur.peel_alias(&self.0.types).unwrap_or_else(|| {
-                panic!("failed to find alias of {id:?}");
-            });
-
-            cur = next;
+            match id.peel_alias(&self.0.types) {
+                Some(next) => id = next,
+                // If there's no more aliases then fall through to the
+                // definition of the type below.
+                None => break,
+            }
         }
+
+        // This type wasn't previously defined, so define it here.
+        return match id {
+            AnyTypeId::Core(ComponentCoreTypeId::Sub(_)) => unreachable!(),
+            AnyTypeId::Core(ComponentCoreTypeId::Module(id)) => self.module_type(state, id),
+            AnyTypeId::Component(id) => match id {
+                ComponentAnyTypeId::Resource(_) => {
+                    unreachable!("should have been handled in `TypeEncoder::component_entity_type`")
+                }
+                ComponentAnyTypeId::Defined(id) => self.defined_type(state, id),
+                ComponentAnyTypeId::Func(id) => self.component_func_type(state, id),
+                ComponentAnyTypeId::Instance(id) => self.component_instance_type(state, id),
+                ComponentAnyTypeId::Component(id) => self.component_type(state, id),
+            },
+        };
     }
 
     fn component_val_type(
@@ -878,12 +862,7 @@ impl<'a> TypeEncoder<'a> {
             let key = (PtrKey(self.0), id.into());
             let value = state.cur.encodable.type_count();
             let prev = state.cur.type_defs.insert(key, value);
-            // Resource aliases will already have been added to the table, but
-            // other types should not have been:
-            assert!(
-                prev.is_none()
-                    || (matches!(id, ComponentAnyTypeId::Resource(_)) && prev == Some(value))
-            );
+            assert!(prev.is_none());
             state.cur.add_type_export(key, name);
         }
         export
diff --git a/crates/wasm-encoder/Cargo.toml b/crates/wasm-encoder/Cargo.toml
index 88cf2d9c..fccc85ce 100644
--- a/crates/wasm-encoder/Cargo.toml
+++ b/crates/wasm-encoder/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-encoder"
-version = "0.36.2"
+version = "0.37.0"
 authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wasm-metadata/Cargo.toml b/crates/wasm-metadata/Cargo.toml
index 09d1d0fd..5b3f62c6 100644
--- a/crates/wasm-metadata/Cargo.toml
+++ b/crates/wasm-metadata/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-metadata"
-version = "0.10.11"
+version = "0.10.12"
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-metadata"
diff --git a/crates/wasm-mutate/Cargo.toml b/crates/wasm-mutate/Cargo.toml
index 5f82ebb1..d618985f 100644
--- a/crates/wasm-mutate/Cargo.toml
+++ b/crates/wasm-mutate/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasm-mutate"
-version = "0.2.40"
+version = "0.2.41"
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-mutate"
diff --git a/crates/wasm-shrink/Cargo.toml b/crates/wasm-shrink/Cargo.toml
index 2cafba6b..9f041625 100644
--- a/crates/wasm-shrink/Cargo.toml
+++ b/crates/wasm-shrink/Cargo.toml
@@ -8,7 +8,7 @@ license = "Apache-2.0 WITH LLVM-exception"
 readme = "./README.md"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-shrink"
 name = "wasm-shrink"
-version = "0.1.41"
+version = "0.1.42"
 
 [dependencies]
 anyhow = { workspace = true }
diff --git a/crates/wasm-smith/Cargo.toml b/crates/wasm-smith/Cargo.toml
index 71afc929..32c1ecbf 100644
--- a/crates/wasm-smith/Cargo.toml
+++ b/crates/wasm-smith/Cargo.toml
@@ -8,7 +8,7 @@ license = "Apache-2.0 WITH LLVM-exception"
 name = "wasm-smith"
 readme = "./README.md"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-smith"
-version = "0.12.23"
+version = "0.12.24"
 exclude = ["/benches/corpus"]
 
 [[bench]]
diff --git a/crates/wasmparser/Cargo.toml b/crates/wasmparser/Cargo.toml
index 06d4a456..6a119523 100644
--- a/crates/wasmparser/Cargo.toml
+++ b/crates/wasmparser/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmparser"
-version = "0.116.1"
+version = "0.117.0"
 authors = ["Yury Delendik <ydelendik@mozilla.com>"]
 license = "Apache-2.0 WITH LLVM-exception"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmparser"
diff --git a/crates/wasmprinter/Cargo.toml b/crates/wasmprinter/Cargo.toml
index 22b85966..d04e8eda 100644
--- a/crates/wasmprinter/Cargo.toml
+++ b/crates/wasmprinter/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wasmprinter"
-version = "0.2.72"
+version = "0.2.73"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wast/Cargo.toml b/crates/wast/Cargo.toml
index bb926220..f89f147d 100644
--- a/crates/wast/Cargo.toml
+++ b/crates/wast/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wast"
-version = "67.0.1"
+version = "68.0.0"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wat/Cargo.toml b/crates/wat/Cargo.toml
index 49f5af4a..98ad7b59 100644
--- a/crates/wat/Cargo.toml
+++ b/crates/wat/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "wat"
-version = "1.0.79"
+version = "1.0.80"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
diff --git a/crates/wit-component/Cargo.toml b/crates/wit-component/Cargo.toml
index 9024cb94..cb9e2436 100644
--- a/crates/wit-component/Cargo.toml
+++ b/crates/wit-component/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "wit-component"
 authors = ["Peter Huene <peter@huene.dev>"]
-version = "0.18.0"
+version = "0.18.1"
 edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 readme = "README.md"
diff --git a/crates/wit-smith/Cargo.toml b/crates/wit-smith/Cargo.toml
index 30f691e0..770f637d 100644
--- a/crates/wit-smith/Cargo.toml
+++ b/crates/wit-smith/Cargo.toml
@@ -5,7 +5,7 @@ edition.workspace = true
 license = "Apache-2.0 WITH LLVM-exception"
 name = "wit-smith"
 repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-smith"
-version = "0.1.21"
+version = "0.1.22"
 
 [dependencies]
 arbitrary = { workspace = true, features = ["derive"] }


Test patch:
diff --git a/crates/wasm-compose/tests/compositions/resources-and-aliases/b.wat b/crates/wasm-compose/tests/compositions/resources-and-aliases/b.wat
new file mode 100644
index 00000000..e5627d1d
--- /dev/null
+++ b/crates/wasm-compose/tests/compositions/resources-and-aliases/b.wat
@@ -0,0 +1,1 @@
+(component)
diff --git a/crates/wasm-compose/tests/compositions/resources-and-aliases/composed.wat b/crates/wasm-compose/tests/compositions/resources-and-aliases/composed.wat
new file mode 100644
index 00000000..932b8b35
--- /dev/null
+++ b/crates/wasm-compose/tests/compositions/resources-and-aliases/composed.wat
@@ -0,0 +1,44 @@
+(component
+  (type (;0;)
+    (instance
+      (export (;0;) "a" (type (sub resource)))
+    )
+  )
+  (import "host-a" (instance (;0;) (type 0)))
+  (alias export 0 "a" (type (;1;)))
+  (type (;2;)
+    (instance
+      (alias outer 1 1 (type (;0;)))
+      (export (;1;) "b" (type (eq 0)))
+    )
+  )
+  (import "host-b" (instance (;1;) (type 2)))
+  (component (;0;)
+    (type (;0;)
+      (instance
+        (export (;0;) "a" (type (sub resource)))
+      )
+    )
+    (import "host-a" (instance $i (;0;) (type 0)))
+    (alias export $i "a" (type $a (;1;)))
+    (type (;2;)
+      (instance
+        (alias outer 1 $a (type (;0;)))
+        (export (;1;) "b" (type (eq 0)))
+      )
+    )
+    (import "host-b" (instance (;1;) (type 2)))
+    (type (;3;)
+      (instance)
+    )
+    (import "b" (instance (;2;) (type 3)))
+  )
+  (component (;1;))
+  (instance (;2;) (instantiate 1))
+  (instance (;3;) (instantiate 0
+      (with "b" (instance 2))
+      (with "host-a" (instance 0))
+      (with "host-b" (instance 1))
+    )
+  )
+)
diff --git a/crates/wasm-compose/tests/compositions/resources-and-aliases/root.wat b/crates/wasm-compose/tests/compositions/resources-and-aliases/root.wat
new file mode 100644
index 00000000..b4e2cf57
--- /dev/null
+++ b/crates/wasm-compose/tests/compositions/resources-and-aliases/root.wat
@@ -0,0 +1,11 @@
+(component
+  (import "host-a" (instance $i
+    (export "a" (type (sub resource)))
+  ))
+  (alias export $i "a" (type $a))
+  (import "host-b" (instance
+    (export "b" (type (eq $a)))
+  ))
+
+  (import "b" (instance))
+)