| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.static_warning_code_test; | 5 library engine.static_warning_code_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/source_io.dart'; | 7 import 'package:analyzer/src/generated/source_io.dart'; |
| 8 import 'package:analyzer/src/generated/error.dart'; | 8 import 'package:analyzer/src/generated/error.dart'; |
| 9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 class B extends A { | 1366 class B extends A { |
| 1367 } | 1367 } |
| 1368 class C extends B { | 1368 class C extends B { |
| 1369 void n() {} | 1369 void n() {} |
| 1370 }'''); | 1370 }'''); |
| 1371 resolve(source); | 1371 resolve(source); |
| 1372 assertErrors(source, [StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_S
UPERCLASS_STATIC]); | 1372 assertErrors(source, [StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_S
UPERCLASS_STATIC]); |
| 1373 verify([source]); | 1373 verify([source]); |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 void test_instanceMethodNameCollidesWithSuperclassStatic_interface() { |
| 1377 Source source = addSource(r''' |
| 1378 class Base { |
| 1379 static foo() {} |
| 1380 } |
| 1381 abstract class Ifc { |
| 1382 foo(); |
| 1383 } |
| 1384 class C extends Base implements Ifc { |
| 1385 foo() {} |
| 1386 } |
| 1387 '''); |
| 1388 resolve(source); |
| 1389 assertErrors(source, [ |
| 1390 StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC])
; |
| 1391 verify([source]); |
| 1392 } |
| 1393 |
| 1376 void test_instanceMethodNameCollidesWithSuperclassStatic_method() { | 1394 void test_instanceMethodNameCollidesWithSuperclassStatic_method() { |
| 1377 Source source = addSource(r''' | 1395 Source source = addSource(r''' |
| 1378 class A { | 1396 class A { |
| 1379 static n () {} | 1397 static n () {} |
| 1380 } | 1398 } |
| 1381 class B extends A { | 1399 class B extends A { |
| 1382 void n() {} | 1400 void n() {} |
| 1383 }'''); | 1401 }'''); |
| 1384 resolve(source); | 1402 resolve(source); |
| 1385 assertErrors(source, [StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_S
UPERCLASS_STATIC]); | 1403 assertErrors(source, [StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_S
UPERCLASS_STATIC]); |
| (...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3137 }'''); | 3155 }'''); |
| 3138 resolve(source); | 3156 resolve(source); |
| 3139 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); | 3157 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); |
| 3140 } | 3158 } |
| 3141 } | 3159 } |
| 3142 | 3160 |
| 3143 main() { | 3161 main() { |
| 3144 groupSep = ' | '; | 3162 groupSep = ' | '; |
| 3145 runReflectiveTests(StaticWarningCodeTest); | 3163 runReflectiveTests(StaticWarningCodeTest); |
| 3146 } | 3164 } |
| OLD | NEW |