Skip to content

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

@ianxm

Description

@ianxm

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions