HaxeFoundation / HaxeFoundation/haxe

[python] Big UInt gets generated as negative int literal.

Open
#9,354 2 comments 0 reactions 0 assignees View on GitHub
bug platform-python
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
class Main {
static function main() {
var u:UInt = 0x80000000;
Sys.println(u);
}
}
```

Yields:

```python
class Main:
_hx_class_name = "Main"
__slots__ = ()
_hx_statics = ["main"]

@staticmethod
def main():
u = -2147483648
_hx_str = Std.string(u)
python_Lib.printString((("" + ("null" if _hx_str is None else _hx_str)) + HxOverrides.stringOrNull(python_Lib.lineEnd)))
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Haxe example from the issue and inspecting the generated Python output. Trace the Python-target code that handles the UInt literal; done means the generated literal preserves the intended unsigned value and the example prints the correct result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.