| Index: pkg/analyzer/lib/src/task/strong/checker.dart
|
| diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
|
| index 7ccdcc97f08140025a5d11887d1ff2b5cd580aac..62bb922a87177129234ce3a1ad42ede429bb5bb6 100644
|
| --- a/pkg/analyzer/lib/src/task/strong/checker.dart
|
| +++ b/pkg/analyzer/lib/src/task/strong/checker.dart
|
| @@ -36,21 +36,13 @@ DartType getDefiniteType(
|
| DartType type = expression.staticType ?? DynamicTypeImpl.instance;
|
| if (typeSystem is StrongTypeSystemImpl &&
|
| type is FunctionType &&
|
| - _hasStrictArrow(expression)) {
|
| + hasStrictArrow(expression)) {
|
| // Remove fuzzy arrow if possible.
|
| return typeSystem.functionTypeToConcreteType(type);
|
| }
|
| return type;
|
| }
|
|
|
| -bool isKnownFunction(Expression expression) {
|
| - var element = _getKnownElement(expression);
|
| - // First class functions and static methods, where we know the original
|
| - // declaration, will have an exact type, so we know a downcast will fail.
|
| - return element is FunctionElement ||
|
| - element is MethodElement && element.isStatic;
|
| -}
|
| -
|
| DartType _elementType(Element e) {
|
| if (e == null) {
|
| // Malformed code - just return dynamic.
|
| @@ -105,7 +97,7 @@ FieldElement _getMemberField(
|
| FunctionType _getMemberType(InterfaceType type, ExecutableElement member) =>
|
| _memberTypeGetter(member)(type);
|
|
|
| -bool _hasStrictArrow(Expression expression) {
|
| +bool hasStrictArrow(Expression expression) {
|
| var element = _getKnownElement(expression);
|
| return element is FunctionElement || element is MethodElement;
|
| }
|
| @@ -1002,7 +994,7 @@ class CodeChecker extends RecursiveAstVisitor {
|
| // a dynamic parameter type requires a dynamic call in general.
|
| // However, as an optimization, if we have an original definition, we know
|
| // dynamic is reified as Object - in this case a regular call is fine.
|
| - if (_hasStrictArrow(call.function)) {
|
| + if (hasStrictArrow(call.function)) {
|
| return false;
|
| }
|
| return rules.anyParameterType(ft, (pt) => pt.isDynamic);
|
| @@ -1090,8 +1082,8 @@ class CodeChecker extends RecursiveAstVisitor {
|
| }
|
| }
|
|
|
| - if (isKnownFunction(expr)) {
|
| - Element e = _getKnownElement(expr);
|
| + Element e = _getKnownElement(expr);
|
| + if (e is FunctionElement || e is MethodElement && e.isStatic) {
|
| _recordMessage(
|
| expr,
|
| e is MethodElement
|
|
|