| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.resolver_test; | 4 library engine.resolver_test; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 11 import 'package:analyzer_experimental/src/generated/error.dart'; | 11 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 12 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 12 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 13 import 'package:analyzer_experimental/src/generated/ast.dart' hide Annotation; | 13 import 'package:analyzer_experimental/src/generated/ast.dart' hide Annotation; |
| 14 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; | 14 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; |
| 15 import 'package:analyzer_experimental/src/generated/element.dart'; | 15 import 'package:analyzer_experimental/src/generated/element.dart'; |
| 16 import 'package:analyzer_experimental/src/generated/resolver.dart'; | 16 import 'package:analyzer_experimental/src/generated/resolver.dart'; |
| 17 import 'package:analyzer_experimental/src/generated/engine.dart'; | 17 import 'package:analyzer_experimental/src/generated/engine.dart'; |
| 18 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; | 18 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; |
| 19 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; | 19 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; |
| 20 import 'package:analyzer_experimental/src/generated/sdk_io.dart' show DirectoryB
asedDartSdk; | 20 import 'package:analyzer_experimental/src/generated/sdk_io.dart' show DirectoryB
asedDartSdk; |
| 21 import 'package:unittest/unittest.dart' as _ut; | 21 import 'package:unittest/unittest.dart' as _ut; |
| 22 import 'test_support.dart'; | 22 import 'test_support.dart'; |
| 23 import 'ast_test.dart' show ASTFactory; | 23 import 'ast_test.dart' show ASTFactory; |
| 24 import 'element_test.dart' show ElementFactory; | 24 import 'element_test.dart' show ElementFactory; |
| 25 | 25 |
| 26 class TypePropagationTest extends ResolverTestCase { | 26 class TypePropagationTest extends ResolverTestCase { |
| 27 void test_as() { | 27 void test_as() { |
| 28 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " bool get g => true;", "}", "A f(var p) {", " if ((p as A).g) {", "
return p;", " } else {", " return null;", " }", "}"])); | 28 Source source = addSource(EngineTestCase.createSource(["class A {", " bool
get g => true;", "}", "A f(var p) {", " if ((p as A).g) {", " return p;", "
} else {", " return null;", " }", "}"])); |
| 29 LibraryElement library = resolve(source, []); | 29 LibraryElement library = resolve(source, []); |
| 30 assertNoErrors(); | 30 assertNoErrors(); |
| 31 verify([source]); | 31 verify([source]); |
| 32 CompilationUnit unit = resolveCompilationUnit(source, library); | 32 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 33 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 33 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 34 InterfaceType typeA = classA.element.type; | 34 InterfaceType typeA = classA.element.type; |
| 35 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 35 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 36 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 36 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 37 IfStatement ifStatement = body2.block.statements[0] as IfStatement; | 37 IfStatement ifStatement = body2.block.statements[0] as IfStatement; |
| 38 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 38 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 39 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 39 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 40 JUnitTestCase.assertSame(typeA, variableName.staticType); | 40 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 41 } | 41 } |
| 42 void test_assert() { | 42 void test_assert() { |
| 43 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " assert (p is A);", " return p;", "}"])); | 43 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " assert (p is A);", " return p;", "}"])); |
| 44 LibraryElement library = resolve(source, []); | 44 LibraryElement library = resolve(source, []); |
| 45 assertNoErrors(); | 45 assertNoErrors(); |
| 46 verify([source]); | 46 verify([source]); |
| 47 CompilationUnit unit = resolveCompilationUnit(source, library); | 47 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 48 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 48 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 49 InterfaceType typeA = classA.element.type; | 49 InterfaceType typeA = classA.element.type; |
| 50 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 50 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 51 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 51 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 52 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; | 52 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; |
| 53 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 53 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 54 JUnitTestCase.assertSame(typeA, variableName.staticType); | 54 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 55 } | 55 } |
| 56 void test_assignment() { | 56 void test_assignment() { |
| 57 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v;", " v = 0;", " return v;", "}"])); | 57 Source source = addSource(EngineTestCase.createSource(["f() {", " var v;",
" v = 0;", " return v;", "}"])); |
| 58 LibraryElement library = resolve(source, []); | 58 LibraryElement library = resolve(source, []); |
| 59 assertNoErrors(); | 59 assertNoErrors(); |
| 60 verify([source]); | 60 verify([source]); |
| 61 CompilationUnit unit = resolveCompilationUnit(source, library); | 61 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 62 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 62 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 63 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 63 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 64 ReturnStatement statement = body2.block.statements[2] as ReturnStatement; | 64 ReturnStatement statement = body2.block.statements[2] as ReturnStatement; |
| 65 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 65 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 66 JUnitTestCase.assertSame(typeProvider.intType, variableName.staticType); | 66 JUnitTestCase.assertSame(typeProvider.intType, variableName.staticType); |
| 67 } | 67 } |
| 68 void test_assignment_afterInitializer() { | 68 void test_assignment_afterInitializer() { |
| 69 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v = 0;", " v = 1.0;", " return v;", "}"])); | 69 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0
;", " v = 1.0;", " return v;", "}"])); |
| 70 LibraryElement library = resolve(source, []); | 70 LibraryElement library = resolve(source, []); |
| 71 assertNoErrors(); | 71 assertNoErrors(); |
| 72 verify([source]); | 72 verify([source]); |
| 73 CompilationUnit unit = resolveCompilationUnit(source, library); | 73 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 74 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 74 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 75 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 75 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 76 ReturnStatement statement = body2.block.statements[2] as ReturnStatement; | 76 ReturnStatement statement = body2.block.statements[2] as ReturnStatement; |
| 77 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 77 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 78 JUnitTestCase.assertSame(typeProvider.doubleType, variableName.staticType); | 78 JUnitTestCase.assertSame(typeProvider.doubleType, variableName.staticType); |
| 79 } | 79 } |
| 80 void test_initializer() { | 80 void test_forEach() { |
| 81 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v = 0;", " return v;", "}"])); | 81 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(Li
st<A> p) {", " for (var e in p) {", " return e;", " }", "}"])); |
| 82 LibraryElement library = resolve(source, []); | 82 LibraryElement library = resolve(source, []); |
| 83 assertNoErrors(); | 83 assertNoErrors(); |
| 84 verify([source]); | 84 verify([source]); |
| 85 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 86 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 87 InterfaceType typeA = classA.element.type; |
| 88 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 89 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 90 ForEachStatement forStatement = body2.block.statements[0] as ForEachStatemen
t; |
| 91 ReturnStatement statement = ((forStatement.body as Block)).statements[0] as
ReturnStatement; |
| 92 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 93 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 94 } |
| 95 void test_initializer() { |
| 96 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0
;", " return v;", "}"])); |
| 97 LibraryElement library = resolve(source, []); |
| 98 assertNoErrors(); |
| 99 verify([source]); |
| 85 CompilationUnit unit = resolveCompilationUnit(source, library); | 100 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 86 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 101 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 87 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 102 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 88 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; | 103 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; |
| 89 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 104 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 90 JUnitTestCase.assertSame(typeProvider.intType, variableName.staticType); | 105 JUnitTestCase.assertSame(typeProvider.intType, variableName.staticType); |
| 91 } | 106 } |
| 107 void test_initializer_dereference() { |
| 108 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = '
String';", " v.", "}"])); |
| 109 LibraryElement library = resolve(source, []); |
| 110 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 111 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 112 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 113 ExpressionStatement statement = body2.block.statements[1] as ExpressionState
ment; |
| 114 PrefixedIdentifier invocation = statement.expression as PrefixedIdentifier; |
| 115 SimpleIdentifier variableName = invocation.prefix; |
| 116 JUnitTestCase.assertSame(typeProvider.stringType, variableName.staticType); |
| 117 } |
| 92 void test_is_conditional() { | 118 void test_is_conditional() { |
| 93 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " return (p is A) ? p : null;", "}"])); | 119 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " return (p is A) ? p : null;", "}"])); |
| 94 LibraryElement library = resolve(source, []); | 120 LibraryElement library = resolve(source, []); |
| 95 assertNoErrors(); | 121 assertNoErrors(); |
| 96 verify([source]); | 122 verify([source]); |
| 97 CompilationUnit unit = resolveCompilationUnit(source, library); | 123 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 98 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 124 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 99 InterfaceType typeA = classA.element.type; | 125 InterfaceType typeA = classA.element.type; |
| 100 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 126 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 101 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 127 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 102 ReturnStatement statement = body2.block.statements[0] as ReturnStatement; | 128 ReturnStatement statement = body2.block.statements[0] as ReturnStatement; |
| 103 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; | 129 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; |
| 104 SimpleIdentifier variableName = conditional.thenExpression as SimpleIdentifi
er; | 130 SimpleIdentifier variableName = conditional.thenExpression as SimpleIdentifi
er; |
| 105 JUnitTestCase.assertSame(typeA, variableName.staticType); | 131 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 106 } | 132 } |
| 107 void test_is_if() { | 133 void test_is_if() { |
| 108 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is A) {", " return p;", " } else {", " re
turn null;", " }", "}"])); | 134 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is A) {", " return p;", " } else {", " return null;", "
}", "}"])); |
| 109 LibraryElement library = resolve(source, []); | 135 LibraryElement library = resolve(source, []); |
| 110 assertNoErrors(); | 136 assertNoErrors(); |
| 111 verify([source]); | 137 verify([source]); |
| 138 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 139 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 140 InterfaceType typeA = classA.element.type; |
| 141 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 142 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 143 IfStatement ifStatement = body2.block.statements[0] as IfStatement; |
| 144 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 145 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 146 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 147 } |
| 148 void test_is_if_lessSpecific() { |
| 149 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(A
p) {", " if (p is Object) {", " return p;", " } else {", " return null;"
, " }", "}"])); |
| 150 LibraryElement library = resolve(source, []); |
| 151 assertNoErrors(); |
| 152 verify([source]); |
| 112 CompilationUnit unit = resolveCompilationUnit(source, library); | 153 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 113 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 154 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 114 InterfaceType typeA = classA.element.type; | 155 InterfaceType typeA = classA.element.type; |
| 115 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 156 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 116 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 157 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 117 IfStatement ifStatement = body2.block.statements[0] as IfStatement; | 158 IfStatement ifStatement = body2.block.statements[0] as IfStatement; |
| 118 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 159 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 119 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 160 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 120 JUnitTestCase.assertSame(typeA, variableName.staticType); | 161 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 121 } | 162 } |
| 122 void test_is_if_logicalAnd() { | 163 void test_is_if_logicalAnd() { |
| 123 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is A && p != null) {", " return p;", " } els
e {", " return null;", " }", "}"])); | 164 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is A && p != null) {", " return p;", " } else {", " ret
urn null;", " }", "}"])); |
| 124 LibraryElement library = resolve(source, []); | 165 LibraryElement library = resolve(source, []); |
| 125 assertNoErrors(); | 166 assertNoErrors(); |
| 126 verify([source]); | 167 verify([source]); |
| 127 CompilationUnit unit = resolveCompilationUnit(source, library); | 168 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 128 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 169 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 129 InterfaceType typeA = classA.element.type; | 170 InterfaceType typeA = classA.element.type; |
| 130 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 171 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 131 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 172 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 132 IfStatement ifStatement = body2.block.statements[0] as IfStatement; | 173 IfStatement ifStatement = body2.block.statements[0] as IfStatement; |
| 133 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 174 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 134 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 175 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 135 JUnitTestCase.assertSame(typeA, variableName.staticType); | 176 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 136 } | 177 } |
| 137 void test_is_postConditional() { | 178 void test_is_postConditional() { |
| 138 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " A a = (p is A) ? p : throw null;", " return p;", "}"]
)); | 179 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " A a = (p is A) ? p : throw null;", " return p;", "}"])); |
| 139 LibraryElement library = resolve(source, []); | 180 LibraryElement library = resolve(source, []); |
| 140 assertNoErrors(); | 181 assertNoErrors(); |
| 141 verify([source]); | 182 verify([source]); |
| 142 CompilationUnit unit = resolveCompilationUnit(source, library); | 183 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 143 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 184 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 144 InterfaceType typeA = classA.element.type; | 185 InterfaceType typeA = classA.element.type; |
| 145 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 186 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 146 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 187 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 147 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; | 188 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; |
| 148 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 189 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 149 JUnitTestCase.assertSame(typeA, variableName.staticType); | 190 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 150 } | 191 } |
| 151 void test_is_postIf() { | 192 void test_is_postIf() { |
| 152 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is A) {", " A a = p;", " } else {", " ret
urn null;", " }", " return p;", "}"])); | 193 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is A) {", " A a = p;", " } else {", " return null;", "
}", " return p;", "}"])); |
| 153 LibraryElement library = resolve(source, []); | 194 LibraryElement library = resolve(source, []); |
| 154 assertNoErrors(); | 195 assertNoErrors(); |
| 155 verify([source]); | 196 verify([source]); |
| 156 CompilationUnit unit = resolveCompilationUnit(source, library); | 197 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 157 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 198 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 158 InterfaceType typeA = classA.element.type; | 199 InterfaceType typeA = classA.element.type; |
| 159 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 200 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 160 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 201 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 161 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; | 202 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; |
| 162 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 203 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 163 JUnitTestCase.assertSame(typeA, variableName.staticType); | 204 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 164 } | 205 } |
| 165 void test_is_subclass() { | 206 void test_is_subclass() { |
| 166 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {", " B m() => this;", "}", "A f(A p) {", " if (p is
B) {", " return p.m();", " }", "}"])); | 207 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " B m() => this;", "}", "A f(A p) {", " if (p is B) {", " r
eturn p.m();", " }", "}"])); |
| 167 LibraryElement library = resolve(source, []); | 208 LibraryElement library = resolve(source, []); |
| 168 assertNoErrors(); | 209 assertNoErrors(); |
| 169 verify([source]); | 210 verify([source]); |
| 170 CompilationUnit unit = resolveCompilationUnit(source, library); | 211 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 171 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; | 212 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; |
| 172 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 213 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 173 IfStatement ifStatement = body2.block.statements[0] as IfStatement; | 214 IfStatement ifStatement = body2.block.statements[0] as IfStatement; |
| 174 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 215 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 175 MethodInvocation invocation = statement.expression as MethodInvocation; | 216 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 176 JUnitTestCase.assertNotNull(invocation.methodName.element); | 217 JUnitTestCase.assertNotNull(invocation.methodName.element); |
| 177 } | 218 } |
| 178 void test_isNot_conditional() { | 219 void test_is_while() { |
| 179 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " return (p is! A) ? null : p;", "}"])); | 220 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " while (p is A) {", " return p;", " }", "}"])); |
| 180 LibraryElement library = resolve(source, []); | 221 LibraryElement library = resolve(source, []); |
| 181 assertNoErrors(); | 222 assertNoErrors(); |
| 182 verify([source]); | 223 verify([source]); |
| 224 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 225 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 226 InterfaceType typeA = classA.element.type; |
| 227 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 228 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 229 WhileStatement whileStatement = body2.block.statements[0] as WhileStatement; |
| 230 ReturnStatement statement = ((whileStatement.body as Block)).statements[0] a
s ReturnStatement; |
| 231 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 232 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 233 } |
| 234 void test_isNot_conditional() { |
| 235 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " return (p is! A) ? null : p;", "}"])); |
| 236 LibraryElement library = resolve(source, []); |
| 237 assertNoErrors(); |
| 238 verify([source]); |
| 183 CompilationUnit unit = resolveCompilationUnit(source, library); | 239 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 184 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 240 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 185 InterfaceType typeA = classA.element.type; | 241 InterfaceType typeA = classA.element.type; |
| 186 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 242 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 187 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 243 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 188 ReturnStatement statement = body2.block.statements[0] as ReturnStatement; | 244 ReturnStatement statement = body2.block.statements[0] as ReturnStatement; |
| 189 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; | 245 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; |
| 190 SimpleIdentifier variableName = conditional.elseExpression as SimpleIdentifi
er; | 246 SimpleIdentifier variableName = conditional.elseExpression as SimpleIdentifi
er; |
| 191 JUnitTestCase.assertSame(typeA, variableName.staticType); | 247 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 192 } | 248 } |
| 193 void test_isNot_if() { | 249 void test_isNot_if() { |
| 194 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is! A) {", " return null;", " } else {", "
return p;", " }", "}"])); | 250 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is! A) {", " return null;", " } else {", " return p;",
" }", "}"])); |
| 195 LibraryElement library = resolve(source, []); | 251 LibraryElement library = resolve(source, []); |
| 196 assertNoErrors(); | 252 assertNoErrors(); |
| 197 verify([source]); | 253 verify([source]); |
| 198 CompilationUnit unit = resolveCompilationUnit(source, library); | 254 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 199 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 255 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 200 InterfaceType typeA = classA.element.type; | 256 InterfaceType typeA = classA.element.type; |
| 201 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 257 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 202 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 258 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 203 IfStatement ifStatement = body2.block.statements[0] as IfStatement; | 259 IfStatement ifStatement = body2.block.statements[0] as IfStatement; |
| 204 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; | 260 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; |
| 205 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 261 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 206 JUnitTestCase.assertSame(typeA, variableName.staticType); | 262 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 207 } | 263 } |
| 208 void test_isNot_if_logicalOr() { | 264 void test_isNot_if_logicalOr() { |
| 209 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is! A || null == p) {", " return null;", " }
else {", " return p;", " }", "}"])); | 265 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is! A || null == p) {", " return null;", " } else {", "
return p;", " }", "}"])); |
| 210 LibraryElement library = resolve(source, []); | 266 LibraryElement library = resolve(source, []); |
| 211 assertNoErrors(); | 267 assertNoErrors(); |
| 212 verify([source]); | 268 verify([source]); |
| 213 CompilationUnit unit = resolveCompilationUnit(source, library); | 269 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 214 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 270 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 215 InterfaceType typeA = classA.element.type; | 271 InterfaceType typeA = classA.element.type; |
| 216 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 272 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 217 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 273 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 218 IfStatement ifStatement = body2.block.statements[0] as IfStatement; | 274 IfStatement ifStatement = body2.block.statements[0] as IfStatement; |
| 219 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; | 275 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; |
| 220 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 276 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 221 JUnitTestCase.assertSame(typeA, variableName.staticType); | 277 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 222 } | 278 } |
| 223 void test_isNot_postConditional() { | 279 void test_isNot_postConditional() { |
| 224 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " A a = (p is! A) ? throw null : p;", " return p;", "}"
])); | 280 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " A a = (p is! A) ? throw null : p;", " return p;", "}"])); |
| 225 LibraryElement library = resolve(source, []); | 281 LibraryElement library = resolve(source, []); |
| 226 assertNoErrors(); | 282 assertNoErrors(); |
| 227 verify([source]); | 283 verify([source]); |
| 228 CompilationUnit unit = resolveCompilationUnit(source, library); | 284 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 229 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 285 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 230 InterfaceType typeA = classA.element.type; | 286 InterfaceType typeA = classA.element.type; |
| 231 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 287 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 232 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 288 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 233 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; | 289 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; |
| 234 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 290 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 235 JUnitTestCase.assertSame(typeA, variableName.staticType); | 291 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 236 } | 292 } |
| 237 void test_isNot_postIf() { | 293 void test_isNot_postIf() { |
| 238 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "A f(var p) {", " if (p is! A) {", " return null;", " }", " return
p;", "}"])); | 294 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is! A) {", " return null;", " }", " return p;", "}"])); |
| 239 LibraryElement library = resolve(source, []); | 295 LibraryElement library = resolve(source, []); |
| 240 assertNoErrors(); | 296 assertNoErrors(); |
| 241 verify([source]); | 297 verify([source]); |
| 242 CompilationUnit unit = resolveCompilationUnit(source, library); | 298 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 243 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 299 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 244 InterfaceType typeA = classA.element.type; | 300 InterfaceType typeA = classA.element.type; |
| 245 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 301 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 246 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; | 302 BlockFunctionBody body2 = function.functionExpression.body as BlockFunctionB
ody; |
| 247 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; | 303 ReturnStatement statement = body2.block.statements[1] as ReturnStatement; |
| 248 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 304 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 249 JUnitTestCase.assertSame(typeA, variableName.staticType); | 305 JUnitTestCase.assertSame(typeA, variableName.staticType); |
| 250 } | 306 } |
| 251 void test_query() { | 307 void test_query() { |
| 252 Source source = addSource("/test.dart", EngineTestCase.createSource(["import
'dart:html';", "", "main() {", " var v1 = query('a');", " var v2 = query('A')
;", " var v3 = query('body:active');", " var v4 = query('button[foo=\"bar\"]')
;", " var v5 = query('div.class');", " var v6 = query('input#id');", " var v7
= query('select#id');", " // invocation of method", " var m1 = document.query
('div');", " // unsupported currently", " var b1 = query('noSuchTag');", " var
b2 = query('DART_EDITOR_NO_SUCH_TYPE');", " var b3 = query('body div');", " r
eturn [v1, v2, v3, v4, v5, v6, v7, m1, b1, b2, b3];", "}"])); | 308 Source source = addSource(EngineTestCase.createSource(["import 'dart:html';"
, "", "main() {", " var v1 = query('a');", " var v2 = query('A');", " var v3
= query('body:active');", " var v4 = query('button[foo=\"bar\"]');", " var v5
= query('div.class');", " var v6 = query('input#id');", " var v7 = query('sele
ct#id');", " // invocation of method", " var m1 = document.query('div');", " /
/ unsupported currently", " var b1 = query('noSuchTag');", " var b2 = query('D
ART_EDITOR_NO_SUCH_TYPE');", " var b3 = query('body div');", " return [v1, v2,
v3, v4, v5, v6, v7, m1, b1, b2, b3];", "}"])); |
| 253 LibraryElement library = resolve(source, []); | 309 LibraryElement library = resolve(source, []); |
| 254 assertNoErrors(); | 310 assertNoErrors(); |
| 255 verify([source]); | 311 verify([source]); |
| 256 CompilationUnit unit = resolveCompilationUnit(source, library); | 312 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 257 FunctionDeclaration main = unit.declarations[0] as FunctionDeclaration; | 313 FunctionDeclaration main = unit.declarations[0] as FunctionDeclaration; |
| 258 BlockFunctionBody body2 = main.functionExpression.body as BlockFunctionBody; | 314 BlockFunctionBody body2 = main.functionExpression.body as BlockFunctionBody; |
| 259 ReturnStatement statement = body2.block.statements[11] as ReturnStatement; | 315 ReturnStatement statement = body2.block.statements[11] as ReturnStatement; |
| 260 NodeList<Expression> elements2 = ((statement.expression as ListLiteral)).ele
ments; | 316 NodeList<Expression> elements2 = ((statement.expression as ListLiteral)).ele
ments; |
| 261 JUnitTestCase.assertEquals("AnchorElement", elements2[0].staticType.name); | 317 JUnitTestCase.assertEquals("AnchorElement", elements2[0].staticType.name); |
| 262 JUnitTestCase.assertEquals("AnchorElement", elements2[1].staticType.name); | 318 JUnitTestCase.assertEquals("AnchorElement", elements2[1].staticType.name); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 281 runJUnitTest(__test, __test.test_assert); | 337 runJUnitTest(__test, __test.test_assert); |
| 282 }); | 338 }); |
| 283 _ut.test('test_assignment', () { | 339 _ut.test('test_assignment', () { |
| 284 final __test = new TypePropagationTest(); | 340 final __test = new TypePropagationTest(); |
| 285 runJUnitTest(__test, __test.test_assignment); | 341 runJUnitTest(__test, __test.test_assignment); |
| 286 }); | 342 }); |
| 287 _ut.test('test_assignment_afterInitializer', () { | 343 _ut.test('test_assignment_afterInitializer', () { |
| 288 final __test = new TypePropagationTest(); | 344 final __test = new TypePropagationTest(); |
| 289 runJUnitTest(__test, __test.test_assignment_afterInitializer); | 345 runJUnitTest(__test, __test.test_assignment_afterInitializer); |
| 290 }); | 346 }); |
| 347 _ut.test('test_forEach', () { |
| 348 final __test = new TypePropagationTest(); |
| 349 runJUnitTest(__test, __test.test_forEach); |
| 350 }); |
| 291 _ut.test('test_initializer', () { | 351 _ut.test('test_initializer', () { |
| 292 final __test = new TypePropagationTest(); | 352 final __test = new TypePropagationTest(); |
| 293 runJUnitTest(__test, __test.test_initializer); | 353 runJUnitTest(__test, __test.test_initializer); |
| 294 }); | 354 }); |
| 355 _ut.test('test_initializer_dereference', () { |
| 356 final __test = new TypePropagationTest(); |
| 357 runJUnitTest(__test, __test.test_initializer_dereference); |
| 358 }); |
| 295 _ut.test('test_isNot_conditional', () { | 359 _ut.test('test_isNot_conditional', () { |
| 296 final __test = new TypePropagationTest(); | 360 final __test = new TypePropagationTest(); |
| 297 runJUnitTest(__test, __test.test_isNot_conditional); | 361 runJUnitTest(__test, __test.test_isNot_conditional); |
| 298 }); | 362 }); |
| 299 _ut.test('test_isNot_if', () { | 363 _ut.test('test_isNot_if', () { |
| 300 final __test = new TypePropagationTest(); | 364 final __test = new TypePropagationTest(); |
| 301 runJUnitTest(__test, __test.test_isNot_if); | 365 runJUnitTest(__test, __test.test_isNot_if); |
| 302 }); | 366 }); |
| 303 _ut.test('test_isNot_if_logicalOr', () { | 367 _ut.test('test_isNot_if_logicalOr', () { |
| 304 final __test = new TypePropagationTest(); | 368 final __test = new TypePropagationTest(); |
| 305 runJUnitTest(__test, __test.test_isNot_if_logicalOr); | 369 runJUnitTest(__test, __test.test_isNot_if_logicalOr); |
| 306 }); | 370 }); |
| 307 _ut.test('test_isNot_postConditional', () { | 371 _ut.test('test_isNot_postConditional', () { |
| 308 final __test = new TypePropagationTest(); | 372 final __test = new TypePropagationTest(); |
| 309 runJUnitTest(__test, __test.test_isNot_postConditional); | 373 runJUnitTest(__test, __test.test_isNot_postConditional); |
| 310 }); | 374 }); |
| 311 _ut.test('test_isNot_postIf', () { | 375 _ut.test('test_isNot_postIf', () { |
| 312 final __test = new TypePropagationTest(); | 376 final __test = new TypePropagationTest(); |
| 313 runJUnitTest(__test, __test.test_isNot_postIf); | 377 runJUnitTest(__test, __test.test_isNot_postIf); |
| 314 }); | 378 }); |
| 315 _ut.test('test_is_conditional', () { | 379 _ut.test('test_is_conditional', () { |
| 316 final __test = new TypePropagationTest(); | 380 final __test = new TypePropagationTest(); |
| 317 runJUnitTest(__test, __test.test_is_conditional); | 381 runJUnitTest(__test, __test.test_is_conditional); |
| 318 }); | 382 }); |
| 319 _ut.test('test_is_if', () { | 383 _ut.test('test_is_if', () { |
| 320 final __test = new TypePropagationTest(); | 384 final __test = new TypePropagationTest(); |
| 321 runJUnitTest(__test, __test.test_is_if); | 385 runJUnitTest(__test, __test.test_is_if); |
| 322 }); | 386 }); |
| 387 _ut.test('test_is_if_lessSpecific', () { |
| 388 final __test = new TypePropagationTest(); |
| 389 runJUnitTest(__test, __test.test_is_if_lessSpecific); |
| 390 }); |
| 323 _ut.test('test_is_if_logicalAnd', () { | 391 _ut.test('test_is_if_logicalAnd', () { |
| 324 final __test = new TypePropagationTest(); | 392 final __test = new TypePropagationTest(); |
| 325 runJUnitTest(__test, __test.test_is_if_logicalAnd); | 393 runJUnitTest(__test, __test.test_is_if_logicalAnd); |
| 326 }); | 394 }); |
| 327 _ut.test('test_is_postConditional', () { | 395 _ut.test('test_is_postConditional', () { |
| 328 final __test = new TypePropagationTest(); | 396 final __test = new TypePropagationTest(); |
| 329 runJUnitTest(__test, __test.test_is_postConditional); | 397 runJUnitTest(__test, __test.test_is_postConditional); |
| 330 }); | 398 }); |
| 331 _ut.test('test_is_postIf', () { | 399 _ut.test('test_is_postIf', () { |
| 332 final __test = new TypePropagationTest(); | 400 final __test = new TypePropagationTest(); |
| 333 runJUnitTest(__test, __test.test_is_postIf); | 401 runJUnitTest(__test, __test.test_is_postIf); |
| 334 }); | 402 }); |
| 335 _ut.test('test_is_subclass', () { | 403 _ut.test('test_is_subclass', () { |
| 336 final __test = new TypePropagationTest(); | 404 final __test = new TypePropagationTest(); |
| 337 runJUnitTest(__test, __test.test_is_subclass); | 405 runJUnitTest(__test, __test.test_is_subclass); |
| 338 }); | 406 }); |
| 407 _ut.test('test_is_while', () { |
| 408 final __test = new TypePropagationTest(); |
| 409 runJUnitTest(__test, __test.test_is_while); |
| 410 }); |
| 339 _ut.test('test_query', () { | 411 _ut.test('test_query', () { |
| 340 final __test = new TypePropagationTest(); | 412 final __test = new TypePropagationTest(); |
| 341 runJUnitTest(__test, __test.test_query); | 413 runJUnitTest(__test, __test.test_query); |
| 342 }); | 414 }); |
| 343 }); | 415 }); |
| 344 } | 416 } |
| 345 } | 417 } |
| 346 class NonErrorResolverTest extends ResolverTestCase { | 418 class NonErrorResolverTest extends ResolverTestCase { |
| 347 void test_argumentDefinitionTestNonParameter_formalParameter() { | 419 void test_argumentDefinitionTestNonParameter_formalParameter() { |
| 348 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
v) {", " return ?v;", "}"])); | 420 Source source = addSource(EngineTestCase.createSource(["f(var v) {", " retu
rn ?v;", "}"])); |
| 349 resolve(source, []); | 421 resolve(source, []); |
| 350 assertNoErrors(); | 422 assertNoErrors(); |
| 351 verify([source]); | 423 verify([source]); |
| 352 } | 424 } |
| 353 void test_argumentDefinitionTestNonParameter_namedParameter() { | 425 void test_argumentDefinitionTestNonParameter_namedParameter() { |
| 354 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({var
v : 0}) {", " return ?v;", "}"])); | 426 Source source = addSource(EngineTestCase.createSource(["f({var v : 0}) {", "
return ?v;", "}"])); |
| 355 resolve(source, []); | 427 resolve(source, []); |
| 356 assertNoErrors(); | 428 assertNoErrors(); |
| 357 verify([source]); | 429 verify([source]); |
| 358 } | 430 } |
| 359 void test_argumentDefinitionTestNonParameter_optionalParameter() { | 431 void test_argumentDefinitionTestNonParameter_optionalParameter() { |
| 360 Source source = addSource("/test.dart", EngineTestCase.createSource(["f([var
v]) {", " return ?v;", "}"])); | 432 Source source = addSource(EngineTestCase.createSource(["f([var v]) {", " re
turn ?v;", "}"])); |
| 361 resolve(source, []); | 433 resolve(source, []); |
| 362 assertNoErrors(); | 434 assertNoErrors(); |
| 363 verify([source]); | 435 verify([source]); |
| 364 } | 436 } |
| 365 void test_breakWithoutLabelInSwitch() { | 437 void test_breakWithoutLabelInSwitch() { |
| 366 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m(int i) {", " switch (i) {", " case 0:", " break;"
, " }", " }", "}"])); | 438 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m(int i) {", " switch (i) {", " case 0:", " break;", " }", "
}", "}"])); |
| 367 resolve(source, []); | 439 resolve(source, []); |
| 368 assertNoErrors(); | 440 assertNoErrors(); |
| 369 verify([source]); | 441 verify([source]); |
| 370 } | 442 } |
| 371 void test_builtInIdentifierAsType_dynamic() { | 443 void test_builtInIdentifierAsType_dynamic() { |
| 372 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " dynamic x;", "}"])); | 444 Source source = addSource(EngineTestCase.createSource(["f() {", " dynamic x
;", "}"])); |
| 373 resolve(source, []); | 445 resolve(source, []); |
| 374 assertNoErrors(); | 446 assertNoErrors(); |
| 375 verify([source]); | 447 verify([source]); |
| 376 } | 448 } |
| 377 void test_caseExpressionTypeImplementsEquals_int() { | 449 void test_caseExpressionTypeImplementsEquals_int() { |
| 378 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
i) {", " switch(i) {", " case(1) : return 1;", " default: return 0;", "
}", "}"])); | 450 Source source = addSource(EngineTestCase.createSource(["f(int i) {", " swit
ch(i) {", " case(1) : return 1;", " default: return 0;", " }", "}"])); |
| 379 resolve(source, []); | 451 resolve(source, []); |
| 380 assertNoErrors(); | 452 assertNoErrors(); |
| 381 verify([source]); | 453 verify([source]); |
| 382 } | 454 } |
| 383 void test_caseExpressionTypeImplementsEquals_Object() { | 455 void test_caseExpressionTypeImplementsEquals_Object() { |
| 384 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", "}", "",
"f(IntWrapper intWrapper) {", " switch(intWrapper) {", " case(const IntWrap
per(1)) : return 1;", " default: return 0;", " }", "}"])); | 456 Source source = addSource(EngineTestCase.createSource(["class IntWrapper {",
" final int value;", " const IntWrapper(this.value);", "}", "", "f(IntWrapper
intWrapper) {", " switch(intWrapper) {", " case(const IntWrapper(1)) : retu
rn 1;", " default: return 0;", " }", "}"])); |
| 385 resolve(source, []); | 457 resolve(source, []); |
| 386 assertNoErrors(); | 458 assertNoErrors(); |
| 387 verify([source]); | 459 verify([source]); |
| 388 } | 460 } |
| 389 void test_caseExpressionTypeImplementsEquals_String() { | 461 void test_caseExpressionTypeImplementsEquals_String() { |
| 390 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(Stri
ng s) {", " switch(s) {", " case('1') : return 1;", " default: return 0;"
, " }", "}"])); | 462 Source source = addSource(EngineTestCase.createSource(["f(String s) {", " s
witch(s) {", " case('1') : return 1;", " default: return 0;", " }", "}"])
); |
| 463 resolve(source, []); |
| 464 assertNoErrors(); |
| 465 verify([source]); |
| 466 } |
| 467 void test_concreteClassWithAbstractMember() { |
| 468 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", "}"])); |
| 391 resolve(source, []); | 469 resolve(source, []); |
| 392 assertNoErrors(); | 470 assertNoErrors(); |
| 393 verify([source]); | 471 verify([source]); |
| 394 } | 472 } |
| 395 void test_constConstructorWithNonFinalField_constInstanceVar() { | 473 void test_constConstructorWithNonFinalField_constInstanceVar() { |
| 396 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x = 0;", " const A() {}", "}"])); | 474 Source source = addSource(EngineTestCase.createSource(["class A {", " const
int x = 0;", " const A() {}", "}"])); |
| 397 resolve(source, []); | 475 resolve(source, []); |
| 398 assertNoErrors(); | 476 assertNoErrors(); |
| 399 verify([source]); | 477 verify([source]); |
| 400 } | 478 } |
| 401 void test_constConstructorWithNonFinalField_finalInstanceVar() { | 479 void test_constConstructorWithNonFinalField_finalInstanceVar() { |
| 402 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " const A() {}", "}"])); | 480 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " const A() {}", "}"])); |
| 403 resolve(source, []); | 481 resolve(source, []); |
| 404 assertNoErrors(); | 482 assertNoErrors(); |
| 405 verify([source]); | 483 verify([source]); |
| 406 } | 484 } |
| 407 void test_constConstructorWithNonFinalField_static() { | 485 void test_constConstructorWithNonFinalField_static() { |
| 408 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int x;", " const A() {}", "}"])); | 486 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", " const A() {}", "}"])); |
| 409 resolve(source, []); | 487 resolve(source, []); |
| 410 assertNoErrors(); | 488 assertNoErrors(); |
| 411 verify([source]); | 489 verify([source]); |
| 412 } | 490 } |
| 413 void test_constConstructorWithNonFinalField_syntheticField() { | 491 void test_constConstructorWithNonFinalField_syntheticField() { |
| 414 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A();", " set x(value) {}", " get x {return 0;}", "}"])); | 492 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", " set x(value) {}", " get x {return 0;}", "}"])); |
| 415 resolve(source, []); | 493 resolve(source, []); |
| 416 assertNoErrors(); | 494 assertNoErrors(); |
| 417 verify([source]); | 495 verify([source]); |
| 418 } | 496 } |
| 419 void test_defaultValueInFunctionTypeAlias() { | 497 void test_defaultValueInFunctionTypeAlias() { |
| 420 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f F([x]);"])); | 498 Source source = addSource(EngineTestCase.createSource(["typedef F([x]);"])); |
| 421 resolve(source, []); | 499 resolve(source, []); |
| 422 assertErrors([]); | 500 assertErrors([]); |
| 423 verify([source]); | 501 verify([source]); |
| 424 } | 502 } |
| 425 void test_duplicateDefinition_emptyName() { | 503 void test_duplicateDefinition_emptyName() { |
| 426 Source source = addSource("/test.dart", EngineTestCase.createSource(["Map _g
lobalMap = {", " 'a' : () {},", " 'b' : () {}", "}"])); | 504 Source source = addSource(EngineTestCase.createSource(["Map _globalMap = {",
" 'a' : () {},", " 'b' : () {}", "}"])); |
| 427 resolve(source, []); | 505 resolve(source, []); |
| 428 assertNoErrors(); | 506 assertNoErrors(); |
| 429 verify([source]); | 507 verify([source]); |
| 430 } | 508 } |
| 431 void test_duplicateDefinition_getter() { | 509 void test_duplicateDefinition_getter() { |
| 432 Source source = addSource("/test.dart", EngineTestCase.createSource(["bool g
et a => true;"])); | 510 Source source = addSource(EngineTestCase.createSource(["bool get a => true;"
])); |
| 433 resolve(source, []); | 511 resolve(source, []); |
| 434 assertNoErrors(); | 512 assertNoErrors(); |
| 435 verify([source]); | 513 verify([source]); |
| 436 } | 514 } |
| 437 void test_exportOfNonLibrary_libraryDeclared() { | 515 void test_exportOfNonLibrary_libraryDeclared() { |
| 438 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';"])); | 516 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';"])); |
| 439 addSource("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); | 517 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 440 resolve(source, []); | 518 resolve(source, []); |
| 441 assertNoErrors(); | 519 assertNoErrors(); |
| 442 verify([source]); | 520 verify([source]); |
| 443 } | 521 } |
| 444 void test_exportOfNonLibrary_libraryNotDeclared() { | 522 void test_exportOfNonLibrary_libraryNotDeclared() { |
| 445 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';"])); | 523 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';"])); |
| 446 addSource("/lib1.dart", EngineTestCase.createSource([""])); | 524 addSource2("/lib1.dart", EngineTestCase.createSource([""])); |
| 447 resolve(source, []); | 525 resolve(source, []); |
| 448 assertNoErrors(); | 526 assertNoErrors(); |
| 449 verify([source]); | 527 verify([source]); |
| 450 } | 528 } |
| 451 void test_fieldInitializedByMultipleInitializers() { | 529 void test_fieldInitializedByMultipleInitializers() { |
| 452 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " int y;", " A() : x = 0, y = 0 {}", "}"])); | 530 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " int y;", " A() : x = 0, y = 0 {}", "}"])); |
| 453 resolve(source, []); | 531 resolve(source, []); |
| 454 assertNoErrors(); | 532 assertNoErrors(); |
| 455 verify([source]); | 533 verify([source]); |
| 456 } | 534 } |
| 457 void test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() { | 535 void test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() { |
| 458 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x = 0;", " A() : x = 1 {}", "}"])); | 536 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
= 0;", " A() : x = 1 {}", "}"])); |
| 459 resolve(source, []); | 537 resolve(source, []); |
| 460 assertNoErrors(); | 538 assertNoErrors(); |
| 461 verify([source]); | 539 verify([source]); |
| 462 } | 540 } |
| 463 void test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() { | 541 void test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() { |
| 464 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " A() : x = 1 {}", "}"])); | 542 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 1 {}", "}"])); |
| 465 resolve(source, []); | 543 resolve(source, []); |
| 466 assertNoErrors(); | 544 assertNoErrors(); |
| 467 verify([source]); | 545 verify([source]); |
| 468 } | 546 } |
| 469 void test_fieldInitializerOutsideConstructor() { | 547 void test_fieldInitializerOutsideConstructor() { |
| 470 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) {}", "}"])); | 548 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); |
| 471 resolve(source, []); | 549 resolve(source, []); |
| 472 assertNoErrors(); | 550 assertNoErrors(); |
| 473 verify([source]); | 551 verify([source]); |
| 474 } | 552 } |
| 475 void test_fieldInitializerOutsideConstructor_defaultParameters() { | 553 void test_fieldInitializerOutsideConstructor_defaultParameters() { |
| 476 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A([this.x]) {}", "}"])); | 554 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A([this.x]) {}", "}"])); |
| 477 resolve(source, []); | 555 resolve(source, []); |
| 478 assertNoErrors(); | 556 assertNoErrors(); |
| 479 verify([source]); | 557 verify([source]); |
| 480 } | 558 } |
| 481 void test_finalInitializedInDeclarationAndConstructor_initializer() { | 559 void test_finalInitializedInDeclarationAndConstructor_initializer() { |
| 482 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A() : x = 1 {}", "}"])); | 560 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A() : x = 1 {}", "}"])); |
| 483 resolve(source, []); | 561 resolve(source, []); |
| 484 assertNoErrors(); | 562 assertNoErrors(); |
| 485 verify([source]); | 563 verify([source]); |
| 486 } | 564 } |
| 487 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { | 565 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { |
| 488 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A(this.x) {}", "}"])); | 566 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A(this.x) {}", "}"])); |
| 489 resolve(source, []); | 567 resolve(source, []); |
| 490 assertNoErrors(); | 568 assertNoErrors(); |
| 491 verify([source]); | 569 verify([source]); |
| 492 } | 570 } |
| 493 void test_finalNotInitialized_atDeclaration() { | 571 void test_finalNotInitialized_atDeclaration() { |
| 494 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " A() {}", "}"])); | 572 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() {}", "}"])); |
| 495 resolve(source, []); | 573 resolve(source, []); |
| 496 assertNoErrors(); | 574 assertNoErrors(); |
| 497 verify([source]); | 575 verify([source]); |
| 498 } | 576 } |
| 499 void test_finalNotInitialized_fieldFormal() { | 577 void test_finalNotInitialized_fieldFormal() { |
| 500 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " A() {}", "}"])); | 578 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() {}", "}"])); |
| 501 resolve(source, []); | 579 resolve(source, []); |
| 502 assertNoErrors(); | 580 assertNoErrors(); |
| 503 verify([source]); | 581 verify([source]); |
| 504 } | 582 } |
| 505 void test_finalNotInitialized_initializer() { | 583 void test_finalNotInitialized_initializer() { |
| 506 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " A() : x = 0 {}", "}"])); | 584 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 0 {}", "}"])); |
| 507 resolve(source, []); | 585 resolve(source, []); |
| 508 assertNoErrors(); | 586 assertNoErrors(); |
| 509 verify([source]); | 587 verify([source]); |
| 510 } | 588 } |
| 511 void test_importOfNonLibrary_libraryDeclared() { | 589 void test_importOfNonLibrary_libraryDeclared() { |
| 512 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "import 'part.dart';"])); | 590 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); |
| 513 addSource("/part.dart", EngineTestCase.createSource(["library lib1;"])); | 591 addSource2("/part.dart", EngineTestCase.createSource(["library lib1;"])); |
| 514 resolve(source, []); | 592 resolve(source, []); |
| 515 assertNoErrors(); | 593 assertNoErrors(); |
| 516 verify([source]); | 594 verify([source]); |
| 517 } | 595 } |
| 518 void test_importOfNonLibrary_libraryNotDeclared() { | 596 void test_importOfNonLibrary_libraryNotDeclared() { |
| 519 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "import 'part.dart';"])); | 597 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); |
| 520 addSource("/part.dart", EngineTestCase.createSource([""])); | 598 addSource2("/part.dart", EngineTestCase.createSource([""])); |
| 521 resolve(source, []); | 599 resolve(source, []); |
| 522 assertNoErrors(); | 600 assertNoErrors(); |
| 523 verify([source]); | 601 verify([source]); |
| 524 } | 602 } |
| 525 void test_inconsistentCaseExpressionTypes() { | 603 void test_inconsistentCaseExpressionTypes() { |
| 526 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " switch (p) {", " case 1:", " break;", " case 2:", " br
eak;", " }", "}"])); | 604 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " swit
ch (p) {", " case 1:", " break;", " case 2:", " break;", " }",
"}"])); |
| 527 resolve(source, []); | 605 resolve(source, []); |
| 528 assertNoErrors(); | 606 assertNoErrors(); |
| 529 verify([source]); | 607 verify([source]); |
| 530 } | 608 } |
| 531 void test_initializingFormalForNonExistantField() { | 609 void test_initializingFormalForNonExistantField() { |
| 532 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) {}", "}"])); | 610 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); |
| 533 resolve(source, []); | 611 resolve(source, []); |
| 534 assertNoErrors(); | 612 assertNoErrors(); |
| 535 verify([source]); | 613 verify([source]); |
| 536 } | 614 } |
| 537 void test_invalidAssignment() { | 615 void test_invalidAssignment() { |
| 538 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var x;", " var y;", " x = y;", "}"])); | 616 Source source = addSource(EngineTestCase.createSource(["f() {", " var x;",
" var y;", " x = y;", "}"])); |
| 539 resolve(source, []); | 617 resolve(source, []); |
| 540 assertNoErrors(); | 618 assertNoErrors(); |
| 541 verify([source]); | 619 verify([source]); |
| 542 } | 620 } |
| 543 void test_invalidAssignment_toDynamic() { | 621 void test_invalidAssignment_toDynamic() { |
| 544 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var g;", " g = () => 0;", "}"])); | 622 Source source = addSource(EngineTestCase.createSource(["f() {", " var g;",
" g = () => 0;", "}"])); |
| 623 resolve(source, []); |
| 624 assertNoErrors(); |
| 625 verify([source]); |
| 626 } |
| 627 void test_invalidTypeArgumentInConstList() { |
| 628 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return <E>[]", " }", "}"])); |
| 629 resolve(source, []); |
| 630 assertNoErrors(); |
| 631 verify([source]); |
| 632 } |
| 633 void test_invalidTypeArgumentInConstMap() { |
| 634 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return <String, E>{}", " }", "}"])); |
| 545 resolve(source, []); | 635 resolve(source, []); |
| 546 assertNoErrors(); | 636 assertNoErrors(); |
| 547 verify([source]); | 637 verify([source]); |
| 548 } | 638 } |
| 549 void test_invocationOfNonFunction_dynamic() { | 639 void test_invocationOfNonFunction_dynamic() { |
| 550 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " var f;", "}", "class B extends A {", " g() {", " f();", " }", "}"]
)); | 640 Source source = addSource(EngineTestCase.createSource(["class A {", " var f
;", "}", "class B extends A {", " g() {", " f();", " }", "}"])); |
| 551 resolve(source, []); | 641 resolve(source, []); |
| 552 assertNoErrors(); | 642 assertNoErrors(); |
| 553 verify([source]); | 643 verify([source]); |
| 554 } | 644 } |
| 555 void test_invocationOfNonFunction_getter() { | 645 void test_invocationOfNonFunction_getter() { |
| 556 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " var g;", "}", "f() {", " A a;", " a.g();", "}"])); | 646 Source source = addSource(EngineTestCase.createSource(["class A {", " var g
;", "}", "f() {", " A a;", " a.g();", "}"])); |
| 557 resolve(source, []); | 647 resolve(source, []); |
| 558 assertNoErrors(); | 648 assertNoErrors(); |
| 559 verify([source]); | 649 verify([source]); |
| 560 } | 650 } |
| 561 void test_invocationOfNonFunction_localVariable() { | 651 void test_invocationOfNonFunction_localVariable() { |
| 562 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var g;", " g();", "}"])); | 652 Source source = addSource(EngineTestCase.createSource(["f() {", " var g;",
" g();", "}"])); |
| 563 resolve(source, []); | 653 resolve(source, []); |
| 564 assertNoErrors(); | 654 assertNoErrors(); |
| 565 verify([source]); | 655 verify([source]); |
| 566 } | 656 } |
| 567 void test_newWithAbstractClass_factory() { | 657 void test_newWithAbstractClass_factory() { |
| 568 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class A {", " factory A() { return new B(); }", "}", "class B implements A {
", " B() {}", "}", "A f() {", " return new A();", "}"])); | 658 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" factory A() { return new B(); }", "}", "class B implements A {", " B() {}",
"}", "A f() {", " return new A();", "}"])); |
| 569 resolve(source, []); | 659 resolve(source, []); |
| 570 assertNoErrors(); | 660 assertNoErrors(); |
| 571 verify([source]); | 661 verify([source]); |
| 572 } | 662 } |
| 573 void test_nonBoolExpression_assert_bool() { | 663 void test_nonBoolExpression_assert_bool() { |
| 574 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " assert(true);", "}"])); | 664 Source source = addSource(EngineTestCase.createSource(["f() {", " assert(tr
ue);", "}"])); |
| 575 resolve(source, []); | 665 resolve(source, []); |
| 576 assertNoErrors(); | 666 assertNoErrors(); |
| 577 verify([source]); | 667 verify([source]); |
| 578 } | 668 } |
| 579 void test_nonBoolExpression_assert_functionType() { | 669 void test_nonBoolExpression_assert_functionType() { |
| 580 Source source = addSource("/test.dart", EngineTestCase.createSource(["bool m
akeAssertion() => true;", "f() {", " assert(makeAssertion);", "}"])); | 670 Source source = addSource(EngineTestCase.createSource(["bool makeAssertion()
=> true;", "f() {", " assert(makeAssertion);", "}"])); |
| 671 resolve(source, []); |
| 672 assertNoErrors(); |
| 673 verify([source]); |
| 674 } |
| 675 void test_optionalParameterInOperator_required() { |
| 676 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(p) {}", "}"])); |
| 581 resolve(source, []); | 677 resolve(source, []); |
| 582 assertNoErrors(); | 678 assertNoErrors(); |
| 583 verify([source]); | 679 verify([source]); |
| 584 } | 680 } |
| 585 void test_rethrowOutsideCatch() { | 681 void test_rethrowOutsideCatch() { |
| 586 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " try {} catch (e) {rethrow;}", " }", "}"])); | 682 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " try {} catch (e) {rethrow;}", " }", "}"])); |
| 683 resolve(source, []); |
| 684 assertNoErrors(); |
| 685 verify([source]); |
| 686 } |
| 687 void test_returnInGenerativeConstructor() { |
| 688 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
return; }", "}"])); |
| 587 resolve(source, []); | 689 resolve(source, []); |
| 588 assertNoErrors(); | 690 assertNoErrors(); |
| 589 verify([source]); | 691 verify([source]); |
| 590 } | 692 } |
| 591 void test_returnOfInvalidType_dynamic() { | 693 void test_returnOfInvalidType_dynamic() { |
| 592 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
TypeError {}", "class A {", " static void testLogicalOp() {", " testOr(a, b,
onTypeError) {", " try {", " return a || b;", " } on TypeError
catch (t) {", " return onTypeError;", " }", " }", " }", "}"])); | 694 Source source = addSource(EngineTestCase.createSource(["class TypeError {}",
"class A {", " static void testLogicalOp() {", " testOr(a, b, onTypeError)
{", " try {", " return a || b;", " } on TypeError catch (t) {",
" return onTypeError;", " }", " }", " }", "}"])); |
| 593 resolve(source, []); | 695 resolve(source, []); |
| 594 assertNoErrors(); | 696 assertNoErrors(); |
| 595 verify([source]); | 697 verify([source]); |
| 596 } | 698 } |
| 597 void test_returnOfInvalidType_subtype() { | 699 void test_returnOfInvalidType_subtype() { |
| 598 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "A f(B b) { return b; }"])); | 700 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "A f(B b) { return b; }"])); |
| 599 resolve(source, []); | 701 resolve(source, []); |
| 600 assertNoErrors(); | 702 assertNoErrors(); |
| 601 verify([source]); | 703 verify([source]); |
| 602 } | 704 } |
| 603 void test_returnOfInvalidType_supertype() { | 705 void test_returnOfInvalidType_supertype() { |
| 604 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "B f(A a) { return a; }"])); | 706 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "B f(A a) { return a; }"])); |
| 707 resolve(source, []); |
| 708 assertNoErrors(); |
| 709 verify([source]); |
| 710 } |
| 711 void test_returnWithoutValue_noReturnType() { |
| 712 Source source = addSource(EngineTestCase.createSource(["f() { return; }"])); |
| 713 resolve(source, []); |
| 714 assertNoErrors(); |
| 715 verify([source]); |
| 716 } |
| 717 void test_returnWithoutValue_void() { |
| 718 Source source = addSource(EngineTestCase.createSource(["void f() { return; }
"])); |
| 605 resolve(source, []); | 719 resolve(source, []); |
| 606 assertNoErrors(); | 720 assertNoErrors(); |
| 607 verify([source]); | 721 verify([source]); |
| 608 } | 722 } |
| 609 void test_typeArgumentNotMatchingBounds_const() { | 723 void test_typeArgumentNotMatchingBounds_const() { |
| 610 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "class G<E extends A> {", " const G() {}", "}",
"f() { return const G<B>(); }"])); | 724 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "class G<E extends A> {", " const G() {}", "}", "f() { return
const G<B>(); }"])); |
| 611 resolve(source, []); | 725 resolve(source, []); |
| 612 assertNoErrors(); | 726 assertNoErrors(); |
| 613 verify([source]); | 727 verify([source]); |
| 614 } | 728 } |
| 615 void test_typeArgumentNotMatchingBounds_new() { | 729 void test_typeArgumentNotMatchingBounds_new() { |
| 616 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "class G<E extends A> {}", "f() { return new G<B>
(); }"])); | 730 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "class G<E extends A> {}", "f() { return new G<B>(); }"])); |
| 617 resolve(source, []); | 731 resolve(source, []); |
| 618 assertNoErrors(); | 732 assertNoErrors(); |
| 619 verify([source]); | 733 verify([source]); |
| 620 } | 734 } |
| 621 void test_undefinedGetter_typeSubstitution() { | 735 void test_undefinedGetter_typeSubstitution() { |
| 622 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {", " E element;", "}", "class B extends A<List> {", " m() {", " eleme
nt.last;", " }", "}"])); | 736 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " E
element;", "}", "class B extends A<List> {", " m() {", " element.last;", "
}", "}"])); |
| 623 resolve(source, []); | 737 resolve(source, []); |
| 624 assertNoErrors(); | 738 assertNoErrors(); |
| 625 verify([source]); | 739 verify([source]); |
| 626 } | 740 } |
| 627 void test_undefinedIdentifier_hide() { | 741 void test_undefinedIdentifier_hide() { |
| 628 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart' hide a;"])); | 742 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' hide a;"])); |
| 629 addSource("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); | 743 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 630 resolve(source, []); | 744 resolve(source, []); |
| 631 assertNoErrors(); | 745 assertNoErrors(); |
| 632 verify([source]); | 746 verify([source]); |
| 633 } | 747 } |
| 634 void test_undefinedIdentifier_show() { | 748 void test_undefinedIdentifier_show() { |
| 635 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart' show a;"])); | 749 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' show a;"])); |
| 636 addSource("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); | 750 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 637 resolve(source, []); | 751 resolve(source, []); |
| 638 assertNoErrors(); | 752 assertNoErrors(); |
| 639 verify([source]); | 753 verify([source]); |
| 754 } |
| 755 void test_undefinedMethod_noSuchMethod() { |
| 756 Source source = addSource(EngineTestCase.createSource(["class A {", " noSuc
hMethod() {}", "}", "f() {", " (new A()).someMethod();", "}"])); |
| 757 resolve(source, []); |
| 758 assertNoErrors(); |
| 640 } | 759 } |
| 641 void test_undefinedOperator_tilde() { | 760 void test_undefinedOperator_tilde() { |
| 642 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
A = 3;", "const B = ~((1 << A) - 1);"])); | 761 Source source = addSource(EngineTestCase.createSource(["const A = 3;", "cons
t B = ~((1 << A) - 1);"])); |
| 643 resolve(source, []); | 762 resolve(source, []); |
| 644 assertNoErrors(); | 763 assertNoErrors(); |
| 645 verify([source]); | 764 verify([source]); |
| 765 } |
| 766 void test_wrongNumberOfParametersForSetter() { |
| 767 Source source = addSource(EngineTestCase.createSource(["class A {", " set x
(a) {}", "}"])); |
| 768 resolve(source, []); |
| 769 assertNoErrors(); |
| 770 verify([source]); |
| 646 } | 771 } |
| 647 static dartSuite() { | 772 static dartSuite() { |
| 648 _ut.group('NonErrorResolverTest', () { | 773 _ut.group('NonErrorResolverTest', () { |
| 649 _ut.test('test_argumentDefinitionTestNonParameter_formalParameter', () { | 774 _ut.test('test_argumentDefinitionTestNonParameter_formalParameter', () { |
| 650 final __test = new NonErrorResolverTest(); | 775 final __test = new NonErrorResolverTest(); |
| 651 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_form
alParameter); | 776 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_form
alParameter); |
| 652 }); | 777 }); |
| 653 _ut.test('test_argumentDefinitionTestNonParameter_namedParameter', () { | 778 _ut.test('test_argumentDefinitionTestNonParameter_namedParameter', () { |
| 654 final __test = new NonErrorResolverTest(); | 779 final __test = new NonErrorResolverTest(); |
| 655 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_name
dParameter); | 780 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_name
dParameter); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 671 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); | 796 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); |
| 672 }); | 797 }); |
| 673 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { | 798 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { |
| 674 final __test = new NonErrorResolverTest(); | 799 final __test = new NonErrorResolverTest(); |
| 675 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); | 800 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); |
| 676 }); | 801 }); |
| 677 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { | 802 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { |
| 678 final __test = new NonErrorResolverTest(); | 803 final __test = new NonErrorResolverTest(); |
| 679 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; | 804 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; |
| 680 }); | 805 }); |
| 806 _ut.test('test_concreteClassWithAbstractMember', () { |
| 807 final __test = new NonErrorResolverTest(); |
| 808 runJUnitTest(__test, __test.test_concreteClassWithAbstractMember); |
| 809 }); |
| 681 _ut.test('test_constConstructorWithNonFinalField_constInstanceVar', () { | 810 _ut.test('test_constConstructorWithNonFinalField_constInstanceVar', () { |
| 682 final __test = new NonErrorResolverTest(); | 811 final __test = new NonErrorResolverTest(); |
| 683 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_const
InstanceVar); | 812 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_const
InstanceVar); |
| 684 }); | 813 }); |
| 685 _ut.test('test_constConstructorWithNonFinalField_finalInstanceVar', () { | 814 _ut.test('test_constConstructorWithNonFinalField_finalInstanceVar', () { |
| 686 final __test = new NonErrorResolverTest(); | 815 final __test = new NonErrorResolverTest(); |
| 687 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_final
InstanceVar); | 816 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_final
InstanceVar); |
| 688 }); | 817 }); |
| 689 _ut.test('test_constConstructorWithNonFinalField_static', () { | 818 _ut.test('test_constConstructorWithNonFinalField_static', () { |
| 690 final __test = new NonErrorResolverTest(); | 819 final __test = new NonErrorResolverTest(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField); | 900 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField); |
| 772 }); | 901 }); |
| 773 _ut.test('test_invalidAssignment', () { | 902 _ut.test('test_invalidAssignment', () { |
| 774 final __test = new NonErrorResolverTest(); | 903 final __test = new NonErrorResolverTest(); |
| 775 runJUnitTest(__test, __test.test_invalidAssignment); | 904 runJUnitTest(__test, __test.test_invalidAssignment); |
| 776 }); | 905 }); |
| 777 _ut.test('test_invalidAssignment_toDynamic', () { | 906 _ut.test('test_invalidAssignment_toDynamic', () { |
| 778 final __test = new NonErrorResolverTest(); | 907 final __test = new NonErrorResolverTest(); |
| 779 runJUnitTest(__test, __test.test_invalidAssignment_toDynamic); | 908 runJUnitTest(__test, __test.test_invalidAssignment_toDynamic); |
| 780 }); | 909 }); |
| 910 _ut.test('test_invalidTypeArgumentInConstList', () { |
| 911 final __test = new NonErrorResolverTest(); |
| 912 runJUnitTest(__test, __test.test_invalidTypeArgumentInConstList); |
| 913 }); |
| 914 _ut.test('test_invalidTypeArgumentInConstMap', () { |
| 915 final __test = new NonErrorResolverTest(); |
| 916 runJUnitTest(__test, __test.test_invalidTypeArgumentInConstMap); |
| 917 }); |
| 781 _ut.test('test_invocationOfNonFunction_dynamic', () { | 918 _ut.test('test_invocationOfNonFunction_dynamic', () { |
| 782 final __test = new NonErrorResolverTest(); | 919 final __test = new NonErrorResolverTest(); |
| 783 runJUnitTest(__test, __test.test_invocationOfNonFunction_dynamic); | 920 runJUnitTest(__test, __test.test_invocationOfNonFunction_dynamic); |
| 784 }); | 921 }); |
| 785 _ut.test('test_invocationOfNonFunction_getter', () { | 922 _ut.test('test_invocationOfNonFunction_getter', () { |
| 786 final __test = new NonErrorResolverTest(); | 923 final __test = new NonErrorResolverTest(); |
| 787 runJUnitTest(__test, __test.test_invocationOfNonFunction_getter); | 924 runJUnitTest(__test, __test.test_invocationOfNonFunction_getter); |
| 788 }); | 925 }); |
| 789 _ut.test('test_invocationOfNonFunction_localVariable', () { | 926 _ut.test('test_invocationOfNonFunction_localVariable', () { |
| 790 final __test = new NonErrorResolverTest(); | 927 final __test = new NonErrorResolverTest(); |
| 791 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable); | 928 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable); |
| 792 }); | 929 }); |
| 793 _ut.test('test_newWithAbstractClass_factory', () { | 930 _ut.test('test_newWithAbstractClass_factory', () { |
| 794 final __test = new NonErrorResolverTest(); | 931 final __test = new NonErrorResolverTest(); |
| 795 runJUnitTest(__test, __test.test_newWithAbstractClass_factory); | 932 runJUnitTest(__test, __test.test_newWithAbstractClass_factory); |
| 796 }); | 933 }); |
| 797 _ut.test('test_nonBoolExpression_assert_bool', () { | 934 _ut.test('test_nonBoolExpression_assert_bool', () { |
| 798 final __test = new NonErrorResolverTest(); | 935 final __test = new NonErrorResolverTest(); |
| 799 runJUnitTest(__test, __test.test_nonBoolExpression_assert_bool); | 936 runJUnitTest(__test, __test.test_nonBoolExpression_assert_bool); |
| 800 }); | 937 }); |
| 801 _ut.test('test_nonBoolExpression_assert_functionType', () { | 938 _ut.test('test_nonBoolExpression_assert_functionType', () { |
| 802 final __test = new NonErrorResolverTest(); | 939 final __test = new NonErrorResolverTest(); |
| 803 runJUnitTest(__test, __test.test_nonBoolExpression_assert_functionType); | 940 runJUnitTest(__test, __test.test_nonBoolExpression_assert_functionType); |
| 804 }); | 941 }); |
| 942 _ut.test('test_optionalParameterInOperator_required', () { |
| 943 final __test = new NonErrorResolverTest(); |
| 944 runJUnitTest(__test, __test.test_optionalParameterInOperator_required); |
| 945 }); |
| 805 _ut.test('test_rethrowOutsideCatch', () { | 946 _ut.test('test_rethrowOutsideCatch', () { |
| 806 final __test = new NonErrorResolverTest(); | 947 final __test = new NonErrorResolverTest(); |
| 807 runJUnitTest(__test, __test.test_rethrowOutsideCatch); | 948 runJUnitTest(__test, __test.test_rethrowOutsideCatch); |
| 808 }); | 949 }); |
| 950 _ut.test('test_returnInGenerativeConstructor', () { |
| 951 final __test = new NonErrorResolverTest(); |
| 952 runJUnitTest(__test, __test.test_returnInGenerativeConstructor); |
| 953 }); |
| 809 _ut.test('test_returnOfInvalidType_dynamic', () { | 954 _ut.test('test_returnOfInvalidType_dynamic', () { |
| 810 final __test = new NonErrorResolverTest(); | 955 final __test = new NonErrorResolverTest(); |
| 811 runJUnitTest(__test, __test.test_returnOfInvalidType_dynamic); | 956 runJUnitTest(__test, __test.test_returnOfInvalidType_dynamic); |
| 812 }); | 957 }); |
| 813 _ut.test('test_returnOfInvalidType_subtype', () { | 958 _ut.test('test_returnOfInvalidType_subtype', () { |
| 814 final __test = new NonErrorResolverTest(); | 959 final __test = new NonErrorResolverTest(); |
| 815 runJUnitTest(__test, __test.test_returnOfInvalidType_subtype); | 960 runJUnitTest(__test, __test.test_returnOfInvalidType_subtype); |
| 816 }); | 961 }); |
| 817 _ut.test('test_returnOfInvalidType_supertype', () { | 962 _ut.test('test_returnOfInvalidType_supertype', () { |
| 818 final __test = new NonErrorResolverTest(); | 963 final __test = new NonErrorResolverTest(); |
| 819 runJUnitTest(__test, __test.test_returnOfInvalidType_supertype); | 964 runJUnitTest(__test, __test.test_returnOfInvalidType_supertype); |
| 820 }); | 965 }); |
| 966 _ut.test('test_returnWithoutValue_noReturnType', () { |
| 967 final __test = new NonErrorResolverTest(); |
| 968 runJUnitTest(__test, __test.test_returnWithoutValue_noReturnType); |
| 969 }); |
| 970 _ut.test('test_returnWithoutValue_void', () { |
| 971 final __test = new NonErrorResolverTest(); |
| 972 runJUnitTest(__test, __test.test_returnWithoutValue_void); |
| 973 }); |
| 821 _ut.test('test_typeArgumentNotMatchingBounds_const', () { | 974 _ut.test('test_typeArgumentNotMatchingBounds_const', () { |
| 822 final __test = new NonErrorResolverTest(); | 975 final __test = new NonErrorResolverTest(); |
| 823 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); | 976 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); |
| 824 }); | 977 }); |
| 825 _ut.test('test_typeArgumentNotMatchingBounds_new', () { | 978 _ut.test('test_typeArgumentNotMatchingBounds_new', () { |
| 826 final __test = new NonErrorResolverTest(); | 979 final __test = new NonErrorResolverTest(); |
| 827 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); | 980 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); |
| 828 }); | 981 }); |
| 829 _ut.test('test_undefinedGetter_typeSubstitution', () { | 982 _ut.test('test_undefinedGetter_typeSubstitution', () { |
| 830 final __test = new NonErrorResolverTest(); | 983 final __test = new NonErrorResolverTest(); |
| 831 runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution); | 984 runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution); |
| 832 }); | 985 }); |
| 833 _ut.test('test_undefinedIdentifier_hide', () { | 986 _ut.test('test_undefinedIdentifier_hide', () { |
| 834 final __test = new NonErrorResolverTest(); | 987 final __test = new NonErrorResolverTest(); |
| 835 runJUnitTest(__test, __test.test_undefinedIdentifier_hide); | 988 runJUnitTest(__test, __test.test_undefinedIdentifier_hide); |
| 836 }); | 989 }); |
| 837 _ut.test('test_undefinedIdentifier_show', () { | 990 _ut.test('test_undefinedIdentifier_show', () { |
| 838 final __test = new NonErrorResolverTest(); | 991 final __test = new NonErrorResolverTest(); |
| 839 runJUnitTest(__test, __test.test_undefinedIdentifier_show); | 992 runJUnitTest(__test, __test.test_undefinedIdentifier_show); |
| 840 }); | 993 }); |
| 994 _ut.test('test_undefinedMethod_noSuchMethod', () { |
| 995 final __test = new NonErrorResolverTest(); |
| 996 runJUnitTest(__test, __test.test_undefinedMethod_noSuchMethod); |
| 997 }); |
| 841 _ut.test('test_undefinedOperator_tilde', () { | 998 _ut.test('test_undefinedOperator_tilde', () { |
| 842 final __test = new NonErrorResolverTest(); | 999 final __test = new NonErrorResolverTest(); |
| 843 runJUnitTest(__test, __test.test_undefinedOperator_tilde); | 1000 runJUnitTest(__test, __test.test_undefinedOperator_tilde); |
| 844 }); | 1001 }); |
| 1002 _ut.test('test_wrongNumberOfParametersForSetter', () { |
| 1003 final __test = new NonErrorResolverTest(); |
| 1004 runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter); |
| 1005 }); |
| 845 }); | 1006 }); |
| 846 } | 1007 } |
| 847 } | 1008 } |
| 848 class LibraryTest extends EngineTestCase { | 1009 class LibraryTest extends EngineTestCase { |
| 849 /** | 1010 /** |
| 850 * The error listener to which all errors will be reported. | 1011 * The error listener to which all errors will be reported. |
| 851 */ | 1012 */ |
| 852 GatheringErrorListener _errorListener; | 1013 GatheringErrorListener _errorListener; |
| 853 /** | 1014 /** |
| 854 * The source factory used to create libraries. | 1015 * The source factory used to create libraries. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 }); | 1147 }); |
| 987 _ut.test('test_setLibraryElement', () { | 1148 _ut.test('test_setLibraryElement', () { |
| 988 final __test = new LibraryTest(); | 1149 final __test = new LibraryTest(); |
| 989 runJUnitTest(__test, __test.test_setLibraryElement); | 1150 runJUnitTest(__test, __test.test_setLibraryElement); |
| 990 }); | 1151 }); |
| 991 }); | 1152 }); |
| 992 } | 1153 } |
| 993 } | 1154 } |
| 994 class StaticTypeWarningCodeTest extends ResolverTestCase { | 1155 class StaticTypeWarningCodeTest extends ResolverTestCase { |
| 995 void fail_inaccessibleSetter() { | 1156 void fail_inaccessibleSetter() { |
| 996 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1157 Source source = addSource(EngineTestCase.createSource([])); |
| 997 resolve(source, []); | 1158 resolve(source, []); |
| 998 assertErrors([StaticTypeWarningCode.INACCESSIBLE_SETTER]); | 1159 assertErrors([StaticTypeWarningCode.INACCESSIBLE_SETTER]); |
| 999 verify([source]); | 1160 verify([source]); |
| 1000 } | 1161 } |
| 1001 void fail_inconsistentMethodInheritance() { | 1162 void fail_inconsistentMethodInheritance() { |
| 1002 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1163 Source source = addSource(EngineTestCase.createSource([])); |
| 1003 resolve(source, []); | 1164 resolve(source, []); |
| 1004 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); | 1165 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); |
| 1005 verify([source]); | 1166 verify([source]); |
| 1006 } | 1167 } |
| 1007 void fail_nonTypeAsTypeArgument() { | 1168 void fail_nonTypeAsTypeArgument() { |
| 1008 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B<E> {}", "f(B<A> b) {}"])); | 1169 Source source = addSource(EngineTestCase.createSource(["int A;", "class B<E>
{}", "f(B<A> b) {}"])); |
| 1009 resolve(source, []); | 1170 resolve(source, []); |
| 1010 assertErrors([StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]); | 1171 assertErrors([StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]); |
| 1011 verify([source]); | 1172 verify([source]); |
| 1012 } | 1173 } |
| 1013 void fail_redirectWithInvalidTypeParameters() { | 1174 void fail_redirectWithInvalidTypeParameters() { |
| 1014 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1175 Source source = addSource(EngineTestCase.createSource([])); |
| 1015 resolve(source, []); | 1176 resolve(source, []); |
| 1016 assertErrors([StaticTypeWarningCode.REDIRECT_WITH_INVALID_TYPE_PARAMETERS]); | 1177 assertErrors([StaticTypeWarningCode.REDIRECT_WITH_INVALID_TYPE_PARAMETERS]); |
| 1017 verify([source]); | 1178 verify([source]); |
| 1018 } | 1179 } |
| 1019 void fail_typeArgumentViolatesBounds() { | 1180 void fail_typeArgumentViolatesBounds() { |
| 1020 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1181 Source source = addSource(EngineTestCase.createSource([])); |
| 1021 resolve(source, []); | 1182 resolve(source, []); |
| 1022 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_VIOLATES_BOUNDS]); | 1183 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_VIOLATES_BOUNDS]); |
| 1023 verify([source]); | 1184 verify([source]); |
| 1024 } | 1185 } |
| 1025 void test_invalidAssignment_instanceVariable() { | 1186 void test_invalidAssignment_instanceVariable() { |
| 1026 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", "}", "f() {", " A a;", " a.x = '0';", "}"])); | 1187 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", "}", "f() {", " A a;", " a.x = '0';", "}"])); |
| 1027 resolve(source, []); | 1188 resolve(source, []); |
| 1028 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 1189 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 1029 verify([source]); | 1190 verify([source]); |
| 1030 } | 1191 } |
| 1031 void test_invalidAssignment_localVariable() { | 1192 void test_invalidAssignment_localVariable() { |
| 1032 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x;", " x = '0';", "}"])); | 1193 Source source = addSource(EngineTestCase.createSource(["f() {", " int x;",
" x = '0';", "}"])); |
| 1033 resolve(source, []); | 1194 resolve(source, []); |
| 1034 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 1195 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 1035 verify([source]); | 1196 verify([source]); |
| 1036 } | 1197 } |
| 1037 void test_invalidAssignment_staticVariable() { | 1198 void test_invalidAssignment_staticVariable() { |
| 1038 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int x;", "}", "f() {", " A.x = '0';", "}"])); | 1199 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", "}", "f() {", " A.x = '0';", "}"])); |
| 1039 resolve(source, []); | 1200 resolve(source, []); |
| 1040 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 1201 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 1041 verify([source]); | 1202 verify([source]); |
| 1042 } | 1203 } |
| 1043 void test_invocationOfNonFunction_class() { | 1204 void test_invocationOfNonFunction_class() { |
| 1044 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " A();", " }", "}"])); | 1205 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " A();", " }", "}"])); |
| 1045 resolve(source, []); | 1206 resolve(source, []); |
| 1046 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1207 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 1047 } | 1208 } |
| 1048 void test_invocationOfNonFunction_localVariable() { | 1209 void test_invocationOfNonFunction_localVariable() { |
| 1049 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x;", " return x();", "}"])); | 1210 Source source = addSource(EngineTestCase.createSource(["f() {", " int x;",
" return x();", "}"])); |
| 1050 resolve(source, []); | 1211 resolve(source, []); |
| 1051 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1212 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 1052 verify([source]); | 1213 verify([source]); |
| 1053 } | 1214 } |
| 1054 void test_invocationOfNonFunction_ordinaryInvocation() { | 1215 void test_invocationOfNonFunction_ordinaryInvocation() { |
| 1055 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", "}", "class B {", " m() {", " A.x();", " }", "}"])); | 1216 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", "}", "class B {", " m() {", " A.x();", " }", "}"])); |
| 1056 resolve(source, []); | 1217 resolve(source, []); |
| 1057 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1218 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 1058 } | 1219 } |
| 1059 void test_invocationOfNonFunction_staticInvocation() { | 1220 void test_invocationOfNonFunction_staticInvocation() { |
| 1060 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => 0;", " f() {", " A.g();", " }", "}"])); | 1221 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int get g => 0;", " f() {", " A.g();", " }", "}"])); |
| 1061 resolve(source, []); | 1222 resolve(source, []); |
| 1062 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 1223 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 1063 } | 1224 } |
| 1064 void test_nonBoolCondition_conditional() { | 1225 void test_nonBoolCondition_conditional() { |
| 1065 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
return 3 ? 2 : 1; }"])); | 1226 Source source = addSource(EngineTestCase.createSource(["f() { return 3 ? 2 :
1; }"])); |
| 1066 resolve(source, []); | 1227 resolve(source, []); |
| 1067 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1228 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 1068 verify([source]); | 1229 verify([source]); |
| 1069 } | 1230 } |
| 1070 void test_nonBoolCondition_do() { | 1231 void test_nonBoolCondition_do() { |
| 1071 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " do {} while (3);", "}"])); | 1232 Source source = addSource(EngineTestCase.createSource(["f() {", " do {} whi
le (3);", "}"])); |
| 1072 resolve(source, []); | 1233 resolve(source, []); |
| 1073 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1234 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 1074 verify([source]); | 1235 verify([source]); |
| 1075 } | 1236 } |
| 1076 void test_nonBoolCondition_if() { | 1237 void test_nonBoolCondition_if() { |
| 1077 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " if (3) return 2; else return 1;", "}"])); | 1238 Source source = addSource(EngineTestCase.createSource(["f() {", " if (3) re
turn 2; else return 1;", "}"])); |
| 1078 resolve(source, []); | 1239 resolve(source, []); |
| 1079 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1240 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 1080 verify([source]); | 1241 verify([source]); |
| 1081 } | 1242 } |
| 1082 void test_nonBoolCondition_while() { | 1243 void test_nonBoolCondition_while() { |
| 1083 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " while (3) {}", "}"])); | 1244 Source source = addSource(EngineTestCase.createSource(["f() {", " while (3)
{}", "}"])); |
| 1084 resolve(source, []); | 1245 resolve(source, []); |
| 1085 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 1246 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 1086 verify([source]); | 1247 verify([source]); |
| 1087 } | 1248 } |
| 1088 void test_nonBoolExpression() { | 1249 void test_nonBoolExpression() { |
| 1089 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " assert(0);", "}"])); | 1250 Source source = addSource(EngineTestCase.createSource(["f() {", " assert(0)
;", "}"])); |
| 1090 resolve(source, []); | 1251 resolve(source, []); |
| 1091 assertErrors([StaticTypeWarningCode.NON_BOOL_EXPRESSION]); | 1252 assertErrors([StaticTypeWarningCode.NON_BOOL_EXPRESSION]); |
| 1092 verify([source]); | 1253 verify([source]); |
| 1093 } | 1254 } |
| 1094 void test_returnOfInvalidType_function() { | 1255 void test_returnOfInvalidType_function() { |
| 1095 Source source = addSource("/test.dart", EngineTestCase.createSource(["int f(
) { return '0'; }"])); | 1256 Source source = addSource(EngineTestCase.createSource(["int f() { return '0'
; }"])); |
| 1096 resolve(source, []); | 1257 resolve(source, []); |
| 1097 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 1258 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 1098 verify([source]); | 1259 verify([source]); |
| 1099 } | 1260 } |
| 1100 void test_returnOfInvalidType_localFunction() { | 1261 void test_returnOfInvalidType_localFunction() { |
| 1101 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " String m() {", " int f() { return '0'; }", " }", "}"])); | 1262 Source source = addSource(EngineTestCase.createSource(["class A {", " Strin
g m() {", " int f() { return '0'; }", " }", "}"])); |
| 1102 resolve(source, []); | 1263 resolve(source, []); |
| 1103 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 1264 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 1104 verify([source]); | 1265 verify([source]); |
| 1105 } | 1266 } |
| 1106 void test_returnOfInvalidType_method() { | 1267 void test_returnOfInvalidType_method() { |
| 1107 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int f() { return '0'; }", "}"])); | 1268 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() { return '0'; }", "}"])); |
| 1108 resolve(source, []); | 1269 resolve(source, []); |
| 1109 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 1270 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 1110 verify([source]); | 1271 verify([source]); |
| 1111 } | 1272 } |
| 1112 void test_typeArgumentNotMatchingBounds_const() { | 1273 void test_typeArgumentNotMatchingBounds_const() { |
| 1113 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B {}", "class G<E extends A> {", " const G() {}", "}", "f() { ret
urn const G<B>(); }"])); | 1274 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {", " const G() {}", "}", "f() { return const G<B>
(); }"])); |
| 1114 resolve(source, []); | 1275 resolve(source, []); |
| 1115 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 1276 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 1116 verify([source]); | 1277 verify([source]); |
| 1117 } | 1278 } |
| 1118 void test_typeArgumentNotMatchingBounds_new() { | 1279 void test_typeArgumentNotMatchingBounds_new() { |
| 1119 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B {}", "class G<E extends A> {}", "f() { return new G<B>(); }"])); | 1280 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "f() { return new G<B>(); }"])); |
| 1120 resolve(source, []); | 1281 resolve(source, []); |
| 1121 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 1282 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 1122 verify([source]); | 1283 verify([source]); |
| 1123 } | 1284 } |
| 1124 void test_undefinedFunction() { | 1285 void test_undefinedFunction() { |
| 1125 Source source = addSource("/test.dart", EngineTestCase.createSource(["void f
() {", " g();", "}"])); | 1286 Source source = addSource(EngineTestCase.createSource(["void f() {", " g();
", "}"])); |
| 1126 resolve(source, []); | 1287 resolve(source, []); |
| 1127 assertErrors([StaticTypeWarningCode.UNDEFINED_FUNCTION]); | 1288 assertErrors([StaticTypeWarningCode.UNDEFINED_FUNCTION]); |
| 1128 } | 1289 } |
| 1129 void test_undefinedGetter() { | 1290 void test_undefinedGetter() { |
| 1130 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {}", "f(T e) { return e.m; }"])); | 1291 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e)
{ return e.m; }"])); |
| 1131 resolve(source, []); | 1292 resolve(source, []); |
| 1132 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); | 1293 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 1133 } | 1294 } |
| 1134 void test_undefinedGetter_static() { | 1295 void test_undefinedGetter_static() { |
| 1135 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "var a = A.B;"])); | 1296 Source source = addSource(EngineTestCase.createSource(["class A {}", "var a
= A.B;"])); |
| 1136 resolve(source, []); | 1297 resolve(source, []); |
| 1137 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); | 1298 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 1138 } | 1299 } |
| 1139 void test_undefinedMethod() { | 1300 void test_undefinedMethod() { |
| 1140 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m() {", " n();", " }", "}"])); | 1301 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " n();", " }", "}"])); |
| 1141 resolve(source, []); | 1302 resolve(source, []); |
| 1142 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); | 1303 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); |
| 1143 } | 1304 } |
| 1144 void test_undefinedSetter() { | 1305 void test_undefinedSetter() { |
| 1145 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {}", "f(T e1) { e1.m = 0; }"])); | 1306 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e1
) { e1.m = 0; }"])); |
| 1146 resolve(source, []); | 1307 resolve(source, []); |
| 1147 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); | 1308 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); |
| 1148 } | 1309 } |
| 1149 void test_undefinedSetter_static() { | 1310 void test_undefinedSetter_static() { |
| 1150 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { A.B = 0;}"])); | 1311 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {
A.B = 0;}"])); |
| 1151 resolve(source, []); | 1312 resolve(source, []); |
| 1152 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); | 1313 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); |
| 1153 } | 1314 } |
| 1154 void test_undefinedSuperMethod() { | 1315 void test_undefinedSuperMethod() { |
| 1155 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {", " m() { return super.m(); }", "}"])); | 1316 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " m() { return super.m(); }", "}"])); |
| 1156 resolve(source, []); | 1317 resolve(source, []); |
| 1157 assertErrors([StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]); | 1318 assertErrors([StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]); |
| 1158 } | 1319 } |
| 1159 void test_wrongNumberOfTypeArguments_tooFew() { | 1320 void test_wrongNumberOfTypeArguments_tooFew() { |
| 1160 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E, F> {}", "A<A> a = null;"])); | 1321 Source source = addSource(EngineTestCase.createSource(["class A<E, F> {}", "
A<A> a = null;"])); |
| 1161 resolve(source, []); | 1322 resolve(source, []); |
| 1162 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 1323 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 1163 verify([source]); | 1324 verify([source]); |
| 1164 } | 1325 } |
| 1165 void test_wrongNumberOfTypeArguments_tooMany() { | 1326 void test_wrongNumberOfTypeArguments_tooMany() { |
| 1166 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {}", "A<A, A> a = null;"])); | 1327 Source source = addSource(EngineTestCase.createSource(["class A<E> {}", "A<A
, A> a = null;"])); |
| 1167 resolve(source, []); | 1328 resolve(source, []); |
| 1168 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 1329 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 1169 verify([source]); | 1330 verify([source]); |
| 1170 } | 1331 } |
| 1171 static dartSuite() { | 1332 static dartSuite() { |
| 1172 _ut.group('StaticTypeWarningCodeTest', () { | 1333 _ut.group('StaticTypeWarningCodeTest', () { |
| 1173 _ut.test('test_invalidAssignment_instanceVariable', () { | 1334 _ut.test('test_invalidAssignment_instanceVariable', () { |
| 1174 final __test = new StaticTypeWarningCodeTest(); | 1335 final __test = new StaticTypeWarningCodeTest(); |
| 1175 runJUnitTest(__test, __test.test_invalidAssignment_instanceVariable); | 1336 runJUnitTest(__test, __test.test_invalidAssignment_instanceVariable); |
| 1176 }); | 1337 }); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 /** | 1455 /** |
| 1295 * The visitor used to resolve types needed to form the type hierarchy. | 1456 * The visitor used to resolve types needed to form the type hierarchy. |
| 1296 */ | 1457 */ |
| 1297 TypeResolverVisitor _visitor; | 1458 TypeResolverVisitor _visitor; |
| 1298 void fail_visitConstructorDeclaration() { | 1459 void fail_visitConstructorDeclaration() { |
| 1299 JUnitTestCase.fail("Not yet tested"); | 1460 JUnitTestCase.fail("Not yet tested"); |
| 1300 _listener.assertNoErrors(); | 1461 _listener.assertNoErrors(); |
| 1301 } | 1462 } |
| 1302 void fail_visitFieldFormalParameter_noType() { | 1463 void fail_visitFieldFormalParameter_noType() { |
| 1303 FormalParameter node = ASTFactory.fieldFormalParameter(Keyword.VAR, null, "p
"); | 1464 FormalParameter node = ASTFactory.fieldFormalParameter(Keyword.VAR, null, "p
"); |
| 1304 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve5(node, [])); | 1465 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve6(node, [])); |
| 1305 _listener.assertNoErrors(); | 1466 _listener.assertNoErrors(); |
| 1306 } | 1467 } |
| 1307 void fail_visitFieldFormalParameter_type() { | 1468 void fail_visitFieldFormalParameter_type() { |
| 1308 FormalParameter node = ASTFactory.fieldFormalParameter(null, ASTFactory.type
Name4("int", []), "p"); | 1469 FormalParameter node = ASTFactory.fieldFormalParameter(null, ASTFactory.type
Name4("int", []), "p"); |
| 1309 JUnitTestCase.assertSame(_typeProvider.intType, resolve5(node, [])); | 1470 JUnitTestCase.assertSame(_typeProvider.intType, resolve6(node, [])); |
| 1310 _listener.assertNoErrors(); | 1471 _listener.assertNoErrors(); |
| 1311 } | 1472 } |
| 1312 void fail_visitFunctionDeclaration() { | 1473 void fail_visitFunctionDeclaration() { |
| 1313 JUnitTestCase.fail("Not yet tested"); | 1474 JUnitTestCase.fail("Not yet tested"); |
| 1314 _listener.assertNoErrors(); | 1475 _listener.assertNoErrors(); |
| 1315 } | 1476 } |
| 1316 void fail_visitFunctionTypeAlias() { | 1477 void fail_visitFunctionTypeAlias() { |
| 1317 JUnitTestCase.fail("Not yet tested"); | 1478 JUnitTestCase.fail("Not yet tested"); |
| 1318 _listener.assertNoErrors(); | 1479 _listener.assertNoErrors(); |
| 1319 } | 1480 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 EngineTestCase.assertLength(1, mixins2); | 1579 EngineTestCase.assertLength(1, mixins2); |
| 1419 JUnitTestCase.assertSame(elementC.type, mixins2[0]); | 1580 JUnitTestCase.assertSame(elementC.type, mixins2[0]); |
| 1420 List<InterfaceType> interfaces2 = elementA.interfaces; | 1581 List<InterfaceType> interfaces2 = elementA.interfaces; |
| 1421 EngineTestCase.assertLength(1, interfaces2); | 1582 EngineTestCase.assertLength(1, interfaces2); |
| 1422 JUnitTestCase.assertSame(elementD.type, interfaces2[0]); | 1583 JUnitTestCase.assertSame(elementD.type, interfaces2[0]); |
| 1423 _listener.assertNoErrors(); | 1584 _listener.assertNoErrors(); |
| 1424 } | 1585 } |
| 1425 void test_visitSimpleFormalParameter_noType() { | 1586 void test_visitSimpleFormalParameter_noType() { |
| 1426 FormalParameter node = ASTFactory.simpleFormalParameter3("p"); | 1587 FormalParameter node = ASTFactory.simpleFormalParameter3("p"); |
| 1427 node.identifier.element = new ParameterElementImpl(ASTFactory.identifier3("p
")); | 1588 node.identifier.element = new ParameterElementImpl(ASTFactory.identifier3("p
")); |
| 1428 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve5(node, [])); | 1589 JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve6(node, [])); |
| 1429 _listener.assertNoErrors(); | 1590 _listener.assertNoErrors(); |
| 1430 } | 1591 } |
| 1431 void test_visitSimpleFormalParameter_type() { | 1592 void test_visitSimpleFormalParameter_type() { |
| 1432 InterfaceType intType2 = _typeProvider.intType; | 1593 InterfaceType intType2 = _typeProvider.intType; |
| 1433 ClassElement intElement = intType2.element; | 1594 ClassElement intElement = intType2.element; |
| 1434 FormalParameter node = ASTFactory.simpleFormalParameter4(ASTFactory.typeName
(intElement, []), "p"); | 1595 FormalParameter node = ASTFactory.simpleFormalParameter4(ASTFactory.typeName
(intElement, []), "p"); |
| 1435 SimpleIdentifier identifier2 = node.identifier; | 1596 SimpleIdentifier identifier2 = node.identifier; |
| 1436 ParameterElementImpl element = new ParameterElementImpl(identifier2); | 1597 ParameterElementImpl element = new ParameterElementImpl(identifier2); |
| 1437 identifier2.element = element; | 1598 identifier2.element = element; |
| 1438 JUnitTestCase.assertSame(intType2, resolve5(node, [intElement])); | 1599 JUnitTestCase.assertSame(intType2, resolve6(node, [intElement])); |
| 1439 _listener.assertNoErrors(); | 1600 _listener.assertNoErrors(); |
| 1440 } | 1601 } |
| 1441 void test_visitTypeName_noParameters_noArguments() { | 1602 void test_visitTypeName_noParameters_noArguments() { |
| 1442 ClassElement classA = ElementFactory.classElement2("A", []); | 1603 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1443 TypeName typeName2 = ASTFactory.typeName(classA, []); | 1604 TypeName typeName2 = ASTFactory.typeName(classA, []); |
| 1444 typeName2.type = null; | 1605 typeName2.type = null; |
| 1445 resolveNode(typeName2, [classA]); | 1606 resolveNode(typeName2, [classA]); |
| 1446 JUnitTestCase.assertSame(classA.type, typeName2.type); | 1607 JUnitTestCase.assertSame(classA.type, typeName2.type); |
| 1447 _listener.assertNoErrors(); | 1608 _listener.assertNoErrors(); |
| 1448 } | 1609 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 } | 1661 } |
| 1501 } | 1662 } |
| 1502 /** | 1663 /** |
| 1503 * Return the type associated with the given parameter after the static type a
nalyzer has computed | 1664 * Return the type associated with the given parameter after the static type a
nalyzer has computed |
| 1504 * a type for it. | 1665 * a type for it. |
| 1505 * @param node the parameter with which the type is associated | 1666 * @param node the parameter with which the type is associated |
| 1506 * @param definedElements the elements that are to be defined in the scope in
which the element is | 1667 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 1507 * being resolved | 1668 * being resolved |
| 1508 * @return the type associated with the parameter | 1669 * @return the type associated with the parameter |
| 1509 */ | 1670 */ |
| 1510 Type2 resolve5(FormalParameter node, List<Element> definedElements) { | 1671 Type2 resolve6(FormalParameter node, List<Element> definedElements) { |
| 1511 resolveNode(node, definedElements); | 1672 resolveNode(node, definedElements); |
| 1512 return ((node.identifier.element as ParameterElement)).type; | 1673 return ((node.identifier.element as ParameterElement)).type; |
| 1513 } | 1674 } |
| 1514 /** | 1675 /** |
| 1515 * Return the element associated with the given identifier after the resolver
has resolved the | 1676 * Return the element associated with the given identifier after the resolver
has resolved the |
| 1516 * identifier. | 1677 * identifier. |
| 1517 * @param node the expression to be resolved | 1678 * @param node the expression to be resolved |
| 1518 * @param definedElements the elements that are to be defined in the scope in
which the element is | 1679 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 1519 * being resolved | 1680 * being resolved |
| 1520 * @return the element to which the expression was resolved | 1681 * @return the element to which the expression was resolved |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 */ | 1762 */ |
| 1602 void assertErrors(List<ErrorCode> expectedErrorCodes) { | 1763 void assertErrors(List<ErrorCode> expectedErrorCodes) { |
| 1603 _errorListener.assertErrors2(expectedErrorCodes); | 1764 _errorListener.assertErrors2(expectedErrorCodes); |
| 1604 } | 1765 } |
| 1605 void setUp() { | 1766 void setUp() { |
| 1606 _errorListener = new GatheringErrorListener(); | 1767 _errorListener = new GatheringErrorListener(); |
| 1607 _analysisContext = AnalysisContextFactory.contextWithCore(); | 1768 _analysisContext = AnalysisContextFactory.contextWithCore(); |
| 1608 _sourceFactory = _analysisContext.sourceFactory; | 1769 _sourceFactory = _analysisContext.sourceFactory; |
| 1609 } | 1770 } |
| 1610 /** | 1771 /** |
| 1772 * Add a source file to the content provider. |
| 1773 * @param contents the contents to be returned by the content provider for the
specified file |
| 1774 * @return the source object representing the added file |
| 1775 */ |
| 1776 Source addSource(String contents) => addSource2("/test.dart", contents); |
| 1777 /** |
| 1611 * Add a source file to the content provider. The file path should be absolute
. | 1778 * Add a source file to the content provider. The file path should be absolute
. |
| 1612 * @param filePath the path of the file being added | 1779 * @param filePath the path of the file being added |
| 1613 * @param contents the contents to be returned by the content provider for the
specified file | 1780 * @param contents the contents to be returned by the content provider for the
specified file |
| 1614 * @return the source object representing the added file | 1781 * @return the source object representing the added file |
| 1615 */ | 1782 */ |
| 1616 Source addSource(String filePath, String contents) { | 1783 Source addSource2(String filePath, String contents) { |
| 1617 Source source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUt
ilities2.createFile(filePath)); | 1784 Source source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUt
ilities2.createFile(filePath)); |
| 1618 _sourceFactory.setContents(source, contents); | 1785 _sourceFactory.setContents(source, contents); |
| 1619 ChangeSet changeSet = new ChangeSet(); | 1786 ChangeSet changeSet = new ChangeSet(); |
| 1620 changeSet.added(source); | 1787 changeSet.added(source); |
| 1621 _analysisContext.applyChanges(changeSet); | 1788 _analysisContext.applyChanges(changeSet); |
| 1622 return source; | 1789 return source; |
| 1623 } | 1790 } |
| 1624 /** | 1791 /** |
| 1625 * Assert that no errors have been gathered. | 1792 * Assert that no errors have been gathered. |
| 1626 * @throws AssertionFailedError if any errors have been gathered | 1793 * @throws AssertionFailedError if any errors have been gathered |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 _ut.group('TypeProviderImplTest', () { | 1945 _ut.group('TypeProviderImplTest', () { |
| 1779 _ut.test('test_creation', () { | 1946 _ut.test('test_creation', () { |
| 1780 final __test = new TypeProviderImplTest(); | 1947 final __test = new TypeProviderImplTest(); |
| 1781 runJUnitTest(__test, __test.test_creation); | 1948 runJUnitTest(__test, __test.test_creation); |
| 1782 }); | 1949 }); |
| 1783 }); | 1950 }); |
| 1784 } | 1951 } |
| 1785 } | 1952 } |
| 1786 class CompileTimeErrorCodeTest extends ResolverTestCase { | 1953 class CompileTimeErrorCodeTest extends ResolverTestCase { |
| 1787 void fail_ambiguousExport() { | 1954 void fail_ambiguousExport() { |
| 1788 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';", "export 'lib2.dart';"])); | 1955 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';", "export 'lib2.dart';"])); |
| 1789 addSource("/lib1.dart", EngineTestCase.createSource(["class N {}"])); | 1956 addSource2("/lib1.dart", EngineTestCase.createSource(["class N {}"])); |
| 1790 addSource("/lib2.dart", EngineTestCase.createSource(["class N {}"])); | 1957 addSource2("/lib2.dart", EngineTestCase.createSource(["class N {}"])); |
| 1791 resolve(source, []); | 1958 resolve(source, []); |
| 1792 assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]); | 1959 assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]); |
| 1793 verify([source]); | 1960 verify([source]); |
| 1794 } | 1961 } |
| 1795 void fail_ambiguousImport_function() { | 1962 void fail_ambiguousImport_function() { |
| 1796 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "import 'lib1.dart';", "import 'lib2.dart';", "g() { return f(); }"])); | 1963 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'lib1.dart';", "import 'lib2.dart';", "g() { return f(); }"])); |
| 1797 addSource("/lib1.dart", EngineTestCase.createSource(["f() {}"])); | 1964 addSource2("/lib1.dart", EngineTestCase.createSource(["f() {}"])); |
| 1798 addSource("/lib2.dart", EngineTestCase.createSource(["f() {}"])); | 1965 addSource2("/lib2.dart", EngineTestCase.createSource(["f() {}"])); |
| 1799 resolve(source, []); | 1966 resolve(source, []); |
| 1800 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 1967 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 1801 verify([source]); | 1968 verify([source]); |
| 1802 } | 1969 } |
| 1803 void fail_ambiguousImport_typeAnnotation() { | 1970 void fail_ambiguousImport_typeAnnotation() { |
| 1804 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "import 'lib1.dart';", "import 'lib2.dart';", "class A extends N {}"])); | 1971 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'lib1.dart';", "import 'lib2.dart';", "class A extends N {}"])); |
| 1805 addSource("/lib1.dart", EngineTestCase.createSource(["class N {}"])); | 1972 addSource2("/lib1.dart", EngineTestCase.createSource(["class N {}"])); |
| 1806 addSource("/lib2.dart", EngineTestCase.createSource(["class N {}"])); | 1973 addSource2("/lib2.dart", EngineTestCase.createSource(["class N {}"])); |
| 1807 resolve(source, []); | 1974 resolve(source, []); |
| 1808 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 1975 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 1809 verify([source]); | 1976 verify([source]); |
| 1810 } | 1977 } |
| 1811 void fail_compileTimeConstantRaisesException() { | 1978 void fail_compileTimeConstantRaisesException() { |
| 1812 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1979 Source source = addSource(EngineTestCase.createSource([])); |
| 1813 resolve(source, []); | 1980 resolve(source, []); |
| 1814 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION]); | 1981 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION]); |
| 1815 verify([source]); | 1982 verify([source]); |
| 1816 } | 1983 } |
| 1817 void fail_constWithNonConstantArgument() { | 1984 void fail_constWithNonConstantArgument() { |
| 1818 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {", " T(a) {};", "}", "f(p) { return const T(p); }"])); | 1985 Source source = addSource(EngineTestCase.createSource(["class T {", " T(a)
{};", "}", "f(p) { return const T(p); }"])); |
| 1819 resolve(source, []); | 1986 resolve(source, []); |
| 1820 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); | 1987 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); |
| 1821 verify([source]); | 1988 verify([source]); |
| 1822 } | 1989 } |
| 1823 void fail_constWithNonType() { | 1990 void fail_constWithNonType() { |
| 1824 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "f() {", " return const A();", "}"])); | 1991 Source source = addSource(EngineTestCase.createSource(["int A;", "f() {", "
return const A();", "}"])); |
| 1825 resolve(source, []); | 1992 resolve(source, []); |
| 1826 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); | 1993 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); |
| 1827 verify([source]); | 1994 verify([source]); |
| 1828 } | 1995 } |
| 1829 void fail_constWithTypeParameters() { | 1996 void fail_constWithTypeParameters() { |
| 1830 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 1997 Source source = addSource(EngineTestCase.createSource([])); |
| 1831 resolve(source, []); | 1998 resolve(source, []); |
| 1832 assertErrors([CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS]); | 1999 assertErrors([CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS]); |
| 1833 verify([source]); | 2000 verify([source]); |
| 1834 } | 2001 } |
| 1835 void fail_constWithUndefinedConstructor() { | 2002 void fail_constWithUndefinedConstructor() { |
| 1836 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A(x) {}", "}", "f() {", " return const A(0);", "}"])); | 2003 Source source = addSource(EngineTestCase.createSource(["class A {", " A(x)
{}", "}", "f() {", " return const A(0);", "}"])); |
| 1837 resolve(source, []); | 2004 resolve(source, []); |
| 1838 assertErrors([CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]); | 2005 assertErrors([CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]); |
| 1839 verify([source]); | 2006 verify([source]); |
| 1840 } | 2007 } |
| 1841 void fail_duplicateDefinition() { | 2008 void fail_duplicateDefinition() { |
| 1842 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int m = 0;", " m(a) {}", "}"])); | 2009 Source source = addSource(EngineTestCase.createSource(["f() {", " int m = 0
;", " m(a) {}", "}"])); |
| 1843 resolve(source, []); | 2010 resolve(source, []); |
| 1844 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 2011 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 1845 verify([source]); | 2012 verify([source]); |
| 1846 } | 2013 } |
| 2014 void fail_duplicateMemberError_classMembers_fields() { |
| 2015 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
int a;", " int a;", "}"])); |
| 2016 resolve(librarySource, []); |
| 2017 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 2018 verify([librarySource]); |
| 2019 } |
| 2020 void fail_duplicateMemberError_classMembers_methods() { |
| 2021 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
m() {}", " m() {}", "}"])); |
| 2022 resolve(librarySource, []); |
| 2023 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 2024 verify([librarySource]); |
| 2025 } |
| 2026 void fail_duplicateMemberError_localFields() { |
| 2027 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
m() {", " int a;", " int a;", " }", "}"])); |
| 2028 resolve(librarySource, []); |
| 2029 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 2030 verify([librarySource]); |
| 2031 } |
| 1847 void fail_duplicateMemberName() { | 2032 void fail_duplicateMemberName() { |
| 1848 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x = 0;", " int x() {}", "}"])); | 2033 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
= 0;", " int x() {}", "}"])); |
| 1849 resolve(source, []); | 2034 resolve(source, []); |
| 1850 assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME]); | 2035 assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME]); |
| 1851 verify([source]); | 2036 verify([source]); |
| 1852 } | 2037 } |
| 1853 void fail_duplicateMemberNameInstanceStatic() { | 2038 void fail_duplicateMemberNameInstanceStatic() { |
| 1854 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " static int x;", "}"])); | 2039 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " static int x;", "}"])); |
| 1855 resolve(source, []); | 2040 resolve(source, []); |
| 1856 assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME_INSTANCE_STATIC]); | 2041 assertErrors([CompileTimeErrorCode.DUPLICATE_MEMBER_NAME_INSTANCE_STATIC]); |
| 1857 verify([source]); | 2042 verify([source]); |
| 1858 } | 2043 } |
| 1859 void fail_duplicateNamedArgument() { | 2044 void fail_duplicateNamedArgument() { |
| 1860 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({a,
a}) {}"])); | 2045 Source source = addSource(EngineTestCase.createSource(["f({a, a}) {}"])); |
| 1861 resolve(source, []); | 2046 resolve(source, []); |
| 1862 assertErrors([CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); | 2047 assertErrors([CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); |
| 1863 verify([source]); | 2048 verify([source]); |
| 1864 } | 2049 } |
| 1865 void fail_extendsOrImplementsDisallowedClass_extends_null() { | 2050 void fail_extendsOrImplementsDisallowedClass_extends_null() { |
| 1866 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends Null {}"])); | 2051 Source source = addSource(EngineTestCase.createSource(["class A extends Null
{}"])); |
| 1867 resolve(source, []); | 2052 resolve(source, []); |
| 1868 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 2053 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 1869 verify([source]); | 2054 verify([source]); |
| 1870 } | 2055 } |
| 1871 void fail_extendsOrImplementsDisallowedClass_implements_null() { | 2056 void fail_extendsOrImplementsDisallowedClass_implements_null() { |
| 1872 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements Null {}"])); | 2057 Source source = addSource(EngineTestCase.createSource(["class A implements N
ull {}"])); |
| 1873 resolve(source, []); | 2058 resolve(source, []); |
| 1874 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2059 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 1875 verify([source]); | 2060 verify([source]); |
| 1876 } | 2061 } |
| 1877 void fail_finalNotInitialized_inConstructor() { | 2062 void fail_finalNotInitialized_inConstructor() { |
| 1878 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " A() {}", "}"])); | 2063 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() {}", "}"])); |
| 1879 resolve(source, []); | 2064 resolve(source, []); |
| 1880 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2065 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 1881 verify([source]); | 2066 verify([source]); |
| 1882 } | 2067 } |
| 1883 void fail_getterAndMethodWithSameName() { | 2068 void fail_getterAndMethodWithSameName() { |
| 1884 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " get x -> 0;", " x(y) {}", "}"])); | 2069 Source source = addSource(EngineTestCase.createSource(["class A {", " get x
-> 0;", " x(y) {}", "}"])); |
| 1885 resolve(source, []); | 2070 resolve(source, []); |
| 1886 assertErrors([CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); | 2071 assertErrors([CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); |
| 1887 verify([source]); | 2072 verify([source]); |
| 1888 } | 2073 } |
| 1889 void fail_importDuplicatedLibraryName() { | 2074 void fail_importDuplicatedLibraryName() { |
| 1890 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y test;", "import 'lib1.dart';", "import 'lib2.dart';"])); | 2075 Source source = addSource(EngineTestCase.createSource(["library test;", "imp
ort 'lib1.dart';", "import 'lib2.dart';"])); |
| 1891 addSource("/lib1.dart", EngineTestCase.createSource(["library lib;"])); | 2076 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib;"])); |
| 1892 addSource("/lib2.dart", EngineTestCase.createSource(["library lib;"])); | 2077 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib;"])); |
| 1893 resolve(source, []); | 2078 resolve(source, []); |
| 1894 assertErrors([CompileTimeErrorCode.IMPORT_DUPLICATED_LIBRARY_NAME]); | 2079 assertErrors([CompileTimeErrorCode.IMPORT_DUPLICATED_LIBRARY_NAME]); |
| 1895 verify([source]); | 2080 verify([source]); |
| 1896 } | 2081 } |
| 1897 void fail_invalidConstructorName() { | 2082 void fail_invalidConstructorName() { |
| 1898 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2083 Source source = addSource(EngineTestCase.createSource([])); |
| 1899 resolve(source, []); | 2084 resolve(source, []); |
| 1900 assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); | 2085 assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); |
| 1901 verify([source]); | 2086 verify([source]); |
| 1902 } | 2087 } |
| 1903 void fail_invalidFactoryNameNotAClass() { | 2088 void fail_invalidFactoryNameNotAClass() { |
| 1904 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2089 Source source = addSource(EngineTestCase.createSource([])); |
| 1905 resolve(source, []); | 2090 resolve(source, []); |
| 1906 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); | 2091 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); |
| 1907 verify([source]); | 2092 verify([source]); |
| 1908 } | 2093 } |
| 1909 void fail_invalidOverrideDefaultValue() { | 2094 void fail_invalidOverrideDefaultValue() { |
| 1910 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m([a = 0]) {}", "}", "class B extends A {", " m([a = 1]) {}", "}"])); | 2095 Source source = addSource(EngineTestCase.createSource(["class A {", " m([a
= 0]) {}", "}", "class B extends A {", " m([a = 1]) {}", "}"])); |
| 1911 resolve(source, []); | 2096 resolve(source, []); |
| 1912 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_DEFAULT_VALUE]); | 2097 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_DEFAULT_VALUE]); |
| 1913 verify([source]); | 2098 verify([source]); |
| 1914 } | 2099 } |
| 1915 void fail_invalidOverrideNamed() { | 2100 void fail_invalidOverrideNamed() { |
| 1916 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m({a, b}) {}", "}", "class B extends A {", " m({a}) {}", "}"])); | 2101 Source source = addSource(EngineTestCase.createSource(["class A {", " m({a,
b}) {}", "}", "class B extends A {", " m({a}) {}", "}"])); |
| 1917 resolve(source, []); | 2102 resolve(source, []); |
| 1918 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]); | 2103 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]); |
| 1919 verify([source]); | 2104 verify([source]); |
| 1920 } | 2105 } |
| 1921 void fail_invalidOverridePositional() { | 2106 void fail_invalidOverridePositional() { |
| 1922 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m([a, b]) {}", "}", "class B extends A {", " m([a]) {}", "}"])); | 2107 Source source = addSource(EngineTestCase.createSource(["class A {", " m([a,
b]) {}", "}", "class B extends A {", " m([a]) {}", "}"])); |
| 1923 resolve(source, []); | 2108 resolve(source, []); |
| 1924 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL]); | 2109 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL]); |
| 1925 verify([source]); | 2110 verify([source]); |
| 1926 } | 2111 } |
| 1927 void fail_invalidOverrideRequired() { | 2112 void fail_invalidOverrideRequired() { |
| 1928 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m(a) {}", "}", "class B extends A {", " m(a, b) {}", "}"])); | 2113 Source source = addSource(EngineTestCase.createSource(["class A {", " m(a)
{}", "}", "class B extends A {", " m(a, b) {}", "}"])); |
| 1929 resolve(source, []); | 2114 resolve(source, []); |
| 1930 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED]); | 2115 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED]); |
| 1931 verify([source]); | 2116 verify([source]); |
| 1932 } | 2117 } |
| 1933 void fail_invalidReferenceToThis_staticMethod() { | 2118 void fail_invalidReferenceToThis_staticMethod() { |
| 1934 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static m() { return this; }", "}"])); | 2119 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c m() { return this; }", "}"])); |
| 1935 resolve(source, []); | 2120 resolve(source, []); |
| 1936 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); | 2121 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| 1937 verify([source]); | 2122 verify([source]); |
| 1938 } | 2123 } |
| 1939 void fail_invalidReferenceToThis_topLevelFunction() { | 2124 void fail_invalidReferenceToThis_topLevelFunction() { |
| 1940 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
return this; }"])); | 2125 Source source = addSource(EngineTestCase.createSource(["f() { return this; }
"])); |
| 1941 resolve(source, []); | 2126 resolve(source, []); |
| 1942 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); | 2127 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| 1943 verify([source]); | 2128 verify([source]); |
| 1944 } | 2129 } |
| 1945 void fail_invalidReferenceToThis_variableInitializer() { | 2130 void fail_invalidReferenceToThis_variableInitializer() { |
| 1946 Source source = addSource("/test.dart", EngineTestCase.createSource(["int x
= this;"])); | 2131 Source source = addSource(EngineTestCase.createSource(["int x = this;"])); |
| 1947 resolve(source, []); | 2132 resolve(source, []); |
| 1948 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); | 2133 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| 1949 verify([source]); | 2134 verify([source]); |
| 1950 } | 2135 } |
| 1951 void fail_invalidTypeArgumentInConstList() { | |
| 1952 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {", " m() {", " return const <E>[]", " }", "}"])); | |
| 1953 resolve(source, []); | |
| 1954 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]); | |
| 1955 verify([source]); | |
| 1956 } | |
| 1957 void fail_invalidTypeArgumentInConstMap() { | |
| 1958 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<E> {", " m() {", " return const <String, E>{}", " }", "}"])); | |
| 1959 resolve(source, []); | |
| 1960 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]); | |
| 1961 verify([source]); | |
| 1962 } | |
| 1963 void fail_memberWithClassName() { | 2136 void fail_memberWithClassName() { |
| 1964 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int A = 0;", "}"])); | 2137 Source source = addSource(EngineTestCase.createSource(["class A {", " int A
= 0;", "}"])); |
| 1965 resolve(source, []); | 2138 resolve(source, []); |
| 1966 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); | 2139 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| 1967 verify([source]); | 2140 verify([source]); |
| 1968 } | 2141 } |
| 1969 void fail_mixinDeclaresConstructor() { | 2142 void fail_mixinDeclaresConstructor() { |
| 1970 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A() {}", "}", "class B extends Object mixin A {}"])); | 2143 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "class B extends Object mixin A {}"])); |
| 1971 resolve(source, []); | 2144 resolve(source, []); |
| 1972 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); | 2145 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| 1973 verify([source]); | 2146 verify([source]); |
| 1974 } | 2147 } |
| 1975 void fail_mixinInheritsFromNotObject() { | 2148 void fail_mixinInheritsFromNotObject() { |
| 1976 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {}", "class C extends Object mixin B {}"])); | 2149 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "class C extends Object mixin B {}"])); |
| 1977 resolve(source, []); | 2150 resolve(source, []); |
| 1978 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); | 2151 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| 1979 verify([source]); | 2152 verify([source]); |
| 1980 } | 2153 } |
| 1981 void fail_mixinOfNonClass() { | 2154 void fail_mixinOfNonClass() { |
| 1982 Source source = addSource("/test.dart", EngineTestCase.createSource(["var A;
", "class B extends Object mixin A {}"])); | 2155 Source source = addSource(EngineTestCase.createSource(["var A;", "class B ex
tends Object mixin A {}"])); |
| 1983 resolve(source, []); | 2156 resolve(source, []); |
| 1984 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); | 2157 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 1985 verify([source]); | 2158 verify([source]); |
| 1986 } | 2159 } |
| 1987 void fail_mixinOfNonMixin() { | 2160 void fail_mixinOfNonMixin() { |
| 1988 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2161 Source source = addSource(EngineTestCase.createSource([])); |
| 1989 resolve(source, []); | 2162 resolve(source, []); |
| 1990 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_MIXIN]); | 2163 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_MIXIN]); |
| 1991 verify([source]); | 2164 verify([source]); |
| 1992 } | 2165 } |
| 1993 void fail_mixinReferencesSuper() { | 2166 void fail_mixinReferencesSuper() { |
| 1994 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " toString() -> super.toString();", "}", "class B extends Object mixin A
{}"])); | 2167 Source source = addSource(EngineTestCase.createSource(["class A {", " toStr
ing() -> super.toString();", "}", "class B extends Object mixin A {}"])); |
| 1995 resolve(source, []); | 2168 resolve(source, []); |
| 1996 assertErrors([CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]); | 2169 assertErrors([CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]); |
| 1997 verify([source]); | 2170 verify([source]); |
| 1998 } | 2171 } |
| 1999 void fail_mixinWithNonClassSuperclass() { | 2172 void fail_mixinWithNonClassSuperclass() { |
| 2000 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B extends Object mixin A {}"])); | 2173 Source source = addSource(EngineTestCase.createSource(["int A;", "class B ex
tends Object mixin A {}"])); |
| 2001 resolve(source, []); | 2174 resolve(source, []); |
| 2002 assertErrors([CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); | 2175 assertErrors([CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); |
| 2003 verify([source]); | 2176 verify([source]); |
| 2004 } | 2177 } |
| 2005 void fail_multipleSuperInitializers() { | 2178 void fail_multipleSuperInitializers() { |
| 2006 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B extends A {", " B() : super(), super() {}", "}"])); | 2179 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " B() : super(), super() {}", "}"])); |
| 2007 resolve(source, []); | 2180 resolve(source, []); |
| 2008 assertErrors([CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]); | 2181 assertErrors([CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]); |
| 2009 verify([source]); | 2182 verify([source]); |
| 2010 } | 2183 } |
| 2011 void fail_nonConstantDefaultValue_named() { | 2184 void fail_nonConstantDefaultValue_named() { |
| 2012 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({x :
2 + 3}) {}"])); | 2185 Source source = addSource(EngineTestCase.createSource(["f({x : 2 + 3}) {}"])
); |
| 2013 resolve(source, []); | 2186 resolve(source, []); |
| 2014 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); | 2187 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| 2015 verify([source]); | 2188 verify([source]); |
| 2016 } | 2189 } |
| 2017 void fail_nonConstantDefaultValue_positional() { | 2190 void fail_nonConstantDefaultValue_positional() { |
| 2018 Source source = addSource("/test.dart", EngineTestCase.createSource(["f([x =
2 + 3]) {}"])); | 2191 Source source = addSource(EngineTestCase.createSource(["f([x = 2 + 3]) {}"])
); |
| 2019 resolve(source, []); | 2192 resolve(source, []); |
| 2020 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); | 2193 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| 2021 verify([source]); | 2194 verify([source]); |
| 2022 } | 2195 } |
| 2023 void fail_nonConstMapAsExpressionStatement() { | 2196 void fail_nonConstMapAsExpressionStatement() { |
| 2024 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " {'a' : 0, 'b' : 1};", "}"])); | 2197 Source source = addSource(EngineTestCase.createSource(["f() {", " {'a' : 0,
'b' : 1};", "}"])); |
| 2025 resolve(source, []); | 2198 resolve(source, []); |
| 2026 assertErrors([CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]); | 2199 assertErrors([CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]); |
| 2027 verify([source]); | 2200 verify([source]); |
| 2028 } | 2201 } |
| 2029 void fail_nonConstMapKey() { | 2202 void fail_nonConstMapKey() { |
| 2030 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {a : 0};", "}"])); | 2203 Source source = addSource(EngineTestCase.createSource(["f(a) {", " return c
onst {a : 0};", "}"])); |
| 2031 resolve(source, []); | 2204 resolve(source, []); |
| 2032 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]); | 2205 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]); |
| 2033 verify([source]); | 2206 verify([source]); |
| 2034 } | 2207 } |
| 2035 void fail_nonConstValueInInitializer() { | 2208 void fail_nonConstValueInInitializer() { |
| 2036 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static C;", " int a;", " A() : a = C {}", "}"])); | 2209 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c C;", " int a;", " A() : a = C {}", "}"])); |
| 2037 resolve(source, []); | 2210 resolve(source, []); |
| 2038 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 2211 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| 2039 verify([source]); | 2212 verify([source]); |
| 2040 } | 2213 } |
| 2041 void fail_objectCannotExtendAnotherClass() { | 2214 void fail_objectCannotExtendAnotherClass() { |
| 2042 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2215 Source source = addSource(EngineTestCase.createSource([])); |
| 2043 resolve(source, []); | 2216 resolve(source, []); |
| 2044 assertErrors([CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]); | 2217 assertErrors([CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]); |
| 2045 verify([source]); | 2218 verify([source]); |
| 2046 } | 2219 } |
| 2047 void fail_optionalParameterInOperator() { | |
| 2048 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " operator +([p]) {}", "}"])); | |
| 2049 resolve(source, []); | |
| 2050 assertErrors([CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]); | |
| 2051 verify([source]); | |
| 2052 } | |
| 2053 void fail_overrideMissingNamedParameters() { | 2220 void fail_overrideMissingNamedParameters() { |
| 2054 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m(a, {b}) {}", "}", "class B extends A {", " m(a) {}", "}"])); | 2221 Source source = addSource(EngineTestCase.createSource(["class A {", " m(a,
{b}) {}", "}", "class B extends A {", " m(a) {}", "}"])); |
| 2055 resolve(source, []); | 2222 resolve(source, []); |
| 2056 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_NAMED_PARAMETERS]); | 2223 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_NAMED_PARAMETERS]); |
| 2057 verify([source]); | 2224 verify([source]); |
| 2058 } | 2225 } |
| 2059 void fail_overrideMissingRequiredParameters() { | 2226 void fail_overrideMissingRequiredParameters() { |
| 2060 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m(a) {}", "}", "class B extends A {", " m(a, b) {}", "}"])); | 2227 Source source = addSource(EngineTestCase.createSource(["class A {", " m(a)
{}", "}", "class B extends A {", " m(a, b) {}", "}"])); |
| 2061 resolve(source, []); | 2228 resolve(source, []); |
| 2062 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_REQUIRED_PARAMETERS]); | 2229 assertErrors([CompileTimeErrorCode.OVERRIDE_MISSING_REQUIRED_PARAMETERS]); |
| 2063 verify([source]); | 2230 verify([source]); |
| 2064 } | 2231 } |
| 2065 void fail_prefixCollidesWithTopLevelMembers() { | 2232 void fail_prefixCollidesWithTopLevelMembers() { |
| 2066 Source source = addSource("/test.dart", EngineTestCase.createSource(["import
'dart:uri' as uri;", "var uri = null;"])); | 2233 Source source = addSource(EngineTestCase.createSource(["import 'dart:uri' as
uri;", "var uri = null;"])); |
| 2067 resolve(source, []); | 2234 resolve(source, []); |
| 2068 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); | 2235 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| 2069 verify([source]); | 2236 verify([source]); |
| 2070 } | 2237 } |
| 2071 void fail_privateOptionalParameter() { | |
| 2072 Source source = addSource("/test.dart", EngineTestCase.createSource(["f({_p
: 0}) {}"])); | |
| 2073 resolve(source, []); | |
| 2074 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); | |
| 2075 verify([source]); | |
| 2076 } | |
| 2077 void fail_recursiveCompileTimeConstant() { | 2238 void fail_recursiveCompileTimeConstant() { |
| 2078 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
x = y + 1;", "const y = x + 1;"])); | 2239 Source source = addSource(EngineTestCase.createSource(["const x = y + 1;", "
const y = x + 1;"])); |
| 2079 resolve(source, []); | 2240 resolve(source, []); |
| 2080 assertErrors([CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); | 2241 assertErrors([CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); |
| 2081 verify([source]); | 2242 verify([source]); |
| 2082 } | 2243 } |
| 2083 void fail_recursiveFactoryRedirect() { | 2244 void fail_recursiveFactoryRedirect() { |
| 2084 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2245 Source source = addSource(EngineTestCase.createSource([])); |
| 2085 resolve(source, []); | 2246 resolve(source, []); |
| 2086 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]); | 2247 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]); |
| 2087 verify([source]); | 2248 verify([source]); |
| 2088 } | 2249 } |
| 2089 void fail_recursiveFunctionTypeAlias_direct() { | 2250 void fail_recursiveFunctionTypeAlias_direct() { |
| 2090 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f F(F f);"])); | 2251 Source source = addSource(EngineTestCase.createSource(["typedef F(F f);"])); |
| 2091 resolve(source, []); | 2252 resolve(source, []); |
| 2092 assertErrors([CompileTimeErrorCode.RECURSIVE_FUNCTION_TYPE_ALIAS]); | 2253 assertErrors([CompileTimeErrorCode.RECURSIVE_FUNCTION_TYPE_ALIAS]); |
| 2093 verify([source]); | 2254 verify([source]); |
| 2094 } | 2255 } |
| 2095 void fail_recursiveFunctionTypeAlias_indirect() { | 2256 void fail_recursiveFunctionTypeAlias_indirect() { |
| 2096 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f F(G g);", "typedef G(F f);"])); | 2257 Source source = addSource(EngineTestCase.createSource(["typedef F(G g);", "t
ypedef G(F f);"])); |
| 2097 resolve(source, []); | 2258 resolve(source, []); |
| 2098 assertErrors([CompileTimeErrorCode.RECURSIVE_FUNCTION_TYPE_ALIAS]); | 2259 assertErrors([CompileTimeErrorCode.RECURSIVE_FUNCTION_TYPE_ALIAS]); |
| 2099 verify([source]); | 2260 verify([source]); |
| 2100 } | 2261 } |
| 2101 void fail_recursiveInterfaceInheritance_direct() { | 2262 void fail_recursiveInterfaceInheritance_direct() { |
| 2102 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements A {}"])); | 2263 Source source = addSource(EngineTestCase.createSource(["class A implements A
{}"])); |
| 2103 resolve(source, []); | 2264 resolve(source, []); |
| 2104 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); | 2265 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 2105 verify([source]); | 2266 verify([source]); |
| 2106 } | 2267 } |
| 2107 void fail_recursiveInterfaceInheritance_indirect() { | 2268 void fail_recursiveInterfaceInheritance_indirect() { |
| 2108 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements B {}", "class B implements A {}"])); | 2269 Source source = addSource(EngineTestCase.createSource(["class A implements B
{}", "class B implements A {}"])); |
| 2109 resolve(source, []); | 2270 resolve(source, []); |
| 2110 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); | 2271 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 2111 verify([source]); | 2272 verify([source]); |
| 2112 } | 2273 } |
| 2113 void fail_redirectToNonConstConstructor() { | 2274 void fail_redirectToNonConstConstructor() { |
| 2114 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2275 Source source = addSource(EngineTestCase.createSource([])); |
| 2115 resolve(source, []); | 2276 resolve(source, []); |
| 2116 assertErrors([CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]); | 2277 assertErrors([CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]); |
| 2117 verify([source]); | 2278 verify([source]); |
| 2118 } | 2279 } |
| 2119 void fail_referenceToDeclaredVariableInInitializer_getter() { | 2280 void fail_referenceToDeclaredVariableInInitializer_getter() { |
| 2120 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x = x + 1;", "}"])); | 2281 Source source = addSource(EngineTestCase.createSource(["f() {", " int x = x
+ 1;", "}"])); |
| 2121 resolve(source, []); | 2282 resolve(source, []); |
| 2122 assertErrors([CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN_INITIAL
IZER]); | 2283 assertErrors([CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN_INITIAL
IZER]); |
| 2123 verify([source]); | 2284 verify([source]); |
| 2124 } | 2285 } |
| 2125 void fail_referenceToDeclaredVariableInInitializer_setter() { | 2286 void fail_referenceToDeclaredVariableInInitializer_setter() { |
| 2126 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " int x = x++;", "}"])); | 2287 Source source = addSource(EngineTestCase.createSource(["f() {", " int x = x
++;", "}"])); |
| 2127 resolve(source, []); | 2288 resolve(source, []); |
| 2128 assertErrors([CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN_INITIAL
IZER]); | 2289 assertErrors([CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN_INITIAL
IZER]); |
| 2129 verify([source]); | 2290 verify([source]); |
| 2130 } | 2291 } |
| 2131 void fail_reservedWordAsIdentifier() { | 2292 void fail_reservedWordAsIdentifier() { |
| 2132 Source source = addSource("/test.dart", EngineTestCase.createSource(["int cl
ass = 2;"])); | 2293 Source source = addSource(EngineTestCase.createSource(["int class = 2;"])); |
| 2133 resolve(source, []); | 2294 resolve(source, []); |
| 2134 assertErrors([CompileTimeErrorCode.RESERVED_WORD_AS_IDENTIFIER]); | 2295 assertErrors([CompileTimeErrorCode.RESERVED_WORD_AS_IDENTIFIER]); |
| 2135 verify([source]); | 2296 verify([source]); |
| 2136 } | 2297 } |
| 2137 void fail_returnInGenerativeConstructor() { | |
| 2138 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A() { return 0; }", "}"])); | |
| 2139 resolve(source, []); | |
| 2140 assertErrors([CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]); | |
| 2141 verify([source]); | |
| 2142 } | |
| 2143 void fail_staticTopLevelFunction_topLevel() { | 2298 void fail_staticTopLevelFunction_topLevel() { |
| 2144 Source source = addSource("/test.dart", EngineTestCase.createSource(["static
f() {}"])); | 2299 Source source = addSource(EngineTestCase.createSource(["static f() {}"])); |
| 2145 resolve(source, []); | 2300 resolve(source, []); |
| 2146 assertErrors([CompileTimeErrorCode.STATIC_TOP_LEVEL_FUNCTION]); | 2301 assertErrors([CompileTimeErrorCode.STATIC_TOP_LEVEL_FUNCTION]); |
| 2147 verify([source]); | 2302 verify([source]); |
| 2148 } | 2303 } |
| 2149 void fail_staticTopLevelVariable() { | 2304 void fail_staticTopLevelVariable() { |
| 2150 Source source = addSource("/test.dart", EngineTestCase.createSource(["static
int x;"])); | 2305 Source source = addSource(EngineTestCase.createSource(["static int x;"])); |
| 2151 resolve(source, []); | 2306 resolve(source, []); |
| 2152 assertErrors([CompileTimeErrorCode.STATIC_TOP_LEVEL_VARIABLE]); | 2307 assertErrors([CompileTimeErrorCode.STATIC_TOP_LEVEL_VARIABLE]); |
| 2153 verify([source]); | 2308 verify([source]); |
| 2154 } | 2309 } |
| 2155 void fail_superInInvalidContext_factoryConstructor() { | 2310 void fail_superInInvalidContext_factoryConstructor() { |
| 2156 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2311 Source source = addSource(EngineTestCase.createSource([])); |
| 2157 resolve(source, []); | 2312 resolve(source, []); |
| 2158 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 2313 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 2159 verify([source]); | 2314 verify([source]); |
| 2160 } | 2315 } |
| 2161 void fail_superInInvalidContext_instanceVariableInitializer() { | 2316 void fail_superInInvalidContext_instanceVariableInitializer() { |
| 2162 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " var a;", "}", "class B extends A {", " var b = super.a;", "}"])); | 2317 Source source = addSource(EngineTestCase.createSource(["class A {", " var a
;", "}", "class B extends A {", " var b = super.a;", "}"])); |
| 2163 resolve(source, []); | 2318 resolve(source, []); |
| 2164 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 2319 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 2165 verify([source]); | 2320 verify([source]); |
| 2166 } | 2321 } |
| 2167 void fail_superInInvalidContext_staticMethod() { | 2322 void fail_superInInvalidContext_staticMethod() { |
| 2168 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static m() {}", "}", "class B extends A {", " static n() { return supe
r.m(); }", "}"])); | 2323 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c m() {}", "}", "class B extends A {", " static n() { return super.m(); }", "}"
])); |
| 2169 resolve(source, []); | 2324 resolve(source, []); |
| 2170 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 2325 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 2171 verify([source]); | 2326 verify([source]); |
| 2172 } | 2327 } |
| 2173 void fail_superInInvalidContext_staticVariableInitializer() { | 2328 void fail_superInInvalidContext_staticVariableInitializer() { |
| 2174 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static a = 0;", "}", "class B extends A {", " static b = super.a;", "}
"])); | 2329 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c a = 0;", "}", "class B extends A {", " static b = super.a;", "}"])); |
| 2175 resolve(source, []); | 2330 resolve(source, []); |
| 2176 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 2331 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 2177 verify([source]); | 2332 verify([source]); |
| 2178 } | 2333 } |
| 2179 void fail_superInInvalidContext_topLevelFunction() { | 2334 void fail_superInInvalidContext_topLevelFunction() { |
| 2180 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " super.f();", "}"])); | 2335 Source source = addSource(EngineTestCase.createSource(["f() {", " super.f()
;", "}"])); |
| 2181 resolve(source, []); | 2336 resolve(source, []); |
| 2182 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 2337 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 2183 verify([source]); | 2338 verify([source]); |
| 2184 } | 2339 } |
| 2185 void fail_superInInvalidContext_variableInitializer() { | 2340 void fail_superInInvalidContext_variableInitializer() { |
| 2186 Source source = addSource("/test.dart", EngineTestCase.createSource(["var v
= super.v;"])); | 2341 Source source = addSource(EngineTestCase.createSource(["var v = super.v;"]))
; |
| 2187 resolve(source, []); | 2342 resolve(source, []); |
| 2188 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 2343 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 2189 verify([source]); | 2344 verify([source]); |
| 2190 } | 2345 } |
| 2191 void fail_superInitializerInObject() { | 2346 void fail_superInitializerInObject() { |
| 2192 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2347 Source source = addSource(EngineTestCase.createSource([])); |
| 2193 resolve(source, []); | 2348 resolve(source, []); |
| 2194 assertErrors([CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]); | 2349 assertErrors([CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]); |
| 2195 verify([source]); | 2350 verify([source]); |
| 2196 } | 2351 } |
| 2197 void fail_typeArgumentsForNonGenericClass_creation_const() { | 2352 void fail_typeArgumentsForNonGenericClass_creation_const() { |
| 2198 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f(p) {", " return const A<int>();", "}"])); | 2353 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(p) {
", " return const A<int>();", "}"])); |
| 2199 resolve(source, []); | 2354 resolve(source, []); |
| 2200 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS]); | 2355 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS]); |
| 2201 verify([source]); | 2356 verify([source]); |
| 2202 } | 2357 } |
| 2203 void fail_typeArgumentsForNonGenericClass_creation_new() { | 2358 void fail_typeArgumentsForNonGenericClass_creation_new() { |
| 2204 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f(p) {", " return new A<int>();", "}"])); | 2359 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(p) {
", " return new A<int>();", "}"])); |
| 2205 resolve(source, []); | 2360 resolve(source, []); |
| 2206 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS]); | 2361 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS]); |
| 2207 verify([source]); | 2362 verify([source]); |
| 2208 } | 2363 } |
| 2209 void fail_typeArgumentsForNonGenericClass_typeCast() { | 2364 void fail_typeArgumentsForNonGenericClass_typeCast() { |
| 2210 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f(p) {", " return p as A<int>;", "}"])); | 2365 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(p) {
", " return p as A<int>;", "}"])); |
| 2211 resolve(source, []); | 2366 resolve(source, []); |
| 2212 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS]); | 2367 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS]); |
| 2213 verify([source]); | 2368 verify([source]); |
| 2214 } | 2369 } |
| 2215 void fail_undefinedConstructorInInitializer() { | 2370 void fail_undefinedConstructorInInitializer() { |
| 2216 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 2371 Source source = addSource(EngineTestCase.createSource([])); |
| 2217 resolve(source, []); | 2372 resolve(source, []); |
| 2218 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]); | 2373 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]); |
| 2219 verify([source]); | 2374 verify([source]); |
| 2220 } | 2375 } |
| 2221 void fail_uninitializedFinalField() { | 2376 void fail_uninitializedFinalField() { |
| 2222 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int i;", "}"])); | 2377 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int i;", "}"])); |
| 2223 resolve(source, []); | 2378 resolve(source, []); |
| 2224 assertErrors([CompileTimeErrorCode.UNINITIALIZED_FINAL_FIELD]); | 2379 assertErrors([CompileTimeErrorCode.UNINITIALIZED_FINAL_FIELD]); |
| 2225 verify([source]); | 2380 verify([source]); |
| 2226 } | 2381 } |
| 2227 void fail_wrongNumberOfParametersForOperator() { | 2382 void fail_wrongNumberOfParametersForOperator() { |
| 2228 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " operator []=(i) {}", "}"])); | 2383 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor []=(i) {}", "}"])); |
| 2229 resolve(source, []); | 2384 resolve(source, []); |
| 2230 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR])
; | 2385 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR])
; |
| 2231 verify([source]); | 2386 verify([source]); |
| 2232 } | 2387 } |
| 2233 void fail_wrongNumberOfParametersForSetter_tooFew() { | |
| 2234 Source source = addSource("/test.dart", EngineTestCase.createSource(["set x(
) {}"])); | |
| 2235 resolve(source, []); | |
| 2236 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); | |
| 2237 verify([source]); | |
| 2238 } | |
| 2239 void fail_wrongNumberOfParametersForSetter_tooMany() { | |
| 2240 Source source = addSource("/test.dart", EngineTestCase.createSource(["set x(
a, b) {}"])); | |
| 2241 resolve(source, []); | |
| 2242 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); | |
| 2243 verify([source]); | |
| 2244 } | |
| 2245 void fail_wrongNumberOfTypeArguments_creation_const_tooFew() { | 2388 void fail_wrongNumberOfTypeArguments_creation_const_tooFew() { |
| 2246 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class C<K, V> {}", "f(p) {", " return const C<A>();", "}"])); | 2389 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<K, V> {}", "f(p) {", " return const C<A>();", "}"])); |
| 2247 resolve(source, []); | 2390 resolve(source, []); |
| 2248 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 2391 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 2249 verify([source]); | 2392 verify([source]); |
| 2250 } | 2393 } |
| 2251 void fail_wrongNumberOfTypeArguments_creation_const_tooMany() { | 2394 void fail_wrongNumberOfTypeArguments_creation_const_tooMany() { |
| 2252 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class C<E> {}", "f(p) {", " return const C<A, A>();", "}"])); | 2395 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<E> {}", "f(p) {", " return const C<A, A>();", "}"])); |
| 2253 resolve(source, []); | 2396 resolve(source, []); |
| 2254 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 2397 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 2255 verify([source]); | 2398 verify([source]); |
| 2256 } | 2399 } |
| 2257 void fail_wrongNumberOfTypeArguments_creation_new_tooFew() { | 2400 void fail_wrongNumberOfTypeArguments_creation_new_tooFew() { |
| 2258 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class C<K, V> {}", "f(p) {", " return new C<A>();", "}"])); | 2401 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<K, V> {}", "f(p) {", " return new C<A>();", "}"])); |
| 2259 resolve(source, []); | 2402 resolve(source, []); |
| 2260 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 2403 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 2261 verify([source]); | 2404 verify([source]); |
| 2262 } | 2405 } |
| 2263 void fail_wrongNumberOfTypeArguments_creation_new_tooMany() { | 2406 void fail_wrongNumberOfTypeArguments_creation_new_tooMany() { |
| 2264 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class C<E> {}", "f(p) {", " return new C<A, A>();", "}"])); | 2407 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<E> {}", "f(p) {", " return new C<A, A>();", "}"])); |
| 2265 resolve(source, []); | 2408 resolve(source, []); |
| 2266 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 2409 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 2267 verify([source]); | 2410 verify([source]); |
| 2268 } | 2411 } |
| 2269 void fail_wrongNumberOfTypeArguments_typeTest_tooFew() { | 2412 void fail_wrongNumberOfTypeArguments_typeTest_tooFew() { |
| 2270 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class C<K, V> {}", "f(p) {", " return p is C<A>;", "}"])); | 2413 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<K, V> {}", "f(p) {", " return p is C<A>;", "}"])); |
| 2271 resolve(source, []); | 2414 resolve(source, []); |
| 2272 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 2415 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 2273 verify([source]); | 2416 verify([source]); |
| 2274 } | 2417 } |
| 2275 void fail_wrongNumberOfTypeArguments_typeTest_tooMany() { | 2418 void fail_wrongNumberOfTypeArguments_typeTest_tooMany() { |
| 2276 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class C<E> {}", "f(p) {", " return p is C<A, A>;", "}"])); | 2419 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<E> {}", "f(p) {", " return p is C<A, A>;", "}"])); |
| 2277 resolve(source, []); | 2420 resolve(source, []); |
| 2278 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 2421 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 2279 verify([source]); | 2422 verify([source]); |
| 2280 } | 2423 } |
| 2281 void test_argumentDefinitionTestNonParameter() { | 2424 void test_argumentDefinitionTestNonParameter() { |
| 2282 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var v = 0;", " return ?v;", "}"])); | 2425 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); |
| 2283 resolve(source, []); | 2426 resolve(source, []); |
| 2284 assertErrors([CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); | 2427 assertErrors([CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); |
| 2285 verify([source]); | 2428 verify([source]); |
| 2286 } | 2429 } |
| 2287 void test_builtInIdentifierAsType() { | 2430 void test_builtInIdentifierAsType() { |
| 2288 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " typedef x;", "}"])); | 2431 Source source = addSource(EngineTestCase.createSource(["f() {", " typedef x
;", "}"])); |
| 2289 resolve(source, []); | 2432 resolve(source, []); |
| 2290 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, StaticWarnin
gCode.UNDEFINED_CLASS]); | 2433 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, StaticWarnin
gCode.UNDEFINED_CLASS]); |
| 2291 verify([source]); | 2434 verify([source]); |
| 2292 } | 2435 } |
| 2293 void test_builtInIdentifierAsTypedefName_classTypeAlias() { | 2436 void test_builtInIdentifierAsTypedefName_classTypeAlias() { |
| 2294 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B {}", "typedef as = A with B;"])); | 2437 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "typedef as = A with B;"])); |
| 2295 resolve(source, []); | 2438 resolve(source, []); |
| 2296 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); | 2439 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
| 2297 verify([source]); | 2440 verify([source]); |
| 2298 } | 2441 } |
| 2299 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { | 2442 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { |
| 2300 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f bool as();"])); | 2443 Source source = addSource(EngineTestCase.createSource(["typedef bool as();"]
)); |
| 2301 resolve(source, []); | 2444 resolve(source, []); |
| 2302 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); | 2445 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
| 2303 verify([source]); | 2446 verify([source]); |
| 2304 } | 2447 } |
| 2305 void test_builtInIdentifierAsTypeName() { | 2448 void test_builtInIdentifierAsTypeName() { |
| 2306 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
as {}"])); | 2449 Source source = addSource(EngineTestCase.createSource(["class as {}"])); |
| 2307 resolve(source, []); | 2450 resolve(source, []); |
| 2308 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]); | 2451 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]); |
| 2309 verify([source]); | 2452 verify([source]); |
| 2310 } | 2453 } |
| 2311 void test_builtInIdentifierAsTypeVariableName() { | 2454 void test_builtInIdentifierAsTypeVariableName() { |
| 2312 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<as> {}"])); | 2455 Source source = addSource(EngineTestCase.createSource(["class A<as> {}"])); |
| 2313 resolve(source, []); | 2456 resolve(source, []); |
| 2314 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); | 2457 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); |
| 2315 verify([source]); | 2458 verify([source]); |
| 2316 } | 2459 } |
| 2317 void test_caseExpressionTypeImplementsEquals() { | 2460 void test_caseExpressionTypeImplementsEquals() { |
| 2318 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", " bool
operator ==(IntWrapper x) {", " return value == x.value;", " }", "}", "", "f
(IntWrapper a) {", " switch(a) {", " case(const IntWrapper(1)) : return 1;",
" default: return 0;", " }", "}"])); | 2461 Source source = addSource(EngineTestCase.createSource(["class IntWrapper {",
" final int value;", " const IntWrapper(this.value);", " bool operator ==(In
tWrapper x) {", " return value == x.value;", " }", "}", "", "f(IntWrapper a)
{", " switch(a) {", " case(const IntWrapper(1)) : return 1;", " default:
return 0;", " }", "}"])); |
| 2319 resolve(source, []); | 2462 resolve(source, []); |
| 2320 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); | 2463 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| 2321 verify([source]); | 2464 verify([source]); |
| 2322 } | 2465 } |
| 2323 void test_conflictingConstructorNameAndMember_field() { | 2466 void test_conflictingConstructorNameAndMember_field() { |
| 2324 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A.x() {}", "}"])); | 2467 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A.x() {}", "}"])); |
| 2325 resolve(source, []); | 2468 resolve(source, []); |
| 2326 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); | 2469 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); |
| 2327 verify([source]); | 2470 verify([source]); |
| 2328 } | 2471 } |
| 2329 void test_conflictingConstructorNameAndMember_method() { | 2472 void test_conflictingConstructorNameAndMember_method() { |
| 2330 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A.x() {}", " void x() {}", "}"])); | 2473 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.x() {}", " void x() {}", "}"])); |
| 2331 resolve(source, []); | 2474 resolve(source, []); |
| 2332 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD])
; | 2475 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD])
; |
| 2333 verify([source]); | 2476 verify([source]); |
| 2334 } | 2477 } |
| 2335 void test_constConstructorWithNonFinalField() { | 2478 void test_constConstructorWithNonFinalField() { |
| 2336 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " const A() {}", "}"])); | 2479 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " const A() {}", "}"])); |
| 2337 resolve(source, []); | 2480 resolve(source, []); |
| 2338 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); | 2481 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); |
| 2339 verify([source]); | 2482 verify([source]); |
| 2340 } | 2483 } |
| 2341 void test_constEvalThrowsException() { | 2484 void test_constEvalThrowsException() { |
| 2342 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {", " const C() { throw null; }", "}", "f() { return const C(); }"])); | 2485 Source source = addSource(EngineTestCase.createSource(["class C {", " const
C() { throw null; }", "}", "f() { return const C(); }"])); |
| 2343 resolve(source, []); | 2486 resolve(source, []); |
| 2344 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); | 2487 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 2345 verify([source]); | 2488 verify([source]); |
| 2346 } | 2489 } |
| 2347 void test_constFormalParameter_fieldFormalParameter() { | 2490 void test_constFormalParameter_fieldFormalParameter() { |
| 2348 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " var x;", " A(const this.x) {}", "}"])); | 2491 Source source = addSource(EngineTestCase.createSource(["class A {", " var x
;", " A(const this.x) {}", "}"])); |
| 2349 resolve(source, []); | 2492 resolve(source, []); |
| 2350 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); | 2493 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); |
| 2351 verify([source]); | 2494 verify([source]); |
| 2352 } | 2495 } |
| 2353 void test_constFormalParameter_simpleFormalParameter() { | 2496 void test_constFormalParameter_simpleFormalParameter() { |
| 2354 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(cons
t x) {}"])); | 2497 Source source = addSource(EngineTestCase.createSource(["f(const x) {}"])); |
| 2355 resolve(source, []); | 2498 resolve(source, []); |
| 2356 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); | 2499 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); |
| 2357 verify([source]); | 2500 verify([source]); |
| 2358 } | 2501 } |
| 2359 void test_constInitializedWithNonConstValue() { | 2502 void test_constInitializedWithNonConstValue() { |
| 2360 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(p) {
", " const C = p;", "}"])); | 2503 Source source = addSource(EngineTestCase.createSource(["f(p) {", " const C
= p;", "}"])); |
| 2361 resolve(source, []); | 2504 resolve(source, []); |
| 2362 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); | 2505 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); |
| 2363 verify([source]); | 2506 verify([source]); |
| 2364 } | 2507 } |
| 2365 void test_constWithInvalidTypeParameters() { | 2508 void test_constWithInvalidTypeParameters() { |
| 2366 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A() {}", "}", "f() { return const A<A>(); }"])); | 2509 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A() {}", "}", "f() { return const A<A>(); }"])); |
| 2367 resolve(source, []); | 2510 resolve(source, []); |
| 2368 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); | 2511 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| 2369 verify([source]); | 2512 verify([source]); |
| 2370 } | 2513 } |
| 2371 void test_constWithNonConst() { | 2514 void test_constWithNonConst() { |
| 2372 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {", " T(a, b, {c, d}) {}", "}", "f() { return const T(0, 1, c: 2, d: 3); }"])
); | 2515 Source source = addSource(EngineTestCase.createSource(["class T {", " T(a,
b, {c, d}) {}", "}", "f() { return const T(0, 1, c: 2, d: 3); }"])); |
| 2373 resolve(source, []); | 2516 resolve(source, []); |
| 2374 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONST]); | 2517 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONST]); |
| 2375 verify([source]); | 2518 verify([source]); |
| 2376 } | 2519 } |
| 2377 void test_defaultValueInFunctionTypeAlias() { | 2520 void test_defaultValueInFunctionTypeAlias() { |
| 2378 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f F([x = 0]);"])); | 2521 Source source = addSource(EngineTestCase.createSource(["typedef F([x = 0]);"
])); |
| 2379 resolve(source, []); | 2522 resolve(source, []); |
| 2380 assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]); | 2523 assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]); |
| 2381 verify([source]); | 2524 verify([source]); |
| 2382 } | 2525 } |
| 2383 void test_duplicateMemberError() { | 2526 void test_duplicateMemberError() { |
| 2384 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';", "part 'b.dart';"])); | 2527 Source librarySource = addSource2("/lib.dart", EngineTestCase.createSource([
"library lib;", "", "part 'a.dart';", "part 'b.dart';"])); |
| 2385 Source sourceA = addSource("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 2528 Source sourceA = addSource2("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 2386 Source sourceB = addSource("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 2529 Source sourceB = addSource2("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 2387 resolve(librarySource, [sourceA, sourceB]); | 2530 resolve(librarySource, [sourceA, sourceB]); |
| 2388 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 2531 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 2389 verify([librarySource, sourceA, sourceB]); | 2532 verify([librarySource, sourceA, sourceB]); |
| 2390 } | 2533 } |
| 2391 void test_exportOfNonLibrary() { | 2534 void test_exportOfNonLibrary() { |
| 2392 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'lib1.dart';"])); | 2535 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';"])); |
| 2393 addSource("/lib1.dart", EngineTestCase.createSource(["part of lib;"])); | 2536 addSource2("/lib1.dart", EngineTestCase.createSource(["part of lib;"])); |
| 2394 resolve(source, []); | 2537 resolve(source, []); |
| 2395 assertErrors([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]); | 2538 assertErrors([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]); |
| 2396 verify([source]); | 2539 verify([source]); |
| 2397 } | 2540 } |
| 2398 void test_extendsNonClass_class() { | 2541 void test_extendsNonClass_class() { |
| 2399 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B extends A {}"])); | 2542 Source source = addSource(EngineTestCase.createSource(["int A;", "class B ex
tends A {}"])); |
| 2400 resolve(source, []); | 2543 resolve(source, []); |
| 2401 assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]); | 2544 assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| 2402 verify([source]); | 2545 verify([source]); |
| 2403 } | 2546 } |
| 2404 void test_extendsOrImplementsDisallowedClass_extends_bool() { | 2547 void test_extendsOrImplementsDisallowedClass_extends_bool() { |
| 2405 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends bool {}"])); | 2548 Source source = addSource(EngineTestCase.createSource(["class A extends bool
{}"])); |
| 2406 resolve(source, []); | 2549 resolve(source, []); |
| 2407 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 2550 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 2408 verify([source]); | 2551 verify([source]); |
| 2409 } | 2552 } |
| 2410 void test_extendsOrImplementsDisallowedClass_extends_double() { | 2553 void test_extendsOrImplementsDisallowedClass_extends_double() { |
| 2411 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends double {}"])); | 2554 Source source = addSource(EngineTestCase.createSource(["class A extends doub
le {}"])); |
| 2412 resolve(source, []); | 2555 resolve(source, []); |
| 2413 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 2556 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 2414 verify([source]); | 2557 verify([source]); |
| 2415 } | 2558 } |
| 2416 void test_extendsOrImplementsDisallowedClass_extends_int() { | 2559 void test_extendsOrImplementsDisallowedClass_extends_int() { |
| 2417 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends int {}"])); | 2560 Source source = addSource(EngineTestCase.createSource(["class A extends int
{}"])); |
| 2418 resolve(source, []); | 2561 resolve(source, []); |
| 2419 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 2562 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 2420 verify([source]); | 2563 verify([source]); |
| 2421 } | 2564 } |
| 2422 void test_extendsOrImplementsDisallowedClass_extends_num() { | 2565 void test_extendsOrImplementsDisallowedClass_extends_num() { |
| 2423 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends num {}"])); | 2566 Source source = addSource(EngineTestCase.createSource(["class A extends num
{}"])); |
| 2424 resolve(source, []); | 2567 resolve(source, []); |
| 2425 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 2568 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 2426 verify([source]); | 2569 verify([source]); |
| 2427 } | 2570 } |
| 2428 void test_extendsOrImplementsDisallowedClass_extends_String() { | 2571 void test_extendsOrImplementsDisallowedClass_extends_String() { |
| 2429 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends String {}"])); | 2572 Source source = addSource(EngineTestCase.createSource(["class A extends Stri
ng {}"])); |
| 2430 resolve(source, []); | 2573 resolve(source, []); |
| 2431 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 2574 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 2432 verify([source]); | 2575 verify([source]); |
| 2433 } | 2576 } |
| 2434 void test_extendsOrImplementsDisallowedClass_implements_bool() { | 2577 void test_extendsOrImplementsDisallowedClass_implements_bool() { |
| 2435 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements bool {}"])); | 2578 Source source = addSource(EngineTestCase.createSource(["class A implements b
ool {}"])); |
| 2436 resolve(source, []); | 2579 resolve(source, []); |
| 2437 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2580 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 2438 verify([source]); | 2581 verify([source]); |
| 2439 } | 2582 } |
| 2440 void test_extendsOrImplementsDisallowedClass_implements_double() { | 2583 void test_extendsOrImplementsDisallowedClass_implements_double() { |
| 2441 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements double {}"])); | 2584 Source source = addSource(EngineTestCase.createSource(["class A implements d
ouble {}"])); |
| 2442 resolve(source, []); | 2585 resolve(source, []); |
| 2443 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2586 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 2444 verify([source]); | 2587 verify([source]); |
| 2445 } | 2588 } |
| 2446 void test_extendsOrImplementsDisallowedClass_implements_int() { | 2589 void test_extendsOrImplementsDisallowedClass_implements_int() { |
| 2447 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements int {}"])); | 2590 Source source = addSource(EngineTestCase.createSource(["class A implements i
nt {}"])); |
| 2448 resolve(source, []); | 2591 resolve(source, []); |
| 2449 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2592 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 2450 verify([source]); | 2593 verify([source]); |
| 2451 } | 2594 } |
| 2452 void test_extendsOrImplementsDisallowedClass_implements_num() { | 2595 void test_extendsOrImplementsDisallowedClass_implements_num() { |
| 2453 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements num {}"])); | 2596 Source source = addSource(EngineTestCase.createSource(["class A implements n
um {}"])); |
| 2454 resolve(source, []); | 2597 resolve(source, []); |
| 2455 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2598 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 2456 verify([source]); | 2599 verify([source]); |
| 2457 } | 2600 } |
| 2458 void test_extendsOrImplementsDisallowedClass_implements_String() { | 2601 void test_extendsOrImplementsDisallowedClass_implements_String() { |
| 2459 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements String {}"])); | 2602 Source source = addSource(EngineTestCase.createSource(["class A implements S
tring {}"])); |
| 2460 resolve(source, []); | 2603 resolve(source, []); |
| 2461 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 2604 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 2462 verify([source]); | 2605 verify([source]); |
| 2463 } | 2606 } |
| 2464 void test_fieldInitializedByMultipleInitializers() { | 2607 void test_fieldInitializedByMultipleInitializers() { |
| 2465 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A() : x = 0, x = 1 {}", "}"])); | 2608 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A() : x = 0, x = 1 {}", "}"])); |
| 2466 resolve(source, []); | 2609 resolve(source, []); |
| 2467 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); | 2610 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); |
| 2468 verify([source]); | 2611 verify([source]); |
| 2469 } | 2612 } |
| 2470 void test_fieldInitializedByMultipleInitializers_multipleInits() { | 2613 void test_fieldInitializedByMultipleInitializers_multipleInits() { |
| 2471 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A() : x = 0, x = 1, x = 2 {}", "}"])); | 2614 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A() : x = 0, x = 1, x = 2 {}", "}"])); |
| 2472 resolve(source, []); | 2615 resolve(source, []); |
| 2473 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); | 2616 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| 2474 verify([source]); | 2617 verify([source]); |
| 2475 } | 2618 } |
| 2476 void test_fieldInitializedByMultipleInitializers_multipleNames() { | 2619 void test_fieldInitializedByMultipleInitializers_multipleNames() { |
| 2477 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " int y;", " A() : x = 0, x = 1, y = 0, y = 1 {}", "}"])); | 2620 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " int y;", " A() : x = 0, x = 1, y = 0, y = 1 {}", "}"])); |
| 2478 resolve(source, []); | 2621 resolve(source, []); |
| 2479 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); | 2622 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| 2480 verify([source]); | 2623 verify([source]); |
| 2481 } | 2624 } |
| 2482 void test_fieldInitializedInInitializerAndDeclaration_const() { | 2625 void test_fieldInitializedInInitializerAndDeclaration_const() { |
| 2483 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x = 0;", " A() : x = 1 {}", "}"])); | 2626 Source source = addSource(EngineTestCase.createSource(["class A {", " const
int x = 0;", " A() : x = 1 {}", "}"])); |
| 2484 resolve(source, []); | 2627 resolve(source, []); |
| 2485 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); | 2628 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); |
| 2486 verify([source]); | 2629 verify([source]); |
| 2487 } | 2630 } |
| 2488 void test_fieldInitializedInInitializerAndDeclaration_final() { | 2631 void test_fieldInitializedInInitializerAndDeclaration_final() { |
| 2489 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x = 0;", " A() : x = 1 {}", "}"])); | 2632 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() : x = 1 {}", "}"])); |
| 2490 resolve(source, []); | 2633 resolve(source, []); |
| 2491 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); | 2634 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); |
| 2492 verify([source]); | 2635 verify([source]); |
| 2493 } | 2636 } |
| 2494 void test_fieldInitializedInParameterAndInitializer() { | 2637 void test_fieldInitializedInParameterAndInitializer() { |
| 2495 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(this.x) : x = 1 {}", "}"])); | 2638 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) : x = 1 {}", "}"])); |
| 2496 resolve(source, []); | 2639 resolve(source, []); |
| 2497 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); | 2640 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); |
| 2498 verify([source]); | 2641 verify([source]); |
| 2499 } | 2642 } |
| 2500 void test_fieldInitializerOutsideConstructor() { | 2643 void test_fieldInitializerOutsideConstructor() { |
| 2501 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " m(this.x) {}", "}"])); | 2644 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " m(this.x) {}", "}"])); |
| 2502 resolve(source, []); | 2645 resolve(source, []); |
| 2503 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); | 2646 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| 2504 verify([source]); | 2647 verify([source]); |
| 2505 } | 2648 } |
| 2506 void test_fieldInitializerOutsideConstructor_defaultParameter() { | 2649 void test_fieldInitializerOutsideConstructor_defaultParameter() { |
| 2507 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " m([this.x]) {}", "}"])); | 2650 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " m([this.x]) {}", "}"])); |
| 2508 resolve(source, []); | 2651 resolve(source, []); |
| 2509 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); | 2652 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| 2510 verify([source]); | 2653 verify([source]); |
| 2511 } | 2654 } |
| 2512 /** | 2655 /** |
| 2513 * This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
code, but tests the | 2656 * This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
code, but tests the |
| 2514 * FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provid
ed here to show | 2657 * FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provid
ed here to show |
| 2515 * coverage over all of the permutations of initializers in constructor declar
ations. | 2658 * coverage over all of the permutations of initializers in constructor declar
ations. |
| 2516 * <p> | 2659 * <p> |
| 2517 * Note: FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION covers a subset of | 2660 * Note: FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION covers a subset of |
| 2518 * FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, since it more specific, w
e use it instead of | 2661 * FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, since it more specific, w
e use it instead of |
| 2519 * the broader code | 2662 * the broader code |
| 2520 */ | 2663 */ |
| 2521 void test_finalInitializedInDeclarationAndConstructor_initializers() { | 2664 void test_finalInitializedInDeclarationAndConstructor_initializers() { |
| 2522 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x = 0;", " A() : x = 0 {}", "}"])); | 2665 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x = 0;", " A() : x = 0 {}", "}"])); |
| 2523 resolve(source, []); | 2666 resolve(source, []); |
| 2524 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); | 2667 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); |
| 2525 verify([source]); | 2668 verify([source]); |
| 2526 } | 2669 } |
| 2527 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { | 2670 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { |
| 2528 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x = 0;", " A(this.x) {}", "}"])); | 2671 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x = 0;", " A(this.x) {}", "}"])); |
| 2529 resolve(source, []); | 2672 resolve(source, []); |
| 2530 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONS
TRUCTOR]); | 2673 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONS
TRUCTOR]); |
| 2531 verify([source]); | 2674 verify([source]); |
| 2532 } | 2675 } |
| 2533 void test_finalInitializedMultipleTimes_initializers() { | 2676 void test_finalInitializedMultipleTimes_initializers() { |
| 2534 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A() : x = 0, x = 0 {}", "}"])); | 2677 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A() : x = 0, x = 0 {}", "}"])); |
| 2535 resolve(source, []); | 2678 resolve(source, []); |
| 2536 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); | 2679 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); |
| 2537 verify([source]); | 2680 verify([source]); |
| 2538 } | 2681 } |
| 2539 /** | 2682 /** |
| 2540 * This test doesn't test the FINAL_INITIALIZED_MULTIPLE_TIMES code, but tests
the | 2683 * This test doesn't test the FINAL_INITIALIZED_MULTIPLE_TIMES code, but tests
the |
| 2541 * FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER code instead. It is provided
here to show | 2684 * FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER code instead. It is provided
here to show |
| 2542 * coverage over all of the permutations of initializers in constructor declar
ations. | 2685 * coverage over all of the permutations of initializers in constructor declar
ations. |
| 2543 * <p> | 2686 * <p> |
| 2544 * Note: FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER covers a subset of | 2687 * Note: FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER covers a subset of |
| 2545 * FINAL_INITIALIZED_MULTIPLE_TIMES, since it more specific, we use it instead
of the broader code | 2688 * FINAL_INITIALIZED_MULTIPLE_TIMES, since it more specific, we use it instead
of the broader code |
| 2546 */ | 2689 */ |
| 2547 void test_finalInitializedMultipleTimes_initializingFormal_initializer() { | 2690 void test_finalInitializedMultipleTimes_initializingFormal_initializer() { |
| 2548 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A(this.x) : x = 0 {}", "}"])); | 2691 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A(this.x) : x = 0 {}", "}"])); |
| 2549 resolve(source, []); | 2692 resolve(source, []); |
| 2550 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); | 2693 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); |
| 2551 verify([source]); | 2694 verify([source]); |
| 2552 } | 2695 } |
| 2553 void test_finalInitializedMultipleTimes_initializingFormals() { | 2696 void test_finalInitializedMultipleTimes_initializingFormals() { |
| 2554 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final x;", " A(this.x, this.x) {}", "}"])); | 2697 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A(this.x, this.x) {}", "}"])); |
| 2555 resolve(source, []); | 2698 resolve(source, []); |
| 2556 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]); | 2699 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]); |
| 2557 verify([source]); | 2700 verify([source]); |
| 2558 } | 2701 } |
| 2559 void test_finalNotInitialized_instanceField_const() { | 2702 void test_finalNotInitialized_instanceField_const() { |
| 2560 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const F;", "}"])); | 2703 Source source = addSource(EngineTestCase.createSource(["class A {", " const
F;", "}"])); |
| 2561 resolve(source, []); | 2704 resolve(source, []); |
| 2562 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2705 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2563 verify([source]); | 2706 verify([source]); |
| 2564 } | 2707 } |
| 2565 void test_finalNotInitialized_instanceField_const_static() { | 2708 void test_finalNotInitialized_instanceField_const_static() { |
| 2566 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static const F;", "}"])); | 2709 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c const F;", "}"])); |
| 2567 resolve(source, []); | 2710 resolve(source, []); |
| 2568 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2711 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2569 verify([source]); | 2712 verify([source]); |
| 2570 } | 2713 } |
| 2571 void test_finalNotInitialized_instanceField_final() { | 2714 void test_finalNotInitialized_instanceField_final() { |
| 2572 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final F;", "}"])); | 2715 Source source = addSource(EngineTestCase.createSource(["class A {", " final
F;", "}"])); |
| 2573 resolve(source, []); | 2716 resolve(source, []); |
| 2574 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2717 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2575 verify([source]); | 2718 verify([source]); |
| 2576 } | 2719 } |
| 2577 void test_finalNotInitialized_instanceField_final_static() { | 2720 void test_finalNotInitialized_instanceField_final_static() { |
| 2578 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static final F;", "}"])); | 2721 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c final F;", "}"])); |
| 2579 resolve(source, []); | 2722 resolve(source, []); |
| 2580 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2723 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2581 verify([source]); | 2724 verify([source]); |
| 2582 } | 2725 } |
| 2583 void test_finalNotInitialized_library_const() { | 2726 void test_finalNotInitialized_library_const() { |
| 2584 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
F;"])); | 2727 Source source = addSource(EngineTestCase.createSource(["const F;"])); |
| 2585 resolve(source, []); | 2728 resolve(source, []); |
| 2586 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2729 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2587 verify([source]); | 2730 verify([source]); |
| 2588 } | 2731 } |
| 2589 void test_finalNotInitialized_library_final() { | 2732 void test_finalNotInitialized_library_final() { |
| 2590 Source source = addSource("/test.dart", EngineTestCase.createSource(["final
F;"])); | 2733 Source source = addSource(EngineTestCase.createSource(["final F;"])); |
| 2591 resolve(source, []); | 2734 resolve(source, []); |
| 2592 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2735 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2593 verify([source]); | 2736 verify([source]); |
| 2594 } | 2737 } |
| 2595 void test_finalNotInitialized_local_const() { | 2738 void test_finalNotInitialized_local_const() { |
| 2596 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " const int x;", "}"])); | 2739 Source source = addSource(EngineTestCase.createSource(["f() {", " const int
x;", "}"])); |
| 2597 resolve(source, []); | 2740 resolve(source, []); |
| 2598 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2741 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2599 verify([source]); | 2742 verify([source]); |
| 2600 } | 2743 } |
| 2601 void test_finalNotInitialized_local_final() { | 2744 void test_finalNotInitialized_local_final() { |
| 2602 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " final int x;", "}"])); | 2745 Source source = addSource(EngineTestCase.createSource(["f() {", " final int
x;", "}"])); |
| 2603 resolve(source, []); | 2746 resolve(source, []); |
| 2604 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); | 2747 assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]); |
| 2605 verify([source]); | 2748 verify([source]); |
| 2606 } | 2749 } |
| 2607 void test_implementsDynamic() { | 2750 void test_implementsDynamic() { |
| 2608 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements dynamic {}"])); | 2751 Source source = addSource(EngineTestCase.createSource(["class A implements d
ynamic {}"])); |
| 2609 resolve(source, []); | 2752 resolve(source, []); |
| 2610 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]); | 2753 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]); |
| 2611 verify([source]); | 2754 verify([source]); |
| 2612 } | 2755 } |
| 2613 void test_implementsNonClass_class() { | 2756 void test_implementsNonClass_class() { |
| 2614 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B implements A {}"])); | 2757 Source source = addSource(EngineTestCase.createSource(["int A;", "class B im
plements A {}"])); |
| 2615 resolve(source, []); | 2758 resolve(source, []); |
| 2616 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); | 2759 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 2617 verify([source]); | 2760 verify([source]); |
| 2618 } | 2761 } |
| 2619 void test_implementsNonClass_typedef() { | 2762 void test_implementsNonClass_typedef() { |
| 2620 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "int B;", "typedef C = A implements B;"])); | 2763 Source source = addSource(EngineTestCase.createSource(["class A {}", "int B;
", "typedef C = A implements B;"])); |
| 2621 resolve(source, []); | 2764 resolve(source, []); |
| 2622 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); | 2765 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 2623 verify([source]); | 2766 verify([source]); |
| 2624 } | 2767 } |
| 2625 void test_implementsRepeated() { | 2768 void test_implementsRepeated() { |
| 2626 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "class B implements A, A {}"])); | 2769 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B implements A, A {}"])); |
| 2627 resolve(source, []); | 2770 resolve(source, []); |
| 2628 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED]); | 2771 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED]); |
| 2629 verify([source]); | 2772 verify([source]); |
| 2630 } | 2773 } |
| 2631 void test_implementsRepeated_3times() { | 2774 void test_implementsRepeated_3times() { |
| 2632 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {} class C{}", "class B implements A, A, A, A {}"])); | 2775 Source source = addSource(EngineTestCase.createSource(["class A {} class C{}
", "class B implements A, A, A, A {}"])); |
| 2633 resolve(source, []); | 2776 resolve(source, []); |
| 2634 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED, CompileTimeErrorCode
.IMPLEMENTS_REPEATED, CompileTimeErrorCode.IMPLEMENTS_REPEATED]); | 2777 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED, CompileTimeErrorCode
.IMPLEMENTS_REPEATED, CompileTimeErrorCode.IMPLEMENTS_REPEATED]); |
| 2635 verify([source]); | 2778 verify([source]); |
| 2636 } | 2779 } |
| 2637 void test_implementsSelf() { | 2780 void test_implementsSelf() { |
| 2638 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A implements A {}"])); | 2781 Source source = addSource(EngineTestCase.createSource(["class A implements A
{}"])); |
| 2639 resolve(source, []); | 2782 resolve(source, []); |
| 2640 assertErrors([CompileTimeErrorCode.IMPLEMENTS_SELF]); | 2783 assertErrors([CompileTimeErrorCode.IMPLEMENTS_SELF]); |
| 2641 verify([source]); | 2784 verify([source]); |
| 2642 } | 2785 } |
| 2643 void test_importOfNonLibrary() { | 2786 void test_importOfNonLibrary() { |
| 2644 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "import 'part.dart';"])); | 2787 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); |
| 2645 addSource("/part.dart", EngineTestCase.createSource(["part of lib;"])); | 2788 addSource2("/part.dart", EngineTestCase.createSource(["part of lib;"])); |
| 2646 resolve(source, []); | 2789 resolve(source, []); |
| 2647 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); | 2790 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); |
| 2648 verify([source]); | 2791 verify([source]); |
| 2649 } | 2792 } |
| 2650 void test_inconsistentCaseExpressionTypes() { | 2793 void test_inconsistentCaseExpressionTypes() { |
| 2651 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " switch (p) {", " case 1:", " break;", " case 'a':", "
break;", " }", "}"])); | 2794 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " swit
ch (p) {", " case 1:", " break;", " case 'a':", " break;", " }"
, "}"])); |
| 2652 resolve(source, []); | 2795 resolve(source, []); |
| 2653 assertErrors([CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); | 2796 assertErrors([CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); |
| 2654 verify([source]); | 2797 verify([source]); |
| 2655 } | 2798 } |
| 2656 void test_inconsistentCaseExpressionTypes_repeated() { | 2799 void test_inconsistentCaseExpressionTypes_repeated() { |
| 2657 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " switch (p) {", " case 1:", " break;", " case 'a':", "
break;", " case 'b':", " break;", " }", "}"])); | 2800 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " swit
ch (p) {", " case 1:", " break;", " case 'a':", " break;", "
case 'b':", " break;", " }", "}"])); |
| 2658 resolve(source, []); | 2801 resolve(source, []); |
| 2659 assertErrors([CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, Compi
leTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); | 2802 assertErrors([CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, Compi
leTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); |
| 2660 verify([source]); | 2803 verify([source]); |
| 2661 } | 2804 } |
| 2662 void test_initializerForNonExistant_initializer() { | 2805 void test_initializerForNonExistant_initializer() { |
| 2663 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A() : x = 0 {}", "}"])); | 2806 Source source = addSource(EngineTestCase.createSource(["class A {", " A() :
x = 0 {}", "}"])); |
| 2664 resolve(source, []); | 2807 resolve(source, []); |
| 2665 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD]); | 2808 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD]); |
| 2666 } | 2809 } |
| 2667 void test_initializerForStaticField() { | 2810 void test_initializerForStaticField() { |
| 2668 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static x;", " A() : x = 0 {}", "}"])); | 2811 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c x;", " A() : x = 0 {}", "}"])); |
| 2669 resolve(source, []); | 2812 resolve(source, []); |
| 2670 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]); | 2813 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]); |
| 2671 verify([source]); | 2814 verify([source]); |
| 2672 } | 2815 } |
| 2673 void test_initializingFormalForNonExistantField() { | 2816 void test_initializingFormalForNonExistantField() { |
| 2674 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A(this.x) {}", "}"])); | 2817 Source source = addSource(EngineTestCase.createSource(["class A {", " A(thi
s.x) {}", "}"])); |
| 2675 resolve(source, []); | 2818 resolve(source, []); |
| 2676 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); | 2819 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 2677 verify([source]); | 2820 verify([source]); |
| 2678 } | 2821 } |
| 2679 void test_initializingFormalForNonExistantField_notInEnclosingClass() { | 2822 void test_initializingFormalForNonExistantField_notInEnclosingClass() { |
| 2680 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", "int x;", "}", "class B extends A {", " B(this.x) {}", "}"])); | 2823 Source source = addSource(EngineTestCase.createSource(["class A {", "int x;"
, "}", "class B extends A {", " B(this.x) {}", "}"])); |
| 2681 resolve(source, []); | 2824 resolve(source, []); |
| 2682 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); | 2825 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 2683 verify([source]); | 2826 verify([source]); |
| 2684 } | 2827 } |
| 2685 void test_initializingFormalForNonExistantField_optional() { | 2828 void test_initializingFormalForNonExistantField_optional() { |
| 2686 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A([this.x]) {}", "}"])); | 2829 Source source = addSource(EngineTestCase.createSource(["class A {", " A([th
is.x]) {}", "}"])); |
| 2687 resolve(source, []); | 2830 resolve(source, []); |
| 2688 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); | 2831 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 2689 verify([source]); | 2832 verify([source]); |
| 2690 } | 2833 } |
| 2691 void test_initializingFormalForNonExistantField_static() { | 2834 void test_initializingFormalForNonExistantField_static() { |
| 2692 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static x;", " A([this.x]) {}", "}"])); | 2835 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c x;", " A([this.x]) {}", "}"])); |
| 2693 resolve(source, []); | 2836 resolve(source, []); |
| 2694 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]); | 2837 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]); |
| 2695 verify([source]); | 2838 verify([source]); |
| 2696 } | 2839 } |
| 2697 void test_invalidTypeArgumentForKey() { | 2840 void test_invalidTypeArgumentForKey() { |
| 2698 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m() {", " return const <int, int>{}", " }", "}"])); | 2841 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
", " return const <int, int>{}", " }", "}"])); |
| 2699 resolve(source, []); | 2842 resolve(source, []); |
| 2700 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_FOR_KEY]); | 2843 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_FOR_KEY]); |
| 2701 verify([source]); | 2844 verify([source]); |
| 2702 } | 2845 } |
| 2846 void test_invalidTypeArgumentInConstList() { |
| 2847 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return const <E>[]", " }", "}"])); |
| 2848 resolve(source, []); |
| 2849 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]); |
| 2850 verify([source]); |
| 2851 } |
| 2852 void test_invalidTypeArgumentInConstMap() { |
| 2853 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return const <String, E>{}", " }", "}"])); |
| 2854 resolve(source, []); |
| 2855 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]); |
| 2856 verify([source]); |
| 2857 } |
| 2703 void test_invalidUri_export() { | 2858 void test_invalidUri_export() { |
| 2704 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "export 'unknown.dart';"])); | 2859 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'unknown.dart';"])); |
| 2705 resolve(source, []); | 2860 resolve(source, []); |
| 2706 assertErrors([CompileTimeErrorCode.INVALID_URI]); | 2861 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 2707 } | 2862 } |
| 2708 void test_invalidUri_import() { | 2863 void test_invalidUri_import() { |
| 2709 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "import 'unknown.dart';"])); | 2864 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'unknown.dart';"])); |
| 2710 resolve(source, []); | 2865 resolve(source, []); |
| 2711 assertErrors([CompileTimeErrorCode.INVALID_URI]); | 2866 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 2712 } | 2867 } |
| 2713 void test_invalidUri_part() { | 2868 void test_invalidUri_part() { |
| 2714 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "part 'unknown.dart';"])); | 2869 Source source = addSource(EngineTestCase.createSource(["library L;", "part '
unknown.dart';"])); |
| 2715 resolve(source, []); | 2870 resolve(source, []); |
| 2716 assertErrors([CompileTimeErrorCode.INVALID_URI]); | 2871 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 2717 } | 2872 } |
| 2718 void test_labelInOuterScope() { | 2873 void test_labelInOuterScope() { |
| 2719 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
int {}", "", "class A {", " void m(int i) {", " l: while (i > 0) {", "
void f() {", " break l;", " };", " }", " }", "}"])); | 2874 Source source = addSource(EngineTestCase.createSource(["class int {}", "", "
class A {", " void m(int i) {", " l: while (i > 0) {", " void f() {", "
break l;", " };", " }", " }", "}"])); |
| 2720 resolve(source, []); | 2875 resolve(source, []); |
| 2721 assertErrors([CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, StaticWarningCode.U
NDEFINED_OPERATOR]); | 2876 assertErrors([CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, StaticWarningCode.U
NDEFINED_OPERATOR]); |
| 2722 } | 2877 } |
| 2723 void test_labelUndefined_break() { | 2878 void test_labelUndefined_break() { |
| 2724 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " break y;", " }", "}"])); | 2879 Source source = addSource(EngineTestCase.createSource(["f() {", " x: while
(true) {", " break y;", " }", "}"])); |
| 2725 resolve(source, []); | 2880 resolve(source, []); |
| 2726 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); | 2881 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); |
| 2727 } | 2882 } |
| 2728 void test_labelUndefined_continue() { | 2883 void test_labelUndefined_continue() { |
| 2729 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " continue y;", " }", "}"])); | 2884 Source source = addSource(EngineTestCase.createSource(["f() {", " x: while
(true) {", " continue y;", " }", "}"])); |
| 2730 resolve(source, []); | 2885 resolve(source, []); |
| 2731 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); | 2886 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); |
| 2732 } | 2887 } |
| 2733 void test_mixinOfNonClass_class() { | 2888 void test_mixinOfNonClass_class() { |
| 2734 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B with A {}"])); | 2889 Source source = addSource(EngineTestCase.createSource(["int A;", "class B wi
th A {}"])); |
| 2735 resolve(source, []); | 2890 resolve(source, []); |
| 2736 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); | 2891 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 2737 verify([source]); | 2892 verify([source]); |
| 2738 } | 2893 } |
| 2739 void test_mixinOfNonClass_typedef() { | 2894 void test_mixinOfNonClass_typedef() { |
| 2740 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "int B;", "typedef C = A with B;"])); | 2895 Source source = addSource(EngineTestCase.createSource(["class A {}", "int B;
", "typedef C = A with B;"])); |
| 2741 resolve(source, []); | 2896 resolve(source, []); |
| 2742 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); | 2897 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 2743 verify([source]); | 2898 verify([source]); |
| 2744 } | 2899 } |
| 2745 void test_nativeFunctionBodyInNonSDKCode_function() { | 2900 void test_nativeFunctionBodyInNonSDKCode_function() { |
| 2746 Source source = addSource("/test.dart", EngineTestCase.createSource(["int m(
a) native 'string';"])); | 2901 Source source = addSource(EngineTestCase.createSource(["int m(a) native 'str
ing';"])); |
| 2747 resolve(source, []); | 2902 resolve(source, []); |
| 2748 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); | 2903 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| 2749 verify([source]); | 2904 verify([source]); |
| 2750 } | 2905 } |
| 2751 void test_nativeFunctionBodyInNonSDKCode_method() { | 2906 void test_nativeFunctionBodyInNonSDKCode_method() { |
| 2752 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A{", " static int m(a) native 'string';", "}"])); | 2907 Source source = addSource(EngineTestCase.createSource(["class A{", " static
int m(a) native 'string';", "}"])); |
| 2753 resolve(source, []); | 2908 resolve(source, []); |
| 2754 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); | 2909 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| 2755 verify([source]); | 2910 verify([source]); |
| 2756 } | 2911 } |
| 2757 void test_newWithInvalidTypeParameters() { | 2912 void test_newWithInvalidTypeParameters() { |
| 2758 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { return new A<A>(); }"])); | 2913 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {
return new A<A>(); }"])); |
| 2759 resolve(source, []); | 2914 resolve(source, []); |
| 2760 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); | 2915 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); |
| 2761 verify([source]); | 2916 verify([source]); |
| 2762 } | 2917 } |
| 2763 void test_nonConstCaseExpression() { | 2918 void test_nonConstCaseExpression() { |
| 2764 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p, int q) {", " switch (p) {", " case 3 + q:", " break;", " }", "}"]))
; | 2919 Source source = addSource(EngineTestCase.createSource(["f(int p, int q) {",
" switch (p) {", " case 3 + q:", " break;", " }", "}"])); |
| 2765 resolve(source, []); | 2920 resolve(source, []); |
| 2766 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); | 2921 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); |
| 2767 verify([source]); | 2922 verify([source]); |
| 2768 } | 2923 } |
| 2769 void test_nonConstListElement() { | 2924 void test_nonConstListElement() { |
| 2770 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const [a];", "}"])); | 2925 Source source = addSource(EngineTestCase.createSource(["f(a) {", " return c
onst [a];", "}"])); |
| 2771 resolve(source, []); | 2926 resolve(source, []); |
| 2772 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); | 2927 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); |
| 2773 verify([source]); | 2928 verify([source]); |
| 2774 } | 2929 } |
| 2775 void test_nonConstMapValue() { | 2930 void test_nonConstMapValue() { |
| 2776 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {'a' : a};", "}"])); | 2931 Source source = addSource(EngineTestCase.createSource(["f(a) {", " return c
onst {'a' : a};", "}"])); |
| 2777 resolve(source, []); | 2932 resolve(source, []); |
| 2778 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); | 2933 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); |
| 2779 verify([source]); | 2934 verify([source]); |
| 2780 } | 2935 } |
| 2936 void test_optionalParameterInOperator_named() { |
| 2937 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +({p}) {}", "}"])); |
| 2938 resolve(source, []); |
| 2939 assertErrors([CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]); |
| 2940 verify([source]); |
| 2941 } |
| 2942 void test_optionalParameterInOperator_positional() { |
| 2943 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +([p]) {}", "}"])); |
| 2944 resolve(source, []); |
| 2945 assertErrors([CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]); |
| 2946 verify([source]); |
| 2947 } |
| 2781 void test_partOfNonPart() { | 2948 void test_partOfNonPart() { |
| 2782 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y l1;", "part 'l2.dart';"])); | 2949 Source source = addSource(EngineTestCase.createSource(["library l1;", "part
'l2.dart';"])); |
| 2783 addSource("/l2.dart", EngineTestCase.createSource(["library l2;"])); | 2950 addSource2("/l2.dart", EngineTestCase.createSource(["library l2;"])); |
| 2784 resolve(source, []); | 2951 resolve(source, []); |
| 2785 assertErrors([CompileTimeErrorCode.PART_OF_NON_PART]); | 2952 assertErrors([CompileTimeErrorCode.PART_OF_NON_PART]); |
| 2786 verify([source]); | 2953 verify([source]); |
| 2787 } | 2954 } |
| 2955 void test_privateOptionalParameter() { |
| 2956 Source source = addSource(EngineTestCase.createSource(["f({_p : 0}) {}"])); |
| 2957 resolve(source, []); |
| 2958 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| 2959 verify([source]); |
| 2960 } |
| 2788 void test_rethrowOutsideCatch() { | 2961 void test_rethrowOutsideCatch() { |
| 2789 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " rethrow;", "}"])); | 2962 Source source = addSource(EngineTestCase.createSource(["f() {", " rethrow;"
, "}"])); |
| 2790 resolve(source, []); | 2963 resolve(source, []); |
| 2791 assertErrors([CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); | 2964 assertErrors([CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); |
| 2792 verify([source]); | 2965 verify([source]); |
| 2793 } | 2966 } |
| 2967 void test_returnInGenerativeConstructor() { |
| 2968 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
return 0; }", "}"])); |
| 2969 resolve(source, []); |
| 2970 assertErrors([CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]); |
| 2971 verify([source]); |
| 2972 } |
| 2794 void test_uriWithInterpolation_constant() { | 2973 void test_uriWithInterpolation_constant() { |
| 2795 Source source = addSource("/test.dart", EngineTestCase.createSource(["import
'stuff_\$platform.dart';"])); | 2974 Source source = addSource(EngineTestCase.createSource(["import 'stuff_\$plat
form.dart';"])); |
| 2796 resolve(source, []); | 2975 resolve(source, []); |
| 2797 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION, StaticWarningCode
.UNDEFINED_IDENTIFIER]); | 2976 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION, StaticWarningCode
.UNDEFINED_IDENTIFIER]); |
| 2798 } | 2977 } |
| 2799 void test_uriWithInterpolation_nonConstant() { | 2978 void test_uriWithInterpolation_nonConstant() { |
| 2800 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "part '\${'a'}.dart';"])); | 2979 Source source = addSource(EngineTestCase.createSource(["library lib;", "part
'\${'a'}.dart';"])); |
| 2801 resolve(source, []); | 2980 resolve(source, []); |
| 2802 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION]); | 2981 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION]); |
| 2803 } | 2982 } |
| 2983 void test_wrongNumberOfParametersForSetter_tooFew() { |
| 2984 Source source = addSource(EngineTestCase.createSource(["class A {", " set x
() {}", "}"])); |
| 2985 resolve(source, []); |
| 2986 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| 2987 verify([source]); |
| 2988 } |
| 2989 void test_wrongNumberOfParametersForSetter_tooMany() { |
| 2990 Source source = addSource(EngineTestCase.createSource(["class A {", " set x
(a, b) {}", "}"])); |
| 2991 resolve(source, []); |
| 2992 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| 2993 verify([source]); |
| 2994 } |
| 2804 static dartSuite() { | 2995 static dartSuite() { |
| 2805 _ut.group('CompileTimeErrorCodeTest', () { | 2996 _ut.group('CompileTimeErrorCodeTest', () { |
| 2806 _ut.test('test_argumentDefinitionTestNonParameter', () { | 2997 _ut.test('test_argumentDefinitionTestNonParameter', () { |
| 2807 final __test = new CompileTimeErrorCodeTest(); | 2998 final __test = new CompileTimeErrorCodeTest(); |
| 2808 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); | 2999 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); |
| 2809 }); | 3000 }); |
| 2810 _ut.test('test_builtInIdentifierAsType', () { | 3001 _ut.test('test_builtInIdentifierAsType', () { |
| 2811 final __test = new CompileTimeErrorCodeTest(); | 3002 final __test = new CompileTimeErrorCodeTest(); |
| 2812 runJUnitTest(__test, __test.test_builtInIdentifierAsType); | 3003 runJUnitTest(__test, __test.test_builtInIdentifierAsType); |
| 2813 }); | 3004 }); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3064 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_o
ptional); | 3255 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_o
ptional); |
| 3065 }); | 3256 }); |
| 3066 _ut.test('test_initializingFormalForNonExistantField_static', () { | 3257 _ut.test('test_initializingFormalForNonExistantField_static', () { |
| 3067 final __test = new CompileTimeErrorCodeTest(); | 3258 final __test = new CompileTimeErrorCodeTest(); |
| 3068 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_s
tatic); | 3259 runJUnitTest(__test, __test.test_initializingFormalForNonExistantField_s
tatic); |
| 3069 }); | 3260 }); |
| 3070 _ut.test('test_invalidTypeArgumentForKey', () { | 3261 _ut.test('test_invalidTypeArgumentForKey', () { |
| 3071 final __test = new CompileTimeErrorCodeTest(); | 3262 final __test = new CompileTimeErrorCodeTest(); |
| 3072 runJUnitTest(__test, __test.test_invalidTypeArgumentForKey); | 3263 runJUnitTest(__test, __test.test_invalidTypeArgumentForKey); |
| 3073 }); | 3264 }); |
| 3265 _ut.test('test_invalidTypeArgumentInConstList', () { |
| 3266 final __test = new CompileTimeErrorCodeTest(); |
| 3267 runJUnitTest(__test, __test.test_invalidTypeArgumentInConstList); |
| 3268 }); |
| 3269 _ut.test('test_invalidTypeArgumentInConstMap', () { |
| 3270 final __test = new CompileTimeErrorCodeTest(); |
| 3271 runJUnitTest(__test, __test.test_invalidTypeArgumentInConstMap); |
| 3272 }); |
| 3074 _ut.test('test_invalidUri_export', () { | 3273 _ut.test('test_invalidUri_export', () { |
| 3075 final __test = new CompileTimeErrorCodeTest(); | 3274 final __test = new CompileTimeErrorCodeTest(); |
| 3076 runJUnitTest(__test, __test.test_invalidUri_export); | 3275 runJUnitTest(__test, __test.test_invalidUri_export); |
| 3077 }); | 3276 }); |
| 3078 _ut.test('test_invalidUri_import', () { | 3277 _ut.test('test_invalidUri_import', () { |
| 3079 final __test = new CompileTimeErrorCodeTest(); | 3278 final __test = new CompileTimeErrorCodeTest(); |
| 3080 runJUnitTest(__test, __test.test_invalidUri_import); | 3279 runJUnitTest(__test, __test.test_invalidUri_import); |
| 3081 }); | 3280 }); |
| 3082 _ut.test('test_invalidUri_part', () { | 3281 _ut.test('test_invalidUri_part', () { |
| 3083 final __test = new CompileTimeErrorCodeTest(); | 3282 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3120 runJUnitTest(__test, __test.test_nonConstCaseExpression); | 3319 runJUnitTest(__test, __test.test_nonConstCaseExpression); |
| 3121 }); | 3320 }); |
| 3122 _ut.test('test_nonConstListElement', () { | 3321 _ut.test('test_nonConstListElement', () { |
| 3123 final __test = new CompileTimeErrorCodeTest(); | 3322 final __test = new CompileTimeErrorCodeTest(); |
| 3124 runJUnitTest(__test, __test.test_nonConstListElement); | 3323 runJUnitTest(__test, __test.test_nonConstListElement); |
| 3125 }); | 3324 }); |
| 3126 _ut.test('test_nonConstMapValue', () { | 3325 _ut.test('test_nonConstMapValue', () { |
| 3127 final __test = new CompileTimeErrorCodeTest(); | 3326 final __test = new CompileTimeErrorCodeTest(); |
| 3128 runJUnitTest(__test, __test.test_nonConstMapValue); | 3327 runJUnitTest(__test, __test.test_nonConstMapValue); |
| 3129 }); | 3328 }); |
| 3329 _ut.test('test_optionalParameterInOperator_named', () { |
| 3330 final __test = new CompileTimeErrorCodeTest(); |
| 3331 runJUnitTest(__test, __test.test_optionalParameterInOperator_named); |
| 3332 }); |
| 3333 _ut.test('test_optionalParameterInOperator_positional', () { |
| 3334 final __test = new CompileTimeErrorCodeTest(); |
| 3335 runJUnitTest(__test, __test.test_optionalParameterInOperator_positional)
; |
| 3336 }); |
| 3130 _ut.test('test_partOfNonPart', () { | 3337 _ut.test('test_partOfNonPart', () { |
| 3131 final __test = new CompileTimeErrorCodeTest(); | 3338 final __test = new CompileTimeErrorCodeTest(); |
| 3132 runJUnitTest(__test, __test.test_partOfNonPart); | 3339 runJUnitTest(__test, __test.test_partOfNonPart); |
| 3133 }); | 3340 }); |
| 3341 _ut.test('test_privateOptionalParameter', () { |
| 3342 final __test = new CompileTimeErrorCodeTest(); |
| 3343 runJUnitTest(__test, __test.test_privateOptionalParameter); |
| 3344 }); |
| 3134 _ut.test('test_rethrowOutsideCatch', () { | 3345 _ut.test('test_rethrowOutsideCatch', () { |
| 3135 final __test = new CompileTimeErrorCodeTest(); | 3346 final __test = new CompileTimeErrorCodeTest(); |
| 3136 runJUnitTest(__test, __test.test_rethrowOutsideCatch); | 3347 runJUnitTest(__test, __test.test_rethrowOutsideCatch); |
| 3137 }); | 3348 }); |
| 3349 _ut.test('test_returnInGenerativeConstructor', () { |
| 3350 final __test = new CompileTimeErrorCodeTest(); |
| 3351 runJUnitTest(__test, __test.test_returnInGenerativeConstructor); |
| 3352 }); |
| 3138 _ut.test('test_uriWithInterpolation_constant', () { | 3353 _ut.test('test_uriWithInterpolation_constant', () { |
| 3139 final __test = new CompileTimeErrorCodeTest(); | 3354 final __test = new CompileTimeErrorCodeTest(); |
| 3140 runJUnitTest(__test, __test.test_uriWithInterpolation_constant); | 3355 runJUnitTest(__test, __test.test_uriWithInterpolation_constant); |
| 3141 }); | 3356 }); |
| 3142 _ut.test('test_uriWithInterpolation_nonConstant', () { | 3357 _ut.test('test_uriWithInterpolation_nonConstant', () { |
| 3143 final __test = new CompileTimeErrorCodeTest(); | 3358 final __test = new CompileTimeErrorCodeTest(); |
| 3144 runJUnitTest(__test, __test.test_uriWithInterpolation_nonConstant); | 3359 runJUnitTest(__test, __test.test_uriWithInterpolation_nonConstant); |
| 3145 }); | 3360 }); |
| 3361 _ut.test('test_wrongNumberOfParametersForSetter_tooFew', () { |
| 3362 final __test = new CompileTimeErrorCodeTest(); |
| 3363 runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_tooFew
); |
| 3364 }); |
| 3365 _ut.test('test_wrongNumberOfParametersForSetter_tooMany', () { |
| 3366 final __test = new CompileTimeErrorCodeTest(); |
| 3367 runJUnitTest(__test, __test.test_wrongNumberOfParametersForSetter_tooMan
y); |
| 3368 }); |
| 3146 }); | 3369 }); |
| 3147 } | 3370 } |
| 3148 } | 3371 } |
| 3149 /** | 3372 /** |
| 3150 * Instances of the class {@code StaticTypeVerifier} verify that all of the node
s in an AST | 3373 * Instances of the class {@code StaticTypeVerifier} verify that all of the node
s in an AST |
| 3151 * structure that should have a static type associated with them do have a stati
c type. | 3374 * structure that should have a static type associated with them do have a stati
c type. |
| 3152 */ | 3375 */ |
| 3153 class StaticTypeVerifier extends GeneralizingASTVisitor<Object> { | 3376 class StaticTypeVerifier extends GeneralizingASTVisitor<Object> { |
| 3154 /** | 3377 /** |
| 3155 * A list containing all of the AST Expression nodes that were not resolved. | 3378 * A list containing all of the AST Expression nodes that were not resolved. |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 classA.constructors = <ConstructorElement> [constructor]; | 3608 classA.constructors = <ConstructorElement> [constructor]; |
| 3386 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); | 3609 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); |
| 3387 resolveNode(name, []); | 3610 resolveNode(name, []); |
| 3388 JUnitTestCase.assertSame(constructor, name.element); | 3611 JUnitTestCase.assertSame(constructor, name.element); |
| 3389 _listener.assertNoErrors(); | 3612 _listener.assertNoErrors(); |
| 3390 } | 3613 } |
| 3391 void test_visitContinueStatement_withLabel() { | 3614 void test_visitContinueStatement_withLabel() { |
| 3392 String label = "loop"; | 3615 String label = "loop"; |
| 3393 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier3(
label), false, false); | 3616 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier3(
label), false, false); |
| 3394 ContinueStatement statement = ASTFactory.continueStatement2(label); | 3617 ContinueStatement statement = ASTFactory.continueStatement2(label); |
| 3395 JUnitTestCase.assertSame(labelElement, resolve2(statement, labelElement)); | 3618 JUnitTestCase.assertSame(labelElement, resolve3(statement, labelElement)); |
| 3396 _listener.assertNoErrors(); | 3619 _listener.assertNoErrors(); |
| 3397 } | 3620 } |
| 3398 void test_visitContinueStatement_withoutLabel() { | 3621 void test_visitContinueStatement_withoutLabel() { |
| 3399 ContinueStatement statement = ASTFactory.continueStatement(); | 3622 ContinueStatement statement = ASTFactory.continueStatement(); |
| 3400 resolveStatement(statement, null); | 3623 resolveStatement(statement, null); |
| 3401 _listener.assertNoErrors(); | 3624 _listener.assertNoErrors(); |
| 3402 } | 3625 } |
| 3403 void test_visitExportDirective_noCombinators() { | 3626 void test_visitExportDirective_noCombinators() { |
| 3404 ExportDirective directive = ASTFactory.exportDirective2(null, []); | 3627 ExportDirective directive = ASTFactory.exportDirective2(null, []); |
| 3405 directive.element = ElementFactory.exportFor(ElementFactory.library(_definin
gLibrary.context, "lib"), []); | 3628 directive.element = ElementFactory.exportFor(ElementFactory.library(_definin
gLibrary.context, "lib"), []); |
| 3406 resolveNode(directive, []); | 3629 resolveNode(directive, []); |
| 3407 _listener.assertNoErrors(); | 3630 _listener.assertNoErrors(); |
| 3408 } | 3631 } |
| 3632 void test_visitFieldFormalParameter() { |
| 3633 InterfaceType intType2 = _typeProvider.intType; |
| 3634 String fieldName = "f"; |
| 3635 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 3636 classA.fields = <FieldElement> [ElementFactory.fieldElement(fieldName, false
, false, false, intType2)]; |
| 3637 FieldFormalParameter parameter = ASTFactory.fieldFormalParameter2(fieldName)
; |
| 3638 parameter.identifier.element = ElementFactory.fieldFormalParameter(parameter
.identifier); |
| 3639 resolveInClass(parameter, classA); |
| 3640 JUnitTestCase.assertSame(intType2, parameter.element.type); |
| 3641 } |
| 3409 void test_visitImportDirective_noCombinators_noPrefix() { | 3642 void test_visitImportDirective_noCombinators_noPrefix() { |
| 3410 ImportDirective directive = ASTFactory.importDirective2(null, null, []); | 3643 ImportDirective directive = ASTFactory.importDirective2(null, null, []); |
| 3411 directive.element = ElementFactory.importFor(ElementFactory.library(_definin
gLibrary.context, "lib"), null, []); | 3644 directive.element = ElementFactory.importFor(ElementFactory.library(_definin
gLibrary.context, "lib"), null, []); |
| 3412 resolveNode(directive, []); | 3645 resolveNode(directive, []); |
| 3413 _listener.assertNoErrors(); | 3646 _listener.assertNoErrors(); |
| 3414 } | 3647 } |
| 3415 void test_visitImportDirective_noCombinators_prefix() { | 3648 void test_visitImportDirective_noCombinators_prefix() { |
| 3416 String prefixName = "p"; | 3649 String prefixName = "p"; |
| 3417 ImportElement importElement = ElementFactory.importFor(ElementFactory.librar
y(_definingLibrary.context, "lib"), ElementFactory.prefix(prefixName), []); | 3650 ImportElement importElement = ElementFactory.importFor(ElementFactory.librar
y(_definingLibrary.context, "lib"), ElementFactory.prefix(prefixName), []); |
| 3418 _definingLibrary.imports = <ImportElement> [importElement]; | 3651 _definingLibrary.imports = <ImportElement> [importElement]; |
| 3419 ImportDirective directive = ASTFactory.importDirective2(null, prefixName, []
); | 3652 ImportDirective directive = ASTFactory.importDirective2(null, prefixName, []
); |
| 3420 directive.element = importElement; | 3653 directive.element = importElement; |
| 3421 resolveNode(directive, []); | 3654 resolveNode(directive, []); |
| 3422 _listener.assertNoErrors(); | 3655 _listener.assertNoErrors(); |
| 3423 } | 3656 } |
| 3424 void test_visitIndexExpression_get() { | 3657 void test_visitIndexExpression_get() { |
| 3425 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3658 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 3426 InterfaceType intType2 = _typeProvider.intType; | 3659 InterfaceType intType2 = _typeProvider.intType; |
| 3427 MethodElement getter = ElementFactory.methodElement("[]", intType2, [intType
2]); | 3660 MethodElement getter = ElementFactory.methodElement("[]", intType2, [intType
2]); |
| 3428 classA.methods = <MethodElement> [getter]; | 3661 classA.methods = <MethodElement> [getter]; |
| 3429 SimpleIdentifier array = ASTFactory.identifier3("a"); | 3662 SimpleIdentifier array = ASTFactory.identifier3("a"); |
| 3430 array.staticType = classA.type; | 3663 array.staticType = classA.type; |
| 3431 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); | 3664 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); |
| 3432 JUnitTestCase.assertSame(getter, resolve4(expression, [])); | 3665 JUnitTestCase.assertSame(getter, resolve5(expression, [])); |
| 3433 _listener.assertNoErrors(); | 3666 _listener.assertNoErrors(); |
| 3434 } | 3667 } |
| 3435 void test_visitIndexExpression_set() { | 3668 void test_visitIndexExpression_set() { |
| 3436 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3669 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 3437 InterfaceType intType2 = _typeProvider.intType; | 3670 InterfaceType intType2 = _typeProvider.intType; |
| 3438 MethodElement setter = ElementFactory.methodElement("[]=", intType2, [intTyp
e2]); | 3671 MethodElement setter = ElementFactory.methodElement("[]=", intType2, [intTyp
e2]); |
| 3439 classA.methods = <MethodElement> [setter]; | 3672 classA.methods = <MethodElement> [setter]; |
| 3440 SimpleIdentifier array = ASTFactory.identifier3("a"); | 3673 SimpleIdentifier array = ASTFactory.identifier3("a"); |
| 3441 array.staticType = classA.type; | 3674 array.staticType = classA.type; |
| 3442 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); | 3675 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); |
| 3443 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.integer
(0)); | 3676 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.integer
(0)); |
| 3444 JUnitTestCase.assertSame(setter, resolve4(expression, [])); | 3677 JUnitTestCase.assertSame(setter, resolve5(expression, [])); |
| 3445 _listener.assertNoErrors(); | 3678 _listener.assertNoErrors(); |
| 3446 } | 3679 } |
| 3447 void test_visitInstanceCreationExpression_named() { | 3680 void test_visitInstanceCreationExpression_named() { |
| 3448 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3681 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 3449 String constructorName = "a"; | 3682 String constructorName = "a"; |
| 3450 ConstructorElement constructor = ElementFactory.constructorElement(construct
orName); | 3683 ConstructorElement constructor = ElementFactory.constructorElement(construct
orName); |
| 3451 classA.constructors = <ConstructorElement> [constructor]; | 3684 classA.constructors = <ConstructorElement> [constructor]; |
| 3452 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); | 3685 ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA
, []), constructorName); |
| 3453 name.element = constructor; | 3686 name.element = constructor; |
| 3454 InstanceCreationExpression creation = ASTFactory.instanceCreationExpression(
Keyword.NEW, name, []); | 3687 InstanceCreationExpression creation = ASTFactory.instanceCreationExpression(
Keyword.NEW, name, []); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 InterfaceType doubleType2 = _typeProvider.doubleType; | 3831 InterfaceType doubleType2 = _typeProvider.doubleType; |
| 3599 String fieldName = "NAN"; | 3832 String fieldName = "NAN"; |
| 3600 SimpleIdentifier node = ASTFactory.identifier3(fieldName); | 3833 SimpleIdentifier node = ASTFactory.identifier3(fieldName); |
| 3601 resolveInClass(node, doubleType2.element); | 3834 resolveInClass(node, doubleType2.element); |
| 3602 JUnitTestCase.assertEquals(getGetter(doubleType2, fieldName), node.element); | 3835 JUnitTestCase.assertEquals(getGetter(doubleType2, fieldName), node.element); |
| 3603 _listener.assertNoErrors(); | 3836 _listener.assertNoErrors(); |
| 3604 } | 3837 } |
| 3605 void test_visitSimpleIdentifier_lexicalScope() { | 3838 void test_visitSimpleIdentifier_lexicalScope() { |
| 3606 SimpleIdentifier node = ASTFactory.identifier3("i"); | 3839 SimpleIdentifier node = ASTFactory.identifier3("i"); |
| 3607 VariableElementImpl element = ElementFactory.localVariableElement(node); | 3840 VariableElementImpl element = ElementFactory.localVariableElement(node); |
| 3608 JUnitTestCase.assertSame(element, resolve3(node, [element])); | 3841 JUnitTestCase.assertSame(element, resolve4(node, [element])); |
| 3609 _listener.assertNoErrors(); | 3842 _listener.assertNoErrors(); |
| 3610 } | 3843 } |
| 3611 void test_visitSimpleIdentifier_lexicalScope_field_setter() { | 3844 void test_visitSimpleIdentifier_lexicalScope_field_setter() { |
| 3612 InterfaceType intType2 = _typeProvider.intType; | 3845 InterfaceType intType2 = _typeProvider.intType; |
| 3613 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 3846 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 3614 String fieldName = "a"; | 3847 String fieldName = "a"; |
| 3615 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType2); | 3848 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType2); |
| 3616 classA.fields = <FieldElement> [field]; | 3849 classA.fields = <FieldElement> [field]; |
| 3617 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; | 3850 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; |
| 3618 SimpleIdentifier node = ASTFactory.identifier3(fieldName); | 3851 SimpleIdentifier node = ASTFactory.identifier3(fieldName); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3685 resolveStatement(statement, labelElement); | 3918 resolveStatement(statement, labelElement); |
| 3686 return statement.label.element; | 3919 return statement.label.element; |
| 3687 } | 3920 } |
| 3688 /** | 3921 /** |
| 3689 * Return the element associated with the label of the given statement after t
he resolver has | 3922 * Return the element associated with the label of the given statement after t
he resolver has |
| 3690 * resolved the statement. | 3923 * resolved the statement. |
| 3691 * @param statement the statement to be resolved | 3924 * @param statement the statement to be resolved |
| 3692 * @param labelElement the label element to be defined in the statement's labe
l scope | 3925 * @param labelElement the label element to be defined in the statement's labe
l scope |
| 3693 * @return the element to which the statement's label was resolved | 3926 * @return the element to which the statement's label was resolved |
| 3694 */ | 3927 */ |
| 3695 Element resolve2(ContinueStatement statement, LabelElementImpl labelElement) { | 3928 Element resolve3(ContinueStatement statement, LabelElementImpl labelElement) { |
| 3696 resolveStatement(statement, labelElement); | 3929 resolveStatement(statement, labelElement); |
| 3697 return statement.label.element; | 3930 return statement.label.element; |
| 3698 } | 3931 } |
| 3699 /** | 3932 /** |
| 3700 * Return the element associated with the given identifier after the resolver
has resolved the | 3933 * Return the element associated with the given identifier after the resolver
has resolved the |
| 3701 * identifier. | 3934 * identifier. |
| 3702 * @param node the expression to be resolved | 3935 * @param node the expression to be resolved |
| 3703 * @param definedElements the elements that are to be defined in the scope in
which the element is | 3936 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 3704 * being resolved | 3937 * being resolved |
| 3705 * @return the element to which the expression was resolved | 3938 * @return the element to which the expression was resolved |
| 3706 */ | 3939 */ |
| 3707 Element resolve3(Identifier node, List<Element> definedElements) { | 3940 Element resolve4(Identifier node, List<Element> definedElements) { |
| 3708 resolveNode(node, definedElements); | 3941 resolveNode(node, definedElements); |
| 3709 return node.element; | 3942 return node.element; |
| 3710 } | 3943 } |
| 3711 /** | 3944 /** |
| 3712 * Return the element associated with the given expression after the resolver
has resolved the | 3945 * Return the element associated with the given expression after the resolver
has resolved the |
| 3713 * expression. | 3946 * expression. |
| 3714 * @param node the expression to be resolved | 3947 * @param node the expression to be resolved |
| 3715 * @param definedElements the elements that are to be defined in the scope in
which the element is | 3948 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 3716 * being resolved | 3949 * being resolved |
| 3717 * @return the element to which the expression was resolved | 3950 * @return the element to which the expression was resolved |
| 3718 */ | 3951 */ |
| 3719 Element resolve4(IndexExpression node, List<Element> definedElements) { | 3952 Element resolve5(IndexExpression node, List<Element> definedElements) { |
| 3720 resolveNode(node, definedElements); | 3953 resolveNode(node, definedElements); |
| 3721 return node.element; | 3954 return node.element; |
| 3722 } | 3955 } |
| 3723 /** | 3956 /** |
| 3724 * Return the element associated with the given identifier after the resolver
has resolved the | 3957 * Return the element associated with the given identifier after the resolver
has resolved the |
| 3725 * identifier. | 3958 * identifier. |
| 3726 * @param node the expression to be resolved | 3959 * @param node the expression to be resolved |
| 3727 * @param enclosingClass the element representing the class enclosing the iden
tifier | 3960 * @param enclosingClass the element representing the class enclosing the iden
tifier |
| 3728 * @return the element to which the expression was resolved | 3961 * @return the element to which the expression was resolved |
| 3729 */ | 3962 */ |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3829 runJUnitTest(__test, __test.test_visitContinueStatement_withLabel); | 4062 runJUnitTest(__test, __test.test_visitContinueStatement_withLabel); |
| 3830 }); | 4063 }); |
| 3831 _ut.test('test_visitContinueStatement_withoutLabel', () { | 4064 _ut.test('test_visitContinueStatement_withoutLabel', () { |
| 3832 final __test = new ElementResolverTest(); | 4065 final __test = new ElementResolverTest(); |
| 3833 runJUnitTest(__test, __test.test_visitContinueStatement_withoutLabel); | 4066 runJUnitTest(__test, __test.test_visitContinueStatement_withoutLabel); |
| 3834 }); | 4067 }); |
| 3835 _ut.test('test_visitExportDirective_noCombinators', () { | 4068 _ut.test('test_visitExportDirective_noCombinators', () { |
| 3836 final __test = new ElementResolverTest(); | 4069 final __test = new ElementResolverTest(); |
| 3837 runJUnitTest(__test, __test.test_visitExportDirective_noCombinators); | 4070 runJUnitTest(__test, __test.test_visitExportDirective_noCombinators); |
| 3838 }); | 4071 }); |
| 4072 _ut.test('test_visitFieldFormalParameter', () { |
| 4073 final __test = new ElementResolverTest(); |
| 4074 runJUnitTest(__test, __test.test_visitFieldFormalParameter); |
| 4075 }); |
| 3839 _ut.test('test_visitImportDirective_noCombinators_noPrefix', () { | 4076 _ut.test('test_visitImportDirective_noCombinators_noPrefix', () { |
| 3840 final __test = new ElementResolverTest(); | 4077 final __test = new ElementResolverTest(); |
| 3841 runJUnitTest(__test, __test.test_visitImportDirective_noCombinators_noPr
efix); | 4078 runJUnitTest(__test, __test.test_visitImportDirective_noCombinators_noPr
efix); |
| 3842 }); | 4079 }); |
| 3843 _ut.test('test_visitImportDirective_noCombinators_prefix', () { | 4080 _ut.test('test_visitImportDirective_noCombinators_prefix', () { |
| 3844 final __test = new ElementResolverTest(); | 4081 final __test = new ElementResolverTest(); |
| 3845 runJUnitTest(__test, __test.test_visitImportDirective_noCombinators_pref
ix); | 4082 runJUnitTest(__test, __test.test_visitImportDirective_noCombinators_pref
ix); |
| 3846 }); | 4083 }); |
| 3847 _ut.test('test_visitIndexExpression_get', () { | 4084 _ut.test('test_visitIndexExpression_get', () { |
| 3848 final __test = new ElementResolverTest(); | 4085 final __test = new ElementResolverTest(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 }); | 4245 }); |
| 4009 _ut.test('test_getType_noScope', () { | 4246 _ut.test('test_getType_noScope', () { |
| 4010 final __test = new TypeOverrideManagerTest(); | 4247 final __test = new TypeOverrideManagerTest(); |
| 4011 runJUnitTest(__test, __test.test_getType_noScope); | 4248 runJUnitTest(__test, __test.test_getType_noScope); |
| 4012 }); | 4249 }); |
| 4013 }); | 4250 }); |
| 4014 } | 4251 } |
| 4015 } | 4252 } |
| 4016 class StaticWarningCodeTest extends ResolverTestCase { | 4253 class StaticWarningCodeTest extends ResolverTestCase { |
| 4017 void fail_argumentTypeNotAssignable() { | 4254 void fail_argumentTypeNotAssignable() { |
| 4018 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4255 Source source = addSource(EngineTestCase.createSource([])); |
| 4019 resolve(source, []); | 4256 resolve(source, []); |
| 4020 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 4257 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 4021 verify([source]); | 4258 verify([source]); |
| 4022 } | 4259 } |
| 4023 void fail_assignmentToFinal() { | 4260 void fail_assignmentToFinal() { |
| 4024 Source source = addSource("/test.dart", EngineTestCase.createSource(["final
x = 0;", "f() { x = 1; }"])); | 4261 Source source = addSource(EngineTestCase.createSource(["final x = 0;", "f()
{ x = 1; }"])); |
| 4025 resolve(source, []); | 4262 resolve(source, []); |
| 4026 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 4263 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 4027 verify([source]); | 4264 verify([source]); |
| 4028 } | 4265 } |
| 4029 void fail_caseBlockNotTerminated() { | 4266 void fail_caseBlockNotTerminated() { |
| 4030 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p) {", " switch (p) {", " case 0:", " f(p);", " case 1:", " bre
ak;", " }", "}"])); | 4267 Source source = addSource(EngineTestCase.createSource(["f(int p) {", " swit
ch (p) {", " case 0:", " f(p);", " case 1:", " break;", " }", "
}"])); |
| 4031 resolve(source, []); | 4268 resolve(source, []); |
| 4032 assertErrors([StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]); | 4269 assertErrors([StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]); |
| 4033 verify([source]); | 4270 verify([source]); |
| 4034 } | 4271 } |
| 4035 void fail_castToNonType() { | 4272 void fail_castToNonType() { |
| 4036 Source source = addSource("/test.dart", EngineTestCase.createSource(["var A
= 0;", "f(String s) { var x = s as A; }"])); | 4273 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(Stri
ng s) { var x = s as A; }"])); |
| 4037 resolve(source, []); | 4274 resolve(source, []); |
| 4038 assertErrors([StaticWarningCode.CAST_TO_NON_TYPE]); | 4275 assertErrors([StaticWarningCode.CAST_TO_NON_TYPE]); |
| 4039 verify([source]); | 4276 verify([source]); |
| 4040 } | 4277 } |
| 4041 void fail_commentReferenceConstructorNotVisible() { | 4278 void fail_commentReferenceConstructorNotVisible() { |
| 4042 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4279 Source source = addSource(EngineTestCase.createSource([])); |
| 4043 resolve(source, []); | 4280 resolve(source, []); |
| 4044 assertErrors([StaticWarningCode.COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE]); | 4281 assertErrors([StaticWarningCode.COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE]); |
| 4045 verify([source]); | 4282 verify([source]); |
| 4046 } | 4283 } |
| 4047 void fail_commentReferenceIdentifierNotVisible() { | 4284 void fail_commentReferenceIdentifierNotVisible() { |
| 4048 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4285 Source source = addSource(EngineTestCase.createSource([])); |
| 4049 resolve(source, []); | 4286 resolve(source, []); |
| 4050 assertErrors([StaticWarningCode.COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE]); | 4287 assertErrors([StaticWarningCode.COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE]); |
| 4051 verify([source]); | 4288 verify([source]); |
| 4052 } | 4289 } |
| 4053 void fail_commentReferenceUndeclaredConstructor() { | 4290 void fail_commentReferenceUndeclaredConstructor() { |
| 4054 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4291 Source source = addSource(EngineTestCase.createSource([])); |
| 4055 resolve(source, []); | 4292 resolve(source, []); |
| 4056 assertErrors([StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR]); | 4293 assertErrors([StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR]); |
| 4057 verify([source]); | 4294 verify([source]); |
| 4058 } | 4295 } |
| 4059 void fail_commentReferenceUndeclaredIdentifier() { | 4296 void fail_commentReferenceUndeclaredIdentifier() { |
| 4060 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4297 Source source = addSource(EngineTestCase.createSource([])); |
| 4061 resolve(source, []); | 4298 resolve(source, []); |
| 4062 assertErrors([StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_IDENTIFIER]); | 4299 assertErrors([StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_IDENTIFIER]); |
| 4063 verify([source]); | 4300 verify([source]); |
| 4064 } | 4301 } |
| 4065 void fail_commentReferenceUriNotLibrary() { | 4302 void fail_commentReferenceUriNotLibrary() { |
| 4066 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4303 Source source = addSource(EngineTestCase.createSource([])); |
| 4067 resolve(source, []); | 4304 resolve(source, []); |
| 4068 assertErrors([StaticWarningCode.COMMENT_REFERENCE_URI_NOT_LIBRARY]); | 4305 assertErrors([StaticWarningCode.COMMENT_REFERENCE_URI_NOT_LIBRARY]); |
| 4069 verify([source]); | 4306 verify([source]); |
| 4070 } | 4307 } |
| 4071 void fail_concreteClassWithAbstractMember() { | 4308 void fail_conflictingInstanceGetterAndSuperclassMember() { |
| 4072 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m();", "}"])); | 4309 Source source = addSource(EngineTestCase.createSource([])); |
| 4310 resolve(source, []); |
| 4311 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); |
| 4312 verify([source]); |
| 4313 } |
| 4314 void fail_conflictingInstanceSetterAndSuperclassMember() { |
| 4315 Source source = addSource(EngineTestCase.createSource([])); |
| 4316 resolve(source, []); |
| 4317 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_M
EMBER]); |
| 4318 verify([source]); |
| 4319 } |
| 4320 void fail_conflictingStaticGetterAndInstanceSetter() { |
| 4321 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c get x -> 0;", " set x(int p) {}", "}"])); |
| 4322 resolve(source, []); |
| 4323 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); |
| 4324 verify([source]); |
| 4325 } |
| 4326 void fail_conflictingStaticSetterAndInstanceGetter() { |
| 4327 Source source = addSource(EngineTestCase.createSource(["class A {", " get x
-> 0;", " static set x(int p) {}", "}"])); |
| 4328 resolve(source, []); |
| 4329 assertErrors([StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_GETTE
R]); |
| 4330 verify([source]); |
| 4331 } |
| 4332 void fail_incorrectNumberOfArguments_tooFew() { |
| 4333 Source source = addSource(EngineTestCase.createSource(["f(a, b) -> 0;", "g()
{", " f(2);", "}"])); |
| 4334 resolve(source, []); |
| 4335 assertErrors([StaticWarningCode.INCORRECT_NUMBER_OF_ARGUMENTS]); |
| 4336 verify([source]); |
| 4337 } |
| 4338 void fail_incorrectNumberOfArguments_tooMany() { |
| 4339 Source source = addSource(EngineTestCase.createSource(["f(a, b) -> 0;", "g()
{", " f(2, 3, 4);", "}"])); |
| 4340 resolve(source, []); |
| 4341 assertErrors([StaticWarningCode.INCORRECT_NUMBER_OF_ARGUMENTS]); |
| 4342 verify([source]); |
| 4343 } |
| 4344 void fail_instanceMethodNameCollidesWithSuperclassStatic() { |
| 4345 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c n", "}", "class C extends A {", " void n() {}", "}"])); |
| 4346 resolve(source, []); |
| 4347 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 4348 verify([source]); |
| 4349 } |
| 4350 void fail_invalidFactoryName() { |
| 4351 Source source = addSource(EngineTestCase.createSource([])); |
| 4352 resolve(source, []); |
| 4353 assertErrors([StaticWarningCode.INVALID_FACTORY_NAME]); |
| 4354 verify([source]); |
| 4355 } |
| 4356 void fail_invalidOverrideGetterType() { |
| 4357 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et g -> 0", "}", "class B extends A {", " String get g { return 'a'; }", "}"]))
; |
| 4358 resolve(source, []); |
| 4359 assertErrors([StaticWarningCode.INVALID_OVERRIDE_GETTER_TYPE]); |
| 4360 verify([source]); |
| 4361 } |
| 4362 void fail_invalidOverrideReturnType() { |
| 4363 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() { return 0; }", "}", "class B extends A {", " String m() { return 'a'; }", "
}"])); |
| 4364 resolve(source, []); |
| 4365 assertErrors([StaticWarningCode.INVALID_OVERRIDE_RETURN_TYPE]); |
| 4366 verify([source]); |
| 4367 } |
| 4368 void fail_invalidOverrideSetterReturnType() { |
| 4369 Source source = addSource(EngineTestCase.createSource(["class A {", " void
set s(int v) {}", "}", "class B extends A {", " void set s(String v) {}", "}"])
); |
| 4370 resolve(source, []); |
| 4371 assertErrors([StaticWarningCode.INVALID_OVERRIDE_SETTER_RETURN_TYPE]); |
| 4372 verify([source]); |
| 4373 } |
| 4374 void fail_invocationOfNonFunction() { |
| 4375 Source source = addSource(EngineTestCase.createSource([])); |
| 4376 resolve(source, []); |
| 4377 assertErrors([StaticWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 4378 verify([source]); |
| 4379 } |
| 4380 void fail_mismatchedGetterAndSetterTypes() { |
| 4381 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et g { return 0; }", " set g(String v) {}", "}"])); |
| 4382 resolve(source, []); |
| 4383 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); |
| 4384 verify([source]); |
| 4385 } |
| 4386 void fail_newWithNonType() { |
| 4387 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "void f
() {", " A a = new A();", "}"])); |
| 4388 resolve(source, []); |
| 4389 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); |
| 4390 verify([source]); |
| 4391 } |
| 4392 void fail_newWithUndefinedConstructor() { |
| 4393 Source source = addSource(EngineTestCase.createSource(["class A {", " A(int
p) {}", "}", "A f() {", " return new A();", "}"])); |
| 4394 resolve(source, []); |
| 4395 assertErrors([StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR]); |
| 4396 verify([source]); |
| 4397 } |
| 4398 void fail_nonAbstractClassInheritsAbstractMember() { |
| 4399 Source source = addSource(EngineTestCase.createSource(["class I {", " m(p)
{}", "}", "class C implements I {", "}"])); |
| 4400 resolve(source, []); |
| 4401 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER]
); |
| 4402 verify([source]); |
| 4403 } |
| 4404 void fail_nonAbstractClassInheritsAbstractMethod() { |
| 4405 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m(p);", "}", "class C extends A {", "}"])); |
| 4406 resolve(source, []); |
| 4407 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_METHOD]
); |
| 4408 verify([source]); |
| 4409 } |
| 4410 void fail_nonType() { |
| 4411 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(var
p) {", " if (p is A) {", " }", "}"])); |
| 4412 resolve(source, []); |
| 4413 assertErrors([StaticWarningCode.NON_TYPE]); |
| 4414 verify([source]); |
| 4415 } |
| 4416 void fail_nonTypeInCatchClause() { |
| 4417 Source source = addSource(EngineTestCase.createSource(["var T = 0;", "f(var
p) {", " try {", " } on T catch e {", " }", "}"])); |
| 4418 resolve(source, []); |
| 4419 assertErrors([StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); |
| 4420 verify([source]); |
| 4421 } |
| 4422 void fail_nonVoidReturnForOperator() { |
| 4423 Source source = addSource(EngineTestCase.createSource(["class A {", " int o
perator []=() {}", "}"])); |
| 4424 resolve(source, []); |
| 4425 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR]); |
| 4426 verify([source]); |
| 4427 } |
| 4428 void fail_nonVoidReturnForSetter() { |
| 4429 Source source = addSource(EngineTestCase.createSource(["int set x(int v) {",
" var s = x;", " x = v;", " return s;", "}"])); |
| 4430 resolve(source, []); |
| 4431 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); |
| 4432 verify([source]); |
| 4433 } |
| 4434 void fail_overrideNotSubtype() { |
| 4435 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() {}", "}", "class B extends A {", " String m() {}", "}"])); |
| 4436 resolve(source, []); |
| 4437 assertErrors([StaticWarningCode.OVERRIDE_NOT_SUBTYPE]); |
| 4438 verify([source]); |
| 4439 } |
| 4440 void fail_overrideWithDifferentDefault() { |
| 4441 Source source = addSource(EngineTestCase.createSource(["class A {", " m([in
t p = 0]) {}", "}", "class B extends A {", " m([int p = 1]) {}", "}"])); |
| 4442 resolve(source, []); |
| 4443 assertErrors([StaticWarningCode.OVERRIDE_WITH_DIFFERENT_DEFAULT]); |
| 4444 verify([source]); |
| 4445 } |
| 4446 void fail_redirectToInvalidReturnType() { |
| 4447 Source source = addSource(EngineTestCase.createSource([])); |
| 4448 resolve(source, []); |
| 4449 assertErrors([StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE]); |
| 4450 verify([source]); |
| 4451 } |
| 4452 void fail_redirectToMissingConstructor() { |
| 4453 Source source = addSource(EngineTestCase.createSource([])); |
| 4454 resolve(source, []); |
| 4455 assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); |
| 4456 verify([source]); |
| 4457 } |
| 4458 void fail_redirectToNonClass() { |
| 4459 Source source = addSource(EngineTestCase.createSource([])); |
| 4460 resolve(source, []); |
| 4461 assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]); |
| 4462 verify([source]); |
| 4463 } |
| 4464 void fail_switchExpressionNotAssignable() { |
| 4465 Source source = addSource(EngineTestCase.createSource(["f(int p) {", " swit
ch (p) {", " case 'a': break;", " }", "}"])); |
| 4466 resolve(source, []); |
| 4467 assertErrors([StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]); |
| 4468 verify([source]); |
| 4469 } |
| 4470 void fail_undefinedGetter() { |
| 4471 Source source = addSource(EngineTestCase.createSource([])); |
| 4472 resolve(source, []); |
| 4473 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); |
| 4474 verify([source]); |
| 4475 } |
| 4476 void fail_undefinedIdentifier_function() { |
| 4477 Source source = addSource(EngineTestCase.createSource(["int a() -> b;"])); |
| 4478 resolve(source, []); |
| 4479 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 4480 verify([source]); |
| 4481 } |
| 4482 void fail_undefinedSetter() { |
| 4483 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " C.m = 0;", "}"])); |
| 4484 resolve(source, []); |
| 4485 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); |
| 4486 verify([source]); |
| 4487 } |
| 4488 void fail_undefinedStaticMethodOrGetter_getter() { |
| 4489 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m);", "}"])); |
| 4490 resolve(source, []); |
| 4491 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 4492 verify([source]); |
| 4493 } |
| 4494 void fail_undefinedStaticMethodOrGetter_method() { |
| 4495 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m());", "}"])); |
| 4496 resolve(source, []); |
| 4497 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 4498 verify([source]); |
| 4499 } |
| 4500 void test_concreteClassWithAbstractMember() { |
| 4501 Source source = addSource(EngineTestCase.createSource(["class A {", " m();"
, "}"])); |
| 4073 resolve(source, []); | 4502 resolve(source, []); |
| 4074 assertErrors([StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER]); | 4503 assertErrors([StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER]); |
| 4075 verify([source]); | 4504 verify([source]); |
| 4076 } | 4505 } |
| 4077 void fail_conflictingInstanceGetterAndSuperclassMember() { | 4506 void test_constWithAbstractClass() { |
| 4078 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4507 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" const A() {}", "}", "void f() {", " A a = const A();", "}"])); |
| 4079 resolve(source, []); | 4508 resolve(source, []); |
| 4080 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); | 4509 assertErrors([StaticWarningCode.CONST_WITH_ABSTRACT_CLASS]); |
| 4081 verify([source]); | 4510 verify([source]); |
| 4082 } | 4511 } |
| 4083 void fail_conflictingInstanceSetterAndSuperclassMember() { | 4512 void test_equalKeysInMap() { |
| 4084 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4513 Source source = addSource(EngineTestCase.createSource(["var m = {'a' : 0, 'b
' : 1, 'a' : 2};"])); |
| 4085 resolve(source, []); | 4514 resolve(source, []); |
| 4086 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_M
EMBER]); | 4515 assertErrors([StaticWarningCode.EQUAL_KEYS_IN_MAP]); |
| 4087 verify([source]); | 4516 verify([source]); |
| 4088 } | 4517 } |
| 4089 void fail_conflictingStaticGetterAndInstanceSetter() { | 4518 void test_fieldInitializerWithInvalidType() { |
| 4090 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static get x -> 0;", " set x(int p) {}", "}"])); | 4519 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(String this.x) {}", "}"])); |
| 4091 resolve(source, []); | |
| 4092 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); | |
| 4093 verify([source]); | |
| 4094 } | |
| 4095 void fail_conflictingStaticSetterAndInstanceGetter() { | |
| 4096 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " get x -> 0;", " static set x(int p) {}", "}"])); | |
| 4097 resolve(source, []); | |
| 4098 assertErrors([StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_GETTE
R]); | |
| 4099 verify([source]); | |
| 4100 } | |
| 4101 void fail_fieldInitializerWithInvalidType() { | |
| 4102 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A(String this.x) {}", "}"])); | |
| 4103 resolve(source, []); | 4520 resolve(source, []); |
| 4104 assertErrors([StaticWarningCode.FIELD_INITIALIZER_WITH_INVALID_TYPE]); | 4521 assertErrors([StaticWarningCode.FIELD_INITIALIZER_WITH_INVALID_TYPE]); |
| 4105 verify([source]); | 4522 verify([source]); |
| 4106 } | 4523 } |
| 4107 void fail_incorrectNumberOfArguments_tooFew() { | 4524 void test_newWithAbstractClass() { |
| 4108 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a, b
) -> 0;", "g() {", " f(2);", "}"])); | 4525 Source source = addSource(EngineTestCase.createSource(["abstract class A {}"
, "void f() {", " A a = new A();", "}"])); |
| 4109 resolve(source, []); | 4526 resolve(source, []); |
| 4110 assertErrors([StaticWarningCode.INCORRECT_NUMBER_OF_ARGUMENTS]); | 4527 assertErrors([StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); |
| 4111 verify([source]); | 4528 verify([source]); |
| 4112 } | 4529 } |
| 4113 void fail_incorrectNumberOfArguments_tooMany() { | 4530 void test_partOfDifferentLibrary() { |
| 4114 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a, b
) -> 0;", "g() {", " f(2, 3, 4);", "}"])); | 4531 Source source = addSource(EngineTestCase.createSource(["library lib;", "part
'part.dart';"])); |
| 4115 resolve(source, []); | 4532 addSource2("/part.dart", EngineTestCase.createSource(["part of lub;"])); |
| 4116 assertErrors([StaticWarningCode.INCORRECT_NUMBER_OF_ARGUMENTS]); | 4533 resolve(source, []); |
| 4117 verify([source]); | 4534 assertErrors([StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]); |
| 4118 } | 4535 verify([source]); |
| 4119 void fail_instanceMethodNameCollidesWithSuperclassStatic() { | 4536 } |
| 4120 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static n", "}", "class C extends A {", " void n() {}", "}"])); | 4537 void test_returnWithoutValue() { |
| 4121 resolve(source, []); | 4538 Source source = addSource(EngineTestCase.createSource(["int f() { return; }"
])); |
| 4122 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | |
| 4123 verify([source]); | |
| 4124 } | |
| 4125 void fail_invalidFactoryName() { | |
| 4126 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | |
| 4127 resolve(source, []); | |
| 4128 assertErrors([StaticWarningCode.INVALID_FACTORY_NAME]); | |
| 4129 verify([source]); | |
| 4130 } | |
| 4131 void fail_invalidOverrideGetterType() { | |
| 4132 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int get g -> 0", "}", "class B extends A {", " String get g { return '
a'; }", "}"])); | |
| 4133 resolve(source, []); | |
| 4134 assertErrors([StaticWarningCode.INVALID_OVERRIDE_GETTER_TYPE]); | |
| 4135 verify([source]); | |
| 4136 } | |
| 4137 void fail_invalidOverrideReturnType() { | |
| 4138 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int m() { return 0; }", "}", "class B extends A {", " String m() { ret
urn 'a'; }", "}"])); | |
| 4139 resolve(source, []); | |
| 4140 assertErrors([StaticWarningCode.INVALID_OVERRIDE_RETURN_TYPE]); | |
| 4141 verify([source]); | |
| 4142 } | |
| 4143 void fail_invalidOverrideSetterReturnType() { | |
| 4144 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void set s(int v) {}", "}", "class B extends A {", " void set s(String
v) {}", "}"])); | |
| 4145 resolve(source, []); | |
| 4146 assertErrors([StaticWarningCode.INVALID_OVERRIDE_SETTER_RETURN_TYPE]); | |
| 4147 verify([source]); | |
| 4148 } | |
| 4149 void fail_invocationOfNonFunction() { | |
| 4150 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | |
| 4151 resolve(source, []); | |
| 4152 assertErrors([StaticWarningCode.INVOCATION_OF_NON_FUNCTION]); | |
| 4153 verify([source]); | |
| 4154 } | |
| 4155 void fail_mismatchedGetterAndSetterTypes() { | |
| 4156 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int get g { return 0; }", " set g(String v) {}", "}"])); | |
| 4157 resolve(source, []); | |
| 4158 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); | |
| 4159 verify([source]); | |
| 4160 } | |
| 4161 void fail_newWithNonType() { | |
| 4162 Source source = addSource("/test.dart", EngineTestCase.createSource(["var A
= 0;", "void f() {", " A a = new A();", "}"])); | |
| 4163 resolve(source, []); | |
| 4164 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); | |
| 4165 verify([source]); | |
| 4166 } | |
| 4167 void fail_newWithUndefinedConstructor() { | |
| 4168 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A(int p) {}", "}", "A f() {", " return new A();", "}"])); | |
| 4169 resolve(source, []); | |
| 4170 assertErrors([StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR]); | |
| 4171 verify([source]); | |
| 4172 } | |
| 4173 void fail_nonAbstractClassInheritsAbstractMember() { | |
| 4174 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
I {", " m(p) {}", "}", "class C implements I {", "}"])); | |
| 4175 resolve(source, []); | |
| 4176 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER]
); | |
| 4177 verify([source]); | |
| 4178 } | |
| 4179 void fail_nonAbstractClassInheritsAbstractMethod() { | |
| 4180 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class A {", " m(p);", "}", "class C extends A {", "}"])); | |
| 4181 resolve(source, []); | |
| 4182 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_METHOD]
); | |
| 4183 verify([source]); | |
| 4184 } | |
| 4185 void fail_nonType() { | |
| 4186 Source source = addSource("/test.dart", EngineTestCase.createSource(["var A
= 0;", "f(var p) {", " if (p is A) {", " }", "}"])); | |
| 4187 resolve(source, []); | |
| 4188 assertErrors([StaticWarningCode.NON_TYPE]); | |
| 4189 verify([source]); | |
| 4190 } | |
| 4191 void fail_nonTypeInCatchClause() { | |
| 4192 Source source = addSource("/test.dart", EngineTestCase.createSource(["var T
= 0;", "f(var p) {", " try {", " } on T catch e {", " }", "}"])); | |
| 4193 resolve(source, []); | |
| 4194 assertErrors([StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); | |
| 4195 verify([source]); | |
| 4196 } | |
| 4197 void fail_nonVoidReturnForOperator() { | |
| 4198 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int operator []=() {}", "}"])); | |
| 4199 resolve(source, []); | |
| 4200 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR]); | |
| 4201 verify([source]); | |
| 4202 } | |
| 4203 void fail_nonVoidReturnForSetter() { | |
| 4204 Source source = addSource("/test.dart", EngineTestCase.createSource(["int se
t x(int v) {", " var s = x;", " x = v;", " return s;", "}"])); | |
| 4205 resolve(source, []); | |
| 4206 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); | |
| 4207 verify([source]); | |
| 4208 } | |
| 4209 void fail_overrideNotSubtype() { | |
| 4210 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int m() {}", "}", "class B extends A {", " String m() {}", "}"])); | |
| 4211 resolve(source, []); | |
| 4212 assertErrors([StaticWarningCode.OVERRIDE_NOT_SUBTYPE]); | |
| 4213 verify([source]); | |
| 4214 } | |
| 4215 void fail_overrideWithDifferentDefault() { | |
| 4216 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " m([int p = 0]) {}", "}", "class B extends A {", " m([int p = 1]) {}",
"}"])); | |
| 4217 resolve(source, []); | |
| 4218 assertErrors([StaticWarningCode.OVERRIDE_WITH_DIFFERENT_DEFAULT]); | |
| 4219 verify([source]); | |
| 4220 } | |
| 4221 void fail_redirectToInvalidReturnType() { | |
| 4222 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | |
| 4223 resolve(source, []); | |
| 4224 assertErrors([StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE]); | |
| 4225 verify([source]); | |
| 4226 } | |
| 4227 void fail_redirectToMissingConstructor() { | |
| 4228 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | |
| 4229 resolve(source, []); | |
| 4230 assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); | |
| 4231 verify([source]); | |
| 4232 } | |
| 4233 void fail_redirectToNonClass() { | |
| 4234 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | |
| 4235 resolve(source, []); | |
| 4236 assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]); | |
| 4237 verify([source]); | |
| 4238 } | |
| 4239 void fail_returnWithoutValue() { | |
| 4240 Source source = addSource("/test.dart", EngineTestCase.createSource(["int f(
) { return; }"])); | |
| 4241 resolve(source, []); | 4539 resolve(source, []); |
| 4242 assertErrors([StaticWarningCode.RETURN_WITHOUT_VALUE]); | 4540 assertErrors([StaticWarningCode.RETURN_WITHOUT_VALUE]); |
| 4243 verify([source]); | 4541 verify([source]); |
| 4244 } | 4542 } |
| 4245 void fail_switchExpressionNotAssignable() { | 4543 void test_undefinedClass_instanceCreation() { |
| 4246 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p) {", " switch (p) {", " case 'a': break;", " }", "}"])); | 4544 Source source = addSource(EngineTestCase.createSource(["f() { new C(); }"]))
; |
| 4247 resolve(source, []); | 4545 resolve(source, []); |
| 4248 assertErrors([StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]); | 4546 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); |
| 4249 verify([source]); | 4547 } |
| 4250 } | 4548 void test_undefinedClass_variableDeclaration() { |
| 4251 void fail_undefinedGetter() { | 4549 Source source = addSource(EngineTestCase.createSource(["f() { C c; }"])); |
| 4252 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 4550 resolve(source, []); |
| 4253 resolve(source, []); | 4551 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); |
| 4254 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); | 4552 } |
| 4255 verify([source]); | 4553 void test_undefinedClassBoolean_variableDeclaration() { |
| 4256 } | 4554 Source source = addSource(EngineTestCase.createSource(["f() { boolean v; }"]
)); |
| 4257 void fail_undefinedIdentifier_function() { | 4555 resolve(source, []); |
| 4258 Source source = addSource("/test.dart", EngineTestCase.createSource(["int a(
) -> b;"])); | 4556 assertErrors([StaticWarningCode.UNDEFINED_CLASS_BOOLEAN]); |
| 4557 } |
| 4558 void test_undefinedIdentifier_commentReference() { |
| 4559 Source source = addSource(EngineTestCase.createSource(["/** [m] xxx [new B.c
] */", "class A {", "}"])); |
| 4560 resolve(source, []); |
| 4561 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER, StaticWarningCode.UNDE
FINED_IDENTIFIER]); |
| 4562 } |
| 4563 void test_undefinedIdentifier_initializer() { |
| 4564 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); |
| 4259 resolve(source, []); | 4565 resolve(source, []); |
| 4260 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 4566 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 4261 verify([source]); | 4567 } |
| 4262 } | 4568 void test_undefinedIdentifier_metadata() { |
| 4263 void fail_undefinedSetter() { | 4569 Source source = addSource(EngineTestCase.createSource(["@undefined class A {
}"])); |
| 4264 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " C.m = 0;", "}"])); | |
| 4265 resolve(source, []); | |
| 4266 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); | |
| 4267 verify([source]); | |
| 4268 } | |
| 4269 void fail_undefinedStaticMethodOrGetter_getter() { | |
| 4270 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " f(C.m);", "}"])); | |
| 4271 resolve(source, []); | |
| 4272 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | |
| 4273 verify([source]); | |
| 4274 } | |
| 4275 void fail_undefinedStaticMethodOrGetter_method() { | |
| 4276 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " f(C.m());", "}"])); | |
| 4277 resolve(source, []); | |
| 4278 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | |
| 4279 verify([source]); | |
| 4280 } | |
| 4281 void test_constWithAbstractClass() { | |
| 4282 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class A {", " const A() {}", "}", "void f() {", " A a = const A();", "}"]))
; | |
| 4283 resolve(source, []); | |
| 4284 assertErrors([StaticWarningCode.CONST_WITH_ABSTRACT_CLASS]); | |
| 4285 verify([source]); | |
| 4286 } | |
| 4287 void test_equalKeysInMap() { | |
| 4288 Source source = addSource("/test.dart", EngineTestCase.createSource(["var m
= {'a' : 0, 'b' : 1, 'a' : 2};"])); | |
| 4289 resolve(source, []); | |
| 4290 assertErrors([StaticWarningCode.EQUAL_KEYS_IN_MAP]); | |
| 4291 verify([source]); | |
| 4292 } | |
| 4293 void test_newWithAbstractClass() { | |
| 4294 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class A {}", "void f() {", " A a = new A();", "}"])); | |
| 4295 resolve(source, []); | |
| 4296 assertErrors([StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); | |
| 4297 verify([source]); | |
| 4298 } | |
| 4299 void test_partOfDifferentLibrary() { | |
| 4300 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y lib;", "part 'part.dart';"])); | |
| 4301 addSource("/part.dart", EngineTestCase.createSource(["part of lub;"])); | |
| 4302 resolve(source, []); | |
| 4303 assertErrors([StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]); | |
| 4304 verify([source]); | |
| 4305 } | |
| 4306 void test_undefinedClass_instanceCreation() { | |
| 4307 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
new C(); }"])); | |
| 4308 resolve(source, []); | |
| 4309 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); | |
| 4310 } | |
| 4311 void test_undefinedClass_variableDeclaration() { | |
| 4312 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
C c; }"])); | |
| 4313 resolve(source, []); | |
| 4314 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); | |
| 4315 } | |
| 4316 void test_undefinedIdentifier_initializer() { | |
| 4317 Source source = addSource("/test.dart", EngineTestCase.createSource(["var a
= b;"])); | |
| 4318 resolve(source, []); | 4570 resolve(source, []); |
| 4319 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 4571 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 4320 } | 4572 } |
| 4321 void test_undefinedIdentifier_methodInvocation() { | 4573 void test_undefinedIdentifier_methodInvocation() { |
| 4322 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {
C.m(); }"])); | 4574 Source source = addSource(EngineTestCase.createSource(["f() { C.m(); }"])); |
| 4323 resolve(source, []); | 4575 resolve(source, []); |
| 4324 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 4576 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 4325 } | 4577 } |
| 4326 static dartSuite() { | 4578 static dartSuite() { |
| 4327 _ut.group('StaticWarningCodeTest', () { | 4579 _ut.group('StaticWarningCodeTest', () { |
| 4580 _ut.test('test_concreteClassWithAbstractMember', () { |
| 4581 final __test = new StaticWarningCodeTest(); |
| 4582 runJUnitTest(__test, __test.test_concreteClassWithAbstractMember); |
| 4583 }); |
| 4328 _ut.test('test_constWithAbstractClass', () { | 4584 _ut.test('test_constWithAbstractClass', () { |
| 4329 final __test = new StaticWarningCodeTest(); | 4585 final __test = new StaticWarningCodeTest(); |
| 4330 runJUnitTest(__test, __test.test_constWithAbstractClass); | 4586 runJUnitTest(__test, __test.test_constWithAbstractClass); |
| 4331 }); | 4587 }); |
| 4332 _ut.test('test_equalKeysInMap', () { | 4588 _ut.test('test_equalKeysInMap', () { |
| 4333 final __test = new StaticWarningCodeTest(); | 4589 final __test = new StaticWarningCodeTest(); |
| 4334 runJUnitTest(__test, __test.test_equalKeysInMap); | 4590 runJUnitTest(__test, __test.test_equalKeysInMap); |
| 4335 }); | 4591 }); |
| 4592 _ut.test('test_fieldInitializerWithInvalidType', () { |
| 4593 final __test = new StaticWarningCodeTest(); |
| 4594 runJUnitTest(__test, __test.test_fieldInitializerWithInvalidType); |
| 4595 }); |
| 4336 _ut.test('test_newWithAbstractClass', () { | 4596 _ut.test('test_newWithAbstractClass', () { |
| 4337 final __test = new StaticWarningCodeTest(); | 4597 final __test = new StaticWarningCodeTest(); |
| 4338 runJUnitTest(__test, __test.test_newWithAbstractClass); | 4598 runJUnitTest(__test, __test.test_newWithAbstractClass); |
| 4339 }); | 4599 }); |
| 4340 _ut.test('test_partOfDifferentLibrary', () { | 4600 _ut.test('test_partOfDifferentLibrary', () { |
| 4341 final __test = new StaticWarningCodeTest(); | 4601 final __test = new StaticWarningCodeTest(); |
| 4342 runJUnitTest(__test, __test.test_partOfDifferentLibrary); | 4602 runJUnitTest(__test, __test.test_partOfDifferentLibrary); |
| 4343 }); | 4603 }); |
| 4604 _ut.test('test_returnWithoutValue', () { |
| 4605 final __test = new StaticWarningCodeTest(); |
| 4606 runJUnitTest(__test, __test.test_returnWithoutValue); |
| 4607 }); |
| 4608 _ut.test('test_undefinedClassBoolean_variableDeclaration', () { |
| 4609 final __test = new StaticWarningCodeTest(); |
| 4610 runJUnitTest(__test, __test.test_undefinedClassBoolean_variableDeclarati
on); |
| 4611 }); |
| 4344 _ut.test('test_undefinedClass_instanceCreation', () { | 4612 _ut.test('test_undefinedClass_instanceCreation', () { |
| 4345 final __test = new StaticWarningCodeTest(); | 4613 final __test = new StaticWarningCodeTest(); |
| 4346 runJUnitTest(__test, __test.test_undefinedClass_instanceCreation); | 4614 runJUnitTest(__test, __test.test_undefinedClass_instanceCreation); |
| 4347 }); | 4615 }); |
| 4348 _ut.test('test_undefinedClass_variableDeclaration', () { | 4616 _ut.test('test_undefinedClass_variableDeclaration', () { |
| 4349 final __test = new StaticWarningCodeTest(); | 4617 final __test = new StaticWarningCodeTest(); |
| 4350 runJUnitTest(__test, __test.test_undefinedClass_variableDeclaration); | 4618 runJUnitTest(__test, __test.test_undefinedClass_variableDeclaration); |
| 4351 }); | 4619 }); |
| 4620 _ut.test('test_undefinedIdentifier_commentReference', () { |
| 4621 final __test = new StaticWarningCodeTest(); |
| 4622 runJUnitTest(__test, __test.test_undefinedIdentifier_commentReference); |
| 4623 }); |
| 4352 _ut.test('test_undefinedIdentifier_initializer', () { | 4624 _ut.test('test_undefinedIdentifier_initializer', () { |
| 4353 final __test = new StaticWarningCodeTest(); | 4625 final __test = new StaticWarningCodeTest(); |
| 4354 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); | 4626 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); |
| 4355 }); | 4627 }); |
| 4628 _ut.test('test_undefinedIdentifier_metadata', () { |
| 4629 final __test = new StaticWarningCodeTest(); |
| 4630 runJUnitTest(__test, __test.test_undefinedIdentifier_metadata); |
| 4631 }); |
| 4356 _ut.test('test_undefinedIdentifier_methodInvocation', () { | 4632 _ut.test('test_undefinedIdentifier_methodInvocation', () { |
| 4357 final __test = new StaticWarningCodeTest(); | 4633 final __test = new StaticWarningCodeTest(); |
| 4358 runJUnitTest(__test, __test.test_undefinedIdentifier_methodInvocation); | 4634 runJUnitTest(__test, __test.test_undefinedIdentifier_methodInvocation); |
| 4359 }); | 4635 }); |
| 4360 }); | 4636 }); |
| 4361 } | 4637 } |
| 4362 } | 4638 } |
| 4363 class ErrorResolverTest extends ResolverTestCase { | 4639 class ErrorResolverTest extends ResolverTestCase { |
| 4364 void test_breakLabelOnSwitchMember() { | 4640 void test_breakLabelOnSwitchMember() { |
| 4365 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m(int i) {", " switch (i) {", " l: case 0:", " brea
k;", " case 1:", " break l;", " }", " }", "}"])); | 4641 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m(int i) {", " switch (i) {", " l: case 0:", " break;", " ca
se 1:", " break l;", " }", " }", "}"])); |
| 4366 resolve(source, []); | 4642 resolve(source, []); |
| 4367 assertErrors([ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER]); | 4643 assertErrors([ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER]); |
| 4368 verify([source]); | 4644 verify([source]); |
| 4369 } | 4645 } |
| 4370 void test_continueLabelOnSwitch() { | 4646 void test_continueLabelOnSwitch() { |
| 4371 Source source = addSource("/a.dart", EngineTestCase.createSource(["class A {
", " void m(int i) {", " l: switch (i) {", " case 0:", " continu
e l;", " }", " }", "}"])); | 4647 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m(int i) {", " l: switch (i) {", " case 0:", " continue l;", "
}", " }", "}"])); |
| 4372 resolve(source, []); | 4648 resolve(source, []); |
| 4373 assertErrors([ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH]); | 4649 assertErrors([ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH]); |
| 4374 verify([source]); | 4650 verify([source]); |
| 4375 } | 4651 } |
| 4376 static dartSuite() { | 4652 static dartSuite() { |
| 4377 _ut.group('ErrorResolverTest', () { | 4653 _ut.group('ErrorResolverTest', () { |
| 4378 _ut.test('test_breakLabelOnSwitchMember', () { | 4654 _ut.test('test_breakLabelOnSwitchMember', () { |
| 4379 final __test = new ErrorResolverTest(); | 4655 final __test = new ErrorResolverTest(); |
| 4380 runJUnitTest(__test, __test.test_breakLabelOnSwitchMember); | 4656 runJUnitTest(__test, __test.test_breakLabelOnSwitchMember); |
| 4381 }); | 4657 }); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4409 Type2 _dynamicType; | 4685 Type2 _dynamicType; |
| 4410 /** | 4686 /** |
| 4411 * The type representing the built-in type 'Function'. | 4687 * The type representing the built-in type 'Function'. |
| 4412 */ | 4688 */ |
| 4413 InterfaceType _functionType; | 4689 InterfaceType _functionType; |
| 4414 /** | 4690 /** |
| 4415 * The type representing the built-in type 'int'. | 4691 * The type representing the built-in type 'int'. |
| 4416 */ | 4692 */ |
| 4417 InterfaceType _intType; | 4693 InterfaceType _intType; |
| 4418 /** | 4694 /** |
| 4695 * The type representing the built-in type 'Iterable'. |
| 4696 */ |
| 4697 InterfaceType _iterableType; |
| 4698 /** |
| 4699 * The type representing the built-in type 'Iterator'. |
| 4700 */ |
| 4701 InterfaceType _iteratorType; |
| 4702 /** |
| 4419 * The type representing the built-in type 'List'. | 4703 * The type representing the built-in type 'List'. |
| 4420 */ | 4704 */ |
| 4421 InterfaceType _listType; | 4705 InterfaceType _listType; |
| 4422 /** | 4706 /** |
| 4423 * The type representing the built-in type 'Map'. | 4707 * The type representing the built-in type 'Map'. |
| 4424 */ | 4708 */ |
| 4425 InterfaceType _mapType; | 4709 InterfaceType _mapType; |
| 4426 /** | 4710 /** |
| 4427 * The type representing the built-in type 'num'. | 4711 * The type representing the built-in type 'num'. |
| 4428 */ | 4712 */ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4478 _functionType = ElementFactory.classElement2("Function", []).type; | 4762 _functionType = ElementFactory.classElement2("Function", []).type; |
| 4479 } | 4763 } |
| 4480 return _functionType; | 4764 return _functionType; |
| 4481 } | 4765 } |
| 4482 InterfaceType get intType { | 4766 InterfaceType get intType { |
| 4483 if (_intType == null) { | 4767 if (_intType == null) { |
| 4484 initializeNumericTypes(); | 4768 initializeNumericTypes(); |
| 4485 } | 4769 } |
| 4486 return _intType; | 4770 return _intType; |
| 4487 } | 4771 } |
| 4772 InterfaceType get iterableType { |
| 4773 if (_iterableType == null) { |
| 4774 ClassElementImpl iterableElement = ElementFactory.classElement2("Iterable"
, ["E"]); |
| 4775 _iterableType = iterableElement.type; |
| 4776 Type2 eType = iterableElement.typeVariables[0].type; |
| 4777 iterableElement.accessors = <PropertyAccessorElement> [ElementFactory.gett
erElement("iterator", false, iteratorType.substitute5(<Type2> [eType])), Element
Factory.getterElement("last", false, eType)]; |
| 4778 } |
| 4779 return _iterableType; |
| 4780 } |
| 4781 InterfaceType get iteratorType { |
| 4782 if (_iteratorType == null) { |
| 4783 ClassElementImpl iteratorElement = ElementFactory.classElement2("Iterator"
, ["E"]); |
| 4784 _iteratorType = iteratorElement.type; |
| 4785 Type2 eType = iteratorElement.typeVariables[0].type; |
| 4786 iteratorElement.accessors = <PropertyAccessorElement> [ElementFactory.gett
erElement("current", false, eType)]; |
| 4787 } |
| 4788 return _iteratorType; |
| 4789 } |
| 4488 InterfaceType get listType { | 4790 InterfaceType get listType { |
| 4489 if (_listType == null) { | 4791 if (_listType == null) { |
| 4490 ClassElementImpl listElement = ElementFactory.classElement2("List", ["E"])
; | 4792 ClassElementImpl listElement = ElementFactory.classElement2("List", ["E"])
; |
| 4491 _listType = listElement.type; | 4793 _listType = listElement.type; |
| 4492 Type2 eType = listElement.typeVariables[0].type; | 4794 Type2 eType = listElement.typeVariables[0].type; |
| 4493 listElement.accessors = <PropertyAccessorElement> [ElementFactory.getterEl
ement("last", false, eType)]; | 4795 InterfaceType supertype = iterableType.substitute5(<Type2> [eType]); |
| 4796 listElement.supertype = supertype; |
| 4494 listElement.methods = <MethodElement> [ElementFactory.methodElement("[]",
eType, [_intType]), ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [
_intType, eType])]; | 4797 listElement.methods = <MethodElement> [ElementFactory.methodElement("[]",
eType, [_intType]), ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [
_intType, eType])]; |
| 4495 } | 4798 } |
| 4496 return _listType; | 4799 return _listType; |
| 4497 } | 4800 } |
| 4498 InterfaceType get mapType { | 4801 InterfaceType get mapType { |
| 4499 if (_mapType == null) { | 4802 if (_mapType == null) { |
| 4500 _mapType = ElementFactory.classElement2("Map", ["K", "V"]).type; | 4803 _mapType = ElementFactory.classElement2("Map", ["K", "V"]).type; |
| 4501 } | 4804 } |
| 4502 return _mapType; | 4805 return _mapType; |
| 4503 } | 4806 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4521 InterfaceType get stackTraceType { | 4824 InterfaceType get stackTraceType { |
| 4522 if (_stackTraceType == null) { | 4825 if (_stackTraceType == null) { |
| 4523 _stackTraceType = ElementFactory.classElement2("StackTrace", []).type; | 4826 _stackTraceType = ElementFactory.classElement2("StackTrace", []).type; |
| 4524 } | 4827 } |
| 4525 return _stackTraceType; | 4828 return _stackTraceType; |
| 4526 } | 4829 } |
| 4527 InterfaceType get stringType { | 4830 InterfaceType get stringType { |
| 4528 if (_stringType == null) { | 4831 if (_stringType == null) { |
| 4529 _stringType = ElementFactory.classElement2("String", []).type; | 4832 _stringType = ElementFactory.classElement2("String", []).type; |
| 4530 ClassElementImpl stringElement = _stringType.element as ClassElementImpl; | 4833 ClassElementImpl stringElement = _stringType.element as ClassElementImpl; |
| 4531 stringElement.accessors = <PropertyAccessorElement> [ElementFactory.getter
Element("length", false, intType)]; | 4834 stringElement.accessors = <PropertyAccessorElement> [ElementFactory.getter
Element("isEmpty", false, boolType), ElementFactory.getterElement("length", fals
e, intType)]; |
| 4835 stringElement.methods = <MethodElement> [ElementFactory.methodElement("toL
owerCase", _stringType, []), ElementFactory.methodElement("toUpperCase", _string
Type, [])]; |
| 4532 } | 4836 } |
| 4533 return _stringType; | 4837 return _stringType; |
| 4534 } | 4838 } |
| 4535 InterfaceType get typeType { | 4839 InterfaceType get typeType { |
| 4536 if (_typeType == null) { | 4840 if (_typeType == null) { |
| 4537 _typeType = ElementFactory.classElement2("Type", []).type; | 4841 _typeType = ElementFactory.classElement2("Type", []).type; |
| 4538 } | 4842 } |
| 4539 return _typeType; | 4843 return _typeType; |
| 4540 } | 4844 } |
| 4541 /** | 4845 /** |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4567 /** | 4871 /** |
| 4568 * The class {@code AnalysisContextFactory} defines utility methods used to crea
te analysis contexts | 4872 * The class {@code AnalysisContextFactory} defines utility methods used to crea
te analysis contexts |
| 4569 * for testing purposes. | 4873 * for testing purposes. |
| 4570 */ | 4874 */ |
| 4571 class AnalysisContextFactory { | 4875 class AnalysisContextFactory { |
| 4572 /** | 4876 /** |
| 4573 * Create an analysis context that has a fake core library already resolved. | 4877 * Create an analysis context that has a fake core library already resolved. |
| 4574 * @return the analysis context that was created | 4878 * @return the analysis context that was created |
| 4575 */ | 4879 */ |
| 4576 static AnalysisContextImpl contextWithCore() { | 4880 static AnalysisContextImpl contextWithCore() { |
| 4577 AnalysisContextImpl context = new AnalysisContextImpl(); | 4881 AnalysisContextImpl sdkContext = DirectoryBasedDartSdk.defaultSdk.context as
AnalysisContextImpl; |
| 4578 SourceFactory sourceFactory = new SourceFactory.con2([new DartUriResolver(Di
rectoryBasedDartSdk.defaultSdk), new FileUriResolver()]); | 4882 SourceFactory sourceFactory2 = sdkContext.sourceFactory; |
| 4579 context.sourceFactory = sourceFactory; | |
| 4580 TestTypeProvider provider = new TestTypeProvider(); | 4883 TestTypeProvider provider = new TestTypeProvider(); |
| 4581 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d
art"); | 4884 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d
art"); |
| 4582 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 4885 Source coreSource = sourceFactory2.forUri(DartSdk.DART_CORE); |
| 4886 sdkContext.setContents(coreSource, ""); |
| 4583 coreUnit.source = coreSource; | 4887 coreUnit.source = coreSource; |
| 4584 coreUnit.types = <ClassElement> [provider.boolType.element, provider.doubleT
ype.element, provider.functionType.element, provider.intType.element, provider.l
istType.element, provider.mapType.element, provider.numType.element, provider.ob
jectType.element, provider.stackTraceType.element, provider.stringType.element,
provider.typeType.element]; | 4888 coreUnit.types = <ClassElement> [provider.boolType.element, provider.doubleT
ype.element, provider.functionType.element, provider.intType.element, provider.l
istType.element, provider.mapType.element, provider.numType.element, provider.ob
jectType.element, provider.stackTraceType.element, provider.stringType.element,
provider.typeType.element]; |
| 4585 LibraryElementImpl coreLibrary = new LibraryElementImpl(context, ASTFactory.
libraryIdentifier2(["dart", "core"])); | 4889 LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "core"])); |
| 4586 coreLibrary.definingCompilationUnit = coreUnit; | 4890 coreLibrary.definingCompilationUnit = coreUnit; |
| 4587 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); | 4891 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); |
| 4588 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 4892 Source htmlSource = sourceFactory2.forUri(DartSdk.DART_HTML); |
| 4893 sdkContext.setContents(htmlSource, ""); |
| 4589 htmlUnit.source = htmlSource; | 4894 htmlUnit.source = htmlSource; |
| 4590 ClassElementImpl elementElement = ElementFactory.classElement2("Element", []
); | 4895 ClassElementImpl elementElement = ElementFactory.classElement2("Element", []
); |
| 4591 InterfaceType elementType = elementElement.type; | 4896 InterfaceType elementType = elementElement.type; |
| 4592 ClassElementImpl documentElement = ElementFactory.classElement("Document", e
lementType, []); | 4897 ClassElementImpl documentElement = ElementFactory.classElement("Document", e
lementType, []); |
| 4593 ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocu
ment", documentElement.type, []); | 4898 ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocu
ment", documentElement.type, []); |
| 4594 htmlDocumentElement.methods = <MethodElement> [ElementFactory.methodElement(
"query", elementType, <Type2> [provider.stringType])]; | 4899 htmlDocumentElement.methods = <MethodElement> [ElementFactory.methodElement(
"query", elementType, <Type2> [provider.stringType])]; |
| 4595 htmlUnit.types = <ClassElement> [ElementFactory.classElement("AnchorElement"
, elementType, []), ElementFactory.classElement("BodyElement", elementType, []),
ElementFactory.classElement("ButtonElement", elementType, []), ElementFactory.c
lassElement("DivElement", elementType, []), documentElement, elementElement, htm
lDocumentElement, ElementFactory.classElement("InputElement", elementType, []),
ElementFactory.classElement("SelectElement", elementType, [])]; | 4900 htmlUnit.types = <ClassElement> [ElementFactory.classElement("AnchorElement"
, elementType, []), ElementFactory.classElement("BodyElement", elementType, []),
ElementFactory.classElement("ButtonElement", elementType, []), ElementFactory.c
lassElement("DivElement", elementType, []), documentElement, elementElement, htm
lDocumentElement, ElementFactory.classElement("InputElement", elementType, []),
ElementFactory.classElement("SelectElement", elementType, [])]; |
| 4596 htmlUnit.functions = <FunctionElement> [ElementFactory.functionElement3("que
ry", elementElement, <ClassElement> [provider.stringType.element], ClassElementI
mpl.EMPTY_ARRAY)]; | 4901 htmlUnit.functions = <FunctionElement> [ElementFactory.functionElement3("que
ry", elementElement, <ClassElement> [provider.stringType.element], ClassElementI
mpl.EMPTY_ARRAY)]; |
| 4597 TopLevelVariableElementImpl document = ElementFactory.topLevelVariableElemen
t2("document"); | 4902 TopLevelVariableElementImpl document = ElementFactory.topLevelVariableElemen
t2("document"); |
| 4598 document.type = htmlDocumentElement.type; | 4903 document.type = htmlDocumentElement.type; |
| 4599 htmlUnit.topLevelVariables = <TopLevelVariableElement> [document]; | 4904 htmlUnit.topLevelVariables = <TopLevelVariableElement> [document]; |
| 4600 LibraryElementImpl htmlLibrary = new LibraryElementImpl(context, ASTFactory.
libraryIdentifier2(["dart", "dom", "html"])); | 4905 LibraryElementImpl htmlLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "dom", "html"])); |
| 4601 htmlLibrary.definingCompilationUnit = htmlUnit; | 4906 htmlLibrary.definingCompilationUnit = htmlUnit; |
| 4602 Map<Source, LibraryElement> elementMap = new Map<Source, LibraryElement>(); | 4907 Map<Source, LibraryElement> elementMap = new Map<Source, LibraryElement>(); |
| 4603 elementMap[coreSource] = coreLibrary; | 4908 elementMap[coreSource] = coreLibrary; |
| 4604 elementMap[htmlSource] = htmlLibrary; | 4909 elementMap[htmlSource] = htmlLibrary; |
| 4605 context.setContents(coreSource, ""); | 4910 sdkContext.recordLibraryElements(elementMap); |
| 4606 context.setContents(htmlSource, ""); | 4911 AnalysisContextImpl context = new DelegatingAnalysisContextImpl(); |
| 4607 context.recordLibraryElements(elementMap); | 4912 sourceFactory2 = new SourceFactory.con2([new DartUriResolver(sdkContext.sour
ceFactory.dartSdk), new FileUriResolver()]); |
| 4913 context.sourceFactory = sourceFactory2; |
| 4608 return context; | 4914 return context; |
| 4609 } | 4915 } |
| 4610 /** | 4916 /** |
| 4611 * Prevent the creation of instances of this class. | 4917 * Prevent the creation of instances of this class. |
| 4612 */ | 4918 */ |
| 4613 AnalysisContextFactory() { | 4919 AnalysisContextFactory() { |
| 4614 } | 4920 } |
| 4615 } | 4921 } |
| 4616 class LibraryImportScopeTest extends ResolverTestCase { | 4922 class LibraryImportScopeTest extends ResolverTestCase { |
| 4617 void test_conflictingImports() { | 4923 void test_conflictingImports() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4719 List<ASTNode> _unresolvedNodes = new List<ASTNode>(); | 5025 List<ASTNode> _unresolvedNodes = new List<ASTNode>(); |
| 4720 /** | 5026 /** |
| 4721 * A list containing all of the AST nodes that were resolved to an element of
the wrong type. | 5027 * A list containing all of the AST nodes that were resolved to an element of
the wrong type. |
| 4722 */ | 5028 */ |
| 4723 List<ASTNode> _wrongTypedNodes = new List<ASTNode>(); | 5029 List<ASTNode> _wrongTypedNodes = new List<ASTNode>(); |
| 4724 /** | 5030 /** |
| 4725 * Initialize a newly created verifier to verify that all of the nodes in the
visited AST | 5031 * Initialize a newly created verifier to verify that all of the nodes in the
visited AST |
| 4726 * structures that are expected to have been resolved have an element associat
ed with them. | 5032 * structures that are expected to have been resolved have an element associat
ed with them. |
| 4727 */ | 5033 */ |
| 4728 ResolutionVerifier() { | 5034 ResolutionVerifier() { |
| 4729 _jtd_constructor_349_impl(); | 5035 _jtd_constructor_351_impl(); |
| 4730 } | 5036 } |
| 4731 _jtd_constructor_349_impl() { | 5037 _jtd_constructor_351_impl() { |
| 4732 _jtd_constructor_350_impl(null); | 5038 _jtd_constructor_352_impl(null); |
| 4733 } | 5039 } |
| 4734 /** | 5040 /** |
| 4735 * Initialize a newly created verifier to verify that all of the identifiers i
n the visited AST | 5041 * Initialize a newly created verifier to verify that all of the identifiers i
n the visited AST |
| 4736 * structures that are expected to have been resolved have an element associat
ed with them. Nodes | 5042 * structures that are expected to have been resolved have an element associat
ed with them. Nodes |
| 4737 * in the set of known exceptions are not expected to have been resolved, even
if they normally | 5043 * in the set of known exceptions are not expected to have been resolved, even
if they normally |
| 4738 * would have been expected to have been resolved. | 5044 * would have been expected to have been resolved. |
| 4739 * @param knownExceptions a set containing nodes that are known to not be reso
lvable and should | 5045 * @param knownExceptions a set containing nodes that are known to not be reso
lvable and should |
| 4740 * therefore not cause the test to fail | 5046 * therefore not cause the test to fail |
| 4741 */ | 5047 */ |
| 4742 ResolutionVerifier.con1(Set<ASTNode> knownExceptions2) { | 5048 ResolutionVerifier.con1(Set<ASTNode> knownExceptions2) { |
| 4743 _jtd_constructor_350_impl(knownExceptions2); | 5049 _jtd_constructor_352_impl(knownExceptions2); |
| 4744 } | 5050 } |
| 4745 _jtd_constructor_350_impl(Set<ASTNode> knownExceptions2) { | 5051 _jtd_constructor_352_impl(Set<ASTNode> knownExceptions2) { |
| 4746 this._knownExceptions = knownExceptions2; | 5052 this._knownExceptions = knownExceptions2; |
| 4747 } | 5053 } |
| 4748 /** | 5054 /** |
| 4749 * Assert that all of the visited identifiers were resolved. | 5055 * Assert that all of the visited identifiers were resolved. |
| 4750 */ | 5056 */ |
| 4751 void assertResolved() { | 5057 void assertResolved() { |
| 4752 if (!_unresolvedNodes.isEmpty || !_wrongTypedNodes.isEmpty) { | 5058 if (!_unresolvedNodes.isEmpty || !_wrongTypedNodes.isEmpty) { |
| 4753 PrintStringWriter writer = new PrintStringWriter(); | 5059 PrintStringWriter writer = new PrintStringWriter(); |
| 4754 if (!_unresolvedNodes.isEmpty) { | 5060 if (!_unresolvedNodes.isEmpty) { |
| 4755 writer.print("Failed to resolve "); | 5061 writer.print("Failed to resolve "); |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6158 ScopeTest_TestScope(LibraryElement definingLibrary, AnalysisErrorListener erro
rListener) { | 6464 ScopeTest_TestScope(LibraryElement definingLibrary, AnalysisErrorListener erro
rListener) { |
| 6159 this._definingLibrary = definingLibrary; | 6465 this._definingLibrary = definingLibrary; |
| 6160 this._errorListener = errorListener; | 6466 this._errorListener = errorListener; |
| 6161 } | 6467 } |
| 6162 LibraryElement get definingLibrary => _definingLibrary; | 6468 LibraryElement get definingLibrary => _definingLibrary; |
| 6163 AnalysisErrorListener get errorListener => _errorListener; | 6469 AnalysisErrorListener get errorListener => _errorListener; |
| 6164 Element lookup3(String name, LibraryElement referencingLibrary) => localLookup
(name, referencingLibrary); | 6470 Element lookup3(String name, LibraryElement referencingLibrary) => localLookup
(name, referencingLibrary); |
| 6165 } | 6471 } |
| 6166 class SimpleResolverTest extends ResolverTestCase { | 6472 class SimpleResolverTest extends ResolverTestCase { |
| 6167 void fail_staticInvocation() { | 6473 void fail_staticInvocation() { |
| 6168 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => (a,b) => 0;", "}", "class B {", " f() {", " A.g
(1,0);", " }", "}"])); | 6474 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int get g => (a,b) => 0;", "}", "class B {", " f() {", " A.g(1,0);", " }"
, "}"])); |
| 6169 resolve(source, []); | 6475 resolve(source, []); |
| 6170 assertNoErrors(); | 6476 assertNoErrors(); |
| 6171 verify([source]); | 6477 verify([source]); |
| 6172 } | 6478 } |
| 6173 void test_class_definesCall() { | 6479 void test_class_definesCall() { |
| 6174 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int call(int x) { return x; }", "}", "int f(A a) {", " return a(0);",
"}"])); | 6480 Source source = addSource(EngineTestCase.createSource(["class A {", " int c
all(int x) { return x; }", "}", "int f(A a) {", " return a(0);", "}"])); |
| 6175 resolve(source, []); | 6481 resolve(source, []); |
| 6176 assertNoErrors(); | 6482 assertNoErrors(); |
| 6177 verify([source]); | 6483 verify([source]); |
| 6178 } | 6484 } |
| 6179 void test_class_extends_implements() { | 6485 void test_class_extends_implements() { |
| 6180 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B implements C {}", "class B {}", "class C {}"])); | 6486 Source source = addSource(EngineTestCase.createSource(["class A extends B im
plements C {}", "class B {}", "class C {}"])); |
| 6487 resolve(source, []); |
| 6488 assertNoErrors(); |
| 6489 verify([source]); |
| 6490 } |
| 6491 void test_commentReference_class() { |
| 6492 Source source = addSource(EngineTestCase.createSource(["f() {}", "/** [A] [n
ew A] [A.n] [new A.n] [m] [f] */", "class A {", " A() {}", " A.n() {}", " m()
{}", "}"])); |
| 6493 resolve(source, []); |
| 6494 assertNoErrors(); |
| 6495 verify([source]); |
| 6496 } |
| 6497 void test_commentReference_parameter() { |
| 6498 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", " A.n() {}", " /** [e] [f] */", " m(e, f()) {}", "}"])); |
| 6499 resolve(source, []); |
| 6500 assertNoErrors(); |
| 6501 verify([source]); |
| 6502 } |
| 6503 void test_commentReference_singleLine() { |
| 6504 Source source = addSource(EngineTestCase.createSource(["/// [A]", "class A {
}"])); |
| 6181 resolve(source, []); | 6505 resolve(source, []); |
| 6182 assertNoErrors(); | 6506 assertNoErrors(); |
| 6183 verify([source]); | 6507 verify([source]); |
| 6184 } | 6508 } |
| 6185 void test_empty() { | 6509 void test_empty() { |
| 6186 Source source = addSource("/test.dart", ""); | 6510 Source source = addSource(""); |
| 6187 resolve(source, []); | 6511 resolve(source, []); |
| 6188 assertNoErrors(); | 6512 assertNoErrors(); |
| 6189 verify([source]); | 6513 verify([source]); |
| 6190 } | 6514 } |
| 6191 void test_extractedMethodAsConstant() { | 6515 void test_extractedMethodAsConstant() { |
| 6192 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class Comparable<T> {", " int compareTo(T other);", " static int compare(Co
mparable a, Comparable b) => a.compareTo(b);", "}", "class A {", " void sort([c
ompare = Comparable.compare]) {}", "}"])); | 6516 Source source = addSource(EngineTestCase.createSource(["abstract class Compa
rable<T> {", " int compareTo(T other);", " static int compare(Comparable a, Co
mparable b) => a.compareTo(b);", "}", "class A {", " void sort([compare = Compa
rable.compare]) {}", "}"])); |
| 6517 resolve(source, []); |
| 6518 assertNoErrors(); |
| 6519 verify([source]); |
| 6520 } |
| 6521 void test_fieldFormalParameter() { |
| 6522 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); |
| 6193 resolve(source, []); | 6523 resolve(source, []); |
| 6194 assertNoErrors(); | 6524 assertNoErrors(); |
| 6195 verify([source]); | 6525 verify([source]); |
| 6196 } | 6526 } |
| 6197 void test_forEachLoops_nonConflicting() { | 6527 void test_forEachLoops_nonConflicting() { |
| 6198 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List list = [1,2,3];", " for (int x in list) {}", " for (int x in list) {
}", "}"])); | 6528 Source source = addSource(EngineTestCase.createSource(["f() {", " List list
= [1,2,3];", " for (int x in list) {}", " for (int x in list) {}", "}"])); |
| 6199 resolve(source, []); | 6529 resolve(source, []); |
| 6200 assertNoErrors(); | 6530 assertNoErrors(); |
| 6201 verify([source]); | 6531 verify([source]); |
| 6202 } | 6532 } |
| 6203 void test_forLoops_nonConflicting() { | 6533 void test_forLoops_nonConflicting() { |
| 6204 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " for (int i = 0; i < 3; i++) {", " }", " for (int i = 0; i < 3; i++) {", "
}", "}"])); | 6534 Source source = addSource(EngineTestCase.createSource(["f() {", " for (int
i = 0; i < 3; i++) {", " }", " for (int i = 0; i < 3; i++) {", " }", "}"])); |
| 6205 resolve(source, []); | 6535 resolve(source, []); |
| 6206 assertNoErrors(); | 6536 assertNoErrors(); |
| 6207 verify([source]); | 6537 verify([source]); |
| 6208 } | 6538 } |
| 6209 void test_functionTypeAlias() { | 6539 void test_functionTypeAlias() { |
| 6210 Source source = addSource("/test.dart", EngineTestCase.createSource(["typede
f bool P(e);", "class A {", " P p;", " m(e) {", " if (p(e)) {}", " }", "}"
])); | 6540 Source source = addSource(EngineTestCase.createSource(["typedef bool P(e);",
"class A {", " P p;", " m(e) {", " if (p(e)) {}", " }", "}"])); |
| 6211 resolve(source, []); | 6541 resolve(source, []); |
| 6212 assertNoErrors(); | 6542 assertNoErrors(); |
| 6213 verify([source]); | 6543 verify([source]); |
| 6214 } | 6544 } |
| 6215 void test_getterAndSetterWithDifferentTypes() { | 6545 void test_getterAndSetterWithDifferentTypes() { |
| 6216 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int get f => 0;", " void set f(String s) {}", "}", "g (A a) {", " a.f
= a.f.toString();", "}"])); | 6546 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et f => 0;", " void set f(String s) {}", "}", "g (A a) {", " a.f = a.f.toStrin
g();", "}"])); |
| 6217 resolve(source, []); | 6547 resolve(source, []); |
| 6218 assertNoErrors(); | 6548 assertNoErrors(); |
| 6219 verify([source]); | 6549 verify([source]); |
| 6220 } | 6550 } |
| 6221 void test_importWithPrefix() { | 6551 void test_importWithPrefix() { |
| 6222 addSource("/two.dart", EngineTestCase.createSource(["library two;", "f(int x
) {", " return x * x;", "}"])); | 6552 addSource2("/two.dart", EngineTestCase.createSource(["library two;", "f(int
x) {", " return x * x;", "}"])); |
| 6223 Source source = addSource("/one.dart", EngineTestCase.createSource(["library
one;", "import 'two.dart' as _two;", "main() {", " _two.f(0);", "}"])); | 6553 Source source = addSource2("/one.dart", EngineTestCase.createSource(["librar
y one;", "import 'two.dart' as _two;", "main() {", " _two.f(0);", "}"])); |
| 6224 resolve(source, []); | 6554 resolve(source, []); |
| 6225 assertNoErrors(); | 6555 assertNoErrors(); |
| 6226 verify([source]); | 6556 verify([source]); |
| 6227 } | 6557 } |
| 6228 void test_indexExpression_typeParameters() { | 6558 void test_indexExpression_typeParameters() { |
| 6229 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List<int> a;", " a[0];", " List<List<int>> b;", " b[0][0];", " List<Lis
t<List<int>>> c;", " c[0][0][0];", "}"])); | 6559 Source source = addSource(EngineTestCase.createSource(["f() {", " List<int>
a;", " a[0];", " List<List<int>> b;", " b[0][0];", " List<List<List<int>>>
c;", " c[0][0][0];", "}"])); |
| 6230 resolve(source, []); | 6560 resolve(source, []); |
| 6231 assertNoErrors(); | 6561 assertNoErrors(); |
| 6232 verify([source]); | 6562 verify([source]); |
| 6233 } | 6563 } |
| 6234 void test_indexExpression_typeParameters_invalidAssignmentWarning() { | 6564 void test_indexExpression_typeParameters_invalidAssignmentWarning() { |
| 6235 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " List<List<int>> b;", " b[0][0] = 'hi';", "}"])); | 6565 Source source = addSource(EngineTestCase.createSource(["f() {", " List<List
<int>> b;", " b[0][0] = 'hi';", "}"])); |
| 6236 resolve(source, []); | 6566 resolve(source, []); |
| 6237 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 6567 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 6238 verify([source]); | 6568 verify([source]); |
| 6239 } | 6569 } |
| 6240 void test_invoke_dynamicThroughGetter() { | 6570 void test_invoke_dynamicThroughGetter() { |
| 6241 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " List get X => [() => 0];", " m(A a) {", " X.last();", " }", "}"]))
; | 6571 Source source = addSource(EngineTestCase.createSource(["class A {", " List
get X => [() => 0];", " m(A a) {", " X.last;", " }", "}"])); |
| 6242 resolve(source, []); | 6572 resolve(source, []); |
| 6243 assertNoErrors(); | 6573 assertNoErrors(); |
| 6244 verify([source]); | 6574 verify([source]); |
| 6245 } | 6575 } |
| 6246 void test_isValidMixin_badSuperclass() { | 6576 void test_isValidMixin_badSuperclass() { |
| 6247 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B {}", "class B {}"])); | 6577 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B {}"])); |
| 6248 LibraryElement library = resolve(source, []); | 6578 LibraryElement library = resolve(source, []); |
| 6249 JUnitTestCase.assertNotNull(library); | 6579 JUnitTestCase.assertNotNull(library); |
| 6250 CompilationUnitElement unit = library.definingCompilationUnit; | 6580 CompilationUnitElement unit = library.definingCompilationUnit; |
| 6251 JUnitTestCase.assertNotNull(unit); | 6581 JUnitTestCase.assertNotNull(unit); |
| 6252 List<ClassElement> classes = unit.types; | 6582 List<ClassElement> classes = unit.types; |
| 6253 EngineTestCase.assertLength(2, classes); | 6583 EngineTestCase.assertLength(2, classes); |
| 6254 JUnitTestCase.assertFalse(classes[0].isValidMixin()); | 6584 JUnitTestCase.assertFalse(classes[0].isValidMixin()); |
| 6255 assertNoErrors(); | 6585 assertNoErrors(); |
| 6256 verify([source]); | 6586 verify([source]); |
| 6257 } | 6587 } |
| 6258 void test_isValidMixin_constructor() { | 6588 void test_isValidMixin_constructor() { |
| 6259 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " A() {}", "}"])); | 6589 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}"])); |
| 6260 LibraryElement library = resolve(source, []); | 6590 LibraryElement library = resolve(source, []); |
| 6261 JUnitTestCase.assertNotNull(library); | 6591 JUnitTestCase.assertNotNull(library); |
| 6262 CompilationUnitElement unit = library.definingCompilationUnit; | 6592 CompilationUnitElement unit = library.definingCompilationUnit; |
| 6263 JUnitTestCase.assertNotNull(unit); | 6593 JUnitTestCase.assertNotNull(unit); |
| 6264 List<ClassElement> classes = unit.types; | 6594 List<ClassElement> classes = unit.types; |
| 6265 EngineTestCase.assertLength(1, classes); | 6595 EngineTestCase.assertLength(1, classes); |
| 6266 JUnitTestCase.assertFalse(classes[0].isValidMixin()); | 6596 JUnitTestCase.assertFalse(classes[0].isValidMixin()); |
| 6267 assertNoErrors(); | 6597 assertNoErrors(); |
| 6268 verify([source]); | 6598 verify([source]); |
| 6269 } | 6599 } |
| 6270 void test_isValidMixin_super() { | 6600 void test_isValidMixin_super() { |
| 6271 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " toString() {", " return super.toString();", " }", "}"])); | 6601 Source source = addSource(EngineTestCase.createSource(["class A {", " toStr
ing() {", " return super.toString();", " }", "}"])); |
| 6272 LibraryElement library = resolve(source, []); | 6602 LibraryElement library = resolve(source, []); |
| 6273 JUnitTestCase.assertNotNull(library); | 6603 JUnitTestCase.assertNotNull(library); |
| 6274 CompilationUnitElement unit = library.definingCompilationUnit; | 6604 CompilationUnitElement unit = library.definingCompilationUnit; |
| 6275 JUnitTestCase.assertNotNull(unit); | 6605 JUnitTestCase.assertNotNull(unit); |
| 6276 List<ClassElement> classes = unit.types; | 6606 List<ClassElement> classes = unit.types; |
| 6277 EngineTestCase.assertLength(1, classes); | 6607 EngineTestCase.assertLength(1, classes); |
| 6278 JUnitTestCase.assertFalse(classes[0].isValidMixin()); | 6608 JUnitTestCase.assertFalse(classes[0].isValidMixin()); |
| 6279 assertNoErrors(); | 6609 assertNoErrors(); |
| 6280 verify([source]); | 6610 verify([source]); |
| 6281 } | 6611 } |
| 6282 void test_isValidMixin_valid() { | 6612 void test_isValidMixin_valid() { |
| 6283 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}"])); | 6613 Source source = addSource(EngineTestCase.createSource(["class A {}"])); |
| 6284 LibraryElement library = resolve(source, []); | 6614 LibraryElement library = resolve(source, []); |
| 6285 JUnitTestCase.assertNotNull(library); | 6615 JUnitTestCase.assertNotNull(library); |
| 6286 CompilationUnitElement unit = library.definingCompilationUnit; | 6616 CompilationUnitElement unit = library.definingCompilationUnit; |
| 6287 JUnitTestCase.assertNotNull(unit); | 6617 JUnitTestCase.assertNotNull(unit); |
| 6288 List<ClassElement> classes = unit.types; | 6618 List<ClassElement> classes = unit.types; |
| 6289 EngineTestCase.assertLength(1, classes); | 6619 EngineTestCase.assertLength(1, classes); |
| 6290 JUnitTestCase.assertTrue(classes[0].isValidMixin()); | 6620 JUnitTestCase.assertTrue(classes[0].isValidMixin()); |
| 6291 assertNoErrors(); | 6621 assertNoErrors(); |
| 6292 verify([source]); | 6622 verify([source]); |
| 6293 } | 6623 } |
| 6624 void test_method_fromSuperclassMixin() { |
| 6625 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m1() {}", "}", "class B with A {", "}", "class C extends B {", "}", "f(C c) {",
" c.m1()", "}"])); |
| 6626 resolve(source, []); |
| 6627 assertNoErrors(); |
| 6628 verify([source]); |
| 6629 } |
| 6294 void test_methodCascades() { | 6630 void test_methodCascades() { |
| 6295 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " void m1() {}", " void m2() {}", " void m() {", " A a = new A();",
" a..m1()", " ..m2();", " }", "}"])); | 6631 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m1() {}", " void m2() {}", " void m() {", " A a = new A();", " a..m1()",
" ..m2();", " }", "}"])); |
| 6296 resolve(source, []); | 6632 resolve(source, []); |
| 6297 assertNoErrors(); | 6633 assertNoErrors(); |
| 6298 verify([source]); | 6634 verify([source]); |
| 6299 } | 6635 } |
| 6300 void test_methodCascades_withSetter() { | 6636 void test_methodCascades_withSetter() { |
| 6301 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " String name;", " void m1() {}", " void m2() {}", " void m() {", "
A a = new A();", " a..m1()", " ..name = 'name'", " ..m2();", " }",
"}"])); | 6637 Source source = addSource(EngineTestCase.createSource(["class A {", " Strin
g name;", " void m1() {}", " void m2() {}", " void m() {", " A a = new A()
;", " a..m1()", " ..name = 'name'", " ..m2();", " }", "}"])); |
| 6302 resolve(source, []); | 6638 resolve(source, []); |
| 6303 assertNoErrors(); | 6639 assertNoErrors(); |
| 6304 verify([source]); | 6640 verify([source]); |
| 6305 } | 6641 } |
| 6306 void test_resolveAgainstNull() { | 6642 void test_resolveAgainstNull() { |
| 6307 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
p) {", " return null == p;", "}"])); | 6643 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " retu
rn null == p;", "}"])); |
| 6308 resolve(source, []); | 6644 resolve(source, []); |
| 6309 assertNoErrors(); | 6645 assertNoErrors(); |
| 6310 verify([source]); | 6646 verify([source]); |
| 6311 } | 6647 } |
| 6312 static dartSuite() { | 6648 static dartSuite() { |
| 6313 _ut.group('SimpleResolverTest', () { | 6649 _ut.group('SimpleResolverTest', () { |
| 6314 _ut.test('test_class_definesCall', () { | 6650 _ut.test('test_class_definesCall', () { |
| 6315 final __test = new SimpleResolverTest(); | 6651 final __test = new SimpleResolverTest(); |
| 6316 runJUnitTest(__test, __test.test_class_definesCall); | 6652 runJUnitTest(__test, __test.test_class_definesCall); |
| 6317 }); | 6653 }); |
| 6318 _ut.test('test_class_extends_implements', () { | 6654 _ut.test('test_class_extends_implements', () { |
| 6319 final __test = new SimpleResolverTest(); | 6655 final __test = new SimpleResolverTest(); |
| 6320 runJUnitTest(__test, __test.test_class_extends_implements); | 6656 runJUnitTest(__test, __test.test_class_extends_implements); |
| 6321 }); | 6657 }); |
| 6658 _ut.test('test_commentReference_class', () { |
| 6659 final __test = new SimpleResolverTest(); |
| 6660 runJUnitTest(__test, __test.test_commentReference_class); |
| 6661 }); |
| 6662 _ut.test('test_commentReference_parameter', () { |
| 6663 final __test = new SimpleResolverTest(); |
| 6664 runJUnitTest(__test, __test.test_commentReference_parameter); |
| 6665 }); |
| 6666 _ut.test('test_commentReference_singleLine', () { |
| 6667 final __test = new SimpleResolverTest(); |
| 6668 runJUnitTest(__test, __test.test_commentReference_singleLine); |
| 6669 }); |
| 6322 _ut.test('test_empty', () { | 6670 _ut.test('test_empty', () { |
| 6323 final __test = new SimpleResolverTest(); | 6671 final __test = new SimpleResolverTest(); |
| 6324 runJUnitTest(__test, __test.test_empty); | 6672 runJUnitTest(__test, __test.test_empty); |
| 6325 }); | 6673 }); |
| 6326 _ut.test('test_extractedMethodAsConstant', () { | 6674 _ut.test('test_extractedMethodAsConstant', () { |
| 6327 final __test = new SimpleResolverTest(); | 6675 final __test = new SimpleResolverTest(); |
| 6328 runJUnitTest(__test, __test.test_extractedMethodAsConstant); | 6676 runJUnitTest(__test, __test.test_extractedMethodAsConstant); |
| 6329 }); | 6677 }); |
| 6678 _ut.test('test_fieldFormalParameter', () { |
| 6679 final __test = new SimpleResolverTest(); |
| 6680 runJUnitTest(__test, __test.test_fieldFormalParameter); |
| 6681 }); |
| 6330 _ut.test('test_forEachLoops_nonConflicting', () { | 6682 _ut.test('test_forEachLoops_nonConflicting', () { |
| 6331 final __test = new SimpleResolverTest(); | 6683 final __test = new SimpleResolverTest(); |
| 6332 runJUnitTest(__test, __test.test_forEachLoops_nonConflicting); | 6684 runJUnitTest(__test, __test.test_forEachLoops_nonConflicting); |
| 6333 }); | 6685 }); |
| 6334 _ut.test('test_forLoops_nonConflicting', () { | 6686 _ut.test('test_forLoops_nonConflicting', () { |
| 6335 final __test = new SimpleResolverTest(); | 6687 final __test = new SimpleResolverTest(); |
| 6336 runJUnitTest(__test, __test.test_forLoops_nonConflicting); | 6688 runJUnitTest(__test, __test.test_forLoops_nonConflicting); |
| 6337 }); | 6689 }); |
| 6338 _ut.test('test_functionTypeAlias', () { | 6690 _ut.test('test_functionTypeAlias', () { |
| 6339 final __test = new SimpleResolverTest(); | 6691 final __test = new SimpleResolverTest(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6376 runJUnitTest(__test, __test.test_isValidMixin_valid); | 6728 runJUnitTest(__test, __test.test_isValidMixin_valid); |
| 6377 }); | 6729 }); |
| 6378 _ut.test('test_methodCascades', () { | 6730 _ut.test('test_methodCascades', () { |
| 6379 final __test = new SimpleResolverTest(); | 6731 final __test = new SimpleResolverTest(); |
| 6380 runJUnitTest(__test, __test.test_methodCascades); | 6732 runJUnitTest(__test, __test.test_methodCascades); |
| 6381 }); | 6733 }); |
| 6382 _ut.test('test_methodCascades_withSetter', () { | 6734 _ut.test('test_methodCascades_withSetter', () { |
| 6383 final __test = new SimpleResolverTest(); | 6735 final __test = new SimpleResolverTest(); |
| 6384 runJUnitTest(__test, __test.test_methodCascades_withSetter); | 6736 runJUnitTest(__test, __test.test_methodCascades_withSetter); |
| 6385 }); | 6737 }); |
| 6738 _ut.test('test_method_fromSuperclassMixin', () { |
| 6739 final __test = new SimpleResolverTest(); |
| 6740 runJUnitTest(__test, __test.test_method_fromSuperclassMixin); |
| 6741 }); |
| 6386 _ut.test('test_resolveAgainstNull', () { | 6742 _ut.test('test_resolveAgainstNull', () { |
| 6387 final __test = new SimpleResolverTest(); | 6743 final __test = new SimpleResolverTest(); |
| 6388 runJUnitTest(__test, __test.test_resolveAgainstNull); | 6744 runJUnitTest(__test, __test.test_resolveAgainstNull); |
| 6389 }); | 6745 }); |
| 6390 }); | 6746 }); |
| 6391 } | 6747 } |
| 6392 } | 6748 } |
| 6393 main() { | 6749 main() { |
| 6394 // ElementResolverTest.dartSuite(); | 6750 ElementResolverTest.dartSuite(); |
| 6395 // LibraryElementBuilderTest.dartSuite(); | 6751 LibraryElementBuilderTest.dartSuite(); |
| 6396 // LibraryTest.dartSuite(); | 6752 LibraryTest.dartSuite(); |
| 6397 // StaticTypeAnalyzerTest.dartSuite(); | 6753 StaticTypeAnalyzerTest.dartSuite(); |
| 6398 // TypeOverrideManagerTest.dartSuite(); | 6754 TypeOverrideManagerTest.dartSuite(); |
| 6399 // TypeProviderImplTest.dartSuite(); | 6755 TypeProviderImplTest.dartSuite(); |
| 6400 // TypeResolverVisitorTest.dartSuite(); | 6756 TypeResolverVisitorTest.dartSuite(); |
| 6401 // EnclosedScopeTest.dartSuite(); | 6757 EnclosedScopeTest.dartSuite(); |
| 6402 // LibraryImportScopeTest.dartSuite(); | 6758 LibraryImportScopeTest.dartSuite(); |
| 6403 // LibraryScopeTest.dartSuite(); | 6759 LibraryScopeTest.dartSuite(); |
| 6404 // ScopeTest.dartSuite(); | 6760 ScopeTest.dartSuite(); |
| 6405 // CompileTimeErrorCodeTest.dartSuite(); | 6761 CompileTimeErrorCodeTest.dartSuite(); |
| 6406 // ErrorResolverTest.dartSuite(); | 6762 ErrorResolverTest.dartSuite(); |
| 6407 // NonErrorResolverTest.dartSuite(); | 6763 NonErrorResolverTest.dartSuite(); |
| 6408 // SimpleResolverTest.dartSuite(); | 6764 SimpleResolverTest.dartSuite(); |
| 6409 // StaticTypeWarningCodeTest.dartSuite(); | 6765 StaticTypeWarningCodeTest.dartSuite(); |
| 6410 // StaticWarningCodeTest.dartSuite(); | 6766 StaticWarningCodeTest.dartSuite(); |
| 6411 // TypePropagationTest.dartSuite(); | 6767 TypePropagationTest.dartSuite(); |
| 6412 } | 6768 } |
| OLD | NEW |