Something like this does not make much sense and it doesn't work, even if addAssign is inline, because a will be tempvared.
abstract A(Int) from Int {
function asInt() return this;
@:op(a += b) static function addAssign(a:Int, b:A):Int {
return a += b.asInt();
}
}
class Main {
static function main() {
var a = 10;
var b:A = 5;
a += b;
trace(a); // still 10
}
}
I think assign-ops only make sense when this can be asssigned to, that is, inline non-static methods. So should we error on this kind of @:op definitions?
Something like this does not make much sense and it doesn't work, even if
addAssignisinline, becauseawill be tempvared.I think assign-ops only make sense when
thiscan be asssigned to, that is,inlinenon-staticmethods. So should we error on this kind of@:opdefinitions?