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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CheckedModeCompileTimeErrorCodeTest.java

Issue 613673006: Support more checked mode compile time errors in analysis engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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: 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);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698