Changed check_top_bit InexactError #33202
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, converting type of a too large or small integer yields this error message:
However, the documentation of
InexactError
states:This implies that the above error message means that
-1
cannot be represented as anInt64
. However, that's wrong - it cannot be represented as aUInt64
. Furthermore,check_top_bit(Int64, -1)
is not a valid function call.With this change, the error message is:
Which is correct. Also,
check_top_bit
now takes a type and a value, socheck_top_bit(UInt64, -1)
is a valid function call (and is also indeed the call that triggered the error).There's probably a larger discussion to be had whether it should really be a
DomainError
instead, but changing the error type is a breaking change.Also see issue #30247 and issue #29766 .