Closed
Description
We'll have to check the places, but I think this is mainly:
- subtype checks & assignability
- type promotion (is checks)
The hint should instruct the user how to fix. For arity checks and types of variables, one can use Null as the parameter type instead of dynamic. To call a function like that one can cast to dynamic:
typedef TwoArgFunction(x, y);
test(g) {
if (g is TwoArgFunction) print(g('hello ', 'world'));
}
main() {
test((String x, String y) => x + y);
test((int x, int y) => x + y);
}
new code:
typedef TwoArgFunction(Null x, Null y); // NOTE: Null
test(g) {
if (g is TwoArgFunction) print((g as dynamic)('hello ', 'world')); // NOTE: cast
}
main() {
test((String x, String y) => x + y);
test((int x, int y) => x + y);
}
EDIT: marked this as a soundness issue because we don't really want to implement proper runtime checks for this. See blocked DDC bug #29295.