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

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

Issue 707073002: Fix analyzer's treatment of mixin constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve error message. Created 6 years, 1 month 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
Index: pkg/analyzer/test/generated/all_the_rest.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest.dart b/pkg/analyzer/test/generated/all_the_rest.dart
index 4e86f49e6e6c701bbc0ebd2fc94cc5cb1a27d505..0adf1d115926b59ea134a114f4052e9eba544dbb 100644
--- a/pkg/analyzer/test/generated/all_the_rest.dart
+++ b/pkg/analyzer/test/generated/all_the_rest.dart
@@ -7396,6 +7396,83 @@ class ElementBuilderTest extends EngineTestCase {
expect(method.name, methodName);
}
+ void test_visitClassTypeAlias() {
+ // class B {}
+ // class M {}
+ // class C = B with M
+ ElementHolder holder = new ElementHolder();
+ ElementBuilder builder = new ElementBuilder(holder);
+ ClassElementImpl classB = ElementFactory.classElement2('B', []);
+ ConstructorElementImpl constructorB =
+ ElementFactory.constructorElement2(classB, '', []);
+ constructorB.setModifier(Modifier.SYNTHETIC, true);
+ classB.constructors = [constructorB];
+ ClassElement classM = ElementFactory.classElement2('M', []);
+ WithClause withClause =
+ AstFactory.withClause([AstFactory.typeName(classM, [])]);
+ ClassTypeAlias alias = AstFactory.classTypeAlias('C', null, null,
+ AstFactory.typeName(classB, []), withClause, null);
+ alias.accept(builder);
+ List<ClassElement> types = holder.types;
+ expect(types, hasLength(1));
+ ClassElement type = types[0];
+ expect(alias.element, same(type));
+ expect(type.name, equals('C'));
+ expect(type.isAbstract, isFalse);
+ expect(type.isSynthetic, isFalse);
+ expect(type.typeParameters, isEmpty);
+ expect(type.fields, isEmpty);
+ expect(type.methods, isEmpty);
+ }
+
+ void test_visitClassTypeAlias_abstract() {
+ // class B {}
+ // class M {}
+ // abstract class C = B with M
+ ElementHolder holder = new ElementHolder();
+ ElementBuilder builder = new ElementBuilder(holder);
+ ClassElementImpl classB = ElementFactory.classElement2('B', []);
+ ConstructorElementImpl constructorB =
+ ElementFactory.constructorElement2(classB, '', []);
+ constructorB.setModifier(Modifier.SYNTHETIC, true);
+ classB.constructors = [constructorB];
+ ClassElement classM = ElementFactory.classElement2('M', []);
+ WithClause withClause =
+ AstFactory.withClause([AstFactory.typeName(classM, [])]);
+ ClassTypeAlias classCAst = AstFactory.classTypeAlias('C', null,
+ Keyword.ABSTRACT, AstFactory.typeName(classB, []), withClause, null);
+ classCAst.accept(builder);
+ List<ClassElement> types = holder.types;
+ expect(types, hasLength(1));
+ ClassElement type = types[0];
+ expect(type.isAbstract, isTrue);
+ }
+
+ void test_visitClassTypeAlias_typeParams() {
+ // class B {}
+ // class M {}
+ // class C<T> = B with M
+ ElementHolder holder = new ElementHolder();
+ ElementBuilder builder = new ElementBuilder(holder);
+ ClassElementImpl classB = ElementFactory.classElement2('B', []);
+ ConstructorElementImpl constructorB =
+ ElementFactory.constructorElement2(classB, '', []);
+ constructorB.setModifier(Modifier.SYNTHETIC, true);
+ classB.constructors = [constructorB];
+ ClassElementImpl classM = ElementFactory.classElement2('M', []);
+ WithClause withClause =
+ AstFactory.withClause([AstFactory.typeName(classM, [])]);
+ ClassTypeAlias classCAst = AstFactory.classTypeAlias('C',
+ AstFactory.typeParameterList(['T']), null,
+ AstFactory.typeName(classB, []), withClause, null);
+ classCAst.accept(builder);
+ List<ClassElement> types = holder.types;
+ expect(types, hasLength(1));
+ ClassElement type = types[0];
+ expect(type.typeParameters, hasLength(1));
+ expect(type.typeParameters[0].name, equals('T'));
+ }
+
void test_visitConstructorDeclaration_factory() {
ElementHolder holder = new ElementHolder();
ElementBuilder builder = new ElementBuilder(holder);
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698