Warn about dead code within match
and if
/else
#23404
Labels
Feature/Enhancement Request
This issue is made to request a feature or an enhancement to an existing one.
Unit: Compiler
Bugs/feature requests, that are related to the V compiler in general.
Describe the feature
A programmer mistake can produce dead code if uses within
if
/else
branches comparisons likea == a
and withinmatch
likematch a { a { ... } else { ... } }
.The compiler could look for these types of comparisons and issue warnings about the possibility of dead code.
Use Case
Dead code with
if
andelse
:Dead code within
match
:match
is more robust thanif
/else
since already prevents repeated constants and exhaust the search with mandatoryelse
. But with variables or post-calculated constants also can produce dead code. Some examples are in issue #23403Proposed Solution
No response
Other Information
No response
Acknowledgements
Version used
V 0.4.9 9fc8352
Environment details (OS name and version, etc.)
Playground
Huly®: V_0.6-21835
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: