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 // TODO(jmesserly): this file needs to be refactored, it's a port from | 5 // TODO(jmesserly): this file needs to be refactored, it's a port from |
6 // package:dev_compiler's tests | 6 // package:dev_compiler's tests |
7 /// General type checking tests | 7 /// General type checking tests |
8 library analyzer.test.src.task.strong.checker_test; | 8 library analyzer.test.src.task.strong.checker_test; |
9 | 9 |
10 import '../../../reflective_tests.dart'; | 10 import '../../../reflective_tests.dart'; |
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 do {} while (/*warning:NON_BOOL_CONDITION*/i); | 1893 do {} while (/*warning:NON_BOOL_CONDITION*/i); |
1894 | 1894 |
1895 for (;b;) {} | 1895 for (;b;) {} |
1896 for (;/*info:DYNAMIC_CAST*/dyn;) {} | 1896 for (;/*info:DYNAMIC_CAST*/dyn;) {} |
1897 for (;/*info:DOWN_CAST_IMPLICIT*/obj;) {} | 1897 for (;/*info:DOWN_CAST_IMPLICIT*/obj;) {} |
1898 for (;/*warning:NON_BOOL_CONDITION*/i;) {} | 1898 for (;/*warning:NON_BOOL_CONDITION*/i;) {} |
1899 } | 1899 } |
1900 '''); | 1900 '''); |
1901 } | 1901 } |
1902 | 1902 |
| 1903 void test_implicitCasts() { |
| 1904 addFile('num n; int i = /*info:ASSIGNMENT_CAST*/n;'); |
| 1905 check(); |
| 1906 addFile('num n; int i = /*warning:ASSIGNMENT_CAST*/n;'); |
| 1907 check(implicitCasts: false); |
| 1908 } |
| 1909 |
1903 void test_invalidOverrides_baseClassOverrideToChildInterface() { | 1910 void test_invalidOverrides_baseClassOverrideToChildInterface() { |
1904 checkFile(''' | 1911 checkFile(''' |
1905 class A {} | 1912 class A {} |
1906 class B {} | 1913 class B {} |
1907 | 1914 |
1908 abstract class I { | 1915 abstract class I { |
1909 m(A a); | 1916 m(A a); |
1910 } | 1917 } |
1911 | 1918 |
1912 class Base { | 1919 class Base { |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3293 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 3300 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
3294 checkFile(''' | 3301 checkFile(''' |
3295 typedef int Foo(); | 3302 typedef int Foo(); |
3296 void foo() {} | 3303 void foo() {} |
3297 void main () { | 3304 void main () { |
3298 Foo x = /*warning:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 3305 Foo x = /*warning:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
3299 } | 3306 } |
3300 '''); | 3307 '''); |
3301 } | 3308 } |
3302 } | 3309 } |
OLD | NEW |