Skip to content

Correct nullable BigDecimal conversion signature - #551

Merged
tompng merged 1 commit into
ruby:masterfrom
OskarEichler:codex/correct-nullable-bigdecimal-rbs
Sep 4, 2026
Merged

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

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

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.

@tompng
tompng merged commit d9c53fb into ruby:master Sep 4, 2026
83 checks passed
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