Skip to content

fix: document panic behavior in operator overloads (issue #180 fix 2)#182

Merged
mfirhas merged 1 commit into
masterfrom
copilot/fix-no-2
May 19, 2026
Merged

fix: document panic behavior in operator overloads (issue #180 fix 2)#182
mfirhas merged 1 commit into
masterfrom
copilot/fix-no-2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

Closes #180 (Fix No. 2).

Every arithmetic operator overload (+, -, +=, -=, *, /, %) for Money and RawMoney previously panicked on overflow with only an internal // WARN: PANIC! source comment as warning — nothing visible in the public docs.

This PR adds a # Panics doc section to each operator impl, documenting the overflow condition and directing users to the corresponding BaseOps::checked_* method for safe arithmetic:

  • Add / AddAssignBaseOps::checked_add
  • Sub / SubAssignBaseOps::checked_sub
  • MulBaseOps::checked_mul
  • DivBaseOps::checked_div (also notes divide-by-zero)
  • RemBaseOps::checked_rem (also notes divide-by-zero)

The internal // WARN: PANIC! comments are removed as the public doc now carries this information. No logic is changed.

@mfirhas mfirhas marked this pull request as ready for review May 19, 2026 22:42
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mfirhas mfirhas merged commit 5a9c9ee into master May 19, 2026
6 checks passed
@mfirhas mfirhas deleted the copilot/fix-no-2 branch May 19, 2026 22:47
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.

Code Review (AI) 2026-05-19

3 participants