Flow analysis detection of trivial exhaustiveness fails to understand [...]
.
#52017
Labels
legacy-area-front-end
Legacy: Use area-dart-model instead.
(Filing this issue to accompany a cherry-pick request; the bulk of the work is tracked in dart-lang/language#2980).
As of the latest beta release (flutter/flutter#124515), list patterns containing a single rest pattern are not recognized by flow analysis as trivially exhaustive. As a result, a switch statement like the following will not be recognized by flow analysis as exhaustive:
And thus there will be an error at the print statement claiming that
description
hasn't been definitely assigned.Worse yet, if the user attempts to fix the problem by adding, e.g.:
then the exhaustiveness checker will (correctly) report a warning that this default case is unreachable.
This affects all platforms, but only programs which use the patterns feature of Dart 3.0.
The text was updated successfully, but these errors were encountered: