From 9cee2ea33f903f742d08a685de03bb2a395c2c0a Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 20 Sep 2022 21:38:59 +0200 Subject: [PATCH] Handle async messages for identifier calls When calling async messages as identifier (e.g. just `foo` instead of `self.foo` or `foo()`), the compiler now correctly compiles the call to a message send, instead of a virtual call. Changelog: fixed --- compiler/src/mir/passes.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/src/mir/passes.rs b/compiler/src/mir/passes.rs index d6ee9d697..86a1e1481 100644 --- a/compiler/src/mir/passes.rs +++ b/compiler/src/mir/passes.rs @@ -3054,7 +3054,10 @@ impl<'a> LowerMethod<'a> { let args = Vec::new(); - if info.dynamic { + if info.id.is_async(self.db()) { + self.current_block_mut() + .send_and_wait(rec, info.id, args, loc); + } else if info.dynamic { self.current_block_mut().call_dynamic(rec, id, args, loc); } else { self.current_block_mut().call(rec, id, args, loc);