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

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

Issue 1692993004: Fix for type parameters of a local generic function in a static generic method of a generic class. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698