Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future.sync() saved to Promise has sticky type on hashlink #172

Open
ianxm opened this issue Jun 7, 2023 · 0 comments
Open

Future.sync() saved to Promise has sticky type on hashlink #172

ianxm opened this issue Jun 7, 2023 · 0 comments

Comments

@ianxm
Copy link

ianxm commented Jun 7, 2023

This works in --interp and -neko but failes on -hl. There's no problem if the promises have the same type parameters, or if they're typed as Futures even with different type parameters.

        var a :Promise<Int> = Future.sync(2);
        a.handle( ii -> trace('a ${ii.sure()}') );

        var b :Promise<String> = Future.sync("two");
        b.handle( ii -> trace('b ${ii.sure()}') );     // <-- line 10

the error is

TinkFuturePromise.hx:7: a 2
Uncaught exception: Can't cast String to i32
Called from tink.core._Promise.$Promise_Impl_.~ofFuture.0(tink/core/Outcome.hx:13)
Called from tink.core._Future.$Future_Impl_.~map.1(tink/core/Future.hx:97)
Called from tink.core._Lazy.LazyFunc.compute(tink/core/Lazy.hx:106)
Called from tink.core._Lazy.$Lazy_Impl_.get(tink/core/Lazy.hx:13)
Called from tink.core._Future.SyncFuture.handle(tink/core/Future.hx:432)
Called from $TinkFuturePromise.main(TinkFuturePromise.hx:10)
Called from .init(?:1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant