Issue 4903. Better error message when static method attempts to use type variable

http://code.google.com/p/dart/issues/detail?id=4903

R=brianwilkerson@google.com
BUG=

Review URL: https://chromiumcodereview.appspot.com//10911087

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11860 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com
2012-09-05 03:36:50 +00:00
parent b46094104a
commit 32ead8d136
@@ -8,9 +8,9 @@ import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.DartCompilerContext;
import com.google.dart.compiler.ErrorCode;
import com.google.dart.compiler.ErrorSeverity;
import com.google.dart.compiler.PackageLibraryManager;
import com.google.dart.compiler.Source;
import com.google.dart.compiler.SubSystem;
import com.google.dart.compiler.PackageLibraryManager;
import com.google.dart.compiler.ast.ASTVisitor;
import com.google.dart.compiler.ast.DartFunctionExpression;
import com.google.dart.compiler.ast.DartFunctionTypeAlias;
@@ -243,6 +243,7 @@ public class ResolutionContext implements ResolutionErrorListener {
errorCode,
wrongNumberErrorCode);
case NONE:
default:
if (errorCode.getSubSystem().equals(SubSystem.RESOLVER)) {
onError(identifier, ResolverErrorCode.TYPE_VARIABLE_IN_STATIC_CONTEXT,
identifier);
@@ -251,14 +252,6 @@ public class ResolutionContext implements ResolutionErrorListener {
identifier);
}
return typeProvider.getDynamicType();
default:
if (errorCode.getSubSystem().equals(SubSystem.RESOLVER)) {
onError(identifier, ResolverErrorCode.NOT_A_TYPE, identifier, elementKind);
} else {
onError(identifier, TypeErrorCode.NOT_A_TYPE, identifier, elementKind);
}
return typeProvider.getDynamicType();
}
}
return makeTypeVariable(typeVariableElement, typeArguments);