JetBrains Rider
 
2021.3
Get JetBrains Rider
You are viewing the documentation for an earlier version of JetBrains Rider.

Code Inspection: Heuristically unreachable case due to integer analysis

Last modified: 07 April 2022

This inspection reports cases of switch statements that will never be executed according to the results of integer value analysis. The inspection only works if Analyze integer arithmetic is enabled on the Editor | Inspection Settings page of JetBrains Rider settings Ctrl+Alt+S.

Here is an example of annotating the method parameter with [NonNegativeValueAttribute] to refine the analysis within the method body. Knowing that the parameter is non-negative, JetBrains Rider can report redundant cases: