Skip to content

Commit 6f1fbed

Browse files
committed
#[itest(async)]: fix TaskHandle expecting to be imported
1 parent e43b480 commit 6f1fbed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

godot-macros/src/itest.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ pub fn attribute_itest(input_item: venial::Item) -> ParseResult<TokenStream> {
6464
quote! { __unused_context: &crate::framework::TestContext }
6565
};
6666

67+
let return_ty = func.return_ty.as_ref();
6768
if is_async
68-
&& func
69-
.return_ty
70-
.as_ref()
69+
&& return_ty
7170
.and_then(extract_typename)
7271
.is_none_or(|segment| segment.ident != "TaskHandle")
7372
{
@@ -78,7 +77,8 @@ pub fn attribute_itest(input_item: venial::Item) -> ParseResult<TokenStream> {
7877

7978
let (return_tokens, test_case_ty, plugin_name);
8079
if is_async {
81-
return_tokens = quote! { -> TaskHandle };
80+
let [arrow, arrow_head] = func.tk_return_arrow.unwrap();
81+
return_tokens = quote! { #arrow #arrow_head #return_ty }; // retain span.
8282
test_case_ty = quote! { crate::framework::AsyncRustTestCase };
8383
plugin_name = ident("__GODOT_ASYNC_ITEST");
8484
} else {

0 commit comments

Comments
 (0)