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

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

Issue 2879153005: Add support to dart2js for option --enable-asserts. (Closed)
Patch Set: Added !$checked to section predicate in co19 status file Created 3 years, 5 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/language/language_dart2js.status ('k') | tests/language/type_error_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 // Dart test for testing the ternary operator. 4 // Dart test for testing the ternary operator.
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 // Test that `Null` acts like the bottom type - less than any other type. 8 // Test that `Null` acts like the bottom type - less than any other type.
9 9
10 bool isCheckedMode = () {
11 bool c = false;
12 assert(c = true);
13 return c;
14 }();
15
16 typedef R Fun<A, R>(A argument); 10 typedef R Fun<A, R>(A argument);
17 11
18 class C<T> { 12 class C<T> {
19 const C(); 13 const C();
20 T returns() => null; 14 T returns() => null;
21 void accepts(T x) {} 15 void accepts(T x) {}
22 } 16 }
23 17
24 class NullBound<T extends num> {} 18 class NullBound<T extends num> {}
25 19
(...skipping 24 matching lines...) Expand all
50 Expect.isNotNull(ccn as C<C<Null>>); 44 Expect.isNotNull(ccn as C<C<Null>>);
51 Expect.isNotNull(ccn as C<C<Object>>); 45 Expect.isNotNull(ccn as C<C<Object>>);
52 Expect.isNotNull(ccn as C<C<int>>); 46 Expect.isNotNull(ccn as C<C<int>>);
53 47
54 var ci = new C<int>(); 48 var ci = new C<int>();
55 Expect.isFalse(ci is C<Null>); 49 Expect.isFalse(ci is C<Null>);
56 50
57 var co = new C<Object>(); 51 var co = new C<Object>();
58 Expect.isFalse(co is C<Null>); 52 Expect.isFalse(co is C<Null>);
59 53
60 if (!isCheckedMode) return; 54 if (!typeAssertionsEnabled) return;
61 55
62 List<int> li1 = const <Null>[]; 56 List<int> li1 = const <Null>[];
63 57
64 C<Null> x1 = cn; 58 C<Null> x1 = cn;
65 C<Object> x2 = cn; 59 C<Object> x2 = cn;
66 60
67 Expect.identical(x1, cn); 61 Expect.identical(x1, cn);
68 Expect.identical(x2, cn); 62 Expect.identical(x2, cn);
69 63
70 const C<Null> cocn = const C<Null>(); 64 const C<Null> cocn = const C<Null>();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Null foo(Null x) => null; 126 Null foo(Null x) => null;
133 Null bar(Null x) => null; 127 Null bar(Null x) => null;
134 int baz(int x) => x; 128 int baz(int x) => x;
135 int qux(int x) => x; 129 int qux(int x) => x;
136 } 130 }
137 131
138 // Avoid "variable not used" warnings. 132 // Avoid "variable not used" warnings.
139 use(x) { 133 use(x) {
140 return identical(x, x); 134 return identical(x, x);
141 } 135 }
OLDNEW
« no previous file with comments | « tests/language/language_dart2js.status ('k') | tests/language/type_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698