diff --git a/crates/rust/src/interface.rs b/crates/rust/src/interface.rs index 38caf7c14..c81c3271e 100644 --- a/crates/rust/src/interface.rs +++ b/crates/rust/src/interface.rs @@ -1887,6 +1887,11 @@ unsafe fn call_import(&mut self, _params: Self::ParamsLower, _results: *mut u8) return format!("{path}::{name}"); } } + // World-level aliases live at macro root. `path_to_root()` is + // `""` at root, `"super::super::"` in stream/future payload mode. + if let TypeOwner::World(_) = self.resolve.types[id].owner { + return format!("{}{name}", self.path_to_root()); + } name } diff --git a/crates/test/src/cpp.rs b/crates/test/src/cpp.rs index 33751f60a..4946a1fef 100644 --- a/crates/test/src/cpp.rs +++ b/crates/test/src/cpp.rs @@ -45,6 +45,10 @@ impl LanguageMethods for Cpp { config: &crate::config::WitConfig, _args: &[String], ) -> bool { + // Compiles on C++ despite the blanket async exclusion below. + if name == "issue-1598.wit" { + return false; + } return match name { "issue1514-6.wit" | "named-fixed-length-list.wit" | "map.wit" => true, _ => false, diff --git a/crates/test/src/csharp.rs b/crates/test/src/csharp.rs index a4d017e18..e95adc3b3 100644 --- a/crates/test/src/csharp.rs +++ b/crates/test/src/csharp.rs @@ -48,6 +48,7 @@ impl LanguageMethods for Csharp { | "async-resource-func.wit" | "import-export-resource.wit" | "issue-1433.wit" + | "issue-1598.wit" | "named-fixed-length-list.wit" | "map.wit" ) diff --git a/crates/test/src/go.rs b/crates/test/src/go.rs index 83060b3a9..afe651951 100644 --- a/crates/test/src/go.rs +++ b/crates/test/src/go.rs @@ -30,6 +30,7 @@ impl LanguageMethods for Go { config.error_context || name == "async-trait-function.wit" || name == "named-fixed-length-list.wit" + || name == "issue-1598.wit" } fn default_bindgen_args_for_codegen(&self) -> &[&str] { diff --git a/tests/codegen/issue-1598.wit b/tests/codegen/issue-1598.wit new file mode 100644 index 000000000..eac624b60 --- /dev/null +++ b/tests/codegen/issue-1598.wit @@ -0,0 +1,14 @@ +//@ async = true + +package a:b; + +world w { + use t.{r}; + export f: async func() -> future>; +} + +interface t { + record r { + x: u32, + } +}