Record pattern matching nullability deduction #3243
Labels
patterns
Issues related to pattern matching.
records
Issues related to records.
type-inference
Type inference, issues or improvements
Hi,
I would like to implement a method in Dart, something like the following:
So, my hope would be that by the 4th case in the switch the Dart compiler would deduce that none of the record fields can be null. It does not, therefore the 4h case does not compile.
I wonder if this is a limitation or a bug in the compiler. Also if there is some elegant way to rewrite this code to make it work with the current Dart compiler.
Thanks!
Marton
The text was updated successfully, but these errors were encountered: