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

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

Issue 18690009: Report CTEC.ARGUMENT_TYPE_NOT_ASSIGNABLE and extra/not-enough arguments as errors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/CompileTimeErrorCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index ba792eafe55a86cfe3a812e5ef5fd21401c41322..428b73617ab9af9736c79e690595a2f2e8e1cffa 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -339,6 +339,32 @@ public class CompileTimeErrorCodeTest 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(CompileTimeErrorCode.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(CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ verify(source);
+ }
+
public void test_builtInIdentifierAsType() throws Exception {
Source source = addSource(createSource(//
"f() {",
@@ -1178,6 +1204,19 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_extraPositionalArguments_const_super() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A();",
+ "}",
+ "class B extends A {",
+ " const B() : super(0);",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS);
+ verify(source);
+ }
+
public void test_fieldInitializedByMultipleInitializers() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -2483,7 +2522,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
resolve(source);
assertErrors(
CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
- StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
verify(source);
}
@@ -2496,7 +2535,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
resolve(source);
assertErrors(
CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
- StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
verify(source);
}
@@ -2589,6 +2628,19 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_notEnoughRequiredArguments_const_super() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A(int p);",
+ "}",
+ "class B extends A {",
+ " const B() : super();",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS);
+ verify(source);
+ }
+
public void test_optionalParameterInOperator_named() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -3397,7 +3449,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
resolve(source);
assertErrors(
CompileTimeErrorCode.CONST_EVAL_TYPE_INT,
- StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
verify(source);
reset();
}
@@ -3411,7 +3463,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
resolve(source);
assertErrors(
CompileTimeErrorCode.CONST_EVAL_TYPE_NUM,
- StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
+ CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE);
verify(source);
reset();
}

Powered by Google App Engine
This is Rietveld 408576698