-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Labels
flow-analysisDiscussions about possible future improvements to flow analysisDiscussions about possible future improvements to flow analysis
Description
The following function:
int foo({int? arg}) {
arg = 0;
return (() => arg)();
}
Produces this error:
error • A value of type 'int?' can't be returned from the function 'foo' because it has a return type of 'int'. • test.dart:3:10 • return_of_invalid_type
Despite the fact that arg
will clearly always be non-null when it's returned. There's not even a hypothetical risk that arg
will be reassigned to null
between the function being created and being invoked, since the non-nullable assignment appears before the function is created and no nullable assignments exist anywhere.
taylankasap, srawlins, jwebbed, gnprice, rubenferreira97 and 6 more
Metadata
Metadata
Assignees
Labels
flow-analysisDiscussions about possible future improvements to flow analysisDiscussions about possible future improvements to flow analysis