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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2364733002: Issue 27300. Report HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE. (Closed)
Patch Set: Created 4 years, 3 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
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index a24bd1e811d0983e3960621a2267bb28eed46501..47ca462965e25dee37baee6e81146c9d2fa36da3 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -283,8 +283,10 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
@override
Object visitMethodInvocation(MethodInvocation node) {
+ Expression realTarget = node.realTarget;
+ _checkForAbstractSuperMemberReference(realTarget, node.methodName);
_checkForCanBeNullAfterNullAware(
- node.realTarget, node.operator, null, node.methodName);
+ realTarget, node.operator, null, node.methodName);
DartType staticInvokeType = node.staticInvokeType;
if (staticInvokeType is InterfaceType) {
MethodElement methodElement = staticInvokeType.lookUpMethod(
@@ -308,8 +310,10 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
@override
Object visitPropertyAccess(PropertyAccess node) {
+ Expression realTarget = node.realTarget;
+ _checkForAbstractSuperMemberReference(realTarget, node.propertyName);
_checkForCanBeNullAfterNullAware(
- node.realTarget, node.operator, node.propertyName, null);
+ realTarget, node.operator, node.propertyName, null);
return super.visitPropertyAccess(node);
}
@@ -409,6 +413,19 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
return false;
}
+ void _checkForAbstractSuperMemberReference(
+ Expression target, SimpleIdentifier name) {
+ if (target is SuperExpression) {
+ Element element = name.staticElement;
+ if (element is ExecutableElement && element.isAbstract) {
+ _errorReporter.reportTypeErrorForNode(
+ HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
+ name,
+ [element.kind.displayName, name.name]);
+ }
+ }
+ }
+
/**
* This verifies that the passed expression can be assigned to its corresponding parameters.
*
@@ -7283,8 +7300,13 @@ class ResolverVisitor extends ScopedVisitor {
originalType is FunctionType &&
originalType.typeFormals.isNotEmpty &&
ts is StrongTypeSystemImpl) {
- contextType = ts.inferGenericFunctionCall(typeProvider, originalType,
- DartType.EMPTY_LIST, DartType.EMPTY_LIST, originalType.returnType, returnContextType);
+ contextType = ts.inferGenericFunctionCall(
+ typeProvider,
+ originalType,
+ DartType.EMPTY_LIST,
+ DartType.EMPTY_LIST,
+ originalType.returnType,
+ returnContextType);
}
InferenceContext.setType(node.argumentList, contextType);

Powered by Google App Engine
This is Rietveld 408576698