Interpreter icon indicating copy to clipboard operation
Interpreter copied to clipboard

Add analyzer check for ignored Result types with expression statements

Open WillBAnders opened this issue 2 years ago • 0 comments

Expression statements currently discard the return value. For functions that return Results, this can result in errors (exceptions) being unintentionally dropped. The likelihood of this is increased due to automatic Result conversions, since a function that throws exceptions like parse! could accidentally be called as parse.

Languages like Rust, for instance, have more advanced solutions to this for determining whether the return value of any function can be ignored. This is a more complex overhaul, so for now special-casing this to Result seems to be a fair balance.

WillBAnders avatar Jun 23 '23 21:06 WillBAnders