-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ondevexp-warningIssues with the analyzer's Warning codesIssues with the analyzer's Warning codeslegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.soundnesstype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
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.
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ondevexp-warningIssues with the analyzer's Warning codesIssues with the analyzer's Warning codeslegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.soundnesstype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug