hxasync icon indicating copy to clipboard operation
hxasync copied to clipboard

Async functions can't return Void type

Open fed239 opened this issue 2 years ago • 1 comments
trafficstars

My code:

  @async private function myAsyncFuncReturningVoid(): Void {
    // do something
    // line 244 is here
  }

  @async private function test() {
      @await this.myAsyncFuncReturningVoid(); // line 264 is here
  }

Compiler output:

ex.hx:244: characters 5-38 : Dynamic should be Void
ex.hx:244: characters 5-38 : Dynamic should be Void
ex.hx:264: characters 14-33 : Void should be hxasync.Awaitable<Void>
ex.hx:264: characters 14-33 : ... For function argument 'arg'

fed239 avatar Feb 03 '23 05:02 fed239

This is a known limitation of Haxe, which I did not find a way to workaround.
I will not close the issue, but you should not expect a fix anytime soon :)

botsman avatar Feb 03 '23 07:02 botsman