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

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

Issue 25605002: 'const' instance creation with incompatible argument types is statis warning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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/StaticWarningCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
index c5ae1f62acbdb4746b09bbaa286f1ca4e0d5f47a..0cd65ec4dd2903ef128eed1bdfdd651472506cc2 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticWarningCodeTest.java
@@ -386,6 +386,32 @@ public class StaticWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_argumentTypeNotAssignable_const() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A(String p);",
+ "}",
+ "main() {",
+ " const A(42);",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ verify(source);
+ }
+
+ public void test_argumentTypeNotAssignable_const_super() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A(String p);",
+ "}",
+ "class B extends A {",
+ " const B() : super(42);",
+ "}"));
+ resolve(source);
+ assertErrors(source, StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ verify(source);
+ }
+
public void test_argumentTypeNotAssignable_index() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698