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

Side by Side Diff: test/checker/checker_test.dart

Issue 1038213003: Downward inference (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Rebase Created 5 years, 8 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 | « lib/src/testing.dart ('k') | test/checker/inferred_type_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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// General type checking tests 5 /// General type checking tests
6 library dev_compiler.test.checker_test; 6 library dev_compiler.test.checker_test;
7 7
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import 'package:dev_compiler/src/testing.dart'; 10 import 'package:dev_compiler/src/testing.dart';
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 test('Subtyping literals', () { 1482 test('Subtyping literals', () {
1483 testChecker({ 1483 testChecker({
1484 '/main.dart': ''' 1484 '/main.dart': '''
1485 test() { 1485 test() {
1486 Iterable i1 = [1, 2, 3]; 1486 Iterable i1 = [1, 2, 3];
1487 i1 = <int>[1, 2, 3]; 1487 i1 = <int>[1, 2, 3];
1488 1488
1489 List l1 = [1, 2, 3]; 1489 List l1 = [1, 2, 3];
1490 l1 = <int>[1, 2, 3]; 1490 l1 = <int>[1, 2, 3];
1491 1491
1492 Iterable<int> i2 = /*warning:InferableLiteral*/[1, 2, 3]; 1492 Iterable<int> i2 = /*severe:StaticTypeError*/[1, 2, 3];
1493 i2 = /*warning:DownCastComposite*/i1; 1493 i2 = /*warning:DownCastComposite*/i1;
1494 i2 = /*warning:DownCastComposite*/l1; 1494 i2 = /*warning:DownCastComposite*/l1;
1495 i2 = <int>[1, 2, 3]; 1495 i2 = <int>[1, 2, 3];
1496 1496
1497 List<int> l2 = /*warning:InferableLiteral*/[1, 2, 3]; 1497 List<int> l2 = /*severe:StaticTypeError*/[1, 2, 3];
1498 l2 = /*warning:DownCastComposite*/i1; 1498 l2 = /*warning:DownCastComposite*/i1;
1499 l2 = /*warning:DownCastComposite*/l1; 1499 l2 = /*warning:DownCastComposite*/l1;
1500 1500
1501 l2 = /*warning:InferableAllocation*/new List(); 1501 l2 = /*severe:StaticTypeError*/new List();
1502 l2 = /*warning:InferableAllocation*/new List(10); 1502 l2 = /*severe:StaticTypeError*/new List(10);
1503 l2 = /*warning:InferableAllocation*/new List.filled(10, 42); 1503 l2 = /*severe:StaticTypeError*/new List.filled(10, 42);
1504 } 1504 }
1505 ''' 1505 '''
1506 }); 1506 }, inferDownwards: false);
1507 }); 1507 });
1508 1508
1509 test('Type checking literals', () { 1509 test('Type checking literals', () {
1510 testChecker({ 1510 testChecker({
1511 '/main.dart': ''' 1511 '/main.dart': '''
1512 test() { 1512 test() {
1513 num n = 3; 1513 num n = 3;
1514 int i = 3; 1514 int i = 3;
1515 String s = "hello"; 1515 String s = "hello";
1516 { 1516 {
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 f = bar as II2D; 2800 f = bar as II2D;
2801 f = bar as DD2I; 2801 f = bar as DD2I;
2802 f = bar as DI2D; 2802 f = bar as DI2D;
2803 f = bar as ID2D; 2803 f = bar as ID2D;
2804 f = bar as DD2D; 2804 f = bar as DD2D;
2805 } 2805 }
2806 ''' 2806 '''
2807 }); 2807 });
2808 }); 2808 });
2809 } 2809 }
OLDNEW
« no previous file with comments | « lib/src/testing.dart ('k') | test/checker/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698