haxetink / tink_core

Core utilities
https://haxetink.github.io/tink_core
MIT License
117 stars 33 forks source link

Promise<Noise> can be casted to any Promise? #158

Closed kevinresol closed 3 years ago

kevinresol commented 3 years ago

I think we do not expect the following to compile? (but it does in v2)

using tink.CoreApi;

class Main {
    static function main() {
    }

    static function foo():Promise<Something> {
        return Promise.NOISE;
    }
}

typedef Something = {
    final foo:Int;
}

Generated:

Main.foo = function() {
    return tink_core_Promise.fromNever(tink_core_Promise.NOISE);
};