Check that the declaration with unimplemented members is ClassDeclaration (not ClassTypeAlias).

Another exception from logs.

R=brianwilkerson@google.com

Change-Id: I87ee5a7ad9c7171b23714a23f8ee861688bbf331
Reviewed-on: https://dart-review.googlesource.com/40467
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2018-02-09 20:41:39 +00:00 committed by commit-bot@chromium.org
parent 94d8d6bf3b
commit befb4f943a
2 changed files with 20 additions and 2 deletions

View file

@ -1466,7 +1466,9 @@ class FixProcessor {
}
Future<Null> _addFix_createMissingOverrides() async {
// prepare target
if (node.parent is! ClassDeclaration) {
return;
}
ClassDeclaration targetClass = node.parent as ClassDeclaration;
ClassElement targetClassElement = targetClass.element;
utils.targetClassElement = targetClassElement;
@ -1613,6 +1615,9 @@ class FixProcessor {
}
Future<Null> _addFix_createNoSuchMethod() async {
if (node.parent is! ClassDeclaration) {
return;
}
ClassDeclaration targetClass = node.parent as ClassDeclaration;
// prepare environment
String prefix = utils.getIndent(1);

View file

@ -3113,7 +3113,20 @@ class B extends A {
''');
}
test_createNoSuchMethod() async {
test_createNoSuchMethod_BAD_classTypeAlias() async {
await resolveTestUnit('''
abstract class A {
m();
}
class B = Object with A;
''');
await assertNoFix(
DartFixKind.CREATE_NO_SUCH_METHOD,
);
}
test_createNoSuchMethod_OK() async {
await resolveTestUnit('''
abstract class A {
m1();