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

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

Issue 16113003: Report SWC. and CTEC.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comment Created 7 years, 7 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 5fd8128d16b366bf8d0b4705c673407d9c356ad2..911193dc26263ea5f9ff704a5ae31d2cbaf97ef3 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
@@ -1191,6 +1191,17 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_fieldInitializerNotAssignable() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " final int x;",
+ " const A() : x = '';",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE);
+ verify(source);
+ }
+
public void test_fieldInitializerOutsideConstructor() throws Exception {
// TODO(brianwilkerson) Fix the duplicate error messages.
Source source = addSource(createSource(//
@@ -2172,7 +2183,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
public void test_nonConstValueInInitializer_binary_notBool_left() throws Exception {
Source source = addSource(createSource(//
"class A {",
- " final int a;",
+ " final bool a;",
" const A(String p) : a = p && true;",
"}"));
resolve(source);
@@ -2183,7 +2194,7 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
public void test_nonConstValueInInitializer_binary_notBool_right() throws Exception {
Source source = addSource(createSource(//
"class A {",
- " final int a;",
+ " final bool a;",
" const A(String p) : a = true && p;",
"}"));
resolve(source);

Powered by Google App Engine
This is Rietveld 408576698