Chromium Code Reviews| Index: pkg/analyzer/test/src/task/strong/checker_test.dart |
| diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart |
| index e1be1b3a56e5d3a6fea435273949f18b566be0be..920a2bba4de0f74cd4e9f9ee19161d127771f2f2 100644 |
| --- a/pkg/analyzer/test/src/task/strong/checker_test.dart |
| +++ b/pkg/analyzer/test/src/task/strong/checker_test.dart |
| @@ -500,12 +500,7 @@ void main() { |
| } |
| void test_covariantOverride() { |
| - addFile(r''' |
| -library meta; |
| -class _Checked { const _Checked(); } |
| -const Object checked = const _Checked(); |
| - ''', name: '/meta.dart'); |
| - |
| + _addMetaLibrary(); |
| checkFile(r''' |
| import 'meta.dart'; |
| class C { |
| @@ -538,12 +533,7 @@ class G_error extends E implements D { |
| } |
| void test_covariantOverride_leastUpperBound() { |
| - addFile(r''' |
| -library meta; |
| -class _Checked { const _Checked(); } |
| -const Object checked = const _Checked(); |
| - ''', name: '/meta.dart'); |
| - |
| + _addMetaLibrary(); |
| checkFile(r''' |
| import "meta.dart"; |
| abstract class Top {} |
| @@ -568,12 +558,7 @@ abstract class TakesBottom implements TakesLeft, TakesRight { |
| } |
| void test_covariantOverride_markerIsInherited() { |
| - addFile(r''' |
| -library meta; |
| -class _Checked { const _Checked(); } |
| -const Object checked = const _Checked(); |
| - ''', name: '/meta.dart'); |
| - |
| + _addMetaLibrary(); |
| checkFile(r''' |
| import 'meta.dart'; |
| class C { |
| @@ -3115,6 +3100,37 @@ abstract class D extends C { |
| check(implicitCasts: false); |
| } |
| + void test_overrideNarrowsType_noDuplicateError() { |
| + // Regression test for https://github.com/dart-lang/sdk/issues/25232 |
| + _addMetaLibrary(); |
| + checkFile(r''' |
| +import 'meta.dart'; |
| +abstract class A { void test(A arg) { } } |
| +abstract class B extends A { |
| + /*error:INVALID_METHOD_OVERRIDE*/void test(B arg) { } |
| +} |
| +abstract class X implements A { } |
| +class C extends B with X { } |
| + |
| +// We treat "implements A" as asking for another check. |
| +// This feels inconsistent to me. |
| +class D /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/extends B implements A { } |
|
Jennifer Messerly
2016/09/15 01:03:10
I'm not a fan of this either, but it's not as supe
|
| + '''); |
| + } |
| + |
| + void test_overrideNarrowsType_legalWithChecked() { |
| + // Regression test for https://github.com/dart-lang/sdk/issues/25232 |
| + _addMetaLibrary(); |
| + checkFile(r''' |
| +import 'meta.dart'; |
| +abstract class A { void test(A arg) { } } |
| +abstract class B extends A { void test(@checked B arg) { } } |
| +abstract class X implements A { } |
| +class C extends B with X { } |
|
Jennifer Messerly
2016/09/15 01:03:10
this was broken! even though we had @checked. OUCH
|
| +class D extends B implements A { } |
| + '''); |
| + } |
| + |
| void test_privateOverride() { |
| addFile( |
| ''' |
| @@ -3840,3 +3856,11 @@ void main () { |
| '''); |
| } |
| } |
| + |
| +void _addMetaLibrary() { |
| + addFile(r''' |
| +library meta; |
| +class _Checked { const _Checked(); } |
| +const Object checked = const _Checked(); |
| + ''', name: '/meta.dart'); |
| +} |