| Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| index cb4fc4e1f8b00f585f78c9a8e83ef48a09d3ab54..399d98b6d38754f13f3a9dc993bdf41780e1ccee 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
|
| @@ -1112,4 +1112,25 @@ public class ResolverTest extends ResolverTestCase {
|
| errEx(ResolverErrorCode.CONST_CLASS_WITH_INHERITED_NONFINAL_FIELDS, 9, 7, 3),
|
| errEx(ResolverErrorCode.CONST_CLASS_WITH_NONFINAL_FIELDS, 21, 7, 3));
|
| }
|
| +
|
| + public void testFinalInit() {
|
| + resolveAndTest(Joiner.on("\n").join(
|
| + "class Object {}",
|
| + "interface int {}",
|
| + "final f1 = 1;",
|
| + "final f2;", // error
|
| + "class A {",
|
| + " final f3 = 1;",
|
| + " final f4;", // not really ok, should be initialized in constructor
|
| + " static final f5 = 1;",
|
| + " static final f6;", // error
|
| + " method() {",
|
| + " final f7 = 1;",
|
| + " final f8;", // error
|
| + " }",
|
| + "}"),
|
| + errEx(ResolverErrorCode.TOPLEVEL_FINAL_REQUIRES_VALUE, 4, 7 , 2),
|
| + errEx(ResolverErrorCode.STATIC_FINAL_REQUIRES_VALUE, 9, 16, 2),
|
| + errEx(ResolverErrorCode.CONSTANTS_MUST_BE_INITIALIZED, 12, 11, 2));
|
| + }
|
| }
|
|
|