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

Side by Side Diff: tests/language/return_type_test.dart

Issue 2718513002: Void is not required to be `null` anymore. (Closed)
Patch Set: Update Kernel code. 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 unified diff | Download patch
« no previous file with comments | « tests/co19/co19-dartium.status ('k') | tests/language/void_check_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 isCheckedMode() { 7 isCheckedMode() {
8 try { 8 try {
9 var i = 1; 9 var i = 1;
10 String s = i; 10 String s = i;
11 return false; 11 return false;
12 } catch (e) { 12 } catch (e) {
13 return true; 13 return true;
14 } 14 }
15 } 15 }
16 16
17 int returnString1() => 's'; 17 int returnString1() => 's';
18 void returnNull() => null; 18 void returnNull() => null;
19 void returnString2() => 's'; 19 void returnString2() => 's';
20 20
21 main() { 21 main() {
22 if (isCheckedMode()) { 22 if (isCheckedMode()) {
23 Expect.throws(returnString1, (e) => e is TypeError); 23 Expect.throws(returnString1, (e) => e is TypeError);
24 Expect.throws(returnString2, (e) => e is TypeError); 24 returnString2();
25 returnNull(); 25 returnNull();
26 } else { 26 } else {
27 returnString1(); 27 returnString1();
28 returnNull(); 28 returnNull();
29 returnString2(); 29 returnString2();
30 } 30 }
31 } 31 }
OLDNEW
« no previous file with comments | « tests/co19/co19-dartium.status ('k') | tests/language/void_check_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698