vegardit / haxe-concurrent

A haxelib for basic platform-agnostic concurrency support
https://vegardit.github.io/haxe-concurrent/
Apache License 2.0
82 stars 14 forks source link

Unsupported recursive type when importing hx.concurrent.executor.Executor #29

Open DawDavis opened 4 months ago

DawDavis commented 4 months ago

When building a haxe project that include the concurrent library against the HashLink target, I get the following error:

/haxe/lib/haxe-concurrent/5,1,3/src/hx/concurrent/Future.hx:13: characters 1-64 : Unsupported recursive type

Steps to reproduce:

Haxe-concurrent 5.1.3 Haxe 4.3.4 OS: Macosx Monterey 12.7.3

program "Main.hx"

package;

import hx.concurrent.executor.Executor;

class Main {
   public static function main() {
      var executor = Executor.create(3);
      executor.submit(()->{trace("hello.");});
   }
}

build .hxml:

-cp src
-lib haxe-concurrent
-main Main
--hl bin/main.hl

My expectation is that this is a bug with Haxe itself, however I am not familiar enough with either the library or the HashLink target to know for sure.

sebthom commented 3 months ago

That is some kind of bug in the HashLink target and you would need to open a ticket at https://github.com/HaxeFoundation/hashlink/issues

Another project also had an issue with the same compiler error: https://github.com/HaxeFlixel/flixel/issues/3149

I played around with it a bit, if I add a line like var unused:hx.concurrent.Future.FutureCompletionListener<Void> = null; to your example, it compiles.

package;

import hx.concurrent.executor.Executor;

class Main {
   public static function main() {
      var unused:hx.concurrent.Future.FutureCompletionListener<Void> = null;
      var executor = Executor.create(3);
      executor.submit(()->{trace("hello.");});
   }
}