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

Unified Diff: pkg/analyzer/test/generated/element_test.dart

Issue 879093002: Fix mixin resolution order when multiple mixins present. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/resolver.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/element_test.dart
diff --git a/pkg/analyzer/test/generated/element_test.dart b/pkg/analyzer/test/generated/element_test.dart
index 399d8c4495c2d8d2f3877ef428f9516842a7354e..e89fb065b2e3c0242797d4ce5882c078d8de3ecd 100644
--- a/pkg/analyzer/test/generated/element_test.dart
+++ b/pkg/analyzer/test/generated/element_test.dart
@@ -3110,6 +3110,33 @@ class InterfaceTypeImplTest extends EngineTestCase {
expect(typeB.lookUpGetter(getterName, library), same(getterG));
}
+ void test_lookUpGetter_mixin_shadowing() {
+ //
+ // class B {}
+ // class M1 { get g {} }
+ // class M2 { get g {} }
+ // class C extends B with M1, M2 {}
+ //
+ TestTypeProvider typeProvider = new TestTypeProvider();
+ String getterName = 'g';
+ ClassElementImpl classB = ElementFactory.classElement2('B');
+ ClassElementImpl classM1 = ElementFactory.classElement2('M1');
+ PropertyAccessorElementImpl getterM1g =
+ ElementFactory.getterElement(getterName, false, typeProvider.dynamicType);
+ classM1.accessors = <PropertyAccessorElement>[getterM1g];
+ ClassElementImpl classM2 = ElementFactory.classElement2('M2');
+ PropertyAccessorElementImpl getterM2g =
+ ElementFactory.getterElement(getterName, false, typeProvider.dynamicType);
+ classM2.accessors = <PropertyAccessorElement>[getterM2g];
+ ClassElementImpl classC = ElementFactory.classElement('C', classB.type);
+ classC.mixins = <InterfaceType>[classM1.type, classM2.type];
+ LibraryElementImpl library =
+ ElementFactory.library(createAnalysisContext(), "lib");
+ CompilationUnitElementImpl unit = library.definingCompilationUnit;
+ unit.types = <ClassElement>[classB, classM1, classM2, classC];
+ expect(classC.type.lookUpGetter(getterName, library), getterM2g);
+ }
+
void test_lookUpGetter_recursive() {
//
// class A extends B {}
@@ -3173,6 +3200,32 @@ class InterfaceTypeImplTest extends EngineTestCase {
expect(typeB.lookUpMethod(methodName, library), same(methodM));
}
+ void test_lookUpMethod_mixin_shadowing() {
+ //
+ // class B {}
+ // class M1 { m() {} }
+ // class M2 { m() {} }
+ // class C extends B with M1, M2 {}
+ //
+ String methodName = 'm';
+ ClassElementImpl classB = ElementFactory.classElement2('B');
+ ClassElementImpl classM1 = ElementFactory.classElement2('M1');
+ MethodElementImpl methodM1m =
+ ElementFactory.methodElement(methodName, null);
+ classM1.methods = <MethodElement>[methodM1m];
+ ClassElementImpl classM2 = ElementFactory.classElement2('M2');
+ MethodElementImpl methodM2m =
+ ElementFactory.methodElement(methodName, null);
+ classM2.methods = <MethodElement>[methodM2m];
+ ClassElementImpl classC = ElementFactory.classElement('C', classB.type);
+ classC.mixins = <InterfaceType>[classM1.type, classM2.type];
+ LibraryElementImpl library =
+ ElementFactory.library(createAnalysisContext(), "lib");
+ CompilationUnitElementImpl unit = library.definingCompilationUnit;
+ unit.types = <ClassElement>[classB, classM1, classM2, classC];
+ expect(classC.type.lookUpMethod(methodName, library), methodM2m);
+ }
+
void test_lookUpMethod_parameterized() {
//
// class A<E> { E m(E p) {} }
@@ -3275,6 +3328,33 @@ class InterfaceTypeImplTest extends EngineTestCase {
expect(typeB.lookUpSetter(setterName, library), same(setterS));
}
+ void test_lookUpSetter_mixin_shadowing() {
+ //
+ // class B {}
+ // class M1 { set s() {} }
+ // class M2 { set s() {} }
+ // class C extends B with M1, M2 {}
+ //
+ TestTypeProvider typeProvider = new TestTypeProvider();
+ String setterName = 's';
+ ClassElementImpl classB = ElementFactory.classElement2('B');
+ ClassElementImpl classM1 = ElementFactory.classElement2('M1');
+ PropertyAccessorElementImpl setterM1g =
+ ElementFactory.setterElement(setterName, false, typeProvider.dynamicType);
+ classM1.accessors = <PropertyAccessorElement>[setterM1g];
+ ClassElementImpl classM2 = ElementFactory.classElement2('M2');
+ PropertyAccessorElementImpl setterM2g =
+ ElementFactory.getterElement(setterName, false, typeProvider.dynamicType);
+ classM2.accessors = <PropertyAccessorElement>[setterM2g];
+ ClassElementImpl classC = ElementFactory.classElement('C', classB.type);
+ classC.mixins = <InterfaceType>[classM1.type, classM2.type];
+ LibraryElementImpl library =
+ ElementFactory.library(createAnalysisContext(), "lib");
+ CompilationUnitElementImpl unit = library.definingCompilationUnit;
+ unit.types = <ClassElement>[classB, classM1, classM2, classC];
+ expect(classC.type.lookUpGetter(setterName, library), setterM2g);
+ }
+
void test_lookUpSetter_recursive() {
//
// class A extends B {}
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698