mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 00:45:16 +00:00
Fix for crash when reporting ABSTRACT_SUPER_MEMBER_REFERENCE for PropertyAccess in mixin.
Change-Id: I3270ac34b837fc5940e6f4938627bb7479eff851 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146920 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
a85c8b7520
commit
e6a3125492
|
@ -1410,15 +1410,11 @@ class ElementResolver extends SimpleAstVisitor<void> {
|
|||
_resolver.inheritance.getInherited2(staticType.element, name);
|
||||
if (element != null) {
|
||||
propertyName.staticElement = element;
|
||||
ClassElementImpl receiverSuperClass =
|
||||
staticType.element.supertype.element;
|
||||
if (!receiverSuperClass.hasNoSuchMethod) {
|
||||
_errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
|
||||
propertyName,
|
||||
[element.kind.displayName, propertyName.name],
|
||||
);
|
||||
}
|
||||
_errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
|
||||
propertyName,
|
||||
[element.kind.displayName, propertyName.name],
|
||||
);
|
||||
} else {
|
||||
_errorReporter.reportErrorForNode(
|
||||
StaticTypeWarningCode.UNDEFINED_SUPER_GETTER,
|
||||
|
|
|
@ -211,6 +211,28 @@ abstract class B extends A {
|
|||
);
|
||||
}
|
||||
|
||||
test_propertyAccess_getter_mixin_implements() async {
|
||||
await assertErrorsInCode(r'''
|
||||
class A {
|
||||
int get foo => 0;
|
||||
}
|
||||
|
||||
mixin M implements A {
|
||||
void bar() {
|
||||
super.foo;
|
||||
}
|
||||
}
|
||||
''', [
|
||||
error(CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE, 81, 3),
|
||||
]);
|
||||
|
||||
assertPropertyAccess2(
|
||||
findNode.propertyAccess('super.foo'),
|
||||
element: findElement.getter('foo', of: 'A'),
|
||||
type: 'int',
|
||||
);
|
||||
}
|
||||
|
||||
test_propertyAccess_getter_mixinHasNoSuchMethod() async {
|
||||
await assertErrorsInCode('''
|
||||
class A {
|
||||
|
|
Loading…
Reference in a new issue