| Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| index 910e9d1e39c86abb4c1ee7cc19bc972a245dd105..01a41796618f924c73f4066c83cb4354308bcafe 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
|
| @@ -1146,14 +1146,19 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
|
| " assert('message');", // not 'bool'
|
| " assert('null');", // not 'bool'
|
| " assert(0);", // not 'bool'
|
| - " assert(f() {});", // OK, dynamic
|
| - " assert(bool f() {});", // OK, '() -> bool'
|
| - " assert(Object f() {});", // OK, 'Object' compatible with 'bool'
|
| - " assert(String f() {});", // not '() -> bool', return type
|
| - " assert(bool f(x) {});", // not '() -> bool', parameter
|
| + " assert(f1);", // OK, dynamic
|
| + " assert(f2);", // OK, '() -> bool'
|
| + " assert(f3);", // OK, 'Object' compatible with 'bool'
|
| + " assert(f4);", // not '() -> bool', return type
|
| + " assert(f5);", // not '() -> bool', parameter
|
| " assert(true, false);", // not single argument
|
| " assert;", // incomplete
|
| "}",
|
| + "f1() {}",
|
| + "bool f2() {}",
|
| + "Object f3() {}",
|
| + "String f4() {}",
|
| + "bool f5(x) {}",
|
| "");
|
| assertErrors(
|
| libraryResult.getErrors(),
|
| @@ -1162,8 +1167,8 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
|
| errEx(TypeErrorCode.ASSERT_BOOL, 5, 10, 9),
|
| errEx(TypeErrorCode.ASSERT_BOOL, 6, 10, 6),
|
| errEx(TypeErrorCode.ASSERT_BOOL, 7, 10, 1),
|
| - errEx(TypeErrorCode.ASSERT_BOOL, 11, 10, 13),
|
| - errEx(TypeErrorCode.ASSERT_BOOL, 12, 10, 12));
|
| + errEx(TypeErrorCode.ASSERT_BOOL, 11, 10, 2),
|
| + errEx(TypeErrorCode.ASSERT_BOOL, 12, 10, 2));
|
| }
|
|
|
| /**
|
| @@ -3885,42 +3890,43 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
|
| public void test_assignMethod() throws Exception {
|
| AnalyzeLibraryResult libraryResult = analyzeLibrary(
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
| - "class C {" +
|
| + "class C {",
|
| " method() { }",
|
| "}",
|
| "main () {",
|
| - " new C().method = _() {};",
|
| - "}");
|
| - assertErrors(
|
| - libraryResult.getErrors(),
|
| - errEx(TypeErrorCode.CANNOT_ASSIGN_TO, 5, 3, 14));
|
| + " new C().method = f;",
|
| + "}",
|
| + "f() {}",
|
| + "");
|
| + assertErrors(libraryResult.getErrors(), errEx(TypeErrorCode.CANNOT_ASSIGN_TO, 6, 3, 14));
|
| }
|
|
|
| public void test_assignSetter() throws Exception {
|
| AnalyzeLibraryResult libraryResult = analyzeLibrary(
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
| - "class C {" +
|
| + "class C {",
|
| " set method(arg) { }",
|
| "}",
|
| "main () {",
|
| - " new C().method = _() {};",
|
| - "}");
|
| - assertErrors(
|
| - libraryResult.getErrors());
|
| + " new C().method = f;",
|
| + "}",
|
| + "f() {}",
|
| + "");
|
| + assertErrors(libraryResult.getErrors());
|
| }
|
|
|
| public void test_assignGetter() throws Exception {
|
| AnalyzeLibraryResult libraryResult = analyzeLibrary(
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
| - "class C {" +
|
| + "class C {",
|
| " get method { }",
|
| "}",
|
| "main () {",
|
| - " new C().method = _() {};",
|
| - "}");
|
| - assertErrors(
|
| - libraryResult.getErrors(),
|
| - errEx(TypeErrorCode.FIELD_HAS_NO_SETTER, 5, 11, 6));
|
| + " new C().method = f;",
|
| + "}",
|
| + "f() {}",
|
| + "");
|
| + assertErrors(libraryResult.getErrors(), errEx(TypeErrorCode.FIELD_HAS_NO_SETTER, 6, 11, 6));
|
| }
|
|
|
| /**
|
| @@ -5831,11 +5837,11 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
| "class A {",
|
| " var x;",
|
| - " B() : x = (foo() { }) {}",
|
| + " B() : x = 0 {}",
|
| "}",
|
| "");
|
| assertErrors(result.getErrors(),
|
| - errEx(ResolverErrorCode.INITIALIZER_ONLY_IN_GENERATIVE_CONSTRUCTOR, 4, 9, 15));
|
| + errEx(ResolverErrorCode.INITIALIZER_ONLY_IN_GENERATIVE_CONSTRUCTOR, 4, 9, 5));
|
| }
|
|
|
| public void test_variableReferencesItselfInInitializer() throws Exception {
|
|
|