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

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

Issue 22759003: Report INVALID_ASSIGNMENT if default value type cannot be assigned to the parameter type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/StaticTypeWarningCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
index 31f81e4d3e9a3e48ec521a8aa1d4d7c4008c32e8..f44cba12093d1412748900ec62bf1e7de810ffb0 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/StaticTypeWarningCodeTest.java
@@ -165,6 +165,24 @@ public class StaticTypeWarningCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_invalidAssignment_defaultValue_named() throws Exception {
+ Source source = addSource(createSource(//
+ "f({String x: 0}) {",
+ "}"));
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.INVALID_ASSIGNMENT);
+ verify(source);
+ }
+
+ public void test_invalidAssignment_defaultValue_optional() throws Exception {
+ Source source = addSource(createSource(//
+ "f([String x = 0]) {",
+ "}"));
+ resolve(source);
+ assertErrors(StaticTypeWarningCode.INVALID_ASSIGNMENT);
+ verify(source);
+ }
+
public void test_invalidAssignment_instanceVariable() throws Exception {
Source source = addSource(createSource(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698