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

Unified Diff: pkg/analyzer/lib/src/dart/element/type.dart

Issue 1683343005: change static method types to not have the class type parameters (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sort Created 4 years, 10 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/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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | pkg/analyzer/test/generated/resolver_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698