| 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 6aef34dc228645291398620e702a204ae74d3309..4fcafd076eeb1f847796c5482f887b86029b0137 100644
|
| --- a/pkg/analyzer/lib/src/dart/element/type.dart
|
| +++ b/pkg/analyzer/lib/src/dart/element/type.dart
|
| @@ -513,13 +513,21 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
|
| // for this generic function's type variables. Those variables are
|
| // tracked in [boundTypeParameters].
|
| _typeParameters = <TypeParameterElement>[];
|
| - Element e = element?.enclosingElement;
|
| +
|
| + Element e = element;
|
| + bool isStaticMethod = e is MethodElement && e.isStatic;
|
| + e = e?.enclosingElement;
|
| +
|
| while (e != null) {
|
| if (e is TypeParameterizedElement) {
|
| - _typeParameters.addAll(e.typeParameters);
|
| + // Class type parameters are not in scope in static methods.
|
| + if (!isStaticMethod || e is! ClassElement) {
|
| + _typeParameters.addAll(e.typeParameters);
|
| + }
|
| }
|
| e = e.enclosingElement;
|
| }
|
| +
|
| if (_isInstantiated) {
|
| // Once the type has been instantiated, type parameters defined at the
|
| // site of the declaration of the method are no longer considered part
|
|
|