| 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 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 8 | 8 |
| 9 import 'strong_test_helper.dart'; | 9 import 'strong_test_helper.dart'; |
| 10 | 10 |
| (...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2654 abstract class D extends Object with M<num> {} | 2654 abstract class D extends Object with M<num> {} |
| 2655 class E extends D with M<int> { | 2655 class E extends D with M<int> { |
| 2656 /*error:INVALID_METHOD_OVERRIDE*/int x; | 2656 /*error:INVALID_METHOD_OVERRIDE*/int x; |
| 2657 } | 2657 } |
| 2658 class F extends D with M<int> { | 2658 class F extends D with M<int> { |
| 2659 num x; | 2659 num x; |
| 2660 } | 2660 } |
| 2661 '''); | 2661 '''); |
| 2662 } | 2662 } |
| 2663 | 2663 |
| 2664 test_interfacesFromMixinsOnlyConsiderMostDerivedMember() { |
| 2665 // Regression test for dart2js interface pattern in strong mode. |
| 2666 return checkFile(r''' |
| 2667 abstract class I1 { num get x; } |
| 2668 abstract class I2 extends I1 { int get x; } |
| 2669 |
| 2670 class M1 { num get x => 0; } |
| 2671 class M2 { int get x => 0; } |
| 2672 |
| 2673 class Base extends Object with M1 implements I1 {} |
| 2674 class Child extends Base with M2 implements I2 {} |
| 2675 |
| 2676 class C extends Object with M1, M2 implements I1, I2 {} |
| 2677 '''); |
| 2678 } |
| 2679 |
| 2664 test_invalidOverrides_baseClassOverrideToChildInterface() async { | 2680 test_invalidOverrides_baseClassOverrideToChildInterface() async { |
| 2665 await checkFile(''' | 2681 await checkFile(''' |
| 2666 class A {} | 2682 class A {} |
| 2667 class B {} | 2683 class B {} |
| 2668 | 2684 |
| 2669 abstract class I { | 2685 abstract class I { |
| 2670 m(A a); | 2686 m(A a); |
| 2671 } | 2687 } |
| 2672 | 2688 |
| 2673 class Base { | 2689 class Base { |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3280 } | 3296 } |
| 3281 | 3297 |
| 3282 class Base { | 3298 class Base { |
| 3283 m(B a) {} | 3299 m(B a) {} |
| 3284 } | 3300 } |
| 3285 | 3301 |
| 3286 class M { | 3302 class M { |
| 3287 m(B a) {} | 3303 m(B a) {} |
| 3288 } | 3304 } |
| 3289 | 3305 |
| 3290 // Here we want to report both, because the error location is | 3306 // TODO(jmesserly): the `INCONSISTENT_METHOD_INHERITANCE` message is from the |
| 3291 // different. | 3307 // Dart 1 checking logic (using strong mode type system), it is not produced |
| 3292 // TODO(sigmund): should we merge these as well? | 3308 // by the strong mode OverrideChecker. |
| 3293 class /*error:INCONSISTENT_METHOD_INHERITANCE*/T1 | 3309 class /*error:INCONSISTENT_METHOD_INHERITANCE*/T1 |
| 3294 /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/extends Base | 3310 extends Base |
| 3295 with /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/M | 3311 with /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/M |
| 3296 implements I1 {} | 3312 implements I1 {} |
| 3297 | 3313 |
| 3298 | |
| 3299 // Here we want to report both, because the error location is | |
| 3300 // different. | |
| 3301 // TODO(sigmund): should we merge these as well? | |
| 3302 class /*error:INCONSISTENT_METHOD_INHERITANCE*/U1 = | 3314 class /*error:INCONSISTENT_METHOD_INHERITANCE*/U1 = |
| 3303 /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/Base | 3315 Base |
| 3304 with /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/M | 3316 with /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/M |
| 3305 implements I1; | 3317 implements I1; |
| 3306 '''); | 3318 '''); |
| 3307 } | 3319 } |
| 3308 | 3320 |
| 3309 test_noDuplicateReports_twoGrandTypesOverrideSameMethodInInterface() async { | 3321 test_noDuplicateReports_twoGrandTypesOverrideSameMethodInInterface() async { |
| 3310 await checkFile(''' | 3322 await checkFile(''' |
| 3311 class A {} | 3323 class A {} |
| 3312 class B {} | 3324 class B {} |
| 3313 | 3325 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3344 } | 3356 } |
| 3345 | 3357 |
| 3346 class M1 { | 3358 class M1 { |
| 3347 m(B a) {} | 3359 m(B a) {} |
| 3348 } | 3360 } |
| 3349 | 3361 |
| 3350 class M2 { | 3362 class M2 { |
| 3351 m(B a) {} | 3363 m(B a) {} |
| 3352 } | 3364 } |
| 3353 | 3365 |
| 3354 // Here we want to report both, because the error location is | |
| 3355 // different. | |
| 3356 // TODO(sigmund): should we merge these as well? | |
| 3357 class /*error:INCONSISTENT_METHOD_INHERITANCE*/T1 extends Object | 3366 class /*error:INCONSISTENT_METHOD_INHERITANCE*/T1 extends Object |
| 3358 with /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/M1, | 3367 with M1, |
| 3359 /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/M2 | 3368 /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/M2 |
| 3360 implements I1 {} | 3369 implements I1 {} |
| 3361 '''); | 3370 '''); |
| 3362 } | 3371 } |
| 3363 | 3372 |
| 3364 test_noDuplicateReports_typeAndBaseTypeOverrideSameMethodInInterface() async { | 3373 test_noDuplicateReports_typeAndBaseTypeOverrideSameMethodInInterface() async { |
| 3365 await checkFile(''' | 3374 await checkFile(''' |
| 3366 class A {} | 3375 class A {} |
| 3367 class B {} | 3376 class B {} |
| 3368 | 3377 |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 class CheckerTest_Driver extends CheckerTest { | 4396 class CheckerTest_Driver extends CheckerTest { |
| 4388 @override | 4397 @override |
| 4389 bool get enableNewAnalysisDriver => true; | 4398 bool get enableNewAnalysisDriver => true; |
| 4390 | 4399 |
| 4391 @failingTest | 4400 @failingTest |
| 4392 @override | 4401 @override |
| 4393 test_covariantOverride_fields() async { | 4402 test_covariantOverride_fields() async { |
| 4394 await super.test_covariantOverride_fields(); | 4403 await super.test_covariantOverride_fields(); |
| 4395 } | 4404 } |
| 4396 } | 4405 } |
| OLD | NEW |