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

Unified Diff: pkg/analyzer/test/src/summary/linker_test.dart

Issue 2994913002: Fix for inheriting covariance from a resynthesyzed parameter. (Closed)
Patch Set: Created 3 years, 4 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/summary/link.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/summary/linker_test.dart
diff --git a/pkg/analyzer/test/src/summary/linker_test.dart b/pkg/analyzer/test/src/summary/linker_test.dart
index 34a89f282c5555e9b9110e449529be24879f6ce3..0ad9f69acc0dba72cb5efe776a4ecf0411c8baca 100644
--- a/pkg/analyzer/test/src/summary/linker_test.dart
+++ b/pkg/analyzer/test/src/summary/linker_test.dart
@@ -641,6 +641,37 @@ class D extends C {
'int');
}
+ void test_inheritsCovariant_fromBundle() {
+ var bundle = createPackageBundle('''
+class X1 {}
+class X2 extends X1 {}
+class A {
+ void foo(covariant X1 x) {}
+}
+class B extends A {
+ void foo(X2 x) {}
+}
+''', path: '/a.dart');
+ addBundle('/a.ds', bundle);
+
+ // C.foo.x must inherit covariance from B.foo.x, even though it is
+ // resynthesized from the bundle.
+ createLinker('''
+import 'a.dart';
+class C extends B {
+ void foo(X2 x) {}
+}
+''');
+ LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
+ library.libraryCycleForLink.ensureLinked();
+
+ ClassElementForLink_Class C = library.getContainedName('C');
+ expect(C.methods, hasLength(1));
+ MethodElementForLink foo = C.methods[0];
+ expect(foo.parameters, hasLength(1));
+ expect(foo.parameters[0].isCovariant, isTrue);
+ }
+
void test_instantiate_param_of_param_to_bounds() {
createLinker('''
class C<T> {}
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698