Skip to content

Commit

Permalink
Make mixins abstract by default
Browse files Browse the repository at this point in the history
Change-Id: I8ca672ac9d6acbb29ccea1bd41a617e0a870c74a
Reviewed-on: https://dart-review.googlesource.com/76303
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
  • Loading branch information
bwilkerson authored and commit-bot@chromium.org committed Sep 25, 2018
1 parent ab305f2 commit a6b1a99
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/analysis_server/test/plugin/protocol_dart_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ mixin A {}
expect(location.startColumn, 7);
}
expect(element.parameters, isNull);
expect(element.flags, 0);
expect(element.flags, Element.FLAG_ABSTRACT);
}
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6580,6 +6580,9 @@ class MixinElementImpl extends ClassElementImpl {
UnlinkedClass unlinkedClass, CompilationUnitElementImpl enclosingUnit)
: super.forSerialized(unlinkedClass, enclosingUnit);

@override
bool get isAbstract => true;

@override
bool get isMixin => true;

Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/generated/error_verifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
InstanceCreationExpression expression,
TypeName typeName,
InterfaceType type) {
if (type.element.isAbstract) {
if (type.element.isAbstract && !type.element.isMixin) {
ConstructorElement element = expression.staticElement;
if (element != null && !element.isFactory) {
bool isImplicit =
Expand Down
4 changes: 4 additions & 0 deletions pkg/analyzer/test/src/dart/resolution/mixin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ mixin M {}
expect(element.typeParameters, isEmpty);

expect(element.supertype, isNull);
expect(element.isAbstract, isTrue);
expect(element.isEnum, isFalse);
expect(element.isMixin, isTrue);
expect(element.isMixinApplication, isFalse);
expect(element.type.isObject, isFalse);

assertElementTypes(element.superclassConstraints, [objectType]);
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/test/src/summary/element_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class _ElementWriter {
writeDocumentation(e);
writeMetadata(e, '', '\n');

writeIf(e.isAbstract, 'abstract ');
writeIf(e.isAbstract && !e.isMixin, 'abstract ');

if (e.isEnum) {
buffer.write('enum ');
Expand Down

0 comments on commit a6b1a99

Please sign in to comment.