Open GWRon opened 3 years ago
Not just return values - this would apply to any potentially "lossy" assignment.
Hmm but doesn't it warn already when passing eg. a double
as a float
in functions ?
Function MyFunc(f:Float)
End Function
MyFunc( sin(10) )
isn't this "similar" ?
Yes, that's part of it.
But while it gives a warning when passing a Double
to a Float
parameter, it doesn't do that for many other cases, such as Float
to Int
, UInt
to Int
, etc.
And it only does that for function/method parameters. It also doesn't give warnings when such implicit conversions happen elsewhere, e.g. Local f:Float = someDoubleVariable
.
If you are not aware of "longValue" being of type
long
(eg by refactoring fromint
tolong
) this issue might sneek in unseen. (the issue in this case is a potential "roll over" if the difference is bigger or smaller than the integer limits)So maybe optionally inform the developer via a "warning", that you cast unseen (here from long to int).