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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1508183002: fixes #25094, type params in static methods shouldn't always be an error (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merged Created 5 years 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 | « pkg/analyzer/lib/src/generated/error.dart ('k') | 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/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 7e131d4fdd2eb80d172e742418f9de818c23d6f5..094b3e4b3ae5bf21a91ec67e384981f5dd6dd2dd 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -5238,9 +5238,14 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (_isInStaticMethod || _isInStaticVariableDeclaration) {
DartType type = name.type;
if (type is TypeParameterType) {
- _errorReporter.reportErrorForNode(
- StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC, name);
- return true;
+ // The class's type parameters are not in scope for static methods.
+ // However all other type parameters are legal (e.g. the static method's
+ // type parameters, or a local function's type parameters).
+ if (type.element.enclosingElement is ClassElement) {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC, name);
+ return true;
+ }
}
}
return false;
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698