lib/main.dart:32:21: Error: A value of type 'void Function(bottom-type)' can't be assigned to a variable of type 'void Function<T extends Object>(T)'.
- 'Object' is from 'dart:core'.
foo = foo == null ? foo : foo as void Function<T extends Object>(T);
This is undesired as the code is valid.
Surprisingly, extracting the raw function type into a typedef makes the code compile:
Dart SDK version: 2.11.0-186.0.dev (dev) (Mon Oct 5 06:44:49 2020 -0700) on "macos_x64"
Note:
While there is a known workaround (typedef), the workaround is inapplicable for code-generators (as they do not see typedefs).
This is blocking https://github.com/rrousselGit/freezed/issues/258 from being fixed.
Consider:
This code does not compile with
This is undesired as the code is valid.
Surprisingly, extracting the raw function type into a typedef makes the code compile:
Dart version:
Note: While there is a known workaround (typedef), the workaround is inapplicable for code-generators (as they do not see typedefs). This is blocking https://github.com/rrousselGit/freezed/issues/258 from being fixed.