HaxeFoundation / HaxeFoundation/haxe

[jvm] int parsing inconsistent with other targets

Open
#9,808 7 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
platform-jvm
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

The compiler parsing constant ints for the jvm target appears to be inconsistent with the python, js, interp and legacy java targets, I've not tested the rest. Tested against both Haxe `36263b3` and `4.0.5` with the same results.

```Haxe
package ;

class Main {

public static function main() {
var i32minc:Int = -2147483648;
var i32maxc:Int = 2147483647;
var i32min:Int = Std.int(-Math.pow(2, 31));
var i32max:Int = Std.int(Math.pow(2, 31) - 1);
var jvmmin:Int = -2147450880;
var jvmerr:Int = -2147450881;
// jvm : 0, -1, -2147483648, 2147483647, -2147450880, 32767
// java : -2147483648, 2147483647, -2147483648, 2147483647, -2147450880, -2147450881
// python : -2147483648, 2147483647, -2147483648, 2147483647, -2147450880, -2147450881
// js : -2147483648, 2147483647, -2147483648, 2147483647, -2147450880, -2147450881
// interp : -2147483648,2147483647,0,-1,-2147450880,-2147450881
trace( i32minc, i32maxc, i32min, i32max, jvmmin, jvmerr );
}

}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.