Consider the below scenario, where there's an unreachable panic error("") statement followed by a variable assignment. Shouldn't we suggest the unreachable code error for the panic statement? Currently, if there's another statement, such as a variable assignment, after the panic statement, we are suggesting the unreachable code error for the variable assignment.
Description:
Consider the below scenario, where there's an unreachable
panic error("")
statement followed by a variable assignment. Shouldn't we suggest theunreachable code
error for the panic statement? Currently, if there's another statement, such as a variable assignment, after the panic statement, we are suggesting theunreachable code
error for the variable assignment.The spec says,
It is a compile error if a statement other than a panic-stmt is not reachable.
Is there a reason for not suggesting the
unreachable code
error for panic statements?Suggested Labels:
Code sample that shows issue:
Related Issues: https://github.com/ballerina-platform/ballerina-lang/issues/42105