| OLD | NEW |
| 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:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 | 9 |
| 10 import '../testing.dart'; | 10 import '../testing.dart'; |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 group('infer type on overridden fields', () { | 730 group('infer type on overridden fields', () { |
| 731 testChecker( | 731 testChecker( |
| 732 '1', | 732 '1', |
| 733 { | 733 { |
| 734 '/main.dart': ''' | 734 '/main.dart': ''' |
| 735 class A { | 735 class A { |
| 736 int x = 2; | 736 int x = 2; |
| 737 } | 737 } |
| 738 | 738 |
| 739 class B extends A { | 739 class B extends A { |
| 740 /*severe:InferableOverride*/get x => 3; | 740 /*severe:InvalidMethodOverride*/get x => 3; |
| 741 } | 741 } |
| 742 | 742 |
| 743 foo() { | 743 foo() { |
| 744 String y = /*info:DynamicCast*/new B().x; | 744 String y = /*info:DynamicCast*/new B().x; |
| 745 int z = /*info:DynamicCast*/new B().x; | 745 int z = /*info:DynamicCast*/new B().x; |
| 746 } | 746 } |
| 747 ''' | 747 ''' |
| 748 }, | 748 }, |
| 749 inferFromOverrides: false); | 749 inferFromOverrides: false); |
| 750 | 750 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 770 | 770 |
| 771 testChecker( | 771 testChecker( |
| 772 '3', | 772 '3', |
| 773 { | 773 { |
| 774 '/main.dart': ''' | 774 '/main.dart': ''' |
| 775 class A { | 775 class A { |
| 776 int x = 2; | 776 int x = 2; |
| 777 } | 777 } |
| 778 | 778 |
| 779 class B implements A { | 779 class B implements A { |
| 780 /*severe:InferableOverride*/get x => 3; | 780 /*severe:InvalidMethodOverride*/get x => 3; |
| 781 } | 781 } |
| 782 | 782 |
| 783 foo() { | 783 foo() { |
| 784 String y = /*info:DynamicCast*/new B().x; | 784 String y = /*info:DynamicCast*/new B().x; |
| 785 int z = /*info:DynamicCast*/new B().x; | 785 int z = /*info:DynamicCast*/new B().x; |
| 786 } | 786 } |
| 787 ''' | 787 ''' |
| 788 }, | 788 }, |
| 789 inferFromOverrides: false); | 789 inferFromOverrides: false); |
| 790 | 790 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 | 834 |
| 835 testChecker( | 835 testChecker( |
| 836 '2', | 836 '2', |
| 837 { | 837 { |
| 838 '/main.dart': ''' | 838 '/main.dart': ''' |
| 839 class A<T> { | 839 class A<T> { |
| 840 T x; | 840 T x; |
| 841 } | 841 } |
| 842 | 842 |
| 843 class B implements A<int> { | 843 class B implements A<int> { |
| 844 /*severe:InferableOverride*/get x => 3; | 844 /*severe:InvalidMethodOverride*/get x => 3; |
| 845 } | 845 } |
| 846 | 846 |
| 847 foo() { | 847 foo() { |
| 848 String y = /*info:DynamicCast*/new B().x; | 848 String y = /*info:DynamicCast*/new B().x; |
| 849 int z = /*info:DynamicCast*/new B().x; | 849 int z = /*info:DynamicCast*/new B().x; |
| 850 } | 850 } |
| 851 ''' | 851 ''' |
| 852 }, | 852 }, |
| 853 inferFromOverrides: false); | 853 inferFromOverrides: false); |
| 854 | 854 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 inferDownwards: true); | 1590 inferDownwards: true); |
| 1591 | 1591 |
| 1592 testChecker('inferred initializing formal checks default value', { | 1592 testChecker('inferred initializing formal checks default value', { |
| 1593 '/main.dart': ''' | 1593 '/main.dart': ''' |
| 1594 class Foo { | 1594 class Foo { |
| 1595 var x = 1; | 1595 var x = 1; |
| 1596 Foo([this.x = /*severe:StaticTypeError*/"1"]); | 1596 Foo([this.x = /*severe:StaticTypeError*/"1"]); |
| 1597 }''' | 1597 }''' |
| 1598 }); | 1598 }); |
| 1599 } | 1599 } |
| OLD | NEW |