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

Side by Side Diff: tests/compiler/dart2js/cpa_inference_test.dart

Issue 11415115: Handle null in augmentField (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart ('k') | no next file » | 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 "dart:uri"; 5 import "dart:uri";
6 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"; 6 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t";
7 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt'; 7 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt';
8 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; 8 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
9 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'; 9 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart';
10 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; 10 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart';
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 var x; 354 var x;
355 A(this.x); 355 A(this.x);
356 get y => x; 356 get y => x;
357 get z => y; 357 get z => y;
358 } 358 }
359 main() { 359 main() {
360 var a = new A(42); 360 var a = new A(42);
361 var foo = a.x; 361 var foo = a.x;
362 var bar = a.y; 362 var bar = a.y;
363 var baz = a.z; 363 var baz = a.z;
364 foo; bar; baz; 364 var qux = null.x;
365 foo; bar; baz; qux;
365 } 366 }
366 """; 367 """;
367 AnalysisResult result = analyze(source); 368 AnalysisResult result = analyze(source);
368 result.checkNodeHasType('foo', [result.int]); 369 result.checkNodeHasType('foo', [result.int]);
369 result.checkNodeHasType('bar', [result.int]); 370 result.checkNodeHasType('bar', [result.int]);
370 result.checkNodeHasType('baz', [result.int]); 371 result.checkNodeHasType('baz', [result.int]);
372 result.checkNodeHasType('qux', []);
371 } 373 }
372 374
373 testSetters() { 375 testSetters() {
374 final String source = r""" 376 final String source = r"""
375 class A { 377 class A {
376 var x; 378 var x;
377 var w; 379 var w;
378 A(this.x, this.w); 380 A(this.x, this.w);
379 set y(a) { x = a; z = a; } 381 set y(a) { x = a; z = a; }
380 set z(a) { w = a; } 382 set z(a) { w = a; }
381 } 383 }
382 main() { 384 main() {
383 var a = new A(42, 42); 385 var a = new A(42, 42);
384 a.x = 'abc'; 386 a.x = 'abc';
385 a.y = true; 387 a.y = true;
388 null.x = 42; // should be ignored
386 } 389 }
387 """; 390 """;
388 AnalysisResult result = analyze(source); 391 AnalysisResult result = analyze(source);
389 result.checkFieldHasType('A', 'x', [result.int, result.string, result.bool]); 392 result.checkFieldHasType('A', 'x', [result.int, result.string, result.bool]);
390 result.checkFieldHasType('A', 'w', [result.int, result.bool]); 393 result.checkFieldHasType('A', 'w', [result.int, result.bool]);
391 } 394 }
392 395
393 testNamedParameters() { 396 testNamedParameters() {
394 final String source = r""" 397 final String source = r"""
395 class A { 398 class A {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 testListLiterals(); 611 testListLiterals();
609 testMapLiterals(); 612 testMapLiterals();
610 testReturn(); 613 testReturn();
611 // testNoReturn(); // right now we infer the empty type instead of null 614 // testNoReturn(); // right now we infer the empty type instead of null
612 testArithmeticOperators(); 615 testArithmeticOperators();
613 testOperators(); 616 testOperators();
614 testCompoundOperators1(); 617 testCompoundOperators1();
615 testCompoundOperators2(); 618 testCompoundOperators2();
616 // testFieldInitialization(); // TODO(polux) 619 // testFieldInitialization(); // TODO(polux)
617 } 620 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698