Skip to content

Correct nullable BigDecimal conversion signature - #551

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/correct-nullable-bigdecimal-rbs
Open

Correct nullable BigDecimal conversion signature#551
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/correct-nullable-bigdecimal-rbs

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary:

  • distinguish the default/exception: true overload from non-literal boolean calls
  • return BigDecimal? whenever exception may be false
  • add a conservative untyped fallback for the dynamic Kernel conversion API

Why:
Kernel.BigDecimal returns nil for failed conversions when exception: false, but the current RBS always declares BigDecimal. The overload shape follows the established Float, Integer and Complex signatures in core RBS.

Verification:

  • full current suite: 266 tests, 13,616 assertions, 0 failures/errors/omissions
  • RBS suite: 146 tests, 1,805 assertions, 0 failures/errors
  • conversion model covers literal true, literal false, a boolean variable and dynamic inputs

Compatibility:
This changes type information only. Existing calls remain accepted while non-raising conversions receive their actual nullable return type.

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.

1 participant