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

Unified Diff: tests/language_2/regress_30339_test.dart

Issue 2993223002: [VM parser] Insert missing result type check in async functions using arrow (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « tests/language_2/language_2_dart2js.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language_2/regress_30339_test.dart
diff --git a/tests/language_2/regress_30339_test.dart b/tests/language_2/regress_30339_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..59ef53f2d0302c09f472bf49db15732e27e28c2d
--- /dev/null
+++ b/tests/language_2/regress_30339_test.dart
@@ -0,0 +1,37 @@
+// 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.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+isCheckedMode() {
+ try {
+ var i = 1;
+ String s = i;
+ return false;
+ } on TypeError {
+ return true;
+ }
+}
+
+var x = 'a';
+
+Future<int> foo() async {
+ return x;
+}
+
+Future<int> bar() async => x;
cbernaschina 2017/08/07 22:19:38 Should we test even against possible future optimi
regis 2017/08/07 22:37:38 What kind of optimizations do you have in mind? Th
+
+main() {
+ foo().then((_) {
+ Expect.isFalse(isCheckedMode());
+ }, onError: (e) {
+ Expect.isTrue(isCheckedMode() && (e is TypeError));
+ });
+ bar().then((_) {
+ Expect.isFalse(isCheckedMode());
+ }, onError: (e) {
+ Expect.isTrue(isCheckedMode() && (e is TypeError));
+ });
+}
« no previous file with comments | « tests/language_2/language_2_dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698