Analyzer does not warn of missing exhaustiveness when combining sealed classes and enums. #52164
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P1
A high priority bug; for example, a single project is unusable or has many test failures
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
The analyzer correctly warns if any of the cases are removed from these switches, and not if all the cases are present:
However, it does not recognize a missing enum entry if it's combined with another type:
Here commenting out the
EE.a
orEE.b
case does not give any errors in the analyzer. The CFE does give the correct error of a missingEE.a
case.Even commenting out both
EE.?
cases doesn't give an error.It looks like the analyzer simply misses that an
enum
declaration can also introduce a subtype of a sealed type which should be included in exhaustiveness.Checking the code ... yes, that is the problem. And it also mixes mixins:
The text was updated successfully, but these errors were encountered: