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

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

Issue 1059873002: Tweaks to warning level and reporting (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix up tests 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 | « test/checker/checker_test.dart ('k') | test/codegen/expect/BenchmarkBase.txt » ('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 /// Tests for type inference. 5 /// Tests for type inference.
6 library dev_compiler.test.inferred_type_test; 6 library dev_compiler.test.inferred_type_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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 // Same code with dynamic yields warnings 661 // Same code with dynamic yields warnings
662 testChecker({ 662 testChecker({
663 '/main.dart': ''' 663 '/main.dart': '''
664 class A { 664 class A {
665 int x = 2; 665 int x = 2;
666 } 666 }
667 667
668 test() { 668 test() {
669 dynamic a = new A(); 669 dynamic a = new A();
670 A b = /*info:DynamicCast*/a; 670 A b = /*info:DynamicCast*/a;
671 print(/*warning:DynamicInvoke*/a.x); 671 print(/*info:DynamicInvoke*/a.x);
672 print((/*warning:DynamicInvoke*/a.x) + 2); 672 print((/*info:DynamicInvoke*/a.x) + 2);
673 } 673 }
674 ''' 674 '''
675 }); 675 });
676 }); 676 });
677 677
678 test('propagate inference transitively ', () { 678 test('propagate inference transitively ', () {
679 testChecker({ 679 testChecker({
680 '/main.dart': ''' 680 '/main.dart': '''
681 class A { 681 class A {
682 int x = 2; 682 int x = 2;
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 testChecker({ 1476 testChecker({
1477 '/main.dart': ''' 1477 '/main.dart': '''
1478 typedef T Function2<S, T>(S x); 1478 typedef T Function2<S, T>(S x);
1479 1479
1480 void main () { 1480 void main () {
1481 { 1481 {
1482 Function2<int, String> l0 = (int x) => null; 1482 Function2<int, String> l0 = (int x) => null;
1483 Function2<int, String> l1 = (int x) => "hello"; 1483 Function2<int, String> l1 = (int x) => "hello";
1484 Function2<int, String> l2 = /*severe:StaticTypeError*/(String x) => "h ello"; 1484 Function2<int, String> l2 = /*severe:StaticTypeError*/(String x) => "h ello";
1485 Function2<int, String> l3 = /*severe:StaticTypeError*/(int x) => 3; 1485 Function2<int, String> l3 = /*severe:StaticTypeError*/(int x) => 3;
1486 Function2<int, String> l4 = /*warning:InferableClosure should be sever e:StaticTypeError*/(int x) {return 3}; 1486 Function2<int, String> l4 = /*warning:UninferredClosure should be seve re:StaticTypeError*/(int x) {return 3};
1487 } 1487 }
1488 { 1488 {
1489 Function2<int, String> l0 = /*info:InferredTypeClosure*/(x) => null; 1489 Function2<int, String> l0 = /*info:InferredTypeClosure*/(x) => null;
1490 Function2<int, String> l1 = /*info:InferredTypeClosure*/(x) => "hello" ; 1490 Function2<int, String> l1 = /*info:InferredTypeClosure*/(x) => "hello" ;
1491 Function2<int, String> l2 = /*severe:StaticTypeError*/(x) => 3; 1491 Function2<int, String> l2 = /*severe:StaticTypeError*/(x) => 3;
1492 Function2<int, String> l3 = /*warning:InferableClosure should be sever e:StaticTypeError*/(x) {return 3}; 1492 Function2<int, String> l3 = /*warning:UninferredClosure should be seve re:StaticTypeError*/(x) {return 3};
1493 } 1493 }
1494 { 1494 {
1495 Function2<int, List<String>> l0 = (int x) => null; 1495 Function2<int, List<String>> l0 = (int x) => null;
1496 Function2<int, List<String>> l1 = /*info:InferredTypeClosure*/(int x) => ["hello"]; 1496 Function2<int, List<String>> l1 = /*info:InferredTypeClosure*/(int x) => ["hello"];
1497 Function2<int, List<String>> l2 = /*severe:StaticTypeError*/(String x) => ["hello"]; 1497 Function2<int, List<String>> l2 = /*severe:StaticTypeError*/(String x) => ["hello"];
1498 Function2<int, List<String>> l3 = /*warning:InferableClosure should be severe:StaticTypeError*/(int x) => [3]; 1498 Function2<int, List<String>> l3 = /*warning:UninferredClosure should b e severe:StaticTypeError*/(int x) => [3];
1499 Function2<int, List<String>> l4 = /*warning:InferableClosure should be severe:StaticTypeError*/(int x) {return [3]}; 1499 Function2<int, List<String>> l4 = /*warning:UninferredClosure should b e severe:StaticTypeError*/(int x) {return [3]};
1500 } 1500 }
1501 { 1501 {
1502 Function2<int, int> l0 = /*info:InferredTypeClosure*/(x) => x; 1502 Function2<int, int> l0 = /*info:InferredTypeClosure*/(x) => x;
1503 Function2<int, int> l1 = /*info:InferredTypeClosure*/(x) => x+1; 1503 Function2<int, int> l1 = /*info:InferredTypeClosure*/(x) => x+1;
1504 Function2<int, String> l2 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => x; 1504 Function2<int, String> l2 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => x;
1505 Function2<int, String> l3 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => /*warning:DynamicInvoke should be pass*/x.substring(3) ; 1505 Function2<int, String> l3 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => /*info:DynamicInvoke should be pass*/x.substring(3);
1506 Function2<String, String> l4 = /*info:InferredTypeClosure*/(x) => /*wa rning:DynamicInvoke should be pass*/x.substring(3); 1506 Function2<String, String> l4 = /*info:InferredTypeClosure*/(x) => /*in fo:DynamicInvoke should be pass*/x.substring(3);
1507 } 1507 }
1508 } 1508 }
1509 ''' 1509 '''
1510 }, inferDownwards: true, wrapClosures: false); 1510 }, inferDownwards: true, wrapClosures: false);
1511 }); 1511 });
1512 } 1512 }
OLDNEW
« no previous file with comments | « test/checker/checker_test.dart ('k') | test/codegen/expect/BenchmarkBase.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698