Skip to content

Fallible arithmetic for Val and Val2#24014

Merged
alice-i-cecile merged 7 commits intobevyengine:mainfrom
ickshonpe:val-fallible-arithmetic
Apr 28, 2026
Merged

Fallible arithmetic for Val and Val2#24014
alice-i-cecile merged 7 commits intobevyengine:mainfrom
ickshonpe:val-fallible-arithmetic

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented Apr 28, 2026

Objective

Add fallible arithmetic support for Vals.

Solution

Implement try_add and try_sub methods for Val and Val2.

The methods succeed only if the Vals are matching variants, and neither is Val:Auto.

I considered allowing arithmetric with incompatible zero(s), but it feels potentially confusing as there isn't a clear and natural way to select the units for the result.

Also removed the val_arithmetic_error_messages test, instead of updating it. I don't see any value there.

@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Apr 28, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Apr 28, 2026
@alice-i-cecile alice-i-cecile added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Apr 28, 2026
@alice-i-cecile alice-i-cecile added the X-Uncontroversial This work is generally agreed upon label Apr 28, 2026
@alice-i-cecile alice-i-cecile requested a review from kfc35 April 28, 2026 17:08
@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 28, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 28, 2026
Merged via the queue into bevyengine:main with commit 89da5a6 Apr 28, 2026
50 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in UI Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants