Closed
Description
While trying to write a more advanced EitherType
, I faced the following issue:
abstract E2<T1,T2>(Dynamic)
from T1 from T2 from E2<T2,T1>
to T1 to T2 to E2<T2,T1>
{}
class Test {
function main():Void {
var v1:E2<Int,String> = 1;
var v2:E2<String,Int> = 2;
v1 = v2; //E2<String, Int> should be E2<Int, String>
}
}
Try to workaround, faced another issue:
abstract E2<T1,T2>(Dynamic)
from T1 from T2
to T1 to T2
{
// note that it compiles fine if not inline
@:from inline static function _from2<_T1:E2<T1,T2>, _T2:E2<T1,T2>>(e:E2<_T1,_T2>):E2<T1,T2> {
return untyped e;
}
}
class Test {
function main():Void {
var v1:E2<Int,String> = 1;
var v2:E2<String,Int> = 2;
v1 = v2; //e : E2<Unknown<0>, Unknown<1>> -> E2<E2.T1, E2.T2> should be E2<String, Int> -> E2<Int, String>
}
}
Activity