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 library analyzer.test.src.task.strong.checker_test; | 5 library analyzer.test.src.task.strong.checker_test; |
6 | 6 |
7 import '../../../reflective_tests.dart'; | 7 import '../../../reflective_tests.dart'; |
8 import 'strong_test_helper.dart'; | 8 import 'strong_test_helper.dart'; |
9 | 9 |
10 void main() { | 10 void main() { |
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 void test_implicitCasts() { | 1910 void test_implicitCasts() { |
1911 addFile('num n; int i = /*info:ASSIGNMENT_CAST*/n;'); | 1911 addFile('num n; int i = /*info:ASSIGNMENT_CAST*/n;'); |
1912 check(); | 1912 check(); |
1913 // TODO(jmesserly): should not be emitting the hint as well as the error. | 1913 // TODO(jmesserly): should not be emitting the hint as well as the error. |
1914 // It is a "strong mode hint" however, so it will not be user visible. | 1914 // It is a "strong mode hint" however, so it will not be user visible. |
1915 addFile( | 1915 addFile( |
1916 'num n; int i = /*info:ASSIGNMENT_CAST,error:INVALID_ASSIGNMENT*/n;'); | 1916 'num n; int i = /*info:ASSIGNMENT_CAST,error:INVALID_ASSIGNMENT*/n;'); |
1917 check(implicitCasts: false); | 1917 check(implicitCasts: false); |
1918 } | 1918 } |
1919 | 1919 |
| 1920 void test_implicitCasts_genericMethods() { |
| 1921 addFile('var x = <String>[].map((x) => "");'); |
| 1922 check(implicitCasts: false); |
| 1923 } |
| 1924 |
1920 void test_implicitDynamic_field() { | 1925 void test_implicitDynamic_field() { |
1921 addFile(r''' | 1926 addFile(r''' |
1922 class C { | 1927 class C { |
1923 var /*error:IMPLICIT_DYNAMIC_FIELD*/x0; | 1928 var /*error:IMPLICIT_DYNAMIC_FIELD*/x0; |
1924 var /*error:IMPLICIT_DYNAMIC_FIELD*/x1 = (<dynamic>[])[0]; | 1929 var /*error:IMPLICIT_DYNAMIC_FIELD*/x1 = (<dynamic>[])[0]; |
1925 var /*error:IMPLICIT_DYNAMIC_FIELD*/x2, | 1930 var /*error:IMPLICIT_DYNAMIC_FIELD*/x2, |
1926 x3 = 42, | 1931 x3 = 42, |
1927 /*error:IMPLICIT_DYNAMIC_FIELD*/x4; | 1932 /*error:IMPLICIT_DYNAMIC_FIELD*/x4; |
1928 dynamic y0; | 1933 dynamic y0; |
1929 dynamic y1 = (<dynamic>[])[0]; | 1934 dynamic y1 = (<dynamic>[])[0]; |
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3535 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 3540 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
3536 checkFile(''' | 3541 checkFile(''' |
3537 typedef int Foo(); | 3542 typedef int Foo(); |
3538 void foo() {} | 3543 void foo() {} |
3539 void main () { | 3544 void main () { |
3540 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 3545 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
3541 } | 3546 } |
3542 '''); | 3547 '''); |
3543 } | 3548 } |
3544 } | 3549 } |
OLD | NEW |