Closed
Description
Dart VM version: 1.14.0-dev.4.0.
This is OK:
typedef int ProcessFunction(int v);
int foo(int a) => a * 2;
int bar(int b) => b * 3;
ProcessFunction process;
void main() {
var t = true;
if (t) process = foo;
else process = bar;
}
However this
typedef int ProcessFunction(int v);
int foo(int a) => a * 2;
int bar(int b) => b * 3;
ProcessFunction process;
void main() {
var t = true;
process = t ? foo : bar;
}
results in WARNING: t ? foo : bar (Function) will need runtime check to cast to type (int) → int
.