Open
Description
Description
We have functionality that checks whether some addition or multiplication causes overflow. Seems like it doesn't reflect specifications (see this comment), so after a discussion with @Markoutte we agreed to change this behaviour in the following way:
- Let's make these checks for addition and multiplication for integer/long overflow only (just like
Math.addExact
) - For all other operations this check should be processed only when narrowing transformation is applied. To do so, we have to implement a check in a cast function that makes sure that the value before the cast is in the bounds of a type after cast.
Expected behavior
Detect overflow for integer and long values, narrowing transformation for all primitive types.
Environment
There is no specific environment.
Potential alternatives
Can be discussed depending on what users expect.
Context
There is no additional context.
Metadata
Metadata
Assignees
Type
Projects
Status
Todo