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

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: Address comments. 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 4fc8a16a9e9d4bbed7203e0cb4e96a711f12451a..2de493a775f86da2e0e9a93e70f8808cb3f4ed02 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -2619,6 +2619,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);
@@ -2727,6 +2731,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 {
@@ -2942,6 +2950,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