You cannot do that because of how type parameters work. When the
compiler sees T, it has no clue that that may actually be an abstract
with its own operators. And since abstracts exist at compile time
only, the operator you defined cannot be resolved at runtime. The one
being used is the one defined on the underlying data type, and that's
integer equality in this case.
Adding `@:generic` metadata to `test` may cause the compiler to
generate a version for each type that will use the actual operator,
but I wouldn't count on it.
Alternatively you can use a macro:
class Foo<T> {
macro public static function test(a,b) {
return macro @:pos(haxe.macro.Context.currentPos) $a == $b;
}
}
Best,
Juraj
> --
> To post to this group
haxe...@googlegroups.com
>
http://groups.google.com/group/haxelang?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Haxe" group.
> For more options, visit
https://groups.google.com/d/optout.