| Index: pkg/analyzer/lib/src/dart/element/type.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
|
| index 7b0408801d16667e8b754a3794d643c476e0660e..cca032820c2d84d85171639cda84ef0c55c917eb 100644
|
| --- a/pkg/analyzer/lib/src/dart/element/type.dart
|
| +++ b/pkg/analyzer/lib/src/dart/element/type.dart
|
| @@ -516,17 +516,15 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
|
| _typeParameters = <TypeParameterElement>[];
|
|
|
| Element e = element;
|
| - bool isStaticMethod = e is MethodElement && e.isStatic;
|
| - e = e?.enclosingElement;
|
| -
|
| while (e != null) {
|
| - if (e is TypeParameterizedElement) {
|
| - // Class type parameters are not in scope in static methods.
|
| - if (!isStaticMethod || e is! ClassElement) {
|
| - _typeParameters.addAll(e.typeParameters);
|
| - }
|
| + // If a static method, skip the enclosing class type parameters.
|
| + if (e is MethodElement && e.isStatic) {
|
| + e = e.enclosingElement;
|
| }
|
| e = e.enclosingElement;
|
| + if (e is TypeParameterizedElement) {
|
| + _typeParameters.addAll(e.typeParameters);
|
| + }
|
| }
|
|
|
| if (_isInstantiated) {
|
|
|