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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java

Issue 10939037: Issue 5232. Type variables are in static scope, but using them is error (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java b/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
index fb7b6a3b759481b0b17da361ace798c9e0df0fd1..7ba300babaaecf3c3da826884d1ab8c0d24bf3b8 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java
@@ -226,34 +226,9 @@ public class ResolutionContext implements ResolutionErrorListener {
case TYPE_VARIABLE: {
TypeVariableElement typeVariableElement = (TypeVariableElement) element;
if (!isFactory && isStatic &&
- typeVariableElement.getDeclaringElement().getKind().equals(ElementKind.CLASS)) {
-
- // Check that type variable is not shadowing any element in enclosing context.
- Scope libraryScope = scope.getLibrary().getScope();
- String name = element.getName();
- Element existingElement = libraryScope.findElement(scope.getLibrary(), name);
-
- switch(ElementKind.of(existingElement)) {
- case CLASS:
- case FUNCTION_TYPE_ALIAS:
- return instantiateParameterizedType((ClassElement)existingElement,
- diagnosticNode,
- typeArguments,
- isStatic,
- isFactory,
- errorCode,
- wrongNumberErrorCode);
- case NONE:
- default:
- if (errorCode.getSubSystem().equals(SubSystem.RESOLVER)) {
- onError(identifier, ResolverErrorCode.TYPE_VARIABLE_IN_STATIC_CONTEXT,
- identifier);
- } else {
- onError(identifier, TypeErrorCode.TYPE_VARIABLE_IN_STATIC_CONTEXT,
- identifier);
- }
- return typeProvider.getDynamicType();
- }
+ typeVariableElement.getDeclaringElement().getKind().equals(ElementKind.CLASS)) {
+ onError(identifier, ResolverErrorCode.TYPE_VARIABLE_IN_STATIC_CONTEXT, identifier);
+ return typeProvider.getDynamicType();
}
return makeTypeVariable(typeVariableElement, typeArguments);
}
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698