You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like it should print (Object?) => Object? twice here, however this does not happen and dart throws a compile error instead.
Dart sample output is:
test.dart:22:11: Error: The argument type 'Object? Function(Never) Function()' can't be assigned to the parameter type 'Object? Function(Object?) Function()'.
'Object' is from 'dart:core'.
try { f(() => captureTypeArgument()); } catch(_) {};
^
Related issues against covariant and contravariant cases are: #44161, #44162.
The text was updated successfully, but these errors were encountered:
typeOf<check>() is obtained by applying i2b on the raw type check, and the resulting type is dynamic Function(dynamic). No errors at compile-time here.
capturedTypeArgument is the greatest closure of _ Function(_) with respect to {_}, which is Object? Function(Never). Note that there is no type T such that T Function(T) is this type, or even a supertype of this type, and this means that it is not possible to choose a type argument T to f such that an actual argument of type Object? Function(Never) Function() is type correct, and hence we get the compile-time error as described.
Dart SDK version: 2.12.0-29.0.dev (dev) (Mon Nov 9 06:42:00 2020 -0800) on "windows_x64"
Here is a source code example:
Seems like it should print
(Object?) => Object?
twice here, however this does not happen and dart throws a compile error instead.Dart sample output is:
Related issues against covariant and contravariant cases are: #44161, #44162.
The text was updated successfully, but these errors were encountered: