Skip to content

Align numeric types API: isZero/isNeg → instance methods, add copy(), fix HL opcode tests#12857

Merged
Simn merged 2 commits intohaxe-numericfrom
copilot/sub-pr-12825
Mar 21, 2026
Merged

Align numeric types API: isZero/isNeg → instance methods, add copy(), fix HL opcode tests#12857
Simn merged 2 commits intohaxe-numericfrom
copilot/sub-pr-12825

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

isZero and isNeg were static functions on Int32/UInt32/Int64/UInt64, inconsistent with the rest of the API. Int32/UInt32 were missing copy() and had different function ordering than Int64/UInt64.

Changes

  • isZero/isNeg → instance methods on all four types, updated all callers (Int64Helper, tests, Issue12415)
// before
Int64.isZero(x)
Int64.isNeg(x)

// after
x.isZero()
x.isNeg()
  • Added copy() to Int32 and UInt32 for consistency with Int64/UInt64

  • Aligned function order in Int32/UInt32 to match Int64/UInt64: copy → fromInt → toInt → compare → ucompare → isNeg/isZero → parseString → fromFloat → toFloat → implicit casts → operators

  • Fixed 5 HL opcode test expectations — register numbering changed after the cleanup commit (0e9ebb0) simplified increment/decrement and conversion patterns

  • Fixed UInt32.compare docstring — incorrectly said "signed mode" despite delegating to ucompare


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

…align API order, fix HL opcode tests

Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/HaxeFoundation/haxe/sessions/330c2464-c0e6-4f48-b8e5-899473797b40
Copilot AI changed the title [WIP] Unify numeric types API across all targets Align numeric types API: isZero/isNeg → instance methods, add copy(), fix HL opcode tests Mar 20, 2026
Copilot AI requested a review from Simn March 20, 2026 22:02
Copilot finished work on behalf of Simn March 20, 2026 22:02
@Simn Simn marked this pull request as ready for review March 21, 2026 06:16
@Simn Simn merged commit b719675 into haxe-numeric Mar 21, 2026
61 checks passed
@Simn Simn deleted the copilot/sub-pr-12825 branch March 21, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants