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
The following code produces an error in VM and no issues in analyzer (both with --enable-experiment=non-nullable)
main() {
(x) {
if (x)
return1;
} (true);
}
VM output is
D:\co19\Language\Statements\Return>dart --enable-experiment=non-nullable,nonfunction-type-aliases many_return_statements_t04.dart
many_return_statements_t04.dart:21:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
(x) {
^
Dart VM version: 2.9.0-20.0.dev (dev) (Wed Jul 1 11:29:16 2020 +0200) on "windows_x64"
@eernstg please clarify what is an expected behavior here
The text was updated successfully, but these errors were encountered:
Blocked on dart-lang/language#1063: the current specification makes the function literal an error, and I'm proposing that we keep it like that even though it means that the analyzer will reject more programs.
lrhn
changed the title
[NNBD] Analyzer and CFE bevahe differenly for implicit return
[NNBD] Analyzer and CFE behave differently for implicit return
Jul 7, 2020
Yes, when the end of a function with inferred return type can be reached (and null is implicitly returned), the inferred return type is made nullable and there is no error.
Implementation issue for CFE, #42743, is closed. The analyzer already did this.
The following code produces an error in VM and no issues in analyzer (both with
--enable-experiment=non-nullable
)VM output is
Dart VM version: 2.9.0-20.0.dev (dev) (Wed Jul 1 11:29:16 2020 +0200) on "windows_x64"
@eernstg please clarify what is an expected behavior here
The text was updated successfully, but these errors were encountered: