Files
sdk/pkg/front_end/testcases/nnbd/issue43174.dart
T
Johnni Winther 5c51990a80 [cfe] Handle void as return context in sync function expressions
Closes #43174

Change-Id: I6b1cc04cbf2d65d9b877dfabf3e0f535f2491a94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168542
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-21 13:43:03 +00:00

25 lines
433 B
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
method(void Function() f) {
f();
}
method2(FutureOr<void> Function() f) {
f();
}
test() {
method(() {
return 42; // error
});
method2(() {
return 42; // ok
});
}
main() {}