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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java

Issue 10532054: Fix for issue 1343 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
===================================================================
--- compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java (revision 8407)
+++ compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java (working copy)
@@ -8,6 +8,7 @@
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.ErrorCode;
import com.google.dart.compiler.ast.DartClass;
+import com.google.dart.compiler.common.ErrorExpectation;
import com.google.dart.compiler.type.DynamicType;
import com.google.dart.compiler.type.InterfaceType;
import com.google.dart.compiler.type.Type;
@@ -919,6 +920,33 @@
ResolverErrorCode.NO_SUCH_TYPE);
}
+ public void test_const_array() throws Exception {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class int {}",
+ "class MyClass<E> {",
+ " var a1 = <int>[];",
+ " var a2 = <E>[];",
+ " var a3 = const <int>[];",
+ " var a4 = const <E>[];",
+ "}"),
+ ErrorExpectation.errEx(ResolverErrorCode.CONST_ARRAY_WITH_TYPE_VARIABLE, 7, 19, 1));
+ }
+
+ public void test_const_map() throws Exception {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class String {}",
+ "class int {}",
+ "class MyClass<E> {",
+ " var a1 = <int>{};",
+ " var a2 = <E>{};",
+ " var a3 = const <int>{};",
+ " var a4 = const <E>{};",
+ "}"),
+ ErrorExpectation.errEx(ResolverErrorCode.CONST_MAP_WITH_TYPE_VARIABLE, 8, 19, 1));
+ }
+
public void test_new_noSuchType() throws Exception {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",

Powered by Google App Engine
This is Rietveld 408576698