Index: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CheckedModeCompileTimeErrorCodeTest.java |
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CheckedModeCompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CheckedModeCompileTimeErrorCodeTest.java |
index 9a896aa39e53c4ce75b64e358f18a17462f2e132..6823c46532460bfdd39a40913adf8c06f491b890 100644 |
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CheckedModeCompileTimeErrorCodeTest.java |
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CheckedModeCompileTimeErrorCodeTest.java |
@@ -31,4 +31,37 @@ public class CheckedModeCompileTimeErrorCodeTest extends ResolverTestCase { |
StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE); |
verify(source); |
} |
+ |
+ public void test_listElementTypeNotAssignable() throws Exception { |
+ Source source = addSource(createSource(// |
+ "var v = const <String> [42];")); |
+ resolve(source); |
+ assertErrors( |
+ source, |
+ CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, |
+ StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE); |
+ verify(source); |
+ } |
+ |
+ public void test_mapKeyTypeNotAssignable() throws Exception { |
+ Source source = addSource(createSource(// |
+ "var v = const <String, int > {1 : 2};")); |
+ resolve(source); |
+ assertErrors( |
+ source, |
+ CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE, |
+ StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE); |
+ verify(source); |
+ } |
+ |
+ public void test_mapValueTypeNotAssignable() throws Exception { |
+ Source source = addSource(createSource(// |
+ "var v = const <String, String> {'a' : 2};")); |
+ resolve(source); |
+ assertErrors( |
+ source, |
+ CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE, |
+ StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE); |
+ verify(source); |
+ } |
} |