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

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

Issue 2899073004: Use declared return type for inference of return and yield statements. (Closed)
Patch Set: Simpler implementation 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/local_return_and_yield.dart
diff --git a/pkg/front_end/testcases/inference/local_return_and_yield.dart b/pkg/front_end/testcases/inference/local_return_and_yield.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5feced12f33fe8d3a87e206d1e5fbab7ef57bf8c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/local_return_and_yield.dart
@@ -0,0 +1,42 @@
+// 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;
+
+import 'dart:async';
+
+typedef int IntToInt(int i);
+
+main() {
+ IntToInt a() {
+ return /*@returnType=int*/ (/*@type=int*/ x) => x;
+ }
+
+ Future<IntToInt> b() async {
+ // TODO(paulberry): this is broken due to bug 29689.
+ return /*@returnType=dynamic*/ (/*@type=dynamic*/ x) => x;
+ }
+
+ Iterable<IntToInt> c() sync* {
+ yield /*@returnType=int*/ (/*@type=int*/ x) => x;
+ }
+
+ Iterable<IntToInt> d() sync* {
+ yield* /*@typeArgs=(int) -> int*/ [
+ /*@returnType=int*/ (/*@type=int*/ x) => x
+ ];
+ }
+
+ Stream<IntToInt> e() async* {
+ yield /*@returnType=int*/ (/*@type=int*/ x) => x;
+ }
+
+ Stream<IntToInt> f() async* {
+ yield* new /*@typeArgs=(int) -> int*/ Stream.fromIterable(
+ /*@typeArgs=(int) -> int*/ [
+ /*@returnType=int*/ (/*@type=int*/ x) => x
+ ]);
+ }
+}
« no previous file with comments | « pkg/front_end/test/fasta/kompile.status ('k') | pkg/front_end/testcases/inference/local_return_and_yield.dart.direct.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698