Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart

Issue 2886873005: Minor type inference fixes to do with null and bottom types. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart b/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart
new file mode 100644
index 0000000000000000000000000000000000000000..852fb3fd716c2b84e6e45fdd97deef4c17f51301
--- /dev/null
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_returns.dart
@@ -0,0 +1,82 @@
+// Copyright (c) 2017, 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.
+
+/*@testedFeatures=inference*/
+library test;
+
+main() {
+ var /*@type=() -> Null*/ a = /*@returnType=Null*/ () {};
+ var /*@type=() -> Null*/ b = /*@returnType=Null*/ () {
+ return;
+ };
+ var /*@type=() -> Null*/ c = /*@returnType=Null*/ () {
+ return null;
+ };
+ var /*@type=() -> int*/ d = /*@returnType=int*/ () {
+ return 0;
+ };
+ var /*@type=(bool) -> Null*/ e = /*@returnType=Null*/ (bool b) {
+ if (b) {
+ return;
+ } else {
+ return;
+ }
+ };
+ var /*@type=(bool) -> Null*/ f = /*@returnType=Null*/ (bool b) {
+ if (b) {
+ return;
+ } else {
+ return null;
+ }
+ };
+ var /*@type=(bool) -> int*/ g = /*@returnType=int*/ (bool b) {
+ if (b) {
+ return;
+ } else {
+ return 0;
+ }
+ };
+ var /*@type=(bool) -> Null*/ h = /*@returnType=Null*/ (bool b) {
+ if (b) {
+ return null;
+ } else {
+ return;
+ }
+ };
+ var /*@type=(bool) -> Null*/ i = /*@returnType=Null*/ (bool b) {
+ if (b) {
+ return null;
+ } else {
+ return null;
+ }
+ };
+ var /*@type=(bool) -> int*/ j = /*@returnType=int*/ (bool b) {
+ if (b) {
+ return null;
+ } else {
+ return 0;
+ }
+ };
+ var /*@type=(bool) -> int*/ k = /*@returnType=int*/ (bool b) {
+ if (b) {
+ return 0;
+ } else {
+ return;
+ }
+ };
+ var /*@type=(bool) -> int*/ l = /*@returnType=int*/ (bool b) {
+ if (b) {
+ return 0;
+ } else {
+ return null;
+ }
+ };
+ var /*@type=(bool) -> int*/ m = /*@returnType=int*/ (bool b) {
+ if (b) {
+ return 0;
+ } else {
+ return 0;
+ }
+ };
+}

Powered by Google App Engine
This is Rietveld 408576698