fix(rust): keep self method calls on the correct owner (#1882)

Fixes #1861. Reuses L4XB's receiver retention and owner resolution from #1866, with duplicate-owner and edit/sync guards.

Co-authored-by: L4XB <lukas.buck@e-mail.de>
This commit is contained in:
Colby Mchenry
2026-09-16 07:18:40 +00:00
committed by GitHub
parent 51116a26cb
commit 8f8081968e
7 changed files with 239 additions and 10 deletions
+10 -2
View File
@@ -894,9 +894,17 @@ impl<'t> Walker<'t> {
_ => callee_name = method_name.to_string(),
}
}
// `self.method()` — keep the `self.` prefix so the
// resolver can read the owner off the calling
// method's qualified name and resolve the method on
// THAT type, instead of matching a bare name by file
// proximity (#1861). Mirrors the wasm extractor.
"self" => {
callee_name = format!("self.{method_name}");
}
_ => {
// parenthesized, await_expression, `self` —
// bare method name.
// parenthesized, await_expression — bare method
// name.
callee_name = method_name.to_string();
}
}