HaxeFoundation / HaxeFoundation/haxe
[regression][js] Std.is(_, Int) often not optimized
Open
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
In haxe 4 these all used to be optimized, while in haxe 5 it [only seems to work for `Dynamic`](https://try.haxe.org/#38C167cD):
```haxe
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.
Contributor guide
Assessment
This issue has not been assessed yet.