Skip to content

Use Rounding_Mode instead of use_bankers flag #12641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Apr 10, 2025
Merged

Use Rounding_Mode instead of use_bankers flag #12641

merged 49 commits into from
Apr 10, 2025

Conversation

GregoryTravis
Copy link
Contributor

@GregoryTravis GregoryTravis commented Mar 25, 2025

Replace the use_bankers flag with the more flexible and user-friendly Rounding_Mode value. This will allow additional rounding modes to be added in the future, rather than adding additional argument flags for each feature.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@GregoryTravis GregoryTravis added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Mar 28, 2025
@github-actions github-actions bot added -libs-API-change-Database Marks a PR that changes the public API of Standard.Database -libs-API-change-Table Marks a PR that changes the public API of Standard.Table -libs-API-change-Base Marks a PR that changes the public API of Standard.Base labels Mar 31, 2025
@GregoryTravis GregoryTravis marked this pull request as ready for review April 2, 2025 19:45
@GregoryTravis GregoryTravis added the CI: Ready to merge This PR is eligible for automatic merge label Apr 9, 2025
@@ -47,7 +47,7 @@
- floor self -> Standard.Base.Data.Numbers.Integer
- negate self -> Standard.Base.Data.Numbers.Integer
- parse text:Standard.Base.Data.Text.Text radix:Standard.Base.Data.Numbers.Integer= -> Standard.Base.Any.Any
- round self decimal_places:Standard.Base.Data.Numbers.Integer= rounding_mode:Standard.Base.Data.Numeric.Rounding_Mode.Rounding_Mode= -> Standard.Base.Any.Any
- round self decimal_places:Standard.Base.Data.Numbers.Integer= rounding_mode:(Standard.Base.Data.Numeric.Rounding_Mode.Rounding_Mode|Standard.Base.Data.Boolean.Boolean)= -> Standard.Base.Any.Any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Why there is no return type specification?
  • at least I guess missing -> Number is the reason why the return type is Any
  • specifying more narrow return type should help static analysis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -3,4 +3,4 @@
- type Rounding_Mode
- Bankers
- Half_Up
- to_java_rounding_mode self -> Standard.Base.Data.Numeric.Rounding_Mode.RoundingMode
- resolve_deprecated_rounding_mode type_name:Standard.Base.Data.Text.Text rounding_mode:(Standard.Base.Data.Numeric.Rounding_Mode.Rounding_Mode|Standard.Base.Data.Boolean.Boolean) ~action:Standard.Base.Any.Any -> Standard.Base.Any.Any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this function visible to public at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed now.

## PRIVATE
Convert deprecated `use_bankers : Boolean` arguments (passed as
`rounding_mode`) to `Rounding_Mode`.
resolve_deprecated_rounding_mode (type_name:Text) (rounding_mode : Rounding_Mode | Boolean) ~action =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resolve_deprecated_rounding_mode (type_name:Text) (rounding_mode : Rounding_Mode | Boolean) ~action =
private resolve_deprecated_rounding_mode (type_name:Text) (rounding_mode : Rounding_Mode | Boolean) ~action =

@GregoryTravis GregoryTravis removed the CI: Ready to merge This PR is eligible for automatic merge label Apr 10, 2025
@GregoryTravis GregoryTravis added the CI: Ready to merge This PR is eligible for automatic merge label Apr 10, 2025
@mergify mergify bot merged commit d5ee5e8 into develop Apr 10, 2025
74 of 75 checks passed
@mergify mergify bot deleted the wip/gmt/9387-rm branch April 10, 2025 21:31
@@ -1,3 +1,6 @@
from Standard.Base import all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

farmaazon pushed a commit that referenced this pull request Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--breaking Important: a change that will break a public API or user-facing behaviour -libs-API-change-Base Marks a PR that changes the public API of Standard.Base -libs-API-change-Database Marks a PR that changes the public API of Standard.Database -libs-API-change-Table Marks a PR that changes the public API of Standard.Table CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants