haxe icon indicating copy to clipboard operation
haxe copied to clipboard

[regression][js] Std.is(_, Int) often not optimized

Open back2dos opened this issue 2 months ago • 0 comments

In haxe 4 these all used to be optimized, while in haxe 5 it only seems to work for Dynamic:

function main() {
  var v:Dynamic = 0;
  trace(Std.is(v, Int)); // typeof(v) == "number" && ((v | 0) === v)
  var v:Any = v;
  trace(Std.is(v, Int)); // js_Boot.__instanceof(v1,Int)
  var v:Int = v;
  trace(Std.is(v, Int)); // js_Boot.__instanceof(v1,Int)
}

Also checking against Float seems to always work.

back2dos avatar Dec 09 '25 13:12 back2dos