Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 2340173002: address #25232 in strong mode (dart1 behavior unchanged) (Closed)
Patch Set: Merge remote-tracking branch 'origin/master' into 25232_strong_fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 { }
+ ''');
+ }
+
+ 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 { }
+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');
+}
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698