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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 16549004: Add type arguments to constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adjust test status. Created 7 years, 6 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: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 95f6edf66847c00e75b51e90cd6dd3c8bb889abc..f210969e496d41a8f37238b7de316cdfd0e80dea 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -2615,6 +2615,10 @@ class ResolverVisitor extends MappingVisitor<Element> {
world.registerStaticUse(constructor.declaration);
ClassElement cls = constructor.getEnclosingClass();
InterfaceType type = mapping.getType(node);
+ if (node.isConst() && type.containsTypeVariables) {
+ compiler.reportErrorCode(node.send.selector,
+ MessageKind.TYPE_VARIABLE_IN_CONSTANT);
+ }
world.registerInstantiatedType(type, mapping);
if (constructor.isFactoryConstructor() && !type.typeArguments.isEmpty) {
world.registerFactoryWithTypeArguments(mapping);
@@ -2723,6 +2727,10 @@ class ResolverVisitor extends MappingVisitor<Element> {
}
DartType listType;
if (typeArgument != null) {
+ if (node.isConst() && typeArgument.containsTypeVariables) {
+ compiler.reportErrorCode(arguments.nodes.head,
+ MessageKind.TYPE_VARIABLE_IN_CONSTANT);
+ }
listType = new InterfaceType(compiler.listClass,
new Link<DartType>.fromList([typeArgument]));
} else {
@@ -2938,6 +2946,10 @@ class ResolverVisitor extends MappingVisitor<Element> {
compiler.mapClass.computeType(compiler);
mapType = compiler.mapClass.rawType;
}
+ if (node.isConst() && mapType.containsTypeVariables) {
+ compiler.reportErrorCode(arguments,
+ MessageKind.TYPE_VARIABLE_IN_CONSTANT);
+ }
mapping.setType(node, mapType);
world.registerInstantiatedClass(compiler.mapClass, mapping);
if (node.isConst()) {

Powered by Google App Engine
This is Rietveld 408576698