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

Side by Side Diff: pkg/analyzer/test/src/task/strong/non_null_checker_test.dart

Issue 2362563004: re-land fix #27110 with proper DDC side of changes (Closed)
Patch Set: add tests Created 4 years, 3 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
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 4
5 // These tests are for an experimental feature that treats Dart primitive types 5 // These tests are for an experimental feature that treats Dart primitive types
6 // (int, bool, double, etc.) as non-nullable. This file is not evidence for an 6 // (int, bool, double, etc.) as non-nullable. This file is not evidence for an
7 // intention to officially support non-nullable primitives in Dart (or general 7 // intention to officially support non-nullable primitives in Dart (or general
8 // NNBD, for that matter) so don't get too crazy about it. 8 // NNBD, for that matter) so don't get too crazy about it.
9 9
10 library analyzer.test.src.task.non_null_primitives.checker_test; 10 library analyzer.test.src.task.non_null_primitives.checker_test;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 } 105 }
106 '''); 106 ''');
107 } 107 }
108 108
109 void test_compoundAssignment() { 109 void test_compoundAssignment() {
110 addFile(''' 110 addFile('''
111 void main() { 111 void main() {
112 int i = 1; 112 int i = 1;
113 i += 2; 113 i += 2;
114 /*error:STATIC_TYPE_ERROR*/i += null; 114 /*error:INVALID_ASSIGNMENT*/i += null;
115 print(i); 115 print(i);
116 } 116 }
117 '''); 117 ''');
118 check(nonnullableTypes: <String>['dart:core,int']); 118 check(nonnullableTypes: <String>['dart:core,int']);
119 } 119 }
120 120
121 void test_forEach() { 121 void test_forEach() {
122 addFile(''' 122 addFile('''
123 void main() { 123 void main() {
124 var ints = <num>[1, 2, 3, null]; 124 var ints = <num>[1, 2, 3, null];
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 legs.insert("goat", 4); 306 legs.insert("goat", 4);
307 legs.insert("chicken", 2); 307 legs.insert("chicken", 2);
308 308
309 int x = legs.get("goat"); // This should not produce an error. 309 int x = legs.get("goat"); // This should not produce an error.
310 int y = legs.get("sheep"); // TODO(stanm): Runtime error here. 310 int y = legs.get("sheep"); // TODO(stanm): Runtime error here.
311 } 311 }
312 '''); 312 ''');
313 check(nonnullableTypes: <String>['dart:core,int']); 313 check(nonnullableTypes: <String>['dart:core,int']);
314 } 314 }
315 } 315 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/strong/checker_test.dart ('k') | pkg/dev_compiler/lib/js/amd/dart_sdk.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698