error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

SelfAssignment false positive with casting a float variable to int

Open DevCharly opened this issue 1 year ago • 1 comments

Description of the problem:

The SelfAssignment checker complains about following:

float width = 123.456f;

width = (int) width;

// value of width is now 123

What version of Error Prone are you using?

2.28.0

DevCharly avatar Jun 14 '24 17:06 DevCharly

Some previous discussion in https://github.com/google/error-prone/issues/2196

cushon avatar Jun 14 '24 17:06 cushon