The Dart Analyzer hangs when destructuring a sealed type variant with a large number of fields inside a switch
statement
#59927
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P2
A bug or feature request we're likely to work on
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Let's say we have the following sealed class:
If we try to use it inside a
switch
statement, the Dart analyzer will likely hang:One possible workaround for this issue is to use an intermediate fields container like this:
Actual behavior
The Dart Analyzer hangs for a very long time (10+ minutes in my case) when attempting to analyze the switch statement with pattern matching on a class containing numerous fields.
Expected behavior
The Dart Analyzer should either:
Repro
demo.zip
For additional context about this issue, please refer to Dart-Code/Dart-Code#5392
Dart SDK version
The text was updated successfully, but these errors were encountered: