HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.03k stars 648 forks source link

Missing type parameter info when return type inferred from interface #11624

Closed kLabz closed 1 month ago

kLabz commented 3 months ago

Hxb makes the issue visible when compiling this through compilation server:

interface Foo {
    function foo<T>():T;
    function bar<T>():T;
    function baz<T>():T;
}

class Bar implements Foo {
    public function foo() return null; // Warning: Unbound type parameter foo.T
    public function bar<T>() return null; // Error: write_full_path hxb writer failure
    public function baz<T>():T return null; // this is fine
}

While looking at what's happening (and so far failing addressing this issue...), I saw that cf_type was TFun([], TMono (Some (TAbstract(Null, [TMono (Some (TInst(T, [])))])))), with that T not having cl_kind = KTypeParameter ttp.

Simn commented 2 months ago

This is very much related to #11411. At this point I'm convinced that valid_redefinition needs a complete rewrite, but doing so requires a very particular state of being.