| 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 library engine.resolver_test; | 3 library engine.resolver_test; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 8 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/error.dart'; | 9 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 11 import 'package:analyzer_experimental/src/generated/ast.dart'; | 11 import 'package:analyzer_experimental/src/generated/ast.dart'; |
| 12 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; | 12 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; |
| 13 import 'package:analyzer_experimental/src/generated/element.dart'; | 13 import 'package:analyzer_experimental/src/generated/element.dart'; |
| 14 import 'package:analyzer_experimental/src/generated/resolver.dart'; | 14 import 'package:analyzer_experimental/src/generated/resolver.dart'; |
| 15 import 'package:analyzer_experimental/src/generated/engine.dart'; | 15 import 'package:analyzer_experimental/src/generated/engine.dart'; |
| 16 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; | 16 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; |
| 17 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; | 17 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; |
| 18 import 'package:analyzer_experimental/src/generated/sdk_io.dart' show DirectoryB
asedDartSdk; | 18 import 'package:analyzer_experimental/src/generated/sdk_io.dart' show DirectoryB
asedDartSdk; |
| 19 import 'package:unittest/unittest.dart' as _ut; | 19 import 'package:unittest/unittest.dart' as _ut; |
| 20 import 'test_support.dart'; | 20 import 'test_support.dart'; |
| 21 import 'ast_test.dart' show ASTFactory; | 21 import 'ast_test.dart' show ASTFactory; |
| 22 import 'element_test.dart' show ElementFactory; | 22 import 'element_test.dart' show ElementFactory; |
| 23 class TypePropagationTest extends ResolverTestCase { | 23 class TypePropagationTest extends ResolverTestCase { |
| 24 void fail_functionExpression_asInvocationArgument_functionExpressionInvocation
() { | 24 void fail_functionExpression_asInvocationArgument_functionExpressionInvocation
() { |
| 25 String code = EngineTestCase.createSource(["main() {", " (f(String value))
{} ((v) {", " v;", " });", "}"]); | 25 String code = EngineTestCase.createSource([ |
| 26 "main() {", |
| 27 " (f(String value)) {} ((v) {", |
| 28 " v;", |
| 29 " });", |
| 30 "}"]); |
| 26 Source source = addSource(code); | 31 Source source = addSource(code); |
| 27 LibraryElement library = resolve(source); | 32 LibraryElement library = resolve(source); |
| 28 assertNoErrors(); | 33 assertNoErrors(); |
| 29 verify([source]); | 34 verify([source]); |
| 30 CompilationUnit unit = resolveCompilationUnit(source, library); | 35 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 31 Type2 dynamicType = typeProvider.dynamicType; | 36 Type2 dynamicType = typeProvider.dynamicType; |
| 32 Type2 stringType = typeProvider.stringType; | 37 Type2 stringType = typeProvider.stringType; |
| 33 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Forma
lParameter); | 38 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Forma
lParameter); |
| 34 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); | 39 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); |
| 35 JUnitTestCase.assertSame(dynamicType, vParameter.identifier.staticType); | 40 JUnitTestCase.assertSame(dynamicType, vParameter.identifier.staticType); |
| 36 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); | 41 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); |
| 37 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType); | 42 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType); |
| 38 JUnitTestCase.assertSame(dynamicType, vIdentifier.staticType); | 43 JUnitTestCase.assertSame(dynamicType, vIdentifier.staticType); |
| 39 } | 44 } |
| 40 void fail_propagatedReturnType_functionExpression() { | 45 void fail_propagatedReturnType_functionExpression() { |
| 41 String code = EngineTestCase.createSource(["main() {", " var v = (() {retur
n 42;})();", "}"]); | 46 String code = EngineTestCase.createSource(["main() {", " var v = (() {retur
n 42;})();", "}"]); |
| 42 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); | 47 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); |
| 43 } | 48 } |
| 44 void test_as() { | 49 void test_as() { |
| 45 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;", " }", "}"])); | 50 Source source = addSource(EngineTestCase.createSource([ |
| 51 "class A {", |
| 52 " bool get g => true;", |
| 53 "}", |
| 54 "A f(var p) {", |
| 55 " if ((p as A).g) {", |
| 56 " return p;", |
| 57 " } else {", |
| 58 " return null;", |
| 59 " }", |
| 60 "}"])); |
| 46 LibraryElement library = resolve(source); | 61 LibraryElement library = resolve(source); |
| 47 assertNoErrors(); | 62 assertNoErrors(); |
| 48 verify([source]); | 63 verify([source]); |
| 49 CompilationUnit unit = resolveCompilationUnit(source, library); | 64 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 50 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 65 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 51 InterfaceType typeA = classA.element.type; | 66 InterfaceType typeA = classA.element.type; |
| 52 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 67 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 53 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 68 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 54 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 69 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 55 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 70 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 56 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 71 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 57 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 72 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 58 } | 73 } |
| 59 void test_assert() { | 74 void test_assert() { |
| 60 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " assert (p is A);", " return p;", "}"])); | 75 Source source = addSource(EngineTestCase.createSource([ |
| 76 "class A {}", |
| 77 "A f(var p) {", |
| 78 " assert (p is A);", |
| 79 " return p;", |
| 80 "}"])); |
| 61 LibraryElement library = resolve(source); | 81 LibraryElement library = resolve(source); |
| 62 assertNoErrors(); | 82 assertNoErrors(); |
| 63 verify([source]); | 83 verify([source]); |
| 64 CompilationUnit unit = resolveCompilationUnit(source, library); | 84 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 65 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 85 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 66 InterfaceType typeA = classA.element.type; | 86 InterfaceType typeA = classA.element.type; |
| 67 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 87 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 68 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 88 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 69 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 89 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 70 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 90 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 88 assertNoErrors(); | 108 assertNoErrors(); |
| 89 verify([source]); | 109 verify([source]); |
| 90 CompilationUnit unit = resolveCompilationUnit(source, library); | 110 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 91 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 111 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 92 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 112 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 93 ReturnStatement statement = body.block.statements[2] as ReturnStatement; | 113 ReturnStatement statement = body.block.statements[2] as ReturnStatement; |
| 94 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 114 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 95 JUnitTestCase.assertSame(typeProvider.doubleType, variableName.propagatedTyp
e); | 115 JUnitTestCase.assertSame(typeProvider.doubleType, variableName.propagatedTyp
e); |
| 96 } | 116 } |
| 97 void test_forEach() { | 117 void test_forEach() { |
| 98 String code = EngineTestCase.createSource(["f(List<String> p) {", " for (va
r e in p) {", " e;", " }", "}"]); | 118 String code = EngineTestCase.createSource([ |
| 119 "f(List<String> p) {", |
| 120 " for (var e in p) {", |
| 121 " e;", |
| 122 " }", |
| 123 "}"]); |
| 99 Source source = addSource(code); | 124 Source source = addSource(code); |
| 100 LibraryElement library = resolve(source); | 125 LibraryElement library = resolve(source); |
| 101 assertNoErrors(); | 126 assertNoErrors(); |
| 102 verify([source]); | 127 verify([source]); |
| 103 CompilationUnit unit = resolveCompilationUnit(source, library); | 128 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 104 InterfaceType stringType = typeProvider.stringType; | 129 InterfaceType stringType = typeProvider.stringType; |
| 105 { | 130 { |
| 106 SimpleIdentifier identifier = EngineTestCase.findNode(unit, code, "e in",
SimpleIdentifier); | 131 SimpleIdentifier identifier = EngineTestCase.findNode(unit, code, "e in",
SimpleIdentifier); |
| 107 JUnitTestCase.assertSame(stringType, identifier.propagatedType); | 132 JUnitTestCase.assertSame(stringType, identifier.propagatedType); |
| 108 } | 133 } |
| 109 { | 134 { |
| 110 SimpleIdentifier identifier = EngineTestCase.findNode(unit, code, "e;", Si
mpleIdentifier); | 135 SimpleIdentifier identifier = EngineTestCase.findNode(unit, code, "e;", Si
mpleIdentifier); |
| 111 JUnitTestCase.assertSame(stringType, identifier.propagatedType); | 136 JUnitTestCase.assertSame(stringType, identifier.propagatedType); |
| 112 } | 137 } |
| 113 } | 138 } |
| 114 void test_functionExpression_asInvocationArgument() { | 139 void test_functionExpression_asInvocationArgument() { |
| 115 String code = EngineTestCase.createSource(["class MyMap<K, V> {", " forEach
(f(K key, V value)) {}", "}", "f(MyMap<int, String> m) {", " m.forEach((k, v) {
", " k;", " v;", " });", "}"]); | 140 String code = EngineTestCase.createSource([ |
| 141 "class MyMap<K, V> {", |
| 142 " forEach(f(K key, V value)) {}", |
| 143 "}", |
| 144 "f(MyMap<int, String> m) {", |
| 145 " m.forEach((k, v) {", |
| 146 " k;", |
| 147 " v;", |
| 148 " });", |
| 149 "}"]); |
| 116 Source source = addSource(code); | 150 Source source = addSource(code); |
| 117 LibraryElement library = resolve(source); | 151 LibraryElement library = resolve(source); |
| 118 assertNoErrors(); | 152 assertNoErrors(); |
| 119 verify([source]); | 153 verify([source]); |
| 120 CompilationUnit unit = resolveCompilationUnit(source, library); | 154 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 121 Type2 intType = typeProvider.intType; | 155 Type2 intType = typeProvider.intType; |
| 122 FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", Simp
leFormalParameter); | 156 FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", Simp
leFormalParameter); |
| 123 JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType); | 157 JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType); |
| 124 SimpleIdentifier kIdentifier = EngineTestCase.findNode(unit, code, "k;", Sim
pleIdentifier); | 158 SimpleIdentifier kIdentifier = EngineTestCase.findNode(unit, code, "k;", Sim
pleIdentifier); |
| 125 JUnitTestCase.assertSame(intType, kIdentifier.propagatedType); | 159 JUnitTestCase.assertSame(intType, kIdentifier.propagatedType); |
| 126 JUnitTestCase.assertSame(typeProvider.dynamicType, kIdentifier.staticType); | 160 JUnitTestCase.assertSame(typeProvider.dynamicType, kIdentifier.staticType); |
| 127 Type2 stringType = typeProvider.stringType; | 161 Type2 stringType = typeProvider.stringType; |
| 128 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); | 162 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); |
| 129 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); | 163 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); |
| 130 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); | 164 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); |
| 131 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType); | 165 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType); |
| 132 JUnitTestCase.assertSame(typeProvider.dynamicType, vIdentifier.staticType); | 166 JUnitTestCase.assertSame(typeProvider.dynamicType, vIdentifier.staticType); |
| 133 } | 167 } |
| 134 void test_functionExpression_asInvocationArgument_fromInferredInvocation() { | 168 void test_functionExpression_asInvocationArgument_fromInferredInvocation() { |
| 135 String code = EngineTestCase.createSource(["class MyMap<K, V> {", " forEach
(f(K key, V value)) {}", "}", "f(MyMap<int, String> m) {", " var m2 = m;", " m
2.forEach((k, v) {});", "}"]); | 169 String code = EngineTestCase.createSource([ |
| 170 "class MyMap<K, V> {", |
| 171 " forEach(f(K key, V value)) {}", |
| 172 "}", |
| 173 "f(MyMap<int, String> m) {", |
| 174 " var m2 = m;", |
| 175 " m2.forEach((k, v) {});", |
| 176 "}"]); |
| 136 Source source = addSource(code); | 177 Source source = addSource(code); |
| 137 LibraryElement library = resolve(source); | 178 LibraryElement library = resolve(source); |
| 138 assertNoErrors(); | 179 assertNoErrors(); |
| 139 verify([source]); | 180 verify([source]); |
| 140 CompilationUnit unit = resolveCompilationUnit(source, library); | 181 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 141 Type2 intType = typeProvider.intType; | 182 Type2 intType = typeProvider.intType; |
| 142 FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", Simp
leFormalParameter); | 183 FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", Simp
leFormalParameter); |
| 143 JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType); | 184 JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType); |
| 144 Type2 stringType = typeProvider.stringType; | 185 Type2 stringType = typeProvider.stringType; |
| 145 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); | 186 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); |
| 146 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); | 187 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); |
| 147 } | 188 } |
| 148 void test_functionExpression_asInvocationArgument_keepIfLessSpecific() { | 189 void test_functionExpression_asInvocationArgument_keepIfLessSpecific() { |
| 149 String code = EngineTestCase.createSource(["class MyList {", " forEach(f(Ob
ject value)) {}", "}", "f(MyList list) {", " list.forEach((int v) {", " v;",
" });", "}"]); | 190 String code = EngineTestCase.createSource([ |
| 191 "class MyList {", |
| 192 " forEach(f(Object value)) {}", |
| 193 "}", |
| 194 "f(MyList list) {", |
| 195 " list.forEach((int v) {", |
| 196 " v;", |
| 197 " });", |
| 198 "}"]); |
| 150 Source source = addSource(code); | 199 Source source = addSource(code); |
| 151 LibraryElement library = resolve(source); | 200 LibraryElement library = resolve(source); |
| 152 assertNoErrors(); | 201 assertNoErrors(); |
| 153 verify([source]); | 202 verify([source]); |
| 154 CompilationUnit unit = resolveCompilationUnit(source, library); | 203 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 155 Type2 intType = typeProvider.intType; | 204 Type2 intType = typeProvider.intType; |
| 156 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); | 205 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); |
| 157 JUnitTestCase.assertSame(null, vParameter.identifier.propagatedType); | 206 JUnitTestCase.assertSame(null, vParameter.identifier.propagatedType); |
| 158 JUnitTestCase.assertSame(intType, vParameter.identifier.staticType); | 207 JUnitTestCase.assertSame(intType, vParameter.identifier.staticType); |
| 159 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); | 208 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); |
| 160 JUnitTestCase.assertSame(intType, vIdentifier.staticType); | 209 JUnitTestCase.assertSame(intType, vIdentifier.staticType); |
| 161 JUnitTestCase.assertSame(null, vIdentifier.propagatedType); | 210 JUnitTestCase.assertSame(null, vIdentifier.propagatedType); |
| 162 } | 211 } |
| 163 void test_functionExpression_asInvocationArgument_replaceIfMoreSpecific() { | 212 void test_functionExpression_asInvocationArgument_replaceIfMoreSpecific() { |
| 164 String code = EngineTestCase.createSource(["class MyList<E> {", " forEach(f
(E value)) {}", "}", "f(MyList<String> list) {", " list.forEach((Object v) {",
" v;", " });", "}"]); | 213 String code = EngineTestCase.createSource([ |
| 214 "class MyList<E> {", |
| 215 " forEach(f(E value)) {}", |
| 216 "}", |
| 217 "f(MyList<String> list) {", |
| 218 " list.forEach((Object v) {", |
| 219 " v;", |
| 220 " });", |
| 221 "}"]); |
| 165 Source source = addSource(code); | 222 Source source = addSource(code); |
| 166 LibraryElement library = resolve(source); | 223 LibraryElement library = resolve(source); |
| 167 assertNoErrors(); | 224 assertNoErrors(); |
| 168 verify([source]); | 225 verify([source]); |
| 169 CompilationUnit unit = resolveCompilationUnit(source, library); | 226 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 170 Type2 stringType = typeProvider.stringType; | 227 Type2 stringType = typeProvider.stringType; |
| 171 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); | 228 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl
eFormalParameter); |
| 172 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); | 229 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); |
| 173 JUnitTestCase.assertSame(typeProvider.objectType, vParameter.identifier.stat
icType); | 230 JUnitTestCase.assertSame(typeProvider.objectType, vParameter.identifier.stat
icType); |
| 174 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); | 231 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim
pleIdentifier); |
| 175 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType); | 232 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType); |
| 176 } | 233 } |
| 177 void test_Future_then() { | 234 void test_Future_then() { |
| 178 String code = EngineTestCase.createSource(["import 'dart:async';", "main(Fut
ure<int> firstFuture) {", " firstFuture.then((p1) {", " return 1.0;", " }).
then((p2) {", " return new Future<String>.value('str');", " }).then((p3) {",
" });", "}"]); | 235 String code = EngineTestCase.createSource([ |
| 236 "import 'dart:async';", |
| 237 "main(Future<int> firstFuture) {", |
| 238 " firstFuture.then((p1) {", |
| 239 " return 1.0;", |
| 240 " }).then((p2) {", |
| 241 " return new Future<String>.value('str');", |
| 242 " }).then((p3) {", |
| 243 " });", |
| 244 "}"]); |
| 179 Source source = addSource(code); | 245 Source source = addSource(code); |
| 180 LibraryElement library = resolve(source); | 246 LibraryElement library = resolve(source); |
| 181 assertNoErrors(); | 247 assertNoErrors(); |
| 182 verify([source]); | 248 verify([source]); |
| 183 CompilationUnit unit = resolveCompilationUnit(source, library); | 249 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 184 FormalParameter p1 = EngineTestCase.findNode(unit, code, "p1) {", SimpleForm
alParameter); | 250 FormalParameter p1 = EngineTestCase.findNode(unit, code, "p1) {", SimpleForm
alParameter); |
| 185 JUnitTestCase.assertSame(typeProvider.intType, p1.identifier.propagatedType)
; | 251 JUnitTestCase.assertSame(typeProvider.intType, p1.identifier.propagatedType)
; |
| 186 FormalParameter p2 = EngineTestCase.findNode(unit, code, "p2) {", SimpleForm
alParameter); | 252 FormalParameter p2 = EngineTestCase.findNode(unit, code, "p2) {", SimpleForm
alParameter); |
| 187 JUnitTestCase.assertSame(typeProvider.doubleType, p2.identifier.propagatedTy
pe); | 253 JUnitTestCase.assertSame(typeProvider.doubleType, p2.identifier.propagatedTy
pe); |
| 188 FormalParameter p3 = EngineTestCase.findNode(unit, code, "p3) {", SimpleForm
alParameter); | 254 FormalParameter p3 = EngineTestCase.findNode(unit, code, "p3) {", SimpleForm
alParameter); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 214 LibraryElement library = resolve(source); | 280 LibraryElement library = resolve(source); |
| 215 CompilationUnit unit = resolveCompilationUnit(source, library); | 281 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 216 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 282 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 217 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 283 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 218 ExpressionStatement statement = body.block.statements[1] as ExpressionStatem
ent; | 284 ExpressionStatement statement = body.block.statements[1] as ExpressionStatem
ent; |
| 219 PrefixedIdentifier invocation = statement.expression as PrefixedIdentifier; | 285 PrefixedIdentifier invocation = statement.expression as PrefixedIdentifier; |
| 220 SimpleIdentifier variableName = invocation.prefix; | 286 SimpleIdentifier variableName = invocation.prefix; |
| 221 JUnitTestCase.assertSame(typeProvider.stringType, variableName.propagatedTyp
e); | 287 JUnitTestCase.assertSame(typeProvider.stringType, variableName.propagatedTyp
e); |
| 222 } | 288 } |
| 223 void test_is_conditional() { | 289 void test_is_conditional() { |
| 224 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " return (p is A) ? p : null;", "}"])); | 290 Source source = addSource(EngineTestCase.createSource([ |
| 291 "class A {}", |
| 292 "A f(var p) {", |
| 293 " return (p is A) ? p : null;", |
| 294 "}"])); |
| 225 LibraryElement library = resolve(source); | 295 LibraryElement library = resolve(source); |
| 226 assertNoErrors(); | 296 assertNoErrors(); |
| 227 verify([source]); | 297 verify([source]); |
| 228 CompilationUnit unit = resolveCompilationUnit(source, library); | 298 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 229 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 299 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 230 InterfaceType typeA = classA.element.type; | 300 InterfaceType typeA = classA.element.type; |
| 231 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 301 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 232 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 302 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 233 ReturnStatement statement = body.block.statements[0] as ReturnStatement; | 303 ReturnStatement statement = body.block.statements[0] as ReturnStatement; |
| 234 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; | 304 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; |
| 235 SimpleIdentifier variableName = conditional.thenExpression as SimpleIdentifi
er; | 305 SimpleIdentifier variableName = conditional.thenExpression as SimpleIdentifi
er; |
| 236 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 306 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 237 } | 307 } |
| 238 void test_is_if() { | 308 void test_is_if() { |
| 239 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is A) {", " return p;", " } else {", " return null;", "
}", "}"])); | 309 Source source = addSource(EngineTestCase.createSource([ |
| 310 "class A {}", |
| 311 "A f(var p) {", |
| 312 " if (p is A) {", |
| 313 " return p;", |
| 314 " } else {", |
| 315 " return null;", |
| 316 " }", |
| 317 "}"])); |
| 240 LibraryElement library = resolve(source); | 318 LibraryElement library = resolve(source); |
| 241 assertNoErrors(); | 319 assertNoErrors(); |
| 242 verify([source]); | 320 verify([source]); |
| 243 CompilationUnit unit = resolveCompilationUnit(source, library); | 321 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 244 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 322 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 245 InterfaceType typeA = classA.element.type; | 323 InterfaceType typeA = classA.element.type; |
| 246 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 324 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 247 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 325 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 248 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 326 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 249 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 327 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 250 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 328 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 251 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 329 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 252 } | 330 } |
| 253 void test_is_if_lessSpecific() { | 331 void test_is_if_lessSpecific() { |
| 254 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(A
p) {", " if (p is Object) {", " return p;", " } else {", " return null;"
, " }", "}"])); | 332 Source source = addSource(EngineTestCase.createSource([ |
| 333 "class A {}", |
| 334 "A f(A p) {", |
| 335 " if (p is Object) {", |
| 336 " return p;", |
| 337 " } else {", |
| 338 " return null;", |
| 339 " }", |
| 340 "}"])); |
| 255 LibraryElement library = resolve(source); | 341 LibraryElement library = resolve(source); |
| 256 assertNoErrors(); | 342 assertNoErrors(); |
| 257 verify([source]); | 343 verify([source]); |
| 258 CompilationUnit unit = resolveCompilationUnit(source, library); | 344 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 259 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 345 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 260 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 346 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 261 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 347 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 262 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 348 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 263 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 349 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 264 JUnitTestCase.assertSame(null, variableName.propagatedType); | 350 JUnitTestCase.assertSame(null, variableName.propagatedType); |
| 265 } | 351 } |
| 266 void test_is_if_logicalAnd() { | 352 void test_is_if_logicalAnd() { |
| 267 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is A && p != null) {", " return p;", " } else {", " ret
urn null;", " }", "}"])); | 353 Source source = addSource(EngineTestCase.createSource([ |
| 354 "class A {}", |
| 355 "A f(var p) {", |
| 356 " if (p is A && p != null) {", |
| 357 " return p;", |
| 358 " } else {", |
| 359 " return null;", |
| 360 " }", |
| 361 "}"])); |
| 268 LibraryElement library = resolve(source); | 362 LibraryElement library = resolve(source); |
| 269 assertNoErrors(); | 363 assertNoErrors(); |
| 270 verify([source]); | 364 verify([source]); |
| 271 CompilationUnit unit = resolveCompilationUnit(source, library); | 365 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 272 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 366 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 273 InterfaceType typeA = classA.element.type; | 367 InterfaceType typeA = classA.element.type; |
| 274 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 368 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 275 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 369 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 276 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 370 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 277 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 371 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 278 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 372 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 279 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 373 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 280 } | 374 } |
| 281 void test_is_postConditional() { | 375 void test_is_postConditional() { |
| 282 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " A a = (p is A) ? p : throw null;", " return p;", "}"])); | 376 Source source = addSource(EngineTestCase.createSource([ |
| 377 "class A {}", |
| 378 "A f(var p) {", |
| 379 " A a = (p is A) ? p : throw null;", |
| 380 " return p;", |
| 381 "}"])); |
| 283 LibraryElement library = resolve(source); | 382 LibraryElement library = resolve(source); |
| 284 assertNoErrors(); | 383 assertNoErrors(); |
| 285 verify([source]); | 384 verify([source]); |
| 286 CompilationUnit unit = resolveCompilationUnit(source, library); | 385 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 287 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 386 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 288 InterfaceType typeA = classA.element.type; | 387 InterfaceType typeA = classA.element.type; |
| 289 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 388 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 290 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 389 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 291 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 390 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 292 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 391 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 293 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 392 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 294 } | 393 } |
| 295 void test_is_postIf() { | 394 void test_is_postIf() { |
| 296 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is A) {", " A a = p;", " } else {", " return null;", "
}", " return p;", "}"])); | 395 Source source = addSource(EngineTestCase.createSource([ |
| 396 "class A {}", |
| 397 "A f(var p) {", |
| 398 " if (p is A) {", |
| 399 " A a = p;", |
| 400 " } else {", |
| 401 " return null;", |
| 402 " }", |
| 403 " return p;", |
| 404 "}"])); |
| 297 LibraryElement library = resolve(source); | 405 LibraryElement library = resolve(source); |
| 298 assertNoErrors(); | 406 assertNoErrors(); |
| 299 verify([source]); | 407 verify([source]); |
| 300 CompilationUnit unit = resolveCompilationUnit(source, library); | 408 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 301 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 409 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 302 InterfaceType typeA = classA.element.type; | 410 InterfaceType typeA = classA.element.type; |
| 303 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 411 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 304 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 412 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 305 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 413 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 306 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 414 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 307 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 415 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 308 } | 416 } |
| 309 void test_is_subclass() { | 417 void test_is_subclass() { |
| 310 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();", " }", "}"])); | 418 Source source = addSource(EngineTestCase.createSource([ |
| 419 "class A {}", |
| 420 "class B extends A {", |
| 421 " B m() => this;", |
| 422 "}", |
| 423 "A f(A p) {", |
| 424 " if (p is B) {", |
| 425 " return p.m();", |
| 426 " }", |
| 427 "}"])); |
| 311 LibraryElement library = resolve(source); | 428 LibraryElement library = resolve(source); |
| 312 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); | 429 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); |
| 313 verify([source]); | 430 verify([source]); |
| 314 CompilationUnit unit = resolveCompilationUnit(source, library); | 431 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 315 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; | 432 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; |
| 316 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 433 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 317 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 434 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 318 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 435 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 319 MethodInvocation invocation = statement.expression as MethodInvocation; | 436 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 320 JUnitTestCase.assertNotNull(invocation.methodName.element); | 437 JUnitTestCase.assertNotNull(invocation.methodName.element); |
| 321 } | 438 } |
| 322 void test_is_while() { | 439 void test_is_while() { |
| 323 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " while (p is A) {", " return p;", " }", "}"])); | 440 Source source = addSource(EngineTestCase.createSource([ |
| 441 "class A {}", |
| 442 "A f(var p) {", |
| 443 " while (p is A) {", |
| 444 " return p;", |
| 445 " }", |
| 446 "}"])); |
| 324 LibraryElement library = resolve(source); | 447 LibraryElement library = resolve(source); |
| 325 assertNoErrors(); | 448 assertNoErrors(); |
| 326 verify([source]); | 449 verify([source]); |
| 327 CompilationUnit unit = resolveCompilationUnit(source, library); | 450 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 328 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 451 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 329 InterfaceType typeA = classA.element.type; | 452 InterfaceType typeA = classA.element.type; |
| 330 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 453 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 331 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 454 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 332 WhileStatement whileStatement = body.block.statements[0] as WhileStatement; | 455 WhileStatement whileStatement = body.block.statements[0] as WhileStatement; |
| 333 ReturnStatement statement = ((whileStatement.body as Block)).statements[0] a
s ReturnStatement; | 456 ReturnStatement statement = ((whileStatement.body as Block)).statements[0] a
s ReturnStatement; |
| 334 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 457 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 335 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 458 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 336 } | 459 } |
| 337 void test_isNot_conditional() { | 460 void test_isNot_conditional() { |
| 338 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " return (p is! A) ? null : p;", "}"])); | 461 Source source = addSource(EngineTestCase.createSource([ |
| 462 "class A {}", |
| 463 "A f(var p) {", |
| 464 " return (p is! A) ? null : p;", |
| 465 "}"])); |
| 339 LibraryElement library = resolve(source); | 466 LibraryElement library = resolve(source); |
| 340 assertNoErrors(); | 467 assertNoErrors(); |
| 341 verify([source]); | 468 verify([source]); |
| 342 CompilationUnit unit = resolveCompilationUnit(source, library); | 469 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 343 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 470 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 344 InterfaceType typeA = classA.element.type; | 471 InterfaceType typeA = classA.element.type; |
| 345 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 472 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 346 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 473 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 347 ReturnStatement statement = body.block.statements[0] as ReturnStatement; | 474 ReturnStatement statement = body.block.statements[0] as ReturnStatement; |
| 348 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; | 475 ConditionalExpression conditional = statement.expression as ConditionalExpre
ssion; |
| 349 SimpleIdentifier variableName = conditional.elseExpression as SimpleIdentifi
er; | 476 SimpleIdentifier variableName = conditional.elseExpression as SimpleIdentifi
er; |
| 350 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 477 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 351 } | 478 } |
| 352 void test_isNot_if() { | 479 void test_isNot_if() { |
| 353 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is! A) {", " return null;", " } else {", " return p;",
" }", "}"])); | 480 Source source = addSource(EngineTestCase.createSource([ |
| 481 "class A {}", |
| 482 "A f(var p) {", |
| 483 " if (p is! A) {", |
| 484 " return null;", |
| 485 " } else {", |
| 486 " return p;", |
| 487 " }", |
| 488 "}"])); |
| 354 LibraryElement library = resolve(source); | 489 LibraryElement library = resolve(source); |
| 355 assertNoErrors(); | 490 assertNoErrors(); |
| 356 verify([source]); | 491 verify([source]); |
| 357 CompilationUnit unit = resolveCompilationUnit(source, library); | 492 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 358 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 493 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 359 InterfaceType typeA = classA.element.type; | 494 InterfaceType typeA = classA.element.type; |
| 360 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 495 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 361 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 496 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 362 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 497 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 363 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; | 498 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; |
| 364 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 499 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 365 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 500 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 366 } | 501 } |
| 367 void test_isNot_if_logicalOr() { | 502 void test_isNot_if_logicalOr() { |
| 368 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is! A || null == p) {", " return null;", " } else {", "
return p;", " }", "}"])); | 503 Source source = addSource(EngineTestCase.createSource([ |
| 504 "class A {}", |
| 505 "A f(var p) {", |
| 506 " if (p is! A || null == p) {", |
| 507 " return null;", |
| 508 " } else {", |
| 509 " return p;", |
| 510 " }", |
| 511 "}"])); |
| 369 LibraryElement library = resolve(source); | 512 LibraryElement library = resolve(source); |
| 370 assertNoErrors(); | 513 assertNoErrors(); |
| 371 verify([source]); | 514 verify([source]); |
| 372 CompilationUnit unit = resolveCompilationUnit(source, library); | 515 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 373 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 516 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 374 InterfaceType typeA = classA.element.type; | 517 InterfaceType typeA = classA.element.type; |
| 375 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 518 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 376 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 519 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 377 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 520 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 378 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; | 521 ReturnStatement statement = ((ifStatement.elseStatement as Block)).statement
s[0] as ReturnStatement; |
| 379 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 522 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 380 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 523 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 381 } | 524 } |
| 382 void test_isNot_postConditional() { | 525 void test_isNot_postConditional() { |
| 383 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " A a = (p is! A) ? throw null : p;", " return p;", "}"])); | 526 Source source = addSource(EngineTestCase.createSource([ |
| 527 "class A {}", |
| 528 "A f(var p) {", |
| 529 " A a = (p is! A) ? throw null : p;", |
| 530 " return p;", |
| 531 "}"])); |
| 384 LibraryElement library = resolve(source); | 532 LibraryElement library = resolve(source); |
| 385 assertNoErrors(); | 533 assertNoErrors(); |
| 386 verify([source]); | 534 verify([source]); |
| 387 CompilationUnit unit = resolveCompilationUnit(source, library); | 535 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 388 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 536 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 389 InterfaceType typeA = classA.element.type; | 537 InterfaceType typeA = classA.element.type; |
| 390 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 538 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 391 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 539 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 392 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 540 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 393 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 541 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| 394 JUnitTestCase.assertSame(typeA, variableName.propagatedType); | 542 JUnitTestCase.assertSame(typeA, variableName.propagatedType); |
| 395 } | 543 } |
| 396 void test_isNot_postIf() { | 544 void test_isNot_postIf() { |
| 397 Source source = addSource(EngineTestCase.createSource(["class A {}", "A f(va
r p) {", " if (p is! A) {", " return null;", " }", " return p;", "}"])); | 545 Source source = addSource(EngineTestCase.createSource([ |
| 546 "class A {}", |
| 547 "A f(var p) {", |
| 548 " if (p is! A) {", |
| 549 " return null;", |
| 550 " }", |
| 551 " return p;", |
| 552 "}"])); |
| 398 LibraryElement library = resolve(source); | 553 LibraryElement library = resolve(source); |
| 399 assertNoErrors(); | 554 assertNoErrors(); |
| 400 verify([source]); | 555 verify([source]); |
| 401 CompilationUnit unit = resolveCompilationUnit(source, library); | 556 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 402 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; | 557 ClassDeclaration classA = unit.declarations[0] as ClassDeclaration; |
| 403 InterfaceType typeA = classA.element.type; | 558 InterfaceType typeA = classA.element.type; |
| 404 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; | 559 FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration; |
| 405 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 560 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 406 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 561 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 407 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; | 562 SimpleIdentifier variableName = statement.expression as SimpleIdentifier; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 425 assertNoErrors(); | 580 assertNoErrors(); |
| 426 verify([source]); | 581 verify([source]); |
| 427 CompilationUnit unit = resolveCompilationUnit(source, library); | 582 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 428 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 583 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 429 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 584 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 430 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 585 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 431 IndexExpression indexExpression = statement.expression as IndexExpression; | 586 IndexExpression indexExpression = statement.expression as IndexExpression; |
| 432 JUnitTestCase.assertSame(typeProvider.intType, indexExpression.propagatedTyp
e); | 587 JUnitTestCase.assertSame(typeProvider.intType, indexExpression.propagatedTyp
e); |
| 433 } | 588 } |
| 434 void test_mapLiteral_different() { | 589 void test_mapLiteral_different() { |
| 435 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = {
'0' : 0, 1 : '1', '2' : 2};", " return v;", "}"])); | 590 Source source = addSource(EngineTestCase.createSource([ |
| 591 "f() {", |
| 592 " var v = {'0' : 0, 1 : '1', '2' : 2};", |
| 593 " return v;", |
| 594 "}"])); |
| 436 LibraryElement library = resolve(source); | 595 LibraryElement library = resolve(source); |
| 437 assertNoErrors(); | 596 assertNoErrors(); |
| 438 verify([source]); | 597 verify([source]); |
| 439 CompilationUnit unit = resolveCompilationUnit(source, library); | 598 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 440 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 599 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 441 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 600 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 442 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 601 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 443 SimpleIdentifier identifier = statement.expression as SimpleIdentifier; | 602 SimpleIdentifier identifier = statement.expression as SimpleIdentifier; |
| 444 InterfaceType propagatedType = identifier.propagatedType as InterfaceType; | 603 InterfaceType propagatedType = identifier.propagatedType as InterfaceType; |
| 445 JUnitTestCase.assertSame(typeProvider.mapType.element, propagatedType.elemen
t); | 604 JUnitTestCase.assertSame(typeProvider.mapType.element, propagatedType.elemen
t); |
| 446 List<Type2> typeArguments = propagatedType.typeArguments; | 605 List<Type2> typeArguments = propagatedType.typeArguments; |
| 447 EngineTestCase.assertLength(2, typeArguments); | 606 EngineTestCase.assertLength(2, typeArguments); |
| 448 JUnitTestCase.assertSame(typeProvider.dynamicType, typeArguments[0]); | 607 JUnitTestCase.assertSame(typeProvider.dynamicType, typeArguments[0]); |
| 449 JUnitTestCase.assertSame(typeProvider.dynamicType, typeArguments[1]); | 608 JUnitTestCase.assertSame(typeProvider.dynamicType, typeArguments[1]); |
| 450 } | 609 } |
| 451 void test_mapLiteral_same() { | 610 void test_mapLiteral_same() { |
| 452 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = {
'a' : 0, 'b' : 1, 'c' : 2};", " return v;", "}"])); | 611 Source source = addSource(EngineTestCase.createSource([ |
| 612 "f() {", |
| 613 " var v = {'a' : 0, 'b' : 1, 'c' : 2};", |
| 614 " return v;", |
| 615 "}"])); |
| 453 LibraryElement library = resolve(source); | 616 LibraryElement library = resolve(source); |
| 454 assertNoErrors(); | 617 assertNoErrors(); |
| 455 verify([source]); | 618 verify([source]); |
| 456 CompilationUnit unit = resolveCompilationUnit(source, library); | 619 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 457 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; | 620 FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration; |
| 458 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 621 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 459 ReturnStatement statement = body.block.statements[1] as ReturnStatement; | 622 ReturnStatement statement = body.block.statements[1] as ReturnStatement; |
| 460 SimpleIdentifier identifier = statement.expression as SimpleIdentifier; | 623 SimpleIdentifier identifier = statement.expression as SimpleIdentifier; |
| 461 InterfaceType propagatedType = identifier.propagatedType as InterfaceType; | 624 InterfaceType propagatedType = identifier.propagatedType as InterfaceType; |
| 462 JUnitTestCase.assertSame(typeProvider.mapType.element, propagatedType.elemen
t); | 625 JUnitTestCase.assertSame(typeProvider.mapType.element, propagatedType.elemen
t); |
| 463 List<Type2> typeArguments = propagatedType.typeArguments; | 626 List<Type2> typeArguments = propagatedType.typeArguments; |
| 464 EngineTestCase.assertLength(2, typeArguments); | 627 EngineTestCase.assertLength(2, typeArguments); |
| 465 JUnitTestCase.assertSame(typeProvider.stringType, typeArguments[0]); | 628 JUnitTestCase.assertSame(typeProvider.stringType, typeArguments[0]); |
| 466 JUnitTestCase.assertSame(typeProvider.intType, typeArguments[1]); | 629 JUnitTestCase.assertSame(typeProvider.intType, typeArguments[1]); |
| 467 } | 630 } |
| 468 void test_propagatedReturnType_function_hasReturnType_returnsNull() { | 631 void test_propagatedReturnType_function_hasReturnType_returnsNull() { |
| 469 String code = EngineTestCase.createSource(["String f() => null;", "main() {"
, " var v = f();", "}"]); | 632 String code = EngineTestCase.createSource(["String f() => null;", "main() {"
, " var v = f();", "}"]); |
| 470 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.stri
ngType); | 633 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.stri
ngType); |
| 471 } | 634 } |
| 472 void test_propagatedReturnType_function_lessSpecificStaticReturnType() { | 635 void test_propagatedReturnType_function_lessSpecificStaticReturnType() { |
| 473 String code = EngineTestCase.createSource(["Object f() => 42;", "main() {",
" var v = f();", "}"]); | 636 String code = EngineTestCase.createSource(["Object f() => 42;", "main() {",
" var v = f();", "}"]); |
| 474 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); | 637 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); |
| 475 } | 638 } |
| 476 void test_propagatedReturnType_function_moreSpecificStaticReturnType() { | 639 void test_propagatedReturnType_function_moreSpecificStaticReturnType() { |
| 477 String code = EngineTestCase.createSource(["int f() => (42 as Object);", "ma
in() {", " var v = f();", "}"]); | 640 String code = EngineTestCase.createSource([ |
| 641 "int f() => (42 as Object);", |
| 642 "main() {", |
| 643 " var v = f();", |
| 644 "}"]); |
| 478 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); | 645 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); |
| 479 } | 646 } |
| 480 void test_propagatedReturnType_function_noReturnTypeName_blockBody_multipleRet
urns() { | 647 void test_propagatedReturnType_function_noReturnTypeName_blockBody_multipleRet
urns() { |
| 481 String code = EngineTestCase.createSource(["f() {", " if (true) return 0;",
" return 1.0;", "}", "main() {", " var v = f();", "}"]); | 648 String code = EngineTestCase.createSource([ |
| 649 "f() {", |
| 650 " if (true) return 0;", |
| 651 " return 1.0;", |
| 652 "}", |
| 653 "main() {", |
| 654 " var v = f();", |
| 655 "}"]); |
| 482 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.numT
ype); | 656 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.numT
ype); |
| 483 } | 657 } |
| 484 void test_propagatedReturnType_function_noReturnTypeName_blockBody_oneReturn()
{ | 658 void test_propagatedReturnType_function_noReturnTypeName_blockBody_oneReturn()
{ |
| 485 String code = EngineTestCase.createSource(["f() {", " var z = 42;", " retu
rn z;", "}", "main() {", " var v = f();", "}"]); | 659 String code = EngineTestCase.createSource([ |
| 660 "f() {", |
| 661 " var z = 42;", |
| 662 " return z;", |
| 663 "}", |
| 664 "main() {", |
| 665 " var v = f();", |
| 666 "}"]); |
| 486 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); | 667 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); |
| 487 } | 668 } |
| 488 void test_propagatedReturnType_function_noReturnTypeName_expressionBody() { | 669 void test_propagatedReturnType_function_noReturnTypeName_expressionBody() { |
| 489 String code = EngineTestCase.createSource(["f() => 42;", "main() {", " var
v = f();", "}"]); | 670 String code = EngineTestCase.createSource(["f() => 42;", "main() {", " var
v = f();", "}"]); |
| 490 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); | 671 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); |
| 491 } | 672 } |
| 492 void test_propagatedReturnType_localFunction() { | 673 void test_propagatedReturnType_localFunction() { |
| 493 String code = EngineTestCase.createSource(["main() {", " f() => 42;", " va
r v = f();", "}"]); | 674 String code = EngineTestCase.createSource(["main() {", " f() => 42;", " va
r v = f();", "}"]); |
| 494 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); | 675 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT
ype); |
| 495 } | 676 } |
| 496 void test_query() { | 677 void test_query() { |
| 497 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];", "}"])); | 678 Source source = addSource(EngineTestCase.createSource([ |
| 679 "import 'dart:html';", |
| 680 "", |
| 681 "main() {", |
| 682 " var v1 = query('a');", |
| 683 " var v2 = query('A');", |
| 684 " var v3 = query('body:active');", |
| 685 " var v4 = query('button[foo=\"bar\"]');", |
| 686 " var v5 = query('div.class');", |
| 687 " var v6 = query('input#id');", |
| 688 " var v7 = query('select#id');", |
| 689 " // invocation of method", |
| 690 " var m1 = document.query('div');", |
| 691 " // unsupported currently", |
| 692 " var b1 = query('noSuchTag');", |
| 693 " var b2 = query('DART_EDITOR_NO_SUCH_TYPE');", |
| 694 " var b3 = query('body div');", |
| 695 " return [v1, v2, v3, v4, v5, v6, v7, m1, b1, b2, b3];", |
| 696 "}"])); |
| 498 LibraryElement library = resolve(source); | 697 LibraryElement library = resolve(source); |
| 499 assertNoErrors(); | 698 assertNoErrors(); |
| 500 verify([source]); | 699 verify([source]); |
| 501 CompilationUnit unit = resolveCompilationUnit(source, library); | 700 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 502 FunctionDeclaration main = unit.declarations[0] as FunctionDeclaration; | 701 FunctionDeclaration main = unit.declarations[0] as FunctionDeclaration; |
| 503 BlockFunctionBody body = main.functionExpression.body as BlockFunctionBody; | 702 BlockFunctionBody body = main.functionExpression.body as BlockFunctionBody; |
| 504 ReturnStatement statement = body.block.statements[11] as ReturnStatement; | 703 ReturnStatement statement = body.block.statements[11] as ReturnStatement; |
| 505 NodeList<Expression> elements = ((statement.expression as ListLiteral)).elem
ents; | 704 NodeList<Expression> elements = ((statement.expression as ListLiteral)).elem
ents; |
| 506 JUnitTestCase.assertEquals("AnchorElement", elements[0].propagatedType.name)
; | 705 JUnitTestCase.assertEquals("AnchorElement", elements[0].propagatedType.name)
; |
| 507 JUnitTestCase.assertEquals("AnchorElement", elements[1].propagatedType.name)
; | 706 JUnitTestCase.assertEquals("AnchorElement", elements[1].propagatedType.name)
; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 }); | 877 }); |
| 679 _ut.test('test_query', () { | 878 _ut.test('test_query', () { |
| 680 final __test = new TypePropagationTest(); | 879 final __test = new TypePropagationTest(); |
| 681 runJUnitTest(__test, __test.test_query); | 880 runJUnitTest(__test, __test.test_query); |
| 682 }); | 881 }); |
| 683 }); | 882 }); |
| 684 } | 883 } |
| 685 } | 884 } |
| 686 class NonErrorResolverTest extends ResolverTestCase { | 885 class NonErrorResolverTest extends ResolverTestCase { |
| 687 void test_ambiguousExport() { | 886 void test_ambiguousExport() { |
| 688 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';", "export 'lib2.dart';"])); | 887 Source source = addSource(EngineTestCase.createSource([ |
| 888 "library L;", |
| 889 "export 'lib1.dart';", |
| 890 "export 'lib2.dart';"])); |
| 689 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s M {}"])); | 891 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s M {}"])); |
| 690 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 892 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 691 resolve(source); | 893 resolve(source); |
| 692 assertNoErrors(); | 894 assertNoErrors(); |
| 693 verify([source]); | 895 verify([source]); |
| 694 } | 896 } |
| 695 void test_ambiguousExport_combinators_hide() { | 897 void test_ambiguousExport_combinators_hide() { |
| 696 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';", "export 'lib2.dart' hide B;"])); | 898 Source source = addSource(EngineTestCase.createSource([ |
| 899 "library L;", |
| 900 "export 'lib1.dart';", |
| 901 "export 'lib2.dart' hide B;"])); |
| 697 addSource2("/lib1.dart", EngineTestCase.createSource(["library L1;", "class
A {}", "class B {}"])); | 902 addSource2("/lib1.dart", EngineTestCase.createSource(["library L1;", "class
A {}", "class B {}"])); |
| 698 addSource2("/lib2.dart", EngineTestCase.createSource(["library L2;", "class
B {}", "class C {}"])); | 903 addSource2("/lib2.dart", EngineTestCase.createSource(["library L2;", "class
B {}", "class C {}"])); |
| 699 resolve(source); | 904 resolve(source); |
| 700 assertNoErrors(); | 905 assertNoErrors(); |
| 701 verify([source]); | 906 verify([source]); |
| 702 } | 907 } |
| 703 void test_ambiguousExport_combinators_show() { | 908 void test_ambiguousExport_combinators_show() { |
| 704 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';", "export 'lib2.dart' show C;"])); | 909 Source source = addSource(EngineTestCase.createSource([ |
| 910 "library L;", |
| 911 "export 'lib1.dart';", |
| 912 "export 'lib2.dart' show C;"])); |
| 705 addSource2("/lib1.dart", EngineTestCase.createSource(["library L1;", "class
A {}", "class B {}"])); | 913 addSource2("/lib1.dart", EngineTestCase.createSource(["library L1;", "class
A {}", "class B {}"])); |
| 706 addSource2("/lib2.dart", EngineTestCase.createSource(["library L2;", "class
B {}", "class C {}"])); | 914 addSource2("/lib2.dart", EngineTestCase.createSource(["library L2;", "class
B {}", "class C {}"])); |
| 707 resolve(source); | 915 resolve(source); |
| 708 assertNoErrors(); | 916 assertNoErrors(); |
| 709 verify([source]); | 917 verify([source]); |
| 710 } | 918 } |
| 711 void test_argumentDefinitionTestNonParameter_formalParameter() { | 919 void test_argumentDefinitionTestNonParameter_formalParameter() { |
| 712 Source source = addSource(EngineTestCase.createSource(["f(var v) {", " retu
rn ?v;", "}"])); | 920 Source source = addSource(EngineTestCase.createSource(["f(var v) {", " retu
rn ?v;", "}"])); |
| 713 resolve(source); | 921 resolve(source); |
| 714 assertErrors([ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]); | 922 assertErrors([ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]); |
| 715 verify([source]); | 923 verify([source]); |
| 716 } | 924 } |
| 717 void test_argumentDefinitionTestNonParameter_namedParameter() { | 925 void test_argumentDefinitionTestNonParameter_namedParameter() { |
| 718 Source source = addSource(EngineTestCase.createSource(["f({var v : 0}) {", "
return ?v;", "}"])); | 926 Source source = addSource(EngineTestCase.createSource(["f({var v : 0}) {", "
return ?v;", "}"])); |
| 719 resolve(source); | 927 resolve(source); |
| 720 assertErrors([ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]); | 928 assertErrors([ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]); |
| 721 verify([source]); | 929 verify([source]); |
| 722 } | 930 } |
| 723 void test_argumentDefinitionTestNonParameter_optionalParameter() { | 931 void test_argumentDefinitionTestNonParameter_optionalParameter() { |
| 724 Source source = addSource(EngineTestCase.createSource(["f([var v]) {", " re
turn ?v;", "}"])); | 932 Source source = addSource(EngineTestCase.createSource(["f([var v]) {", " re
turn ?v;", "}"])); |
| 725 resolve(source); | 933 resolve(source); |
| 726 assertErrors([ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]); | 934 assertErrors([ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]); |
| 727 verify([source]); | 935 verify([source]); |
| 728 } | 936 } |
| 729 void test_argumentTypeNotAssignable_classWithCall_Function() { | 937 void test_argumentTypeNotAssignable_classWithCall_Function() { |
| 730 Source source = addSource(EngineTestCase.createSource([" caller(Function ca
llee) {", " callee();", " }", "", " class CallMeBack {", " call() => 0;"
, " }", "", " main() {", " caller(new CallMeBack());", " }"])); | 938 Source source = addSource(EngineTestCase.createSource([ |
| 939 " caller(Function callee) {", |
| 940 " callee();", |
| 941 " }", |
| 942 "", |
| 943 " class CallMeBack {", |
| 944 " call() => 0;", |
| 945 " }", |
| 946 "", |
| 947 " main() {", |
| 948 " caller(new CallMeBack());", |
| 949 " }"])); |
| 731 resolve(source); | 950 resolve(source); |
| 732 assertNoErrors(); | 951 assertNoErrors(); |
| 733 verify([source]); | 952 verify([source]); |
| 734 } | 953 } |
| 735 void test_argumentTypeNotAssignable_invocation_functionParameter_generic() { | 954 void test_argumentTypeNotAssignable_invocation_functionParameter_generic() { |
| 736 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " m(
f(K k), K v) {", " f(v);", " }", "}"])); | 955 Source source = addSource(EngineTestCase.createSource([ |
| 956 "class A<K> {", |
| 957 " m(f(K k), K v) {", |
| 958 " f(v);", |
| 959 " }", |
| 960 "}"])); |
| 737 resolve(source); | 961 resolve(source); |
| 738 assertNoErrors(); | 962 assertNoErrors(); |
| 739 verify([source]); | 963 verify([source]); |
| 740 } | 964 } |
| 741 void test_argumentTypeNotAssignable_invocation_typedef_generic() { | 965 void test_argumentTypeNotAssignable_invocation_typedef_generic() { |
| 742 Source source = addSource(EngineTestCase.createSource(["typedef A<T>(T p);",
"f(A<int> a) {", " a(1);", "}"])); | 966 Source source = addSource(EngineTestCase.createSource(["typedef A<T>(T p);",
"f(A<int> a) {", " a(1);", "}"])); |
| 743 resolve(source); | 967 resolve(source); |
| 744 assertNoErrors(); | 968 assertNoErrors(); |
| 745 verify([source]); | 969 verify([source]); |
| 746 } | 970 } |
| 747 void test_argumentTypeNotAssignable_Object_Function() { | 971 void test_argumentTypeNotAssignable_Object_Function() { |
| 748 Source source = addSource(EngineTestCase.createSource(["main() {", " proces
s(() {});", "}", "process(Object x) {}"])); | 972 Source source = addSource(EngineTestCase.createSource([ |
| 973 "main() {", |
| 974 " process(() {});", |
| 975 "}", |
| 976 "process(Object x) {}"])); |
| 749 resolve(source); | 977 resolve(source); |
| 750 assertNoErrors(); | 978 assertNoErrors(); |
| 751 verify([source]); | 979 verify([source]); |
| 752 } | 980 } |
| 753 void test_argumentTypeNotAssignable_typedef_local() { | 981 void test_argumentTypeNotAssignable_typedef_local() { |
| 754 Source source = addSource(EngineTestCase.createSource(["typedef A(int p1, St
ring p2);", "A getA() => null;", "f() {", " A a = getA();", " a(1, '2');", "}"
])); | 982 Source source = addSource(EngineTestCase.createSource([ |
| 983 "typedef A(int p1, String p2);", |
| 984 "A getA() => null;", |
| 985 "f() {", |
| 986 " A a = getA();", |
| 987 " a(1, '2');", |
| 988 "}"])); |
| 755 resolve(source); | 989 resolve(source); |
| 756 assertNoErrors(); | 990 assertNoErrors(); |
| 757 verify([source]); | 991 verify([source]); |
| 758 } | 992 } |
| 759 void test_argumentTypeNotAssignable_typedef_parameter() { | 993 void test_argumentTypeNotAssignable_typedef_parameter() { |
| 760 Source source = addSource(EngineTestCase.createSource(["typedef A(int p1, St
ring p2);", "f(A a) {", " a(1, '2');", "}"])); | 994 Source source = addSource(EngineTestCase.createSource([ |
| 995 "typedef A(int p1, String p2);", |
| 996 "f(A a) {", |
| 997 " a(1, '2');", |
| 998 "}"])); |
| 761 resolve(source); | 999 resolve(source); |
| 762 assertNoErrors(); | 1000 assertNoErrors(); |
| 763 verify([source]); | 1001 verify([source]); |
| 764 } | 1002 } |
| 765 void test_assignmentToFinal_prefixNegate() { | 1003 void test_assignmentToFinal_prefixNegate() { |
| 766 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " -x;", "}"])); | 1004 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " -x;", "}"])); |
| 767 resolve(source); | 1005 resolve(source); |
| 768 assertNoErrors(); | 1006 assertNoErrors(); |
| 769 verify([source]); | 1007 verify([source]); |
| 770 } | 1008 } |
| 771 void test_assignmentToFinals_importWithPrefix() { | 1009 void test_assignmentToFinals_importWithPrefix() { |
| 772 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'lib1.dart' as foo;", "main() {", " foo.x = true;", "}"])); | 1010 Source source = addSource(EngineTestCase.createSource([ |
| 1011 "library lib;", |
| 1012 "import 'lib1.dart' as foo;", |
| 1013 "main() {", |
| 1014 " foo.x = true;", |
| 1015 "}"])); |
| 773 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "bool
x = false;"])); | 1016 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "bool
x = false;"])); |
| 774 resolve(source); | 1017 resolve(source); |
| 775 assertNoErrors(); | 1018 assertNoErrors(); |
| 776 verify([source]); | 1019 verify([source]); |
| 777 } | 1020 } |
| 778 void test_breakWithoutLabelInSwitch() { | 1021 void test_breakWithoutLabelInSwitch() { |
| 779 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m(int i) {", " switch (i) {", " case 0:", " break;", " }", "
}", "}"])); | 1022 Source source = addSource(EngineTestCase.createSource([ |
| 1023 "class A {", |
| 1024 " void m(int i) {", |
| 1025 " switch (i) {", |
| 1026 " case 0:", |
| 1027 " break;", |
| 1028 " }", |
| 1029 " }", |
| 1030 "}"])); |
| 780 resolve(source); | 1031 resolve(source); |
| 781 assertNoErrors(); | 1032 assertNoErrors(); |
| 782 verify([source]); | 1033 verify([source]); |
| 783 } | 1034 } |
| 784 void test_builtInIdentifierAsType_dynamic() { | 1035 void test_builtInIdentifierAsType_dynamic() { |
| 785 Source source = addSource(EngineTestCase.createSource(["f() {", " dynamic x
;", "}"])); | 1036 Source source = addSource(EngineTestCase.createSource(["f() {", " dynamic x
;", "}"])); |
| 786 resolve(source); | 1037 resolve(source); |
| 787 assertNoErrors(); | 1038 assertNoErrors(); |
| 788 verify([source]); | 1039 verify([source]); |
| 789 } | 1040 } |
| 790 void test_caseBlockNotTerminated() { | 1041 void test_caseBlockNotTerminated() { |
| 791 Source source = addSource(EngineTestCase.createSource(["f(int p) {", " for
(int i = 0; i < 10; i++) {", " switch (p) {", " case 0:", " break
;", " case 1:", " continue;", " case 2:", " return;", "
case 3:", " throw new Object();", " case 4:", " case 5:",
" return;", " case 6:", " default:", " return;", " }"
, " }", "}"])); | 1042 Source source = addSource(EngineTestCase.createSource([ |
| 1043 "f(int p) {", |
| 1044 " for (int i = 0; i < 10; i++) {", |
| 1045 " switch (p) {", |
| 1046 " case 0:", |
| 1047 " break;", |
| 1048 " case 1:", |
| 1049 " continue;", |
| 1050 " case 2:", |
| 1051 " return;", |
| 1052 " case 3:", |
| 1053 " throw new Object();", |
| 1054 " case 4:", |
| 1055 " case 5:", |
| 1056 " return;", |
| 1057 " case 6:", |
| 1058 " default:", |
| 1059 " return;", |
| 1060 " }", |
| 1061 " }", |
| 1062 "}"])); |
| 792 resolve(source); | 1063 resolve(source); |
| 793 assertNoErrors(); | 1064 assertNoErrors(); |
| 794 verify([source]); | 1065 verify([source]); |
| 795 } | 1066 } |
| 796 void test_caseBlockNotTerminated_lastCase() { | 1067 void test_caseBlockNotTerminated_lastCase() { |
| 797 Source source = addSource(EngineTestCase.createSource(["f(int p) {", " swit
ch (p) {", " case 0:", " p = p + 1;", " }", "}"])); | 1068 Source source = addSource(EngineTestCase.createSource([ |
| 1069 "f(int p) {", |
| 1070 " switch (p) {", |
| 1071 " case 0:", |
| 1072 " p = p + 1;", |
| 1073 " }", |
| 1074 "}"])); |
| 798 resolve(source); | 1075 resolve(source); |
| 799 assertNoErrors(); | 1076 assertNoErrors(); |
| 800 verify([source]); | 1077 verify([source]); |
| 801 } | 1078 } |
| 802 void test_caseExpressionTypeImplementsEquals_int() { | 1079 void test_caseExpressionTypeImplementsEquals_int() { |
| 803 Source source = addSource(EngineTestCase.createSource(["f(int i) {", " swit
ch(i) {", " case(1) : return 1;", " default: return 0;", " }", "}"])); | 1080 Source source = addSource(EngineTestCase.createSource([ |
| 1081 "f(int i) {", |
| 1082 " switch(i) {", |
| 1083 " case(1) : return 1;", |
| 1084 " default: return 0;", |
| 1085 " }", |
| 1086 "}"])); |
| 804 resolve(source); | 1087 resolve(source); |
| 805 assertNoErrors(); | 1088 assertNoErrors(); |
| 806 verify([source]); | 1089 verify([source]); |
| 807 } | 1090 } |
| 808 void test_caseExpressionTypeImplementsEquals_Object() { | 1091 void test_caseExpressionTypeImplementsEquals_Object() { |
| 809 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;", " }", "}"])); | 1092 Source source = addSource(EngineTestCase.createSource([ |
| 1093 "class IntWrapper {", |
| 1094 " final int value;", |
| 1095 " const IntWrapper(this.value);", |
| 1096 "}", |
| 1097 "", |
| 1098 "f(IntWrapper intWrapper) {", |
| 1099 " switch(intWrapper) {", |
| 1100 " case(const IntWrapper(1)) : return 1;", |
| 1101 " default: return 0;", |
| 1102 " }", |
| 1103 "}"])); |
| 810 resolve(source); | 1104 resolve(source); |
| 811 assertNoErrors(); | 1105 assertNoErrors(); |
| 812 verify([source]); | 1106 verify([source]); |
| 813 } | 1107 } |
| 814 void test_caseExpressionTypeImplementsEquals_String() { | 1108 void test_caseExpressionTypeImplementsEquals_String() { |
| 815 Source source = addSource(EngineTestCase.createSource(["f(String s) {", " s
witch(s) {", " case('1') : return 1;", " default: return 0;", " }", "}"])
); | 1109 Source source = addSource(EngineTestCase.createSource([ |
| 1110 "f(String s) {", |
| 1111 " switch(s) {", |
| 1112 " case('1') : return 1;", |
| 1113 " default: return 0;", |
| 1114 " }", |
| 1115 "}"])); |
| 816 resolve(source); | 1116 resolve(source); |
| 817 assertNoErrors(); | 1117 assertNoErrors(); |
| 818 verify([source]); | 1118 verify([source]); |
| 819 } | 1119 } |
| 820 void test_concreteClassWithAbstractMember() { | 1120 void test_concreteClassWithAbstractMember() { |
| 821 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", "}"])); | 1121 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", "}"])); |
| 822 resolve(source); | 1122 resolve(source); |
| 823 assertNoErrors(); | 1123 assertNoErrors(); |
| 824 verify([source]); | 1124 verify([source]); |
| 825 } | 1125 } |
| 826 void test_conflictingInstanceGetterAndSuperclassMember_instance() { | 1126 void test_conflictingInstanceGetterAndSuperclassMember_instance() { |
| 827 Source source = addSource(EngineTestCase.createSource(["class A {", " get v
=> 0;", "}", "class B extends A {", " get v => 1;", "}"])); | 1127 Source source = addSource(EngineTestCase.createSource([ |
| 1128 "class A {", |
| 1129 " get v => 0;", |
| 1130 "}", |
| 1131 "class B extends A {", |
| 1132 " get v => 1;", |
| 1133 "}"])); |
| 828 resolve(source); | 1134 resolve(source); |
| 829 assertNoErrors(); | 1135 assertNoErrors(); |
| 830 verify([source]); | 1136 verify([source]); |
| 831 } | 1137 } |
| 832 void test_conflictingStaticGetterAndInstanceSetter_thisClass() { | 1138 void test_conflictingStaticGetterAndInstanceSetter_thisClass() { |
| 833 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c get x => 0;", " static set x(int p) {}", "}"])); | 1139 Source source = addSource(EngineTestCase.createSource([ |
| 1140 "class A {", |
| 1141 " static get x => 0;", |
| 1142 " static set x(int p) {}", |
| 1143 "}"])); |
| 834 resolve(source); | 1144 resolve(source); |
| 835 assertNoErrors(); | 1145 assertNoErrors(); |
| 836 verify([source]); | 1146 verify([source]); |
| 837 } | 1147 } |
| 838 void test_conflictingStaticSetterAndInstanceMember_thisClass_method() { | 1148 void test_conflictingStaticSetterAndInstanceMember_thisClass_method() { |
| 839 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c x() {}", " static set x(int p) {}", "}"])); | 1149 Source source = addSource(EngineTestCase.createSource([ |
| 1150 "class A {", |
| 1151 " static x() {}", |
| 1152 " static set x(int p) {}", |
| 1153 "}"])); |
| 840 resolve(source); | 1154 resolve(source); |
| 841 assertNoErrors(); | 1155 assertNoErrors(); |
| 842 verify([source]); | 1156 verify([source]); |
| 843 } | 1157 } |
| 844 void test_constConstructorWithNonFinalField_finalInstanceVar() { | 1158 void test_constConstructorWithNonFinalField_finalInstanceVar() { |
| 845 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " const A();", "}"])); | 1159 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " const A();", "}"])); |
| 846 resolve(source); | 1160 resolve(source); |
| 847 assertNoErrors(); | 1161 assertNoErrors(); |
| 848 verify([source]); | 1162 verify([source]); |
| 849 } | 1163 } |
| 850 void test_constConstructorWithNonFinalField_mixin() { | 1164 void test_constConstructorWithNonFinalField_mixin() { |
| 851 Source source = addSource(EngineTestCase.createSource(["class A {", " a() {
}", "}", "class B extends Object with A {", " const B();", "}"])); | 1165 Source source = addSource(EngineTestCase.createSource([ |
| 1166 "class A {", |
| 1167 " a() {}", |
| 1168 "}", |
| 1169 "class B extends Object with A {", |
| 1170 " const B();", |
| 1171 "}"])); |
| 852 resolve(source); | 1172 resolve(source); |
| 853 assertNoErrors(); | 1173 assertNoErrors(); |
| 854 verify([source]); | 1174 verify([source]); |
| 855 } | 1175 } |
| 856 void test_constConstructorWithNonFinalField_static() { | 1176 void test_constConstructorWithNonFinalField_static() { |
| 857 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", " const A();", "}"])); | 1177 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", " const A();", "}"])); |
| 858 resolve(source); | 1178 resolve(source); |
| 859 assertNoErrors(); | 1179 assertNoErrors(); |
| 860 verify([source]); | 1180 verify([source]); |
| 861 } | 1181 } |
| 862 void test_constConstructorWithNonFinalField_syntheticField() { | 1182 void test_constConstructorWithNonFinalField_syntheticField() { |
| 863 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", " set x(value) {}", " get x {return 0;}", "}"])); | 1183 Source source = addSource(EngineTestCase.createSource([ |
| 1184 "class A {", |
| 1185 " const A();", |
| 1186 " set x(value) {}", |
| 1187 " get x {return 0;}", |
| 1188 "}"])); |
| 864 resolve(source); | 1189 resolve(source); |
| 865 assertNoErrors(); | 1190 assertNoErrors(); |
| 866 verify([source]); | 1191 verify([source]); |
| 867 } | 1192 } |
| 868 void test_constEval_propertyExtraction_fieldStatic_targetType() { | 1193 void test_constEval_propertyExtraction_fieldStatic_targetType() { |
| 869 addSource2("/math.dart", EngineTestCase.createSource(["library math;", "cons
t PI = 3.14;"])); | 1194 addSource2("/math.dart", EngineTestCase.createSource(["library math;", "cons
t PI = 3.14;"])); |
| 870 Source source = addSource(EngineTestCase.createSource(["import 'math.dart' a
s math;", "const C = math.PI;"])); | 1195 Source source = addSource(EngineTestCase.createSource(["import 'math.dart' a
s math;", "const C = math.PI;"])); |
| 871 resolve(source); | 1196 resolve(source); |
| 872 assertNoErrors(); | 1197 assertNoErrors(); |
| 873 verify([source]); | 1198 verify([source]); |
| 874 } | 1199 } |
| 875 void test_constEval_propertyExtraction_methodStatic_targetType() { | 1200 void test_constEval_propertyExtraction_methodStatic_targetType() { |
| 876 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", " static m() {}", "}", "const C = A.m;"])); | 1201 Source source = addSource(EngineTestCase.createSource([ |
| 1202 "class A {", |
| 1203 " const A();", |
| 1204 " static m() {}", |
| 1205 "}", |
| 1206 "const C = A.m;"])); |
| 877 resolve(source); | 1207 resolve(source); |
| 878 assertNoErrors(); | 1208 assertNoErrors(); |
| 879 verify([source]); | 1209 verify([source]); |
| 880 } | 1210 } |
| 881 void test_constEvalTypeBoolNumString_equal() { | 1211 void test_constEvalTypeBoolNumString_equal() { |
| 882 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "class B {", " final v;", " const B.a1(bool p) : v = p == true;",
" const B.a2(bool p) : v = p == false;", " const B.a3(bool p) : v = p == 0;",
" const B.a4(bool p) : v = p == 0.0;", " const B.a5(bool p) : v = p == '';",
" const B.b1(int p) : v = p == true;", " const B.b2(int p) : v = p == false;",
" const B.b3(int p) : v = p == 0;", " const B.b4(int p) : v = p == 0.0;", "
const B.b5(int p) : v = p == '';", " const B.c1(String p) : v = p == true;", "
const B.c2(String p) : v = p == false;", " const B.c3(String p) : v = p == 0;"
, " const B.c4(String p) : v = p == 0.0;", " const B.c5(String p) : v = p == '
';", " const B.n1(num p) : v = p == null;", " const B.n2(num p) : v = null ==
p;", "}"])); | 1212 Source source = addSource(EngineTestCase.createSource([ |
| 1213 "class A {", |
| 1214 " const A();", |
| 1215 "}", |
| 1216 "class B {", |
| 1217 " final v;", |
| 1218 " const B.a1(bool p) : v = p == true;", |
| 1219 " const B.a2(bool p) : v = p == false;", |
| 1220 " const B.a3(bool p) : v = p == 0;", |
| 1221 " const B.a4(bool p) : v = p == 0.0;", |
| 1222 " const B.a5(bool p) : v = p == '';", |
| 1223 " const B.b1(int p) : v = p == true;", |
| 1224 " const B.b2(int p) : v = p == false;", |
| 1225 " const B.b3(int p) : v = p == 0;", |
| 1226 " const B.b4(int p) : v = p == 0.0;", |
| 1227 " const B.b5(int p) : v = p == '';", |
| 1228 " const B.c1(String p) : v = p == true;", |
| 1229 " const B.c2(String p) : v = p == false;", |
| 1230 " const B.c3(String p) : v = p == 0;", |
| 1231 " const B.c4(String p) : v = p == 0.0;", |
| 1232 " const B.c5(String p) : v = p == '';", |
| 1233 " const B.n1(num p) : v = p == null;", |
| 1234 " const B.n2(num p) : v = null == p;", |
| 1235 "}"])); |
| 883 resolve(source); | 1236 resolve(source); |
| 884 assertNoErrors(); | 1237 assertNoErrors(); |
| 885 verify([source]); | 1238 verify([source]); |
| 886 } | 1239 } |
| 887 void test_constEvalTypeBoolNumString_notEqual() { | 1240 void test_constEvalTypeBoolNumString_notEqual() { |
| 888 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "class B {", " final v;", " const B.a1(bool p) : v = p != true;",
" const B.a2(bool p) : v = p != false;", " const B.a3(bool p) : v = p != 0;",
" const B.a4(bool p) : v = p != 0.0;", " const B.a5(bool p) : v = p != '';",
" const B.b1(int p) : v = p != true;", " const B.b2(int p) : v = p != false;",
" const B.b3(int p) : v = p != 0;", " const B.b4(int p) : v = p != 0.0;", "
const B.b5(int p) : v = p != '';", " const B.c1(String p) : v = p != true;", "
const B.c2(String p) : v = p != false;", " const B.c3(String p) : v = p != 0;"
, " const B.c4(String p) : v = p != 0.0;", " const B.c5(String p) : v = p != '
';", " const B.n1(num p) : v = p != null;", " const B.n2(num p) : v = null !=
p;", "}"])); | 1241 Source source = addSource(EngineTestCase.createSource([ |
| 1242 "class A {", |
| 1243 " const A();", |
| 1244 "}", |
| 1245 "class B {", |
| 1246 " final v;", |
| 1247 " const B.a1(bool p) : v = p != true;", |
| 1248 " const B.a2(bool p) : v = p != false;", |
| 1249 " const B.a3(bool p) : v = p != 0;", |
| 1250 " const B.a4(bool p) : v = p != 0.0;", |
| 1251 " const B.a5(bool p) : v = p != '';", |
| 1252 " const B.b1(int p) : v = p != true;", |
| 1253 " const B.b2(int p) : v = p != false;", |
| 1254 " const B.b3(int p) : v = p != 0;", |
| 1255 " const B.b4(int p) : v = p != 0.0;", |
| 1256 " const B.b5(int p) : v = p != '';", |
| 1257 " const B.c1(String p) : v = p != true;", |
| 1258 " const B.c2(String p) : v = p != false;", |
| 1259 " const B.c3(String p) : v = p != 0;", |
| 1260 " const B.c4(String p) : v = p != 0.0;", |
| 1261 " const B.c5(String p) : v = p != '';", |
| 1262 " const B.n1(num p) : v = p != null;", |
| 1263 " const B.n2(num p) : v = null != p;", |
| 1264 "}"])); |
| 889 resolve(source); | 1265 resolve(source); |
| 890 assertNoErrors(); | 1266 assertNoErrors(); |
| 891 verify([source]); | 1267 verify([source]); |
| 892 } | 1268 } |
| 893 void test_constWithNonConstantArgument_literals() { | 1269 void test_constWithNonConstantArgument_literals() { |
| 894 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A(a, b, c, d);", "}", "f() { return const A(true, 0, 1.0, '2'); }"])); | 1270 Source source = addSource(EngineTestCase.createSource([ |
| 1271 "class A {", |
| 1272 " const A(a, b, c, d);", |
| 1273 "}", |
| 1274 "f() { return const A(true, 0, 1.0, '2'); }"])); |
| 895 resolve(source); | 1275 resolve(source); |
| 896 assertNoErrors(); | 1276 assertNoErrors(); |
| 897 verify([source]); | 1277 verify([source]); |
| 898 } | 1278 } |
| 899 void test_constWithTypeParameters_direct() { | 1279 void test_constWithTypeParameters_direct() { |
| 900 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " st
atic const V = const A<int>();", " const A();", "}"])); | 1280 Source source = addSource(EngineTestCase.createSource([ |
| 1281 "class A<T> {", |
| 1282 " static const V = const A<int>();", |
| 1283 " const A();", |
| 1284 "}"])); |
| 901 resolve(source); | 1285 resolve(source); |
| 902 assertNoErrors(); | 1286 assertNoErrors(); |
| 903 verify([source]); | 1287 verify([source]); |
| 904 } | 1288 } |
| 905 void test_constWithUndefinedConstructor() { | 1289 void test_constWithUndefinedConstructor() { |
| 906 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.name();", "}", "f() {", " return const A.name();", "}"])); | 1290 Source source = addSource(EngineTestCase.createSource([ |
| 1291 "class A {", |
| 1292 " const A.name();", |
| 1293 "}", |
| 1294 "f() {", |
| 1295 " return const A.name();", |
| 1296 "}"])); |
| 907 resolve(source); | 1297 resolve(source); |
| 908 assertNoErrors(); | 1298 assertNoErrors(); |
| 909 verify([source]); | 1299 verify([source]); |
| 910 } | 1300 } |
| 911 void test_constWithUndefinedConstructorDefault() { | 1301 void test_constWithUndefinedConstructorDefault() { |
| 912 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "f() {", " return const A();", "}"])); | 1302 Source source = addSource(EngineTestCase.createSource([ |
| 1303 "class A {", |
| 1304 " const A();", |
| 1305 "}", |
| 1306 "f() {", |
| 1307 " return const A();", |
| 1308 "}"])); |
| 913 resolve(source); | 1309 resolve(source); |
| 914 assertNoErrors(); | 1310 assertNoErrors(); |
| 915 verify([source]); | 1311 verify([source]); |
| 916 } | 1312 } |
| 917 void test_defaultValueInFunctionTypeAlias() { | 1313 void test_defaultValueInFunctionTypeAlias() { |
| 918 Source source = addSource(EngineTestCase.createSource(["typedef F([x]);"])); | 1314 Source source = addSource(EngineTestCase.createSource(["typedef F([x]);"])); |
| 919 resolve(source); | 1315 resolve(source); |
| 920 assertErrors([]); | 1316 assertErrors([]); |
| 921 verify([source]); | 1317 verify([source]); |
| 922 } | 1318 } |
| 923 void test_duplicateDefinition_emptyName() { | 1319 void test_duplicateDefinition_emptyName() { |
| 924 Source source = addSource(EngineTestCase.createSource(["Map _globalMap = {",
" 'a' : () {},", " 'b' : () {}", "};"])); | 1320 Source source = addSource(EngineTestCase.createSource([ |
| 1321 "Map _globalMap = {", |
| 1322 " 'a' : () {},", |
| 1323 " 'b' : () {}", |
| 1324 "};"])); |
| 925 resolve(source); | 1325 resolve(source); |
| 926 assertNoErrors(); | 1326 assertNoErrors(); |
| 927 verify([source]); | 1327 verify([source]); |
| 928 } | 1328 } |
| 929 void test_duplicateDefinition_getter() { | 1329 void test_duplicateDefinition_getter() { |
| 930 Source source = addSource(EngineTestCase.createSource(["bool get a => true;"
])); | 1330 Source source = addSource(EngineTestCase.createSource(["bool get a => true;"
])); |
| 931 resolve(source); | 1331 resolve(source); |
| 932 assertNoErrors(); | 1332 assertNoErrors(); |
| 933 verify([source]); | 1333 verify([source]); |
| 934 } | 1334 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 952 assertNoErrors(); | 1352 assertNoErrors(); |
| 953 verify([source]); | 1353 verify([source]); |
| 954 } | 1354 } |
| 955 void test_extraPositionalArguments_Function() { | 1355 void test_extraPositionalArguments_Function() { |
| 956 Source source = addSource(EngineTestCase.createSource(["f(Function a) {", "
a(1, 2);", "}"])); | 1356 Source source = addSource(EngineTestCase.createSource(["f(Function a) {", "
a(1, 2);", "}"])); |
| 957 resolve(source); | 1357 resolve(source); |
| 958 assertNoErrors(); | 1358 assertNoErrors(); |
| 959 verify([source]); | 1359 verify([source]); |
| 960 } | 1360 } |
| 961 void test_extraPositionalArguments_typedef_local() { | 1361 void test_extraPositionalArguments_typedef_local() { |
| 962 Source source = addSource(EngineTestCase.createSource(["typedef A(p1, p2);",
"A getA() => null;", "f() {", " A a = getA();", " a(1, 2);", "}"])); | 1362 Source source = addSource(EngineTestCase.createSource([ |
| 1363 "typedef A(p1, p2);", |
| 1364 "A getA() => null;", |
| 1365 "f() {", |
| 1366 " A a = getA();", |
| 1367 " a(1, 2);", |
| 1368 "}"])); |
| 963 resolve(source); | 1369 resolve(source); |
| 964 assertNoErrors(); | 1370 assertNoErrors(); |
| 965 verify([source]); | 1371 verify([source]); |
| 966 } | 1372 } |
| 967 void test_extraPositionalArguments_typedef_parameter() { | 1373 void test_extraPositionalArguments_typedef_parameter() { |
| 968 Source source = addSource(EngineTestCase.createSource(["typedef A(p1, p2);",
"f(A a) {", " a(1, 2);", "}"])); | 1374 Source source = addSource(EngineTestCase.createSource(["typedef A(p1, p2);",
"f(A a) {", " a(1, 2);", "}"])); |
| 969 resolve(source); | 1375 resolve(source); |
| 970 assertNoErrors(); | 1376 assertNoErrors(); |
| 971 verify([source]); | 1377 verify([source]); |
| 972 } | 1378 } |
| 973 void test_fieldInitializedByMultipleInitializers() { | 1379 void test_fieldInitializedByMultipleInitializers() { |
| 974 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " int y;", " A() : x = 0, y = 0 {}", "}"])); | 1380 Source source = addSource(EngineTestCase.createSource([ |
| 1381 "class A {", |
| 1382 " int x;", |
| 1383 " int y;", |
| 1384 " A() : x = 0, y = 0 {}", |
| 1385 "}"])); |
| 975 resolve(source); | 1386 resolve(source); |
| 976 assertNoErrors(); | 1387 assertNoErrors(); |
| 977 verify([source]); | 1388 verify([source]); |
| 978 } | 1389 } |
| 979 void test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() { | 1390 void test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() { |
| 980 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
= 0;", " A() : x = 1 {}", "}"])); | 1391 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
= 0;", " A() : x = 1 {}", "}"])); |
| 981 resolve(source); | 1392 resolve(source); |
| 982 assertNoErrors(); | 1393 assertNoErrors(); |
| 983 verify([source]); | 1394 verify([source]); |
| 984 } | 1395 } |
| 985 void test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() { | 1396 void test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() { |
| 986 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 1 {}", "}"])); | 1397 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 1 {}", "}"])); |
| 987 resolve(source); | 1398 resolve(source); |
| 988 assertNoErrors(); | 1399 assertNoErrors(); |
| 989 verify([source]); | 1400 verify([source]); |
| 990 } | 1401 } |
| 991 void test_fieldInitializerOutsideConstructor() { | 1402 void test_fieldInitializerOutsideConstructor() { |
| 992 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); | 1403 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); |
| 993 resolve(source); | 1404 resolve(source); |
| 994 assertNoErrors(); | 1405 assertNoErrors(); |
| 995 verify([source]); | 1406 verify([source]); |
| 996 } | 1407 } |
| 997 void test_fieldInitializerOutsideConstructor_defaultParameters() { | 1408 void test_fieldInitializerOutsideConstructor_defaultParameters() { |
| 998 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A([this.x]) {}", "}"])); | 1409 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A([this.x]) {}", "}"])); |
| 999 resolve(source); | 1410 resolve(source); |
| 1000 assertNoErrors(); | 1411 assertNoErrors(); |
| 1001 verify([source]); | 1412 verify([source]); |
| 1002 } | 1413 } |
| 1003 void test_fieldInitializerRedirectingConstructor_super() { | 1414 void test_fieldInitializerRedirectingConstructor_super() { |
| 1004 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "class B extends A {", " int x;", " A(this.x) : super();", "}"])); | 1415 Source source = addSource(EngineTestCase.createSource([ |
| 1416 "class A {", |
| 1417 " A() {}", |
| 1418 "}", |
| 1419 "class B extends A {", |
| 1420 " int x;", |
| 1421 " A(this.x) : super();", |
| 1422 "}"])); |
| 1005 resolve(source); | 1423 resolve(source); |
| 1006 assertNoErrors(); | 1424 assertNoErrors(); |
| 1007 verify([source]); | 1425 verify([source]); |
| 1008 } | 1426 } |
| 1009 void test_finalInitializedInDeclarationAndConstructor_initializer() { | 1427 void test_finalInitializedInDeclarationAndConstructor_initializer() { |
| 1010 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A() : x = 1 {}", "}"])); | 1428 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A() : x = 1 {}", "}"])); |
| 1011 resolve(source); | 1429 resolve(source); |
| 1012 assertNoErrors(); | 1430 assertNoErrors(); |
| 1013 verify([source]); | 1431 verify([source]); |
| 1014 } | 1432 } |
| 1015 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { | 1433 void test_finalInitializedInDeclarationAndConstructor_initializingFormal() { |
| 1016 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A(this.x) {}", "}"])); | 1434 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A(this.x) {}", "}"])); |
| 1017 resolve(source); | 1435 resolve(source); |
| 1018 assertNoErrors(); | 1436 assertNoErrors(); |
| 1019 verify([source]); | 1437 verify([source]); |
| 1020 } | 1438 } |
| 1021 void test_finalNotInitialized_atDeclaration() { | 1439 void test_finalNotInitialized_atDeclaration() { |
| 1022 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() {}", "}"])); | 1440 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() {}", "}"])); |
| 1023 resolve(source); | 1441 resolve(source); |
| 1024 assertNoErrors(); | 1442 assertNoErrors(); |
| 1025 verify([source]); | 1443 verify([source]); |
| 1026 } | 1444 } |
| 1027 void test_finalNotInitialized_fieldFormal() { | 1445 void test_finalNotInitialized_fieldFormal() { |
| 1028 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() {}", "}"])); | 1446 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() {}", "}"])); |
| 1029 resolve(source); | 1447 resolve(source); |
| 1030 assertNoErrors(); | 1448 assertNoErrors(); |
| 1031 verify([source]); | 1449 verify([source]); |
| 1032 } | 1450 } |
| 1451 void test_finalNotInitialized_functionTypedFieldFormal() { |
| 1452 Source source = addSource(EngineTestCase.createSource([ |
| 1453 "class A {", |
| 1454 " final Function x;", |
| 1455 " A(int this.x(int p)) {}", |
| 1456 "}"])); |
| 1457 resolve(source); |
| 1458 assertNoErrors(); |
| 1459 verify([source]); |
| 1460 } |
| 1461 void test_finalNotInitialized_hasNativeClause_hasConstructor() { |
| 1462 Source source = addSource(EngineTestCase.createSource([ |
| 1463 "class A native 'something' {", |
| 1464 " final int x;", |
| 1465 " A() {}", |
| 1466 "}"])); |
| 1467 resolve(source); |
| 1468 assertNoErrors(); |
| 1469 verify([source]); |
| 1470 } |
| 1471 void test_finalNotInitialized_hasNativeClause_noConstructor() { |
| 1472 Source source = addSource(EngineTestCase.createSource(["class A native 'some
thing' {", " final int x;", "}"])); |
| 1473 resolve(source); |
| 1474 assertNoErrors(); |
| 1475 verify([source]); |
| 1476 } |
| 1033 void test_finalNotInitialized_initializer() { | 1477 void test_finalNotInitialized_initializer() { |
| 1034 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 0 {}", "}"])); | 1478 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 0 {}", "}"])); |
| 1035 resolve(source); | 1479 resolve(source); |
| 1036 assertNoErrors(); | 1480 assertNoErrors(); |
| 1037 verify([source]); | 1481 verify([source]); |
| 1038 } | 1482 } |
| 1483 void test_finalNotInitialized_redirectingConstructor() { |
| 1484 Source source = addSource(EngineTestCase.createSource([ |
| 1485 "class A {", |
| 1486 " final int x;", |
| 1487 " A(this.x);", |
| 1488 " A.named() : this (42);", |
| 1489 "}"])); |
| 1490 resolve(source); |
| 1491 assertNoErrors(); |
| 1492 verify([source]); |
| 1493 } |
| 1039 void test_implicitThisReferenceInInitializer_constructorName() { | 1494 void test_implicitThisReferenceInInitializer_constructorName() { |
| 1040 Source source = addSource(EngineTestCase.createSource(["class A {", " A.nam
ed() {}", "}", "class B {", " var v;", " B() : v = new A.named();", "}"])); | 1495 Source source = addSource(EngineTestCase.createSource([ |
| 1496 "class A {", |
| 1497 " A.named() {}", |
| 1498 "}", |
| 1499 "class B {", |
| 1500 " var v;", |
| 1501 " B() : v = new A.named();", |
| 1502 "}"])); |
| 1041 resolve(source); | 1503 resolve(source); |
| 1042 assertNoErrors(); | 1504 assertNoErrors(); |
| 1043 verify([source]); | 1505 verify([source]); |
| 1044 } | 1506 } |
| 1045 void test_implicitThisReferenceInInitializer_prefixedIdentifier() { | 1507 void test_implicitThisReferenceInInitializer_prefixedIdentifier() { |
| 1046 Source source = addSource(EngineTestCase.createSource(["class A {", " var f
;", "}", "class B {", " var v;", " B(A a) : v = a.f;", "}"])); | 1508 Source source = addSource(EngineTestCase.createSource([ |
| 1509 "class A {", |
| 1510 " var f;", |
| 1511 "}", |
| 1512 "class B {", |
| 1513 " var v;", |
| 1514 " B(A a) : v = a.f;", |
| 1515 "}"])); |
| 1047 resolve(source); | 1516 resolve(source); |
| 1048 assertNoErrors(); | 1517 assertNoErrors(); |
| 1049 verify([source]); | 1518 verify([source]); |
| 1050 } | 1519 } |
| 1051 void test_implicitThisReferenceInInitializer_qualifiedMethodInvocation() { | 1520 void test_implicitThisReferenceInInitializer_qualifiedMethodInvocation() { |
| 1052 Source source = addSource(EngineTestCase.createSource(["class A {", " f() {
}", "}", "class B {", " var v;", " B() : v = new A().f();", "}"])); | 1521 Source source = addSource(EngineTestCase.createSource([ |
| 1522 "class A {", |
| 1523 " f() {}", |
| 1524 "}", |
| 1525 "class B {", |
| 1526 " var v;", |
| 1527 " B() : v = new A().f();", |
| 1528 "}"])); |
| 1053 resolve(source); | 1529 resolve(source); |
| 1054 assertNoErrors(); | 1530 assertNoErrors(); |
| 1055 verify([source]); | 1531 verify([source]); |
| 1056 } | 1532 } |
| 1057 void test_implicitThisReferenceInInitializer_qualifiedPropertyAccess() { | 1533 void test_implicitThisReferenceInInitializer_qualifiedPropertyAccess() { |
| 1058 Source source = addSource(EngineTestCase.createSource(["class A {", " var f
;", "}", "class B {", " var v;", " B() : v = new A().f;", "}"])); | 1534 Source source = addSource(EngineTestCase.createSource([ |
| 1535 "class A {", |
| 1536 " var f;", |
| 1537 "}", |
| 1538 "class B {", |
| 1539 " var v;", |
| 1540 " B() : v = new A().f;", |
| 1541 "}"])); |
| 1059 resolve(source); | 1542 resolve(source); |
| 1060 assertNoErrors(); | 1543 assertNoErrors(); |
| 1061 verify([source]); | 1544 verify([source]); |
| 1062 } | 1545 } |
| 1063 void test_implicitThisReferenceInInitializer_staticField_superClass() { | 1546 void test_implicitThisReferenceInInitializer_staticField_superClass() { |
| 1064 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c var f;", "}", "class B extends A {", " var v;", " B() : v = f;", "}"])); | 1547 Source source = addSource(EngineTestCase.createSource([ |
| 1548 "class A {", |
| 1549 " static var f;", |
| 1550 "}", |
| 1551 "class B extends A {", |
| 1552 " var v;", |
| 1553 " B() : v = f;", |
| 1554 "}"])); |
| 1065 resolve(source); | 1555 resolve(source); |
| 1066 assertNoErrors(); | 1556 assertNoErrors(); |
| 1067 verify([source]); | 1557 verify([source]); |
| 1068 } | 1558 } |
| 1069 void test_implicitThisReferenceInInitializer_staticField_thisClass() { | 1559 void test_implicitThisReferenceInInitializer_staticField_thisClass() { |
| 1070 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f;", " static var f;", "}"])); | 1560 Source source = addSource(EngineTestCase.createSource([ |
| 1561 "class A {", |
| 1562 " var v;", |
| 1563 " A() : v = f;", |
| 1564 " static var f;", |
| 1565 "}"])); |
| 1071 resolve(source); | 1566 resolve(source); |
| 1072 assertNoErrors(); | 1567 assertNoErrors(); |
| 1073 verify([source]); | 1568 verify([source]); |
| 1074 } | 1569 } |
| 1075 void test_implicitThisReferenceInInitializer_staticGetter() { | 1570 void test_implicitThisReferenceInInitializer_staticGetter() { |
| 1076 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f;", " static get f => 42;", "}"])); | 1571 Source source = addSource(EngineTestCase.createSource([ |
| 1572 "class A {", |
| 1573 " var v;", |
| 1574 " A() : v = f;", |
| 1575 " static get f => 42;", |
| 1576 "}"])); |
| 1077 resolve(source); | 1577 resolve(source); |
| 1078 assertNoErrors(); | 1578 assertNoErrors(); |
| 1079 verify([source]); | 1579 verify([source]); |
| 1080 } | 1580 } |
| 1081 void test_implicitThisReferenceInInitializer_staticMethod() { | 1581 void test_implicitThisReferenceInInitializer_staticMethod() { |
| 1082 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f();", " static f() => 42;", "}"])); | 1582 Source source = addSource(EngineTestCase.createSource([ |
| 1583 "class A {", |
| 1584 " var v;", |
| 1585 " A() : v = f();", |
| 1586 " static f() => 42;", |
| 1587 "}"])); |
| 1083 resolve(source); | 1588 resolve(source); |
| 1084 assertNoErrors(); | 1589 assertNoErrors(); |
| 1085 verify([source]); | 1590 verify([source]); |
| 1086 } | 1591 } |
| 1087 void test_implicitThisReferenceInInitializer_topLevelField() { | 1592 void test_implicitThisReferenceInInitializer_topLevelField() { |
| 1088 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f;", "}", "var f = 42;"])); | 1593 Source source = addSource(EngineTestCase.createSource([ |
| 1594 "class A {", |
| 1595 " var v;", |
| 1596 " A() : v = f;", |
| 1597 "}", |
| 1598 "var f = 42;"])); |
| 1089 resolve(source); | 1599 resolve(source); |
| 1090 assertNoErrors(); | 1600 assertNoErrors(); |
| 1091 verify([source]); | 1601 verify([source]); |
| 1092 } | 1602 } |
| 1093 void test_implicitThisReferenceInInitializer_topLevelFunction() { | 1603 void test_implicitThisReferenceInInitializer_topLevelFunction() { |
| 1094 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f();", "}", "f() => 42;"])); | 1604 Source source = addSource(EngineTestCase.createSource([ |
| 1605 "class A {", |
| 1606 " var v;", |
| 1607 " A() : v = f();", |
| 1608 "}", |
| 1609 "f() => 42;"])); |
| 1095 resolve(source); | 1610 resolve(source); |
| 1096 assertNoErrors(); | 1611 assertNoErrors(); |
| 1097 verify([source]); | 1612 verify([source]); |
| 1098 } | 1613 } |
| 1099 void test_implicitThisReferenceInInitializer_topLevelGetter() { | 1614 void test_implicitThisReferenceInInitializer_topLevelGetter() { |
| 1100 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f;", "}", "get f => 42;"])); | 1615 Source source = addSource(EngineTestCase.createSource([ |
| 1616 "class A {", |
| 1617 " var v;", |
| 1618 " A() : v = f;", |
| 1619 "}", |
| 1620 "get f => 42;"])); |
| 1101 resolve(source); | 1621 resolve(source); |
| 1102 assertNoErrors(); | 1622 assertNoErrors(); |
| 1103 verify([source]); | 1623 verify([source]); |
| 1104 } | 1624 } |
| 1105 void test_implicitThisReferenceInInitializer_typeVariable() { | 1625 void test_implicitThisReferenceInInitializer_typeVariable() { |
| 1106 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " va
r v;", " A(p) : v = (p is T);", "}"])); | 1626 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " va
r v;", " A(p) : v = (p is T);", "}"])); |
| 1107 resolve(source); | 1627 resolve(source); |
| 1108 assertNoErrors(); | 1628 assertNoErrors(); |
| 1109 verify([source]); | 1629 verify([source]); |
| 1110 } | 1630 } |
| 1111 void test_importDuplicatedLibraryName() { | 1631 void test_importDuplicatedLibraryName() { |
| 1112 Source source = addSource(EngineTestCase.createSource(["library test;", "imp
ort 'lib.dart';", "import 'lib.dart';"])); | 1632 Source source = addSource(EngineTestCase.createSource([ |
| 1633 "library test;", |
| 1634 "import 'lib.dart';", |
| 1635 "import 'lib.dart';"])); |
| 1113 addSource2("/lib.dart", "library lib;"); | 1636 addSource2("/lib.dart", "library lib;"); |
| 1114 resolve(source); | 1637 resolve(source); |
| 1115 assertNoErrors(); | 1638 assertNoErrors(); |
| 1116 verify([source]); | 1639 verify([source]); |
| 1117 } | 1640 } |
| 1118 void test_importOfNonLibrary_libraryDeclared() { | 1641 void test_importOfNonLibrary_libraryDeclared() { |
| 1119 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); | 1642 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); |
| 1120 addSource2("/part.dart", EngineTestCase.createSource(["library lib1;"])); | 1643 addSource2("/part.dart", EngineTestCase.createSource(["library lib1;"])); |
| 1121 resolve(source); | 1644 resolve(source); |
| 1122 assertNoErrors(); | 1645 assertNoErrors(); |
| 1123 verify([source]); | 1646 verify([source]); |
| 1124 } | 1647 } |
| 1125 void test_importOfNonLibrary_libraryNotDeclared() { | 1648 void test_importOfNonLibrary_libraryNotDeclared() { |
| 1126 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); | 1649 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); |
| 1127 addSource2("/part.dart", EngineTestCase.createSource([""])); | 1650 addSource2("/part.dart", EngineTestCase.createSource([""])); |
| 1128 resolve(source); | 1651 resolve(source); |
| 1129 assertNoErrors(); | 1652 assertNoErrors(); |
| 1130 verify([source]); | 1653 verify([source]); |
| 1131 } | 1654 } |
| 1132 void test_inconsistentCaseExpressionTypes() { | 1655 void test_inconsistentCaseExpressionTypes() { |
| 1133 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " swit
ch (p) {", " case 1:", " break;", " case 2:", " break;", " }",
"}"])); | 1656 Source source = addSource(EngineTestCase.createSource([ |
| 1657 "f(var p) {", |
| 1658 " switch (p) {", |
| 1659 " case 1:", |
| 1660 " break;", |
| 1661 " case 2:", |
| 1662 " break;", |
| 1663 " }", |
| 1664 "}"])); |
| 1134 resolve(source); | 1665 resolve(source); |
| 1135 assertNoErrors(); | 1666 assertNoErrors(); |
| 1136 verify([source]); | 1667 verify([source]); |
| 1137 } | 1668 } |
| 1138 void test_initializingFormalForNonExistantField() { | 1669 void test_initializingFormalForNonExistantField() { |
| 1139 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); | 1670 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); |
| 1140 resolve(source); | 1671 resolve(source); |
| 1141 assertNoErrors(); | 1672 assertNoErrors(); |
| 1142 verify([source]); | 1673 verify([source]); |
| 1143 } | 1674 } |
| 1144 void test_instanceMemberAccessFromStatic_fromComment() { | 1675 void test_instanceMemberAccessFromStatic_fromComment() { |
| 1145 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", " /// [m]", " static foo() {", " }", "}"])); | 1676 Source source = addSource(EngineTestCase.createSource([ |
| 1677 "class A {", |
| 1678 " m() {}", |
| 1679 " /// [m]", |
| 1680 " static foo() {", |
| 1681 " }", |
| 1682 "}"])); |
| 1146 resolve(source); | 1683 resolve(source); |
| 1147 assertNoErrors(); | 1684 assertNoErrors(); |
| 1148 verify([source]); | 1685 verify([source]); |
| 1149 } | 1686 } |
| 1150 void test_invalidAnnotation_constantVariable() { | 1687 void test_invalidAnnotation_constantVariable() { |
| 1151 Source source = addSource(EngineTestCase.createSource(["const C = 0;", "@C",
"main() {", "}"])); | 1688 Source source = addSource(EngineTestCase.createSource(["const C = 0;", "@C",
"main() {", "}"])); |
| 1152 resolve(source); | 1689 resolve(source); |
| 1153 assertNoErrors(); | 1690 assertNoErrors(); |
| 1154 verify([source]); | 1691 verify([source]); |
| 1155 } | 1692 } |
| 1156 void test_invalidAnnotation_importWithPrefix_constantVariable() { | 1693 void test_invalidAnnotation_importWithPrefix_constantVariable() { |
| 1157 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "const
C = 0;"])); | 1694 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "const
C = 0;"])); |
| 1158 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "@p.C", "main() {", "}"])); | 1695 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "@p.C", "main() {", "}"])); |
| 1159 resolve(source); | 1696 resolve(source); |
| 1160 assertNoErrors(); | 1697 assertNoErrors(); |
| 1161 verify([source]); | 1698 verify([source]); |
| 1162 } | 1699 } |
| 1163 void test_invalidAnnotation_importWithPrefix_constConstructor() { | 1700 void test_invalidAnnotation_importWithPrefix_constConstructor() { |
| 1164 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A {", " const A.named(int p);", "}"])); | 1701 addSource2("/lib.dart", EngineTestCase.createSource([ |
| 1165 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "@p.A.named(42)", "main() {", "}"])); | 1702 "library lib;", |
| 1703 "class A {", |
| 1704 " const A.named(int p);", |
| 1705 "}"])); |
| 1706 Source source = addSource(EngineTestCase.createSource([ |
| 1707 "import 'lib.dart' as p;", |
| 1708 "@p.A.named(42)", |
| 1709 "main() {", |
| 1710 "}"])); |
| 1166 resolve(source); | 1711 resolve(source); |
| 1167 assertNoErrors(); | 1712 assertNoErrors(); |
| 1168 verify([source]); | 1713 verify([source]); |
| 1169 } | 1714 } |
| 1170 void test_invalidAssignment() { | 1715 void test_invalidAssignment() { |
| 1171 Source source = addSource(EngineTestCase.createSource(["f() {", " var x;",
" var y;", " x = y;", "}"])); | 1716 Source source = addSource(EngineTestCase.createSource(["f() {", " var x;",
" var y;", " x = y;", "}"])); |
| 1172 resolve(source); | 1717 resolve(source); |
| 1173 assertNoErrors(); | 1718 assertNoErrors(); |
| 1174 verify([source]); | 1719 verify([source]); |
| 1175 } | 1720 } |
| 1176 void test_invalidAssignment_compoundAssignment() { | 1721 void test_invalidAssignment_compoundAssignment() { |
| 1177 Source source = addSource(EngineTestCase.createSource(["class byte {", " in
t _value;", " byte(this._value);", " byte operator +(int val) {}", "}", "", "v
oid main() {", " byte b = new byte(52);", " b += 3;", "}"])); | 1722 Source source = addSource(EngineTestCase.createSource([ |
| 1723 "class byte {", |
| 1724 " int _value;", |
| 1725 " byte(this._value);", |
| 1726 " byte operator +(int val) {}", |
| 1727 "}", |
| 1728 "", |
| 1729 "void main() {", |
| 1730 " byte b = new byte(52);", |
| 1731 " b += 3;", |
| 1732 "}"])); |
| 1178 resolve(source); | 1733 resolve(source); |
| 1179 assertNoErrors(); | 1734 assertNoErrors(); |
| 1180 verify([source]); | 1735 verify([source]); |
| 1181 } | 1736 } |
| 1182 void test_invalidAssignment_toDynamic() { | 1737 void test_invalidAssignment_toDynamic() { |
| 1183 Source source = addSource(EngineTestCase.createSource(["f() {", " var g;",
" g = () => 0;", "}"])); | 1738 Source source = addSource(EngineTestCase.createSource(["f() {", " var g;",
" g = () => 0;", "}"])); |
| 1184 resolve(source); | 1739 resolve(source); |
| 1185 assertNoErrors(); | 1740 assertNoErrors(); |
| 1186 verify([source]); | 1741 verify([source]); |
| 1187 } | 1742 } |
| 1188 void test_invalidFactoryNameNotAClass() { | 1743 void test_invalidFactoryNameNotAClass() { |
| 1189 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() {}", "}"])); | 1744 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() {}", "}"])); |
| 1190 resolve(source); | 1745 resolve(source); |
| 1191 assertNoErrors(); | 1746 assertNoErrors(); |
| 1192 verify([source]); | 1747 verify([source]); |
| 1193 } | 1748 } |
| 1194 void test_invalidMethodOverrideNamedParamType() { | 1749 void test_invalidMethodOverrideNamedParamType() { |
| 1195 Source source = addSource(EngineTestCase.createSource(["class A {", " m({in
t a}) {}", "}", "class B implements A {", " m({int a, int b}) {}", "}"])); | 1750 Source source = addSource(EngineTestCase.createSource([ |
| 1751 "class A {", |
| 1752 " m({int a}) {}", |
| 1753 "}", |
| 1754 "class B implements A {", |
| 1755 " m({int a, int b}) {}", |
| 1756 "}"])); |
| 1196 resolve(source); | 1757 resolve(source); |
| 1197 assertNoErrors(); | 1758 assertNoErrors(); |
| 1198 verify([source]); | 1759 verify([source]); |
| 1199 } | 1760 } |
| 1200 void test_invalidOverrideDifferentDefaultValues_named() { | 1761 void test_invalidOverrideDifferentDefaultValues_named() { |
| 1201 Source source = addSource(EngineTestCase.createSource(["class A {", " m({in
t p : 0}) {}", "}", "class B extends A {", " m({int p : 0}) {}", "}"])); | 1762 Source source = addSource(EngineTestCase.createSource([ |
| 1763 "class A {", |
| 1764 " m({int p : 0}) {}", |
| 1765 "}", |
| 1766 "class B extends A {", |
| 1767 " m({int p : 0}) {}", |
| 1768 "}"])); |
| 1202 resolve(source); | 1769 resolve(source); |
| 1203 assertNoErrors(); | 1770 assertNoErrors(); |
| 1204 verify([source]); | 1771 verify([source]); |
| 1205 } | 1772 } |
| 1206 void test_invalidOverrideDifferentDefaultValues_positional() { | 1773 void test_invalidOverrideDifferentDefaultValues_positional() { |
| 1207 Source source = addSource(EngineTestCase.createSource(["class A {", " m([in
t p = 0]) {}", "}", "class B extends A {", " m([int p = 0]) {}", "}"])); | 1774 Source source = addSource(EngineTestCase.createSource([ |
| 1775 "class A {", |
| 1776 " m([int p = 0]) {}", |
| 1777 "}", |
| 1778 "class B extends A {", |
| 1779 " m([int p = 0]) {}", |
| 1780 "}"])); |
| 1208 resolve(source); | 1781 resolve(source); |
| 1209 assertNoErrors(); | 1782 assertNoErrors(); |
| 1210 verify([source]); | 1783 verify([source]); |
| 1211 } | 1784 } |
| 1212 void test_invalidOverrideDifferentDefaultValues_positional_changedOrder() { | 1785 void test_invalidOverrideDifferentDefaultValues_positional_changedOrder() { |
| 1213 Source source = addSource(EngineTestCase.createSource(["class A {", " m([in
t a = 0, String b = '0']) {}", "}", "class B extends A {", " m([int b = 0, Stri
ng a = '0']) {}", "}"])); | 1786 Source source = addSource(EngineTestCase.createSource([ |
| 1787 "class A {", |
| 1788 " m([int a = 0, String b = '0']) {}", |
| 1789 "}", |
| 1790 "class B extends A {", |
| 1791 " m([int b = 0, String a = '0']) {}", |
| 1792 "}"])); |
| 1214 resolve(source); | 1793 resolve(source); |
| 1215 assertNoErrors(); | 1794 assertNoErrors(); |
| 1216 verify([source]); | 1795 verify([source]); |
| 1217 } | 1796 } |
| 1218 void test_invalidOverrideNamed_unorderedNamedParameter() { | 1797 void test_invalidOverrideNamed_unorderedNamedParameter() { |
| 1219 Source source = addSource(EngineTestCase.createSource(["class A {", " m({a,
b}) {}", "}", "class B extends A {", " m({b, a}) {}", "}"])); | 1798 Source source = addSource(EngineTestCase.createSource([ |
| 1799 "class A {", |
| 1800 " m({a, b}) {}", |
| 1801 "}", |
| 1802 "class B extends A {", |
| 1803 " m({b, a}) {}", |
| 1804 "}"])); |
| 1220 resolve(source); | 1805 resolve(source); |
| 1221 assertNoErrors(); | 1806 assertNoErrors(); |
| 1222 verify([source]); | 1807 verify([source]); |
| 1223 } | 1808 } |
| 1224 void test_invalidOverrideReturnType_returnType_interface() { | 1809 void test_invalidOverrideReturnType_returnType_interface() { |
| 1225 Source source = addSource2("/test.dart", EngineTestCase.createSource(["abstr
act class A {", " num m();", "}", "class B implements A {", " int m() { return
1; }", "}"])); | 1810 Source source = addSource2("/test.dart", EngineTestCase.createSource([ |
| 1811 "abstract class A {", |
| 1812 " num m();", |
| 1813 "}", |
| 1814 "class B implements A {", |
| 1815 " int m() { return 1; }", |
| 1816 "}"])); |
| 1226 resolve(source); | 1817 resolve(source); |
| 1227 assertNoErrors(); | 1818 assertNoErrors(); |
| 1228 verify([source]); | 1819 verify([source]); |
| 1229 } | 1820 } |
| 1230 void test_invalidOverrideReturnType_returnType_interface2() { | 1821 void test_invalidOverrideReturnType_returnType_interface2() { |
| 1231 Source source = addSource2("/test.dart", EngineTestCase.createSource(["abstr
act class A {", " num m();", "}", "abstract class B implements A {", "}", "clas
s C implements B {", " int m() { return 1; }", "}"])); | 1822 Source source = addSource2("/test.dart", EngineTestCase.createSource([ |
| 1823 "abstract class A {", |
| 1824 " num m();", |
| 1825 "}", |
| 1826 "abstract class B implements A {", |
| 1827 "}", |
| 1828 "class C implements B {", |
| 1829 " int m() { return 1; }", |
| 1830 "}"])); |
| 1232 resolve(source); | 1831 resolve(source); |
| 1233 assertNoErrors(); | 1832 assertNoErrors(); |
| 1234 verify([source]); | 1833 verify([source]); |
| 1235 } | 1834 } |
| 1236 void test_invalidOverrideReturnType_returnType_mixin() { | 1835 void test_invalidOverrideReturnType_returnType_mixin() { |
| 1237 Source source = addSource2("/test.dart", EngineTestCase.createSource(["class
A {", " num m() { return 0; }", "}", "class B extends Object with A {", " int
m() { return 1; }", "}"])); | 1836 Source source = addSource2("/test.dart", EngineTestCase.createSource([ |
| 1837 "class A {", |
| 1838 " num m() { return 0; }", |
| 1839 "}", |
| 1840 "class B extends Object with A {", |
| 1841 " int m() { return 1; }", |
| 1842 "}"])); |
| 1238 resolve(source); | 1843 resolve(source); |
| 1239 assertNoErrors(); | 1844 assertNoErrors(); |
| 1240 verify([source]); | 1845 verify([source]); |
| 1241 } | 1846 } |
| 1242 void test_invalidOverrideReturnType_returnType_parameterizedTypes() { | 1847 void test_invalidOverrideReturnType_returnType_parameterizedTypes() { |
| 1243 Source source = addSource(EngineTestCase.createSource(["abstract class A<E>
{", " List<E> m();", "}", "class B extends A<dynamic> {", " List<dynamic> m()
{ return new List<dynamic>(); }", "}"])); | 1848 Source source = addSource(EngineTestCase.createSource([ |
| 1849 "abstract class A<E> {", |
| 1850 " List<E> m();", |
| 1851 "}", |
| 1852 "class B extends A<dynamic> {", |
| 1853 " List<dynamic> m() { return new List<dynamic>(); }", |
| 1854 "}"])); |
| 1244 resolve(source); | 1855 resolve(source); |
| 1245 assertNoErrors(); | 1856 assertNoErrors(); |
| 1246 verify([source]); | 1857 verify([source]); |
| 1247 } | 1858 } |
| 1248 void test_invalidOverrideReturnType_returnType_sameType() { | 1859 void test_invalidOverrideReturnType_returnType_sameType() { |
| 1249 Source source = addSource2("/test.dart", EngineTestCase.createSource(["class
A {", " int m() { return 0; }", "}", "class B extends A {", " int m() { retur
n 1; }", "}"])); | 1860 Source source = addSource2("/test.dart", EngineTestCase.createSource([ |
| 1861 "class A {", |
| 1862 " int m() { return 0; }", |
| 1863 "}", |
| 1864 "class B extends A {", |
| 1865 " int m() { return 1; }", |
| 1866 "}"])); |
| 1250 resolve(source); | 1867 resolve(source); |
| 1251 assertNoErrors(); | 1868 assertNoErrors(); |
| 1252 verify([source]); | 1869 verify([source]); |
| 1253 } | 1870 } |
| 1254 void test_invalidOverrideReturnType_returnType_superclass() { | 1871 void test_invalidOverrideReturnType_returnType_superclass() { |
| 1255 Source source = addSource2("/test.dart", EngineTestCase.createSource(["class
A {", " num m() { return 0; }", "}", "class B extends A {", " int m() { retur
n 1; }", "}"])); | 1872 Source source = addSource2("/test.dart", EngineTestCase.createSource([ |
| 1873 "class A {", |
| 1874 " num m() { return 0; }", |
| 1875 "}", |
| 1876 "class B extends A {", |
| 1877 " int m() { return 1; }", |
| 1878 "}"])); |
| 1256 resolve(source); | 1879 resolve(source); |
| 1257 assertNoErrors(); | 1880 assertNoErrors(); |
| 1258 verify([source]); | 1881 verify([source]); |
| 1259 } | 1882 } |
| 1260 void test_invalidOverrideReturnType_returnType_superclass2() { | 1883 void test_invalidOverrideReturnType_returnType_superclass2() { |
| 1261 Source source = addSource2("/test.dart", EngineTestCase.createSource(["class
A {", " num m() { return 0; }", "}", "class B extends A {", "}", "class C exte
nds B {", " int m() { return 1; }", "}"])); | 1884 Source source = addSource2("/test.dart", EngineTestCase.createSource([ |
| 1885 "class A {", |
| 1886 " num m() { return 0; }", |
| 1887 "}", |
| 1888 "class B extends A {", |
| 1889 "}", |
| 1890 "class C extends B {", |
| 1891 " int m() { return 1; }", |
| 1892 "}"])); |
| 1262 resolve(source); | 1893 resolve(source); |
| 1263 assertNoErrors(); | 1894 assertNoErrors(); |
| 1264 verify([source]); | 1895 verify([source]); |
| 1265 } | 1896 } |
| 1266 void test_invalidOverrideReturnType_returnType_void() { | 1897 void test_invalidOverrideReturnType_returnType_void() { |
| 1267 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {}", "}", "class B extends A {", " int m() {}", "}"])); | 1898 Source source = addSource(EngineTestCase.createSource([ |
| 1899 "class A {", |
| 1900 " void m() {}", |
| 1901 "}", |
| 1902 "class B extends A {", |
| 1903 " int m() {}", |
| 1904 "}"])); |
| 1268 resolve(source); | 1905 resolve(source); |
| 1269 assertNoErrors(); | 1906 assertNoErrors(); |
| 1270 verify([source]); | 1907 verify([source]); |
| 1271 } | 1908 } |
| 1272 void test_invalidReferenceToThis_constructor() { | 1909 void test_invalidReferenceToThis_constructor() { |
| 1273 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
", " var v = this;", " }", "}"])); | 1910 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
", " var v = this;", " }", "}"])); |
| 1274 resolve(source); | 1911 resolve(source); |
| 1275 assertNoErrors(); | 1912 assertNoErrors(); |
| 1276 verify([source]); | 1913 verify([source]); |
| 1277 } | 1914 } |
| 1278 void test_invalidReferenceToThis_instanceMethod() { | 1915 void test_invalidReferenceToThis_instanceMethod() { |
| 1279 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
", " var v = this;", " }", "}"])); | 1916 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
", " var v = this;", " }", "}"])); |
| 1280 resolve(source); | 1917 resolve(source); |
| 1281 assertNoErrors(); | 1918 assertNoErrors(); |
| 1282 verify([source]); | 1919 verify([source]); |
| 1283 } | 1920 } |
| 1284 void test_invalidTypeArgumentInConstList() { | 1921 void test_invalidTypeArgumentInConstList() { |
| 1285 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return <E>[];", " }", "}"])); | 1922 Source source = addSource(EngineTestCase.createSource([ |
| 1923 "class A<E> {", |
| 1924 " m() {", |
| 1925 " return <E>[];", |
| 1926 " }", |
| 1927 "}"])); |
| 1286 resolve(source); | 1928 resolve(source); |
| 1287 assertNoErrors(); | 1929 assertNoErrors(); |
| 1288 verify([source]); | 1930 verify([source]); |
| 1289 } | 1931 } |
| 1290 void test_invalidTypeArgumentInConstMap() { | 1932 void test_invalidTypeArgumentInConstMap() { |
| 1291 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return <String, E>{};", " }", "}"])); | 1933 Source source = addSource(EngineTestCase.createSource([ |
| 1934 "class A<E> {", |
| 1935 " m() {", |
| 1936 " return <String, E>{};", |
| 1937 " }", |
| 1938 "}"])); |
| 1292 resolve(source); | 1939 resolve(source); |
| 1293 assertNoErrors(); | 1940 assertNoErrors(); |
| 1294 verify([source]); | 1941 verify([source]); |
| 1295 } | 1942 } |
| 1296 void test_invocationOfNonFunction_dynamic() { | 1943 void test_invocationOfNonFunction_dynamic() { |
| 1297 Source source = addSource(EngineTestCase.createSource(["class A {", " var f
;", "}", "class B extends A {", " g() {", " f();", " }", "}"])); | 1944 Source source = addSource(EngineTestCase.createSource([ |
| 1945 "class A {", |
| 1946 " var f;", |
| 1947 "}", |
| 1948 "class B extends A {", |
| 1949 " g() {", |
| 1950 " f();", |
| 1951 " }", |
| 1952 "}"])); |
| 1298 resolve(source); | 1953 resolve(source); |
| 1299 assertNoErrors(); | 1954 assertNoErrors(); |
| 1300 verify([source]); | 1955 verify([source]); |
| 1301 } | 1956 } |
| 1302 void test_invocationOfNonFunction_getter() { | 1957 void test_invocationOfNonFunction_getter() { |
| 1303 Source source = addSource(EngineTestCase.createSource(["class A {", " var g
;", "}", "f() {", " A a;", " a.g();", "}"])); | 1958 Source source = addSource(EngineTestCase.createSource([ |
| 1959 "class A {", |
| 1960 " var g;", |
| 1961 "}", |
| 1962 "f() {", |
| 1963 " A a;", |
| 1964 " a.g();", |
| 1965 "}"])); |
| 1304 resolve(source); | 1966 resolve(source); |
| 1305 assertNoErrors(); | 1967 assertNoErrors(); |
| 1306 verify([source]); | 1968 verify([source]); |
| 1307 } | 1969 } |
| 1308 void test_invocationOfNonFunction_localVariable() { | 1970 void test_invocationOfNonFunction_localVariable() { |
| 1309 Source source = addSource(EngineTestCase.createSource(["f() {", " var g;",
" g();", "}"])); | 1971 Source source = addSource(EngineTestCase.createSource(["f() {", " var g;",
" g();", "}"])); |
| 1310 resolve(source); | 1972 resolve(source); |
| 1311 assertNoErrors(); | 1973 assertNoErrors(); |
| 1312 verify([source]); | 1974 verify([source]); |
| 1313 } | 1975 } |
| 1314 void test_invocationOfNonFunction_localVariable_dynamic() { | 1976 void test_invocationOfNonFunction_localVariable_dynamic() { |
| 1315 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {",
" var v = f;", " v();", "}"])); | 1977 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {",
" var v = f;", " v();", "}"])); |
| 1316 resolve(source); | 1978 resolve(source); |
| 1317 assertNoErrors(); | 1979 assertNoErrors(); |
| 1318 verify([source]); | 1980 verify([source]); |
| 1319 } | 1981 } |
| 1320 void test_invocationOfNonFunction_localVariable_dynamic2() { | 1982 void test_invocationOfNonFunction_localVariable_dynamic2() { |
| 1321 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {",
" var v = f;", " v = 1;", " v();", "}"])); | 1983 Source source = addSource(EngineTestCase.createSource([ |
| 1984 "f() {}", |
| 1985 "main() {", |
| 1986 " var v = f;", |
| 1987 " v = 1;", |
| 1988 " v();", |
| 1989 "}"])); |
| 1322 resolve(source); | 1990 resolve(source); |
| 1323 assertNoErrors(); | 1991 assertNoErrors(); |
| 1324 verify([source]); | 1992 verify([source]); |
| 1325 } | 1993 } |
| 1326 void test_invocationOfNonFunction_Object() { | 1994 void test_invocationOfNonFunction_Object() { |
| 1327 Source source = addSource(EngineTestCase.createSource(["main() {", " Object
v = null;", " v();", "}"])); | 1995 Source source = addSource(EngineTestCase.createSource(["main() {", " Object
v = null;", " v();", "}"])); |
| 1328 resolve(source); | 1996 resolve(source); |
| 1329 assertNoErrors(); | 1997 assertNoErrors(); |
| 1330 verify([source]); | 1998 verify([source]); |
| 1331 } | 1999 } |
| 2000 void test_listElementTypeNotAssignable() { |
| 2001 Source source = addSource(EngineTestCase.createSource(["var v1 = <int> [42];
", "var v2 = const <int> [42];"])); |
| 2002 resolve(source); |
| 2003 assertNoErrors(); |
| 2004 verify([source]); |
| 2005 } |
| 2006 void test_mapKeyTypeNotAssignable() { |
| 2007 Source source = addSource(EngineTestCase.createSource(["var v = <String, int
> {'a' : 1};"])); |
| 2008 resolve(source); |
| 2009 assertNoErrors(); |
| 2010 verify([source]); |
| 2011 } |
| 1332 void test_memberWithClassName_setter() { | 2012 void test_memberWithClassName_setter() { |
| 1333 Source source = addSource(EngineTestCase.createSource(["class A {", " set A
(v) {}", "}"])); | 2013 Source source = addSource(EngineTestCase.createSource(["class A {", " set A
(v) {}", "}"])); |
| 1334 resolve(source); | 2014 resolve(source); |
| 1335 assertNoErrors(); | 2015 assertNoErrors(); |
| 1336 verify([source]); | 2016 verify([source]); |
| 1337 } | 2017 } |
| 1338 void test_misMatchedGetterAndSetterTypes_instance_sameTypes() { | 2018 void test_misMatchedGetterAndSetterTypes_instance_sameTypes() { |
| 1339 Source source = addSource(EngineTestCase.createSource(["class C {", " int g
et x => 0;", " set x(int v) {}", "}"])); | 2019 Source source = addSource(EngineTestCase.createSource([ |
| 2020 "class C {", |
| 2021 " int get x => 0;", |
| 2022 " set x(int v) {}", |
| 2023 "}"])); |
| 1340 resolve(source); | 2024 resolve(source); |
| 1341 assertNoErrors(); | 2025 assertNoErrors(); |
| 1342 verify([source]); | 2026 verify([source]); |
| 1343 } | 2027 } |
| 1344 void test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter() { | 2028 void test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter() { |
| 1345 Source source = addSource(EngineTestCase.createSource(["class C {", " get x
=> 0;", " set x(String v) {}", "}"])); | 2029 Source source = addSource(EngineTestCase.createSource(["class C {", " get x
=> 0;", " set x(String v) {}", "}"])); |
| 1346 resolve(source); | 2030 resolve(source); |
| 1347 assertNoErrors(); | 2031 assertNoErrors(); |
| 1348 verify([source]); | 2032 verify([source]); |
| 1349 } | 2033 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1365 assertNoErrors(); | 2049 assertNoErrors(); |
| 1366 verify([source]); | 2050 verify([source]); |
| 1367 } | 2051 } |
| 1368 void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() { | 2052 void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() { |
| 1369 Source source = addSource(EngineTestCase.createSource(["int get x => 0;", "s
et x(v) {}"])); | 2053 Source source = addSource(EngineTestCase.createSource(["int get x => 0;", "s
et x(v) {}"])); |
| 1370 resolve(source); | 2054 resolve(source); |
| 1371 assertNoErrors(); | 2055 assertNoErrors(); |
| 1372 verify([source]); | 2056 verify([source]); |
| 1373 } | 2057 } |
| 1374 void test_mixinDeclaresConstructor() { | 2058 void test_mixinDeclaresConstructor() { |
| 1375 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "class B extends Object with A {}"])); | 2059 Source source = addSource(EngineTestCase.createSource([ |
| 2060 "class A {", |
| 2061 " m() {}", |
| 2062 "}", |
| 2063 "class B extends Object with A {}"])); |
| 1376 resolve(source); | 2064 resolve(source); |
| 1377 assertNoErrors(); | 2065 assertNoErrors(); |
| 1378 verify([source]); | 2066 verify([source]); |
| 1379 } | 2067 } |
| 1380 void test_mixinDeclaresConstructor_factory() { | 2068 void test_mixinDeclaresConstructor_factory() { |
| 1381 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() {}", "}", "class B extends Object with A {}"])); | 2069 Source source = addSource(EngineTestCase.createSource([ |
| 2070 "class A {", |
| 2071 " factory A() {}", |
| 2072 "}", |
| 2073 "class B extends Object with A {}"])); |
| 1382 resolve(source); | 2074 resolve(source); |
| 1383 assertNoErrors(); | 2075 assertNoErrors(); |
| 1384 verify([source]); | 2076 verify([source]); |
| 1385 } | 2077 } |
| 1386 void test_mixinInheritsFromNotObject_classDeclaration_mixTypedef() { | 2078 void test_mixinInheritsFromNotObject_classDeclaration_mixTypedef() { |
| 1387 Source source = addSource(EngineTestCase.createSource(["class A {}", "typede
f B = Object with A;", "class C extends Object with B {}"])); | 2079 Source source = addSource(EngineTestCase.createSource([ |
| 2080 "class A {}", |
| 2081 "typedef B = Object with A;", |
| 2082 "class C extends Object with B {}"])); |
| 1388 resolve(source); | 2083 resolve(source); |
| 1389 assertNoErrors(); | 2084 assertNoErrors(); |
| 1390 verify([source]); | 2085 verify([source]); |
| 1391 } | 2086 } |
| 1392 void test_mixinInheritsFromNotObject_typedef_mixTypedef() { | 2087 void test_mixinInheritsFromNotObject_typedef_mixTypedef() { |
| 1393 Source source = addSource(EngineTestCase.createSource(["class A {}", "typede
f B = Object with A;", "typedef C = Object with B;"])); | 2088 Source source = addSource(EngineTestCase.createSource([ |
| 2089 "class A {}", |
| 2090 "typedef B = Object with A;", |
| 2091 "typedef C = Object with B;"])); |
| 1394 resolve(source); | 2092 resolve(source); |
| 1395 assertNoErrors(); | 2093 assertNoErrors(); |
| 1396 verify([source]); | 2094 verify([source]); |
| 1397 } | 2095 } |
| 1398 void test_multipleSuperInitializers_no() { | 2096 void test_multipleSuperInitializers_no() { |
| 1399 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " B() {}", "}"])); | 2097 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " B() {}", "}"])); |
| 1400 resolve(source); | 2098 resolve(source); |
| 1401 assertNoErrors(); | 2099 assertNoErrors(); |
| 1402 verify([source]); | 2100 verify([source]); |
| 1403 } | 2101 } |
| 1404 void test_multipleSuperInitializers_single() { | 2102 void test_multipleSuperInitializers_single() { |
| 1405 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " B() : super() {}", "}"])); | 2103 Source source = addSource(EngineTestCase.createSource([ |
| 2104 "class A {}", |
| 2105 "class B extends A {", |
| 2106 " B() : super() {}", |
| 2107 "}"])); |
| 1406 resolve(source); | 2108 resolve(source); |
| 1407 assertNoErrors(); | 2109 assertNoErrors(); |
| 1408 verify([source]); | 2110 verify([source]); |
| 1409 } | 2111 } |
| 1410 void test_newWithAbstractClass_factory() { | 2112 void test_newWithAbstractClass_factory() { |
| 1411 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" factory A() { return new B(); }", "}", "class B implements A {", " B() {}",
"}", "A f() {", " return new A();", "}"])); | 2113 Source source = addSource(EngineTestCase.createSource([ |
| 2114 "abstract class A {", |
| 2115 " factory A() { return new B(); }", |
| 2116 "}", |
| 2117 "class B implements A {", |
| 2118 " B() {}", |
| 2119 "}", |
| 2120 "A f() {", |
| 2121 " return new A();", |
| 2122 "}"])); |
| 1412 resolve(source); | 2123 resolve(source); |
| 1413 assertNoErrors(); | 2124 assertNoErrors(); |
| 1414 verify([source]); | 2125 verify([source]); |
| 1415 } | 2126 } |
| 1416 void test_newWithUndefinedConstructor() { | 2127 void test_newWithUndefinedConstructor() { |
| 1417 Source source = addSource(EngineTestCase.createSource(["class A {", " A.nam
e() {}", "}", "f() {", " new A.name();", "}"])); | 2128 Source source = addSource(EngineTestCase.createSource([ |
| 2129 "class A {", |
| 2130 " A.name() {}", |
| 2131 "}", |
| 2132 "f() {", |
| 2133 " new A.name();", |
| 2134 "}"])); |
| 1418 resolve(source); | 2135 resolve(source); |
| 1419 assertNoErrors(); | 2136 assertNoErrors(); |
| 1420 verify([source]); | 2137 verify([source]); |
| 1421 } | 2138 } |
| 1422 void test_newWithUndefinedConstructorDefault() { | 2139 void test_newWithUndefinedConstructorDefault() { |
| 1423 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "f() {", " new A();", "}"])); | 2140 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "f() {", " new A();", "}"])); |
| 1424 resolve(source); | 2141 resolve(source); |
| 1425 assertNoErrors(); | 2142 assertNoErrors(); |
| 1426 verify([source]); | 2143 verify([source]); |
| 1427 } | 2144 } |
| 1428 void test_nonBoolExpression_assert_bool() { | 2145 void test_nonBoolExpression_assert_bool() { |
| 1429 Source source = addSource(EngineTestCase.createSource(["f() {", " assert(tr
ue);", "}"])); | 2146 Source source = addSource(EngineTestCase.createSource(["f() {", " assert(tr
ue);", "}"])); |
| 1430 resolve(source); | 2147 resolve(source); |
| 1431 assertNoErrors(); | 2148 assertNoErrors(); |
| 1432 verify([source]); | 2149 verify([source]); |
| 1433 } | 2150 } |
| 1434 void test_nonBoolExpression_assert_functionType() { | 2151 void test_nonBoolExpression_assert_functionType() { |
| 1435 Source source = addSource(EngineTestCase.createSource(["bool makeAssertion()
=> true;", "f() {", " assert(makeAssertion);", "}"])); | 2152 Source source = addSource(EngineTestCase.createSource([ |
| 2153 "bool makeAssertion() => true;", |
| 2154 "f() {", |
| 2155 " assert(makeAssertion);", |
| 2156 "}"])); |
| 1436 resolve(source); | 2157 resolve(source); |
| 1437 assertNoErrors(); | 2158 assertNoErrors(); |
| 1438 verify([source]); | 2159 verify([source]); |
| 1439 } | 2160 } |
| 1440 void test_nonConstantDefaultValue_function_named() { | 2161 void test_nonConstantDefaultValue_function_named() { |
| 1441 Source source = addSource(EngineTestCase.createSource(["f({x : 2 + 3}) {}"])
); | 2162 Source source = addSource(EngineTestCase.createSource(["f({x : 2 + 3}) {}"])
); |
| 1442 resolve(source); | 2163 resolve(source); |
| 1443 assertNoErrors(); | 2164 assertNoErrors(); |
| 1444 verify([source]); | 2165 verify([source]); |
| 1445 } | 2166 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1467 assertNoErrors(); | 2188 assertNoErrors(); |
| 1468 verify([source]); | 2189 verify([source]); |
| 1469 } | 2190 } |
| 1470 void test_nonConstantDefaultValue_method_positional() { | 2191 void test_nonConstantDefaultValue_method_positional() { |
| 1471 Source source = addSource(EngineTestCase.createSource(["class A {", " m([x
= 2 + 3]) {}", "}"])); | 2192 Source source = addSource(EngineTestCase.createSource(["class A {", " m([x
= 2 + 3]) {}", "}"])); |
| 1472 resolve(source); | 2193 resolve(source); |
| 1473 assertNoErrors(); | 2194 assertNoErrors(); |
| 1474 verify([source]); | 2195 verify([source]); |
| 1475 } | 2196 } |
| 1476 void test_nonConstCaseExpression() { | 2197 void test_nonConstCaseExpression() { |
| 1477 Source source = addSource(EngineTestCase.createSource(["f(Type t) {", " swi
tch (t) {", " case bool:", " case int:", " return true;", " defaul
t:", " return false;", " }", "}"])); | 2198 Source source = addSource(EngineTestCase.createSource([ |
| 2199 "f(Type t) {", |
| 2200 " switch (t) {", |
| 2201 " case bool:", |
| 2202 " case int:", |
| 2203 " return true;", |
| 2204 " default:", |
| 2205 " return false;", |
| 2206 " }", |
| 2207 "}"])); |
| 1478 resolve(source); | 2208 resolve(source); |
| 1479 assertNoErrors(); | 2209 assertNoErrors(); |
| 1480 verify([source]); | 2210 verify([source]); |
| 1481 } | 2211 } |
| 1482 void test_nonConstMapAsExpressionStatement_const() { | 2212 void test_nonConstMapAsExpressionStatement_const() { |
| 1483 Source source = addSource(EngineTestCase.createSource(["f() {", " const {'a
' : 0, 'b' : 1};", "}"])); | 2213 Source source = addSource(EngineTestCase.createSource(["f() {", " const {'a
' : 0, 'b' : 1};", "}"])); |
| 1484 resolve(source); | 2214 resolve(source); |
| 1485 assertNoErrors(); | 2215 assertNoErrors(); |
| 1486 verify([source]); | 2216 verify([source]); |
| 1487 } | 2217 } |
| 1488 void test_nonConstMapAsExpressionStatement_notExpressionStatement() { | 2218 void test_nonConstMapAsExpressionStatement_notExpressionStatement() { |
| 1489 Source source = addSource(EngineTestCase.createSource(["f() {", " var m = {
'a' : 0, 'b' : 1};", "}"])); | 2219 Source source = addSource(EngineTestCase.createSource(["f() {", " var m = {
'a' : 0, 'b' : 1};", "}"])); |
| 1490 resolve(source); | 2220 resolve(source); |
| 1491 assertNoErrors(); | 2221 assertNoErrors(); |
| 1492 verify([source]); | 2222 verify([source]); |
| 1493 } | 2223 } |
| 1494 void test_nonConstMapAsExpressionStatement_typeArguments() { | 2224 void test_nonConstMapAsExpressionStatement_typeArguments() { |
| 1495 Source source = addSource(EngineTestCase.createSource(["f() {", " <String,
int> {'a' : 0, 'b' : 1};", "}"])); | 2225 Source source = addSource(EngineTestCase.createSource(["f() {", " <String,
int> {'a' : 0, 'b' : 1};", "}"])); |
| 1496 resolve(source); | 2226 resolve(source); |
| 1497 assertNoErrors(); | 2227 assertNoErrors(); |
| 1498 verify([source]); | 2228 verify([source]); |
| 1499 } | 2229 } |
| 1500 void test_nonConstValueInInitializer_binary_bool() { | 2230 void test_nonConstValueInInitializer_binary_bool() { |
| 1501 Source source = addSource(EngineTestCase.createSource(["class A {", " final
v;", " const A.a1(bool p) : v = p && true;", " const A.a2(bool p) : v = true
&& p;", " const A.b1(bool p) : v = p || true;", " const A.b2(bool p) : v = tru
e || p;", "}"])); | 2231 Source source = addSource(EngineTestCase.createSource([ |
| 2232 "class A {", |
| 2233 " final v;", |
| 2234 " const A.a1(bool p) : v = p && true;", |
| 2235 " const A.a2(bool p) : v = true && p;", |
| 2236 " const A.b1(bool p) : v = p || true;", |
| 2237 " const A.b2(bool p) : v = true || p;", |
| 2238 "}"])); |
| 1502 resolve(source); | 2239 resolve(source); |
| 1503 assertErrors([HintCode.DEAD_CODE]); | 2240 assertErrors([HintCode.DEAD_CODE]); |
| 1504 verify([source]); | 2241 verify([source]); |
| 1505 } | 2242 } |
| 1506 void test_nonConstValueInInitializer_binary_dynamic() { | 2243 void test_nonConstValueInInitializer_binary_dynamic() { |
| 1507 Source source = addSource(EngineTestCase.createSource(["class A {", " final
v;", " const A.a1(p) : v = p + 5;", " const A.a2(p) : v = 5 + p;", " const A
.b1(p) : v = p - 5;", " const A.b2(p) : v = 5 - p;", " const A.c1(p) : v = p *
5;", " const A.c2(p) : v = 5 * p;", " const A.d1(p) : v = p / 5;", " const A
.d2(p) : v = 5 / p;", " const A.e1(p) : v = p ~/ 5;", " const A.e2(p) : v = 5
~/ p;", " const A.f1(p) : v = p > 5;", " const A.f2(p) : v = 5 > p;", " const
A.g1(p) : v = p < 5;", " const A.g2(p) : v = 5 < p;", " const A.h1(p) : v = p
>= 5;", " const A.h2(p) : v = 5 >= p;", " const A.i1(p) : v = p <= 5;", " co
nst A.i2(p) : v = 5 <= p;", " const A.j1(p) : v = p % 5;", " const A.j2(p) : v
= 5 % p;", "}"])); | 2244 Source source = addSource(EngineTestCase.createSource([ |
| 2245 "class A {", |
| 2246 " final v;", |
| 2247 " const A.a1(p) : v = p + 5;", |
| 2248 " const A.a2(p) : v = 5 + p;", |
| 2249 " const A.b1(p) : v = p - 5;", |
| 2250 " const A.b2(p) : v = 5 - p;", |
| 2251 " const A.c1(p) : v = p * 5;", |
| 2252 " const A.c2(p) : v = 5 * p;", |
| 2253 " const A.d1(p) : v = p / 5;", |
| 2254 " const A.d2(p) : v = 5 / p;", |
| 2255 " const A.e1(p) : v = p ~/ 5;", |
| 2256 " const A.e2(p) : v = 5 ~/ p;", |
| 2257 " const A.f1(p) : v = p > 5;", |
| 2258 " const A.f2(p) : v = 5 > p;", |
| 2259 " const A.g1(p) : v = p < 5;", |
| 2260 " const A.g2(p) : v = 5 < p;", |
| 2261 " const A.h1(p) : v = p >= 5;", |
| 2262 " const A.h2(p) : v = 5 >= p;", |
| 2263 " const A.i1(p) : v = p <= 5;", |
| 2264 " const A.i2(p) : v = 5 <= p;", |
| 2265 " const A.j1(p) : v = p % 5;", |
| 2266 " const A.j2(p) : v = 5 % p;", |
| 2267 "}"])); |
| 1508 resolve(source); | 2268 resolve(source); |
| 1509 assertNoErrors(); | 2269 assertNoErrors(); |
| 1510 } | 2270 } |
| 1511 void test_nonConstValueInInitializer_binary_int() { | 2271 void test_nonConstValueInInitializer_binary_int() { |
| 1512 Source source = addSource(EngineTestCase.createSource(["class A {", " final
v;", " const A.a1(int p) : v = p ^ 5;", " const A.a2(int p) : v = 5 ^ p;", "
const A.b1(int p) : v = p & 5;", " const A.b2(int p) : v = 5 & p;", " const A
.c1(int p) : v = p | 5;", " const A.c2(int p) : v = 5 | p;", " const A.d1(int
p) : v = p >> 5;", " const A.d2(int p) : v = 5 >> p;", " const A.e1(int p) : v
= p << 5;", " const A.e2(int p) : v = 5 << p;", "}"])); | 2272 Source source = addSource(EngineTestCase.createSource([ |
| 2273 "class A {", |
| 2274 " final v;", |
| 2275 " const A.a1(int p) : v = p ^ 5;", |
| 2276 " const A.a2(int p) : v = 5 ^ p;", |
| 2277 " const A.b1(int p) : v = p & 5;", |
| 2278 " const A.b2(int p) : v = 5 & p;", |
| 2279 " const A.c1(int p) : v = p | 5;", |
| 2280 " const A.c2(int p) : v = 5 | p;", |
| 2281 " const A.d1(int p) : v = p >> 5;", |
| 2282 " const A.d2(int p) : v = 5 >> p;", |
| 2283 " const A.e1(int p) : v = p << 5;", |
| 2284 " const A.e2(int p) : v = 5 << p;", |
| 2285 "}"])); |
| 1513 resolve(source); | 2286 resolve(source); |
| 1514 assertNoErrors(); | 2287 assertNoErrors(); |
| 1515 verify([source]); | 2288 verify([source]); |
| 1516 } | 2289 } |
| 1517 void test_nonConstValueInInitializer_binary_num() { | 2290 void test_nonConstValueInInitializer_binary_num() { |
| 1518 Source source = addSource(EngineTestCase.createSource(["class A {", " final
v;", " const A.a1(num p) : v = p + 5;", " const A.a2(num p) : v = 5 + p;", "
const A.b1(num p) : v = p - 5;", " const A.b2(num p) : v = 5 - p;", " const A
.c1(num p) : v = p * 5;", " const A.c2(num p) : v = 5 * p;", " const A.d1(num
p) : v = p / 5;", " const A.d2(num p) : v = 5 / p;", " const A.e1(num p) : v =
p ~/ 5;", " const A.e2(num p) : v = 5 ~/ p;", " const A.f1(num p) : v = p > 5
;", " const A.f2(num p) : v = 5 > p;", " const A.g1(num p) : v = p < 5;", " c
onst A.g2(num p) : v = 5 < p;", " const A.h1(num p) : v = p >= 5;", " const A.
h2(num p) : v = 5 >= p;", " const A.i1(num p) : v = p <= 5;", " const A.i2(num
p) : v = 5 <= p;", " const A.j1(num p) : v = p % 5;", " const A.j2(num p) : v
= 5 % p;", "}"])); | 2291 Source source = addSource(EngineTestCase.createSource([ |
| 2292 "class A {", |
| 2293 " final v;", |
| 2294 " const A.a1(num p) : v = p + 5;", |
| 2295 " const A.a2(num p) : v = 5 + p;", |
| 2296 " const A.b1(num p) : v = p - 5;", |
| 2297 " const A.b2(num p) : v = 5 - p;", |
| 2298 " const A.c1(num p) : v = p * 5;", |
| 2299 " const A.c2(num p) : v = 5 * p;", |
| 2300 " const A.d1(num p) : v = p / 5;", |
| 2301 " const A.d2(num p) : v = 5 / p;", |
| 2302 " const A.e1(num p) : v = p ~/ 5;", |
| 2303 " const A.e2(num p) : v = 5 ~/ p;", |
| 2304 " const A.f1(num p) : v = p > 5;", |
| 2305 " const A.f2(num p) : v = 5 > p;", |
| 2306 " const A.g1(num p) : v = p < 5;", |
| 2307 " const A.g2(num p) : v = 5 < p;", |
| 2308 " const A.h1(num p) : v = p >= 5;", |
| 2309 " const A.h2(num p) : v = 5 >= p;", |
| 2310 " const A.i1(num p) : v = p <= 5;", |
| 2311 " const A.i2(num p) : v = 5 <= p;", |
| 2312 " const A.j1(num p) : v = p % 5;", |
| 2313 " const A.j2(num p) : v = 5 % p;", |
| 2314 "}"])); |
| 1519 resolve(source); | 2315 resolve(source); |
| 1520 assertNoErrors(); | 2316 assertNoErrors(); |
| 1521 verify([source]); | 2317 verify([source]); |
| 1522 } | 2318 } |
| 1523 void test_nonConstValueInInitializer_field() { | 2319 void test_nonConstValueInInitializer_field() { |
| 1524 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int a;", " const A() : a = 5;", "}"])); | 2320 Source source = addSource(EngineTestCase.createSource([ |
| 2321 "class A {", |
| 2322 " final int a;", |
| 2323 " const A() : a = 5;", |
| 2324 "}"])); |
| 1525 resolve(source); | 2325 resolve(source); |
| 1526 assertNoErrors(); | 2326 assertNoErrors(); |
| 1527 verify([source]); | 2327 verify([source]); |
| 1528 } | 2328 } |
| 1529 void test_nonConstValueInInitializer_redirecting() { | 2329 void test_nonConstValueInInitializer_redirecting() { |
| 1530 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.named(p);", " const A() : this.named(42);", "}"])); | 2330 Source source = addSource(EngineTestCase.createSource([ |
| 2331 "class A {", |
| 2332 " const A.named(p);", |
| 2333 " const A() : this.named(42);", |
| 2334 "}"])); |
| 1531 resolve(source); | 2335 resolve(source); |
| 1532 assertNoErrors(); | 2336 assertNoErrors(); |
| 1533 verify([source]); | 2337 verify([source]); |
| 1534 } | 2338 } |
| 1535 void test_nonConstValueInInitializer_super() { | 2339 void test_nonConstValueInInitializer_super() { |
| 1536 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A(p);", "}", "class B extends A {", " const B() : super(42);", "}"])); | 2340 Source source = addSource(EngineTestCase.createSource([ |
| 2341 "class A {", |
| 2342 " const A(p);", |
| 2343 "}", |
| 2344 "class B extends A {", |
| 2345 " const B() : super(42);", |
| 2346 "}"])); |
| 1537 resolve(source); | 2347 resolve(source); |
| 1538 assertNoErrors(); | 2348 assertNoErrors(); |
| 1539 verify([source]); | 2349 verify([source]); |
| 1540 } | 2350 } |
| 1541 void test_nonConstValueInInitializer_unary() { | 2351 void test_nonConstValueInInitializer_unary() { |
| 1542 Source source = addSource(EngineTestCase.createSource(["class A {", " final
v;", " const A.a(bool p) : v = !p;", " const A.b(int p) : v = ~p;", " const
A.c(num p) : v = -p;", "}"])); | 2352 Source source = addSource(EngineTestCase.createSource([ |
| 2353 "class A {", |
| 2354 " final v;", |
| 2355 " const A.a(bool p) : v = !p;", |
| 2356 " const A.b(int p) : v = ~p;", |
| 2357 " const A.c(num p) : v = -p;", |
| 2358 "}"])); |
| 1543 resolve(source); | 2359 resolve(source); |
| 1544 assertNoErrors(); | 2360 assertNoErrors(); |
| 1545 verify([source]); | 2361 verify([source]); |
| 1546 } | 2362 } |
| 1547 void test_nonGenerativeConstructor() { | 2363 void test_nonGenerativeConstructor() { |
| 1548 Source source = addSource(EngineTestCase.createSource(["class A {", " A.nam
ed() {}", " factory A() {}", "}", "class B extends A {", " B() : super.named()
;", "}"])); | 2364 Source source = addSource(EngineTestCase.createSource([ |
| 2365 "class A {", |
| 2366 " A.named() {}", |
| 2367 " factory A() {}", |
| 2368 "}", |
| 2369 "class B extends A {", |
| 2370 " B() : super.named();", |
| 2371 "}"])); |
| 1549 resolve(source); | 2372 resolve(source); |
| 1550 assertNoErrors(); | 2373 assertNoErrors(); |
| 1551 verify([source]); | 2374 verify([source]); |
| 1552 } | 2375 } |
| 1553 void test_nonTypeInCatchClause_isClass() { | 2376 void test_nonTypeInCatchClause_isClass() { |
| 1554 Source source = addSource(EngineTestCase.createSource(["f() {", " try {", "
} on String catch (e) {", " }", "}"])); | 2377 Source source = addSource(EngineTestCase.createSource([ |
| 2378 "f() {", |
| 2379 " try {", |
| 2380 " } on String catch (e) {", |
| 2381 " }", |
| 2382 "}"])); |
| 1555 resolve(source); | 2383 resolve(source); |
| 1556 assertNoErrors(); | 2384 assertNoErrors(); |
| 1557 verify([source]); | 2385 verify([source]); |
| 1558 } | 2386 } |
| 1559 void test_nonTypeInCatchClause_isFunctionTypeAlias() { | 2387 void test_nonTypeInCatchClause_isFunctionTypeAlias() { |
| 1560 Source source = addSource(EngineTestCase.createSource(["typedef F();", "f()
{", " try {", " } on F catch (e) {", " }", "}"])); | 2388 Source source = addSource(EngineTestCase.createSource([ |
| 2389 "typedef F();", |
| 2390 "f() {", |
| 2391 " try {", |
| 2392 " } on F catch (e) {", |
| 2393 " }", |
| 2394 "}"])); |
| 1561 resolve(source); | 2395 resolve(source); |
| 1562 assertNoErrors(); | 2396 assertNoErrors(); |
| 1563 verify([source]); | 2397 verify([source]); |
| 1564 } | 2398 } |
| 1565 void test_nonTypeInCatchClause_isTypeVariable() { | 2399 void test_nonTypeInCatchClause_isTypeVariable() { |
| 1566 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " f(
) {", " try {", " } on T catch (e) {", " }", " }", "}"])); | 2400 Source source = addSource(EngineTestCase.createSource([ |
| 2401 "class A<T> {", |
| 2402 " f() {", |
| 2403 " try {", |
| 2404 " } on T catch (e) {", |
| 2405 " }", |
| 2406 " }", |
| 2407 "}"])); |
| 1567 resolve(source); | 2408 resolve(source); |
| 1568 assertNoErrors(); | 2409 assertNoErrors(); |
| 1569 verify([source]); | 2410 verify([source]); |
| 1570 } | 2411 } |
| 1571 void test_nonTypeInCatchClause_noType() { | 2412 void test_nonTypeInCatchClause_noType() { |
| 1572 Source source = addSource(EngineTestCase.createSource(["f() {", " try {", "
} catch (e) {", " }", "}"])); | 2413 Source source = addSource(EngineTestCase.createSource(["f() {", " try {", "
} catch (e) {", " }", "}"])); |
| 1573 resolve(source); | 2414 resolve(source); |
| 1574 assertNoErrors(); | 2415 assertNoErrors(); |
| 1575 verify([source]); | 2416 verify([source]); |
| 1576 } | 2417 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 verify([source]); | 2452 verify([source]); |
| 1612 } | 2453 } |
| 1613 void test_optionalParameterInOperator_required() { | 2454 void test_optionalParameterInOperator_required() { |
| 1614 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(p) {}", "}"])); | 2455 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(p) {}", "}"])); |
| 1615 resolve(source); | 2456 resolve(source); |
| 1616 assertNoErrors(); | 2457 assertNoErrors(); |
| 1617 verify([source]); | 2458 verify([source]); |
| 1618 } | 2459 } |
| 1619 void test_prefixCollidesWithTopLevelMembers() { | 2460 void test_prefixCollidesWithTopLevelMembers() { |
| 1620 addSource2("/lib.dart", "library lib;"); | 2461 addSource2("/lib.dart", "library lib;"); |
| 1621 Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' a
s p;", "typedef P();", "p2() {}", "var p3;", "class p4 {}"])); | 2462 Source source = addSource(EngineTestCase.createSource([ |
| 2463 "import '/lib.dart' as p;", |
| 2464 "typedef P();", |
| 2465 "p2() {}", |
| 2466 "var p3;", |
| 2467 "class p4 {}"])); |
| 1622 resolve(source); | 2468 resolve(source); |
| 1623 assertNoErrors(); | 2469 assertNoErrors(); |
| 1624 verify([source]); | 2470 verify([source]); |
| 1625 } | 2471 } |
| 1626 void test_recursiveConstructorRedirect() { | 2472 void test_recursiveConstructorRedirect() { |
| 1627 Source source = addSource(EngineTestCase.createSource(["class A {", " A.a()
: this.b();", " A.b() : this.c();", " A.c() {}", "}"])); | 2473 Source source = addSource(EngineTestCase.createSource([ |
| 2474 "class A {", |
| 2475 " A.a() : this.b();", |
| 2476 " A.b() : this.c();", |
| 2477 " A.c() {}", |
| 2478 "}"])); |
| 1628 resolve(source); | 2479 resolve(source); |
| 1629 assertNoErrors(); | 2480 assertNoErrors(); |
| 1630 verify([source]); | 2481 verify([source]); |
| 1631 } | 2482 } |
| 1632 void test_recursiveFactoryRedirect() { | 2483 void test_recursiveFactoryRedirect() { |
| 1633 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() = B;", "}", "class B implements A {", " factory B() = C;", "}", "class C
implements B {", " factory C() {}", "}"])); | 2484 Source source = addSource(EngineTestCase.createSource([ |
| 2485 "class A {", |
| 2486 " factory A() = B;", |
| 2487 "}", |
| 2488 "class B implements A {", |
| 2489 " factory B() = C;", |
| 2490 "}", |
| 2491 "class C implements B {", |
| 2492 " factory C() {}", |
| 2493 "}"])); |
| 1634 resolve(source); | 2494 resolve(source); |
| 1635 assertNoErrors(); | 2495 assertNoErrors(); |
| 1636 verify([source]); | 2496 verify([source]); |
| 1637 } | 2497 } |
| 1638 void test_redirectToInvalidFunctionType() { | 2498 void test_redirectToInvalidFunctionType() { |
| 1639 Source source = addSource(EngineTestCase.createSource(["class A implements B
{", " A(int p) {}", "}", "class B {", " B(int p) = A;", "}"])); | 2499 Source source = addSource(EngineTestCase.createSource([ |
| 2500 "class A implements B {", |
| 2501 " A(int p) {}", |
| 2502 "}", |
| 2503 "class B {", |
| 2504 " factory B(int p) = A;", |
| 2505 "}"])); |
| 1640 resolve(source); | 2506 resolve(source); |
| 1641 assertNoErrors(); | 2507 assertNoErrors(); |
| 1642 verify([source]); | 2508 verify([source]); |
| 1643 } | 2509 } |
| 1644 void test_redirectToNonConstConstructor() { | 2510 void test_redirectToNonConstConstructor() { |
| 1645 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.a();", " const factory A.b() = A.a;", "}"])); | 2511 Source source = addSource(EngineTestCase.createSource([ |
| 2512 "class A {", |
| 2513 " const A.a();", |
| 2514 " const factory A.b() = A.a;", |
| 2515 "}"])); |
| 1646 resolve(source); | 2516 resolve(source); |
| 1647 assertNoErrors(); | 2517 assertNoErrors(); |
| 1648 verify([source]); | 2518 verify([source]); |
| 1649 } | 2519 } |
| 1650 void test_referenceToDeclaredVariableInInitializer_constructorName() { | 2520 void test_referenceToDeclaredVariableInInitializer_constructorName() { |
| 1651 Source source = addSource(EngineTestCase.createSource(["class A {", " A.x()
{}", "}", "f() {", " var x = new A.x();", "}"])); | 2521 Source source = addSource(EngineTestCase.createSource([ |
| 2522 "class A {", |
| 2523 " A.x() {}", |
| 2524 "}", |
| 2525 "f() {", |
| 2526 " var x = new A.x();", |
| 2527 "}"])); |
| 1652 resolve(source); | 2528 resolve(source); |
| 1653 assertNoErrors(); | 2529 assertNoErrors(); |
| 1654 verify([source]); | 2530 verify([source]); |
| 1655 } | 2531 } |
| 1656 void test_referenceToDeclaredVariableInInitializer_methodName() { | 2532 void test_referenceToDeclaredVariableInInitializer_methodName() { |
| 1657 Source source = addSource(EngineTestCase.createSource(["class A {", " x() {
}", "}", "f(A a) {", " var x = a.x();", "}"])); | 2533 Source source = addSource(EngineTestCase.createSource([ |
| 2534 "class A {", |
| 2535 " x() {}", |
| 2536 "}", |
| 2537 "f(A a) {", |
| 2538 " var x = a.x();", |
| 2539 "}"])); |
| 1658 resolve(source); | 2540 resolve(source); |
| 1659 assertNoErrors(); | 2541 assertNoErrors(); |
| 1660 verify([source]); | 2542 verify([source]); |
| 1661 } | 2543 } |
| 1662 void test_referenceToDeclaredVariableInInitializer_propertyName() { | 2544 void test_referenceToDeclaredVariableInInitializer_propertyName() { |
| 1663 Source source = addSource(EngineTestCase.createSource(["class A {", " var x
;", "}", "f(A a) {", " var x = a.x;", "}"])); | 2545 Source source = addSource(EngineTestCase.createSource([ |
| 2546 "class A {", |
| 2547 " var x;", |
| 2548 "}", |
| 2549 "f(A a) {", |
| 2550 " var x = a.x;", |
| 2551 "}"])); |
| 1664 resolve(source); | 2552 resolve(source); |
| 1665 assertNoErrors(); | 2553 assertNoErrors(); |
| 1666 verify([source]); | 2554 verify([source]); |
| 1667 } | 2555 } |
| 1668 void test_rethrowOutsideCatch() { | 2556 void test_rethrowOutsideCatch() { |
| 1669 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " try {} catch (e) {rethrow;}", " }", "}"])); | 2557 Source source = addSource(EngineTestCase.createSource([ |
| 2558 "class A {", |
| 2559 " void m() {", |
| 2560 " try {} catch (e) {rethrow;}", |
| 2561 " }", |
| 2562 "}"])); |
| 1670 resolve(source); | 2563 resolve(source); |
| 1671 assertNoErrors(); | 2564 assertNoErrors(); |
| 1672 verify([source]); | 2565 verify([source]); |
| 1673 } | 2566 } |
| 1674 void test_returnInGenerativeConstructor() { | 2567 void test_returnInGenerativeConstructor() { |
| 1675 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
return; }", "}"])); | 2568 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
return; }", "}"])); |
| 1676 resolve(source); | 2569 resolve(source); |
| 1677 assertNoErrors(); | 2570 assertNoErrors(); |
| 1678 verify([source]); | 2571 verify([source]); |
| 1679 } | 2572 } |
| 1680 void test_returnOfInvalidType_dynamic() { | 2573 void test_returnOfInvalidType_dynamic() { |
| 1681 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;", " }", " }", " }", "}"])); | 2574 Source source = addSource(EngineTestCase.createSource([ |
| 2575 "class TypeError {}", |
| 2576 "class A {", |
| 2577 " static void testLogicalOp() {", |
| 2578 " testOr(a, b, onTypeError) {", |
| 2579 " try {", |
| 2580 " return a || b;", |
| 2581 " } on TypeError catch (t) {", |
| 2582 " return onTypeError;", |
| 2583 " }", |
| 2584 " }", |
| 2585 " }", |
| 2586 "}"])); |
| 1682 resolve(source); | 2587 resolve(source); |
| 1683 assertNoErrors(); | 2588 assertNoErrors(); |
| 1684 verify([source]); | 2589 verify([source]); |
| 1685 } | 2590 } |
| 1686 void test_returnOfInvalidType_dynamicAsTypeArgument() { | 2591 void test_returnOfInvalidType_dynamicAsTypeArgument() { |
| 1687 Source source = addSource(EngineTestCase.createSource(["class I<T> {", " fa
ctory I() => new A<T>();", "}", "class A<T> implements I {", "}"])); | 2592 Source source = addSource(EngineTestCase.createSource([ |
| 2593 "class I<T> {", |
| 2594 " factory I() => new A<T>();", |
| 2595 "}", |
| 2596 "class A<T> implements I {", |
| 2597 "}"])); |
| 1688 resolve(source); | 2598 resolve(source); |
| 1689 assertNoErrors(); | 2599 assertNoErrors(); |
| 1690 verify([source]); | 2600 verify([source]); |
| 1691 } | 2601 } |
| 1692 void test_returnOfInvalidType_subtype() { | 2602 void test_returnOfInvalidType_subtype() { |
| 1693 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "A f(B b) { return b; }"])); | 2603 Source source = addSource(EngineTestCase.createSource([ |
| 2604 "class A {}", |
| 2605 "class B extends A {}", |
| 2606 "A f(B b) { return b; }"])); |
| 1694 resolve(source); | 2607 resolve(source); |
| 1695 assertNoErrors(); | 2608 assertNoErrors(); |
| 1696 verify([source]); | 2609 verify([source]); |
| 1697 } | 2610 } |
| 1698 void test_returnOfInvalidType_supertype() { | 2611 void test_returnOfInvalidType_supertype() { |
| 1699 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "B f(A a) { return a; }"])); | 2612 Source source = addSource(EngineTestCase.createSource([ |
| 2613 "class A {}", |
| 2614 "class B extends A {}", |
| 2615 "B f(A a) { return a; }"])); |
| 1700 resolve(source); | 2616 resolve(source); |
| 1701 assertNoErrors(); | 2617 assertNoErrors(); |
| 1702 verify([source]); | 2618 verify([source]); |
| 1703 } | 2619 } |
| 1704 void test_returnOfInvalidType_void() { | 2620 void test_returnOfInvalidType_void() { |
| 1705 Source source = addSource(EngineTestCase.createSource(["void f1() {}", "void
f2() { return; }", "void f3() { return null; }", "void f4() { return g1(); }",
"void f5() { return g2(); }", "g1() {}", "void g2() {}", ""])); | 2621 Source source = addSource(EngineTestCase.createSource([ |
| 2622 "void f1() {}", |
| 2623 "void f2() { return; }", |
| 2624 "void f3() { return null; }", |
| 2625 "void f4() { return g1(); }", |
| 2626 "void f5() { return g2(); }", |
| 2627 "g1() {}", |
| 2628 "void g2() {}", |
| 2629 ""])); |
| 1706 resolve(source); | 2630 resolve(source); |
| 1707 assertNoErrors(); | 2631 assertNoErrors(); |
| 1708 verify([source]); | 2632 verify([source]); |
| 1709 } | 2633 } |
| 1710 void test_returnWithoutValue_noReturnType() { | 2634 void test_returnWithoutValue_noReturnType() { |
| 1711 Source source = addSource(EngineTestCase.createSource(["f() { return; }"])); | 2635 Source source = addSource(EngineTestCase.createSource(["f() { return; }"])); |
| 1712 resolve(source); | 2636 resolve(source); |
| 1713 assertNoErrors(); | 2637 assertNoErrors(); |
| 1714 verify([source]); | 2638 verify([source]); |
| 1715 } | 2639 } |
| 1716 void test_returnWithoutValue_void() { | 2640 void test_returnWithoutValue_void() { |
| 1717 Source source = addSource(EngineTestCase.createSource(["void f() { return; }
"])); | 2641 Source source = addSource(EngineTestCase.createSource(["void f() { return; }
"])); |
| 1718 resolve(source); | 2642 resolve(source); |
| 1719 assertNoErrors(); | 2643 assertNoErrors(); |
| 1720 verify([source]); | 2644 verify([source]); |
| 1721 } | 2645 } |
| 1722 void test_staticAccessToInstanceMember_annotation() { | 2646 void test_staticAccessToInstanceMember_annotation() { |
| 1723 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.name();", "}", "@A.name()", "main() {", "}"])); | 2647 Source source = addSource(EngineTestCase.createSource([ |
| 2648 "class A {", |
| 2649 " const A.name();", |
| 2650 "}", |
| 2651 "@A.name()", |
| 2652 "main() {", |
| 2653 "}"])); |
| 1724 resolve(source); | 2654 resolve(source); |
| 1725 assertNoErrors(); | 2655 assertNoErrors(); |
| 1726 verify([source]); | 2656 verify([source]); |
| 1727 } | 2657 } |
| 1728 void test_staticAccessToInstanceMember_method() { | 2658 void test_staticAccessToInstanceMember_method() { |
| 1729 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c m() {}", "}", "main() {", " A.m;", " A.m();", "}"])); | 2659 Source source = addSource(EngineTestCase.createSource([ |
| 2660 "class A {", |
| 2661 " static m() {}", |
| 2662 "}", |
| 2663 "main() {", |
| 2664 " A.m;", |
| 2665 " A.m();", |
| 2666 "}"])); |
| 1730 resolve(source); | 2667 resolve(source); |
| 1731 assertNoErrors(); | 2668 assertNoErrors(); |
| 1732 verify([source]); | 2669 verify([source]); |
| 1733 } | 2670 } |
| 1734 void test_staticAccessToInstanceMember_propertyAccess_field() { | 2671 void test_staticAccessToInstanceMember_propertyAccess_field() { |
| 1735 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c var f;", "}", "main() {", " A.f;", " A.f = 1;", "}"])); | 2672 Source source = addSource(EngineTestCase.createSource([ |
| 2673 "class A {", |
| 2674 " static var f;", |
| 2675 "}", |
| 2676 "main() {", |
| 2677 " A.f;", |
| 2678 " A.f = 1;", |
| 2679 "}"])); |
| 1736 resolve(source); | 2680 resolve(source); |
| 1737 assertNoErrors(); | 2681 assertNoErrors(); |
| 1738 verify([source]); | 2682 verify([source]); |
| 1739 } | 2683 } |
| 1740 void test_staticAccessToInstanceMember_propertyAccess_propertyAccessor() { | 2684 void test_staticAccessToInstanceMember_propertyAccess_propertyAccessor() { |
| 1741 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c get f => 42;", " static set f(x) {}", "}", "main() {", " A.f;", " A.f = 1;"
, "}"])); | 2685 Source source = addSource(EngineTestCase.createSource([ |
| 2686 "class A {", |
| 2687 " static get f => 42;", |
| 2688 " static set f(x) {}", |
| 2689 "}", |
| 2690 "main() {", |
| 2691 " A.f;", |
| 2692 " A.f = 1;", |
| 2693 "}"])); |
| 1742 resolve(source); | 2694 resolve(source); |
| 1743 assertNoErrors(); | 2695 assertNoErrors(); |
| 1744 verify([source]); | 2696 verify([source]); |
| 1745 } | 2697 } |
| 1746 void test_superInInvalidContext() { | 2698 void test_superInInvalidContext() { |
| 1747 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "class B extends A {", " B() {", " var v = super.m();", " }", " n
() {", " var v = super.m();", " }", "}"])); | 2699 Source source = addSource(EngineTestCase.createSource([ |
| 2700 "class A {", |
| 2701 " m() {}", |
| 2702 "}", |
| 2703 "class B extends A {", |
| 2704 " B() {", |
| 2705 " var v = super.m();", |
| 2706 " }", |
| 2707 " n() {", |
| 2708 " var v = super.m();", |
| 2709 " }", |
| 2710 "}"])); |
| 1748 resolve(source); | 2711 resolve(source); |
| 1749 assertNoErrors(); | 2712 assertNoErrors(); |
| 1750 verify([source]); | 2713 verify([source]); |
| 1751 } | 2714 } |
| 1752 void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() { | 2715 void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() { |
| 1753 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "cl
ass B {", " A a;", "}"])); | 2716 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "cl
ass B {", " A a;", "}"])); |
| 1754 resolve(source); | 2717 resolve(source); |
| 1755 assertNoErrors(); | 2718 assertNoErrors(); |
| 1756 verify([source]); | 2719 verify([source]); |
| 1757 } | 2720 } |
| 1758 void test_typeArgumentNotMatchingBounds_const() { | 2721 void test_typeArgumentNotMatchingBounds_const() { |
| 1759 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "class G<E extends A> {", " const G();", "}", "f() { return co
nst G<B>(); }"])); | 2722 Source source = addSource(EngineTestCase.createSource([ |
| 2723 "class A {}", |
| 2724 "class B extends A {}", |
| 2725 "class G<E extends A> {", |
| 2726 " const G();", |
| 2727 "}", |
| 2728 "f() { return const G<B>(); }"])); |
| 1760 resolve(source); | 2729 resolve(source); |
| 1761 assertNoErrors(); | 2730 assertNoErrors(); |
| 1762 verify([source]); | 2731 verify([source]); |
| 1763 } | 2732 } |
| 1764 void test_typeArgumentNotMatchingBounds_new() { | 2733 void test_typeArgumentNotMatchingBounds_new() { |
| 1765 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "class G<E extends A> {}", "f() { return new G<B>(); }"])); | 2734 Source source = addSource(EngineTestCase.createSource([ |
| 2735 "class A {}", |
| 2736 "class B extends A {}", |
| 2737 "class G<E extends A> {}", |
| 2738 "f() { return new G<B>(); }"])); |
| 1766 resolve(source); | 2739 resolve(source); |
| 1767 assertNoErrors(); | 2740 assertNoErrors(); |
| 1768 verify([source]); | 2741 verify([source]); |
| 1769 } | 2742 } |
| 1770 void test_typeArgumentNotMatchingBounds_typeArgumentList_0() { | 2743 void test_typeArgumentNotMatchingBounds_typeArgumentList_0() { |
| 1771 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A>{}"])); | 2744 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A>{}"])); |
| 1772 resolve(source); | 2745 resolve(source); |
| 1773 assertNoErrors(); | 2746 assertNoErrors(); |
| 1774 verify([source]); | 2747 verify([source]); |
| 1775 } | 2748 } |
| 1776 void test_typeArgumentNotMatchingBounds_typeArgumentList_1() { | 2749 void test_typeArgumentNotMatchingBounds_typeArgumentList_1() { |
| 1777 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A<A>>{}"])); | 2750 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A<A>>{}"])); |
| 1778 resolve(source); | 2751 resolve(source); |
| 1779 assertNoErrors(); | 2752 assertNoErrors(); |
| 1780 verify([source]); | 2753 verify([source]); |
| 1781 } | 2754 } |
| 1782 void test_typeArgumentNotMatchingBounds_typeArgumentList_20() { | 2755 void test_typeArgumentNotMatchingBounds_typeArgumentList_20() { |
| 1783 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A>>>>>>>>>>>>>>>>>>>>>{}"])); | 2756 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A>>>>>>>>>>>>>>>>>>>>>{}"])); |
| 1784 resolve(source); | 2757 resolve(source); |
| 1785 assertNoErrors(); | 2758 assertNoErrors(); |
| 1786 verify([source]); | 2759 verify([source]); |
| 1787 } | 2760 } |
| 1788 void test_undefinedConstructorInInitializer_explicit_named() { | 2761 void test_undefinedConstructorInInitializer_explicit_named() { |
| 1789 Source source = addSource(EngineTestCase.createSource(["class A {", " A.nam
ed() {}", "}", "class B extends A {", " B() : super.named();", "}"])); | 2762 Source source = addSource(EngineTestCase.createSource([ |
| 2763 "class A {", |
| 2764 " A.named() {}", |
| 2765 "}", |
| 2766 "class B extends A {", |
| 2767 " B() : super.named();", |
| 2768 "}"])); |
| 1790 resolve(source); | 2769 resolve(source); |
| 1791 assertNoErrors(); | 2770 assertNoErrors(); |
| 1792 verify([source]); | 2771 verify([source]); |
| 1793 } | 2772 } |
| 1794 void test_undefinedConstructorInInitializer_explicit_unnamed() { | 2773 void test_undefinedConstructorInInitializer_explicit_unnamed() { |
| 1795 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "class B extends A {", " B() : super();", "}"])); | 2774 Source source = addSource(EngineTestCase.createSource([ |
| 2775 "class A {", |
| 2776 " A() {}", |
| 2777 "}", |
| 2778 "class B extends A {", |
| 2779 " B() : super();", |
| 2780 "}"])); |
| 1796 resolve(source); | 2781 resolve(source); |
| 1797 assertNoErrors(); | 2782 assertNoErrors(); |
| 1798 verify([source]); | 2783 verify([source]); |
| 1799 } | 2784 } |
| 1800 void test_undefinedConstructorInInitializer_hasOptionalParameters() { | 2785 void test_undefinedConstructorInInitializer_hasOptionalParameters() { |
| 1801 Source source = addSource(EngineTestCase.createSource(["class A {", " A([p]
) {}", "}", "class B extends A {", " B();", "}"])); | 2786 Source source = addSource(EngineTestCase.createSource([ |
| 2787 "class A {", |
| 2788 " A([p]) {}", |
| 2789 "}", |
| 2790 "class B extends A {", |
| 2791 " B();", |
| 2792 "}"])); |
| 1802 resolve(source); | 2793 resolve(source); |
| 1803 assertNoErrors(); | 2794 assertNoErrors(); |
| 1804 verify([source]); | 2795 verify([source]); |
| 1805 } | 2796 } |
| 1806 void test_undefinedConstructorInInitializer_implicit() { | 2797 void test_undefinedConstructorInInitializer_implicit() { |
| 1807 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "class B extends A {", " B();", "}"])); | 2798 Source source = addSource(EngineTestCase.createSource([ |
| 2799 "class A {", |
| 2800 " A() {}", |
| 2801 "}", |
| 2802 "class B extends A {", |
| 2803 " B();", |
| 2804 "}"])); |
| 1808 resolve(source); | 2805 resolve(source); |
| 1809 assertNoErrors(); | 2806 assertNoErrors(); |
| 1810 verify([source]); | 2807 verify([source]); |
| 1811 } | 2808 } |
| 1812 void test_undefinedConstructorInInitializer_implicit_typedef() { | 2809 void test_undefinedConstructorInInitializer_implicit_typedef() { |
| 1813 Source source = addSource(EngineTestCase.createSource(["class M {}", "typede
f A = Object with M;", "class B extends A {", " B();", "}"])); | 2810 Source source = addSource(EngineTestCase.createSource([ |
| 2811 "class M {}", |
| 2812 "typedef A = Object with M;", |
| 2813 "class B extends A {", |
| 2814 " B();", |
| 2815 "}"])); |
| 1814 resolve(source); | 2816 resolve(source); |
| 1815 assertNoErrors(); | 2817 assertNoErrors(); |
| 1816 verify([source]); | 2818 verify([source]); |
| 1817 } | 2819 } |
| 1818 void test_undefinedConstructorInInitializer_redirecting() { | 2820 void test_undefinedConstructorInInitializer_redirecting() { |
| 1819 Source source = addSource(EngineTestCase.createSource(["class Foo {", " Foo
.ctor();", "}", "class Bar extends Foo {", " Bar() : this.ctor();", " Bar.ctor
() : super.ctor();", "}"])); | 2821 Source source = addSource(EngineTestCase.createSource([ |
| 2822 "class Foo {", |
| 2823 " Foo.ctor();", |
| 2824 "}", |
| 2825 "class Bar extends Foo {", |
| 2826 " Bar() : this.ctor();", |
| 2827 " Bar.ctor() : super.ctor();", |
| 2828 "}"])); |
| 1820 resolve(source); | 2829 resolve(source); |
| 1821 assertNoErrors(); | 2830 assertNoErrors(); |
| 1822 verify([source]); | 2831 verify([source]); |
| 1823 } | 2832 } |
| 1824 void test_undefinedGetter_noSuchMethod_getter() { | 2833 void test_undefinedGetter_noSuchMethod_getter() { |
| 1825 Source source = addSource(EngineTestCase.createSource(["class A {", " noSuc
hMethod(invocation) {}", "}", "f() {", " (new A()).g;", "}"])); | 2834 Source source = addSource(EngineTestCase.createSource([ |
| 2835 "class A {", |
| 2836 " noSuchMethod(invocation) {}", |
| 2837 "}", |
| 2838 "f() {", |
| 2839 " (new A()).g;", |
| 2840 "}"])); |
| 1826 resolve(source); | 2841 resolve(source); |
| 1827 assertNoErrors(); | 2842 assertNoErrors(); |
| 1828 } | 2843 } |
| 1829 void test_undefinedGetter_noSuchMethod_getter2() { | 2844 void test_undefinedGetter_noSuchMethod_getter2() { |
| 1830 Source source = addSource(EngineTestCase.createSource(["class A {", " noSuc
hMethod(invocation) {}", "}", "class B {", " A a = new A();", " m() {", " a
.g;", " }", "}"])); | 2845 Source source = addSource(EngineTestCase.createSource([ |
| 2846 "class A {", |
| 2847 " noSuchMethod(invocation) {}", |
| 2848 "}", |
| 2849 "class B {", |
| 2850 " A a = new A();", |
| 2851 " m() {", |
| 2852 " a.g;", |
| 2853 " }", |
| 2854 "}"])); |
| 1831 resolve(source); | 2855 resolve(source); |
| 1832 assertNoErrors(); | 2856 assertNoErrors(); |
| 1833 } | 2857 } |
| 1834 void test_undefinedGetter_typeSubstitution() { | 2858 void test_undefinedGetter_typeSubstitution() { |
| 1835 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " E
element;", "}", "class B extends A<List> {", " m() {", " element.last;", "
}", "}"])); | 2859 Source source = addSource(EngineTestCase.createSource([ |
| 2860 "class A<E> {", |
| 2861 " E element;", |
| 2862 "}", |
| 2863 "class B extends A<List> {", |
| 2864 " m() {", |
| 2865 " element.last;", |
| 2866 " }", |
| 2867 "}"])); |
| 1836 resolve(source); | 2868 resolve(source); |
| 1837 assertNoErrors(); | 2869 assertNoErrors(); |
| 1838 verify([source]); | 2870 verify([source]); |
| 1839 } | 2871 } |
| 1840 void test_undefinedIdentifier_hide() { | 2872 void test_undefinedIdentifier_hide() { |
| 1841 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' hide a;"])); | 2873 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' hide a;"])); |
| 1842 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); | 2874 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 1843 resolve(source); | 2875 resolve(source); |
| 1844 assertNoErrors(); | 2876 assertNoErrors(); |
| 1845 verify([source]); | 2877 verify([source]); |
| 1846 } | 2878 } |
| 1847 void test_undefinedIdentifier_noSuchMethod() { | 2879 void test_undefinedIdentifier_noSuchMethod() { |
| 1848 Source source = addSource(EngineTestCase.createSource(["class A {", " noSuc
hMethod(invocation) {}", " f() {", " var v = a;", " }", "}"])); | 2880 Source source = addSource(EngineTestCase.createSource([ |
| 2881 "class A {", |
| 2882 " noSuchMethod(invocation) {}", |
| 2883 " f() {", |
| 2884 " var v = a;", |
| 2885 " }", |
| 2886 "}"])); |
| 1849 resolve(source); | 2887 resolve(source); |
| 1850 assertNoErrors(); | 2888 assertNoErrors(); |
| 1851 } | 2889 } |
| 1852 void test_undefinedIdentifier_show() { | 2890 void test_undefinedIdentifier_show() { |
| 1853 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' show a;"])); | 2891 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' show a;"])); |
| 1854 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); | 2892 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 1855 resolve(source); | 2893 resolve(source); |
| 1856 assertNoErrors(); | 2894 assertNoErrors(); |
| 1857 verify([source]); | 2895 verify([source]); |
| 1858 } | 2896 } |
| 1859 void test_undefinedMethod_functionExpression_callMethod() { | 2897 void test_undefinedMethod_functionExpression_callMethod() { |
| 1860 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null).call();", "}"])); | 2898 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null).call();", "}"])); |
| 1861 resolve(source); | 2899 resolve(source); |
| 1862 assertNoErrors(); | 2900 assertNoErrors(); |
| 1863 } | 2901 } |
| 1864 void test_undefinedMethod_functionExpression_directCall() { | 2902 void test_undefinedMethod_functionExpression_directCall() { |
| 1865 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null)();", "}"])); | 2903 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null)();", "}"])); |
| 1866 resolve(source); | 2904 resolve(source); |
| 1867 assertNoErrors(); | 2905 assertNoErrors(); |
| 1868 } | 2906 } |
| 1869 void test_undefinedMethod_noSuchMethod() { | 2907 void test_undefinedMethod_noSuchMethod() { |
| 1870 Source source = addSource(EngineTestCase.createSource(["class A {", " noSuc
hMethod(invocation) {}", "}", "f() {", " (new A()).m();", "}"])); | 2908 Source source = addSource(EngineTestCase.createSource([ |
| 2909 "class A {", |
| 2910 " noSuchMethod(invocation) {}", |
| 2911 "}", |
| 2912 "f() {", |
| 2913 " (new A()).m();", |
| 2914 "}"])); |
| 1871 resolve(source); | 2915 resolve(source); |
| 1872 assertNoErrors(); | 2916 assertNoErrors(); |
| 1873 } | 2917 } |
| 1874 void test_undefinedOperator_index() { | 2918 void test_undefinedOperator_index() { |
| 1875 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor [](a) {}", " operator []=(a, b) {}", "}", "f(A a) {", " a[0];", " a[0] =
1;", "}"])); | 2919 Source source = addSource(EngineTestCase.createSource([ |
| 2920 "class A {", |
| 2921 " operator [](a) {}", |
| 2922 " operator []=(a, b) {}", |
| 2923 "}", |
| 2924 "f(A a) {", |
| 2925 " a[0];", |
| 2926 " a[0] = 1;", |
| 2927 "}"])); |
| 1876 resolve(source); | 2928 resolve(source); |
| 1877 assertNoErrors(); | 2929 assertNoErrors(); |
| 1878 verify([source]); | 2930 verify([source]); |
| 1879 } | 2931 } |
| 1880 void test_undefinedOperator_tilde() { | 2932 void test_undefinedOperator_tilde() { |
| 1881 Source source = addSource(EngineTestCase.createSource(["const A = 3;", "cons
t B = ~((1 << A) - 1);"])); | 2933 Source source = addSource(EngineTestCase.createSource(["const A = 3;", "cons
t B = ~((1 << A) - 1);"])); |
| 1882 resolve(source); | 2934 resolve(source); |
| 1883 assertNoErrors(); | 2935 assertNoErrors(); |
| 1884 verify([source]); | 2936 verify([source]); |
| 1885 } | 2937 } |
| 1886 void test_undefinedSetter_noSuchMethod() { | 2938 void test_undefinedSetter_noSuchMethod() { |
| 1887 Source source = addSource(EngineTestCase.createSource(["class A {", " noSuc
hMethod(invocation) {}", "}", "f() {", " (new A()).s = 1;", "}"])); | 2939 Source source = addSource(EngineTestCase.createSource([ |
| 2940 "class A {", |
| 2941 " noSuchMethod(invocation) {}", |
| 2942 "}", |
| 2943 "f() {", |
| 2944 " (new A()).s = 1;", |
| 2945 "}"])); |
| 1888 resolve(source); | 2946 resolve(source); |
| 1889 assertNoErrors(); | 2947 assertNoErrors(); |
| 1890 } | 2948 } |
| 1891 void test_undefinedSuperMethod_field() { | 2949 void test_undefinedSuperMethod_field() { |
| 1892 Source source = addSource(EngineTestCase.createSource(["class A {", " var m
;", "}", "class B extends A {", " f() {", " super.m();", " }", "}"])); | 2950 Source source = addSource(EngineTestCase.createSource([ |
| 2951 "class A {", |
| 2952 " var m;", |
| 2953 "}", |
| 2954 "class B extends A {", |
| 2955 " f() {", |
| 2956 " super.m();", |
| 2957 " }", |
| 2958 "}"])); |
| 1893 resolve(source); | 2959 resolve(source); |
| 1894 assertNoErrors(); | 2960 assertNoErrors(); |
| 1895 verify([source]); | 2961 verify([source]); |
| 1896 } | 2962 } |
| 1897 void test_undefinedSuperMethod_method() { | 2963 void test_undefinedSuperMethod_method() { |
| 1898 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "class B extends A {", " f() {", " super.m();", " }", "}"])); | 2964 Source source = addSource(EngineTestCase.createSource([ |
| 2965 "class A {", |
| 2966 " m() {}", |
| 2967 "}", |
| 2968 "class B extends A {", |
| 2969 " f() {", |
| 2970 " super.m();", |
| 2971 " }", |
| 2972 "}"])); |
| 1899 resolve(source); | 2973 resolve(source); |
| 1900 assertNoErrors(); | 2974 assertNoErrors(); |
| 1901 verify([source]); | 2975 verify([source]); |
| 1902 } | 2976 } |
| 1903 void test_wrongNumberOfParametersForOperator_index() { | 2977 void test_wrongNumberOfParametersForOperator_index() { |
| 1904 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor []=(a, b) {}", "}"])); | 2978 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor []=(a, b) {}", "}"])); |
| 1905 resolve(source); | 2979 resolve(source); |
| 1906 assertNoErrors(); | 2980 assertNoErrors(); |
| 1907 verify([source]); | 2981 verify([source]); |
| 1908 } | 2982 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstru
ctor_initializingFormal); | 3236 runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstru
ctor_initializingFormal); |
| 2163 }); | 3237 }); |
| 2164 _ut.test('test_finalNotInitialized_atDeclaration', () { | 3238 _ut.test('test_finalNotInitialized_atDeclaration', () { |
| 2165 final __test = new NonErrorResolverTest(); | 3239 final __test = new NonErrorResolverTest(); |
| 2166 runJUnitTest(__test, __test.test_finalNotInitialized_atDeclaration); | 3240 runJUnitTest(__test, __test.test_finalNotInitialized_atDeclaration); |
| 2167 }); | 3241 }); |
| 2168 _ut.test('test_finalNotInitialized_fieldFormal', () { | 3242 _ut.test('test_finalNotInitialized_fieldFormal', () { |
| 2169 final __test = new NonErrorResolverTest(); | 3243 final __test = new NonErrorResolverTest(); |
| 2170 runJUnitTest(__test, __test.test_finalNotInitialized_fieldFormal); | 3244 runJUnitTest(__test, __test.test_finalNotInitialized_fieldFormal); |
| 2171 }); | 3245 }); |
| 3246 _ut.test('test_finalNotInitialized_functionTypedFieldFormal', () { |
| 3247 final __test = new NonErrorResolverTest(); |
| 3248 runJUnitTest(__test, __test.test_finalNotInitialized_functionTypedFieldF
ormal); |
| 3249 }); |
| 3250 _ut.test('test_finalNotInitialized_hasNativeClause_hasConstructor', () { |
| 3251 final __test = new NonErrorResolverTest(); |
| 3252 runJUnitTest(__test, __test.test_finalNotInitialized_hasNativeClause_has
Constructor); |
| 3253 }); |
| 3254 _ut.test('test_finalNotInitialized_hasNativeClause_noConstructor', () { |
| 3255 final __test = new NonErrorResolverTest(); |
| 3256 runJUnitTest(__test, __test.test_finalNotInitialized_hasNativeClause_noC
onstructor); |
| 3257 }); |
| 2172 _ut.test('test_finalNotInitialized_initializer', () { | 3258 _ut.test('test_finalNotInitialized_initializer', () { |
| 2173 final __test = new NonErrorResolverTest(); | 3259 final __test = new NonErrorResolverTest(); |
| 2174 runJUnitTest(__test, __test.test_finalNotInitialized_initializer); | 3260 runJUnitTest(__test, __test.test_finalNotInitialized_initializer); |
| 2175 }); | 3261 }); |
| 3262 _ut.test('test_finalNotInitialized_redirectingConstructor', () { |
| 3263 final __test = new NonErrorResolverTest(); |
| 3264 runJUnitTest(__test, __test.test_finalNotInitialized_redirectingConstruc
tor); |
| 3265 }); |
| 2176 _ut.test('test_implicitThisReferenceInInitializer_constructorName', () { | 3266 _ut.test('test_implicitThisReferenceInInitializer_constructorName', () { |
| 2177 final __test = new NonErrorResolverTest(); | 3267 final __test = new NonErrorResolverTest(); |
| 2178 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_cons
tructorName); | 3268 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_cons
tructorName); |
| 2179 }); | 3269 }); |
| 2180 _ut.test('test_implicitThisReferenceInInitializer_prefixedIdentifier', ()
{ | 3270 _ut.test('test_implicitThisReferenceInInitializer_prefixedIdentifier', ()
{ |
| 2181 final __test = new NonErrorResolverTest(); | 3271 final __test = new NonErrorResolverTest(); |
| 2182 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_pref
ixedIdentifier); | 3272 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_pref
ixedIdentifier); |
| 2183 }); | 3273 }); |
| 2184 _ut.test('test_implicitThisReferenceInInitializer_qualifiedMethodInvocatio
n', () { | 3274 _ut.test('test_implicitThisReferenceInInitializer_qualifiedMethodInvocatio
n', () { |
| 2185 final __test = new NonErrorResolverTest(); | 3275 final __test = new NonErrorResolverTest(); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable); | 3448 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable); |
| 2359 }); | 3449 }); |
| 2360 _ut.test('test_invocationOfNonFunction_localVariable_dynamic', () { | 3450 _ut.test('test_invocationOfNonFunction_localVariable_dynamic', () { |
| 2361 final __test = new NonErrorResolverTest(); | 3451 final __test = new NonErrorResolverTest(); |
| 2362 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable_d
ynamic); | 3452 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable_d
ynamic); |
| 2363 }); | 3453 }); |
| 2364 _ut.test('test_invocationOfNonFunction_localVariable_dynamic2', () { | 3454 _ut.test('test_invocationOfNonFunction_localVariable_dynamic2', () { |
| 2365 final __test = new NonErrorResolverTest(); | 3455 final __test = new NonErrorResolverTest(); |
| 2366 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable_d
ynamic2); | 3456 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable_d
ynamic2); |
| 2367 }); | 3457 }); |
| 3458 _ut.test('test_listElementTypeNotAssignable', () { |
| 3459 final __test = new NonErrorResolverTest(); |
| 3460 runJUnitTest(__test, __test.test_listElementTypeNotAssignable); |
| 3461 }); |
| 3462 _ut.test('test_mapKeyTypeNotAssignable', () { |
| 3463 final __test = new NonErrorResolverTest(); |
| 3464 runJUnitTest(__test, __test.test_mapKeyTypeNotAssignable); |
| 3465 }); |
| 2368 _ut.test('test_memberWithClassName_setter', () { | 3466 _ut.test('test_memberWithClassName_setter', () { |
| 2369 final __test = new NonErrorResolverTest(); | 3467 final __test = new NonErrorResolverTest(); |
| 2370 runJUnitTest(__test, __test.test_memberWithClassName_setter); | 3468 runJUnitTest(__test, __test.test_memberWithClassName_setter); |
| 2371 }); | 3469 }); |
| 2372 _ut.test('test_misMatchedGetterAndSetterTypes_instance_sameTypes', () { | 3470 _ut.test('test_misMatchedGetterAndSetterTypes_instance_sameTypes', () { |
| 2373 final __test = new NonErrorResolverTest(); | 3471 final __test = new NonErrorResolverTest(); |
| 2374 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_instance
_sameTypes); | 3472 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_instance
_sameTypes); |
| 2375 }); | 3473 }); |
| 2376 _ut.test('test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter',
() { | 3474 _ut.test('test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter',
() { |
| 2377 final __test = new NonErrorResolverTest(); | 3475 final __test = new NonErrorResolverTest(); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2903 assertErrors([StaticTypeWarningCode.INACCESSIBLE_SETTER]); | 4001 assertErrors([StaticTypeWarningCode.INACCESSIBLE_SETTER]); |
| 2904 verify([source]); | 4002 verify([source]); |
| 2905 } | 4003 } |
| 2906 void fail_redirectWithInvalidTypeParameters() { | 4004 void fail_redirectWithInvalidTypeParameters() { |
| 2907 Source source = addSource(EngineTestCase.createSource([])); | 4005 Source source = addSource(EngineTestCase.createSource([])); |
| 2908 resolve(source); | 4006 resolve(source); |
| 2909 assertErrors([StaticTypeWarningCode.REDIRECT_WITH_INVALID_TYPE_PARAMETERS]); | 4007 assertErrors([StaticTypeWarningCode.REDIRECT_WITH_INVALID_TYPE_PARAMETERS]); |
| 2910 verify([source]); | 4008 verify([source]); |
| 2911 } | 4009 } |
| 2912 void test_inconsistentMethodInheritance_paramCount() { | 4010 void test_inconsistentMethodInheritance_paramCount() { |
| 2913 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" int x();", "}", "abstract class B {", " int x(int y);", "}", "class C imple
ments A, B {", "}"])); | 4011 Source source = addSource(EngineTestCase.createSource([ |
| 4012 "abstract class A {", |
| 4013 " int x();", |
| 4014 "}", |
| 4015 "abstract class B {", |
| 4016 " int x(int y);", |
| 4017 "}", |
| 4018 "class C implements A, B {", |
| 4019 "}"])); |
| 2914 resolve(source); | 4020 resolve(source); |
| 2915 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); | 4021 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); |
| 2916 verify([source]); | 4022 verify([source]); |
| 2917 } | 4023 } |
| 2918 void test_inconsistentMethodInheritance_paramType() { | 4024 void test_inconsistentMethodInheritance_paramType() { |
| 2919 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" x(int i);", "}", "abstract class B {", " x(String s);", "}", "abstract clas
s C implements A, B {}"])); | 4025 Source source = addSource(EngineTestCase.createSource([ |
| 4026 "abstract class A {", |
| 4027 " x(int i);", |
| 4028 "}", |
| 4029 "abstract class B {", |
| 4030 " x(String s);", |
| 4031 "}", |
| 4032 "abstract class C implements A, B {}"])); |
| 2920 resolve(source); | 4033 resolve(source); |
| 2921 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); | 4034 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); |
| 2922 verify([source]); | 4035 verify([source]); |
| 2923 } | 4036 } |
| 2924 void test_inconsistentMethodInheritance_returnType() { | 4037 void test_inconsistentMethodInheritance_returnType() { |
| 2925 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" int x();", "}", "abstract class B {", " String x();", "}", "abstract class
C implements A, B {}"])); | 4038 Source source = addSource(EngineTestCase.createSource([ |
| 4039 "abstract class A {", |
| 4040 " int x();", |
| 4041 "}", |
| 4042 "abstract class B {", |
| 4043 " String x();", |
| 4044 "}", |
| 4045 "abstract class C implements A, B {}"])); |
| 2926 resolve(source); | 4046 resolve(source); |
| 2927 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); | 4047 assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); |
| 2928 verify([source]); | 4048 verify([source]); |
| 2929 } | 4049 } |
| 2930 void test_invalidAssignment_compoundAssignment() { | 4050 void test_invalidAssignment_compoundAssignment() { |
| 2931 Source source = addSource(EngineTestCase.createSource(["class byte {", " in
t _value;", " byte(this._value);", " int operator +(int val) {}", "}", "", "vo
id main() {", " byte b = new byte(52);", " b += 3;", "}"])); | 4051 Source source = addSource(EngineTestCase.createSource([ |
| 4052 "class byte {", |
| 4053 " int _value;", |
| 4054 " byte(this._value);", |
| 4055 " int operator +(int val) {}", |
| 4056 "}", |
| 4057 "", |
| 4058 "void main() {", |
| 4059 " byte b = new byte(52);", |
| 4060 " b += 3;", |
| 4061 "}"])); |
| 2932 resolve(source); | 4062 resolve(source); |
| 2933 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 4063 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 2934 verify([source]); | 4064 verify([source]); |
| 2935 } | 4065 } |
| 2936 void test_invalidAssignment_instanceVariable() { | 4066 void test_invalidAssignment_instanceVariable() { |
| 2937 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", "}", "f() {", " A a;", " a.x = '0';", "}"])); | 4067 Source source = addSource(EngineTestCase.createSource([ |
| 4068 "class A {", |
| 4069 " int x;", |
| 4070 "}", |
| 4071 "f() {", |
| 4072 " A a;", |
| 4073 " a.x = '0';", |
| 4074 "}"])); |
| 2938 resolve(source); | 4075 resolve(source); |
| 2939 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 4076 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 2940 verify([source]); | 4077 verify([source]); |
| 2941 } | 4078 } |
| 2942 void test_invalidAssignment_localVariable() { | 4079 void test_invalidAssignment_localVariable() { |
| 2943 Source source = addSource(EngineTestCase.createSource(["f() {", " int x;",
" x = '0';", "}"])); | 4080 Source source = addSource(EngineTestCase.createSource(["f() {", " int x;",
" x = '0';", "}"])); |
| 2944 resolve(source); | 4081 resolve(source); |
| 2945 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 4082 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 2946 verify([source]); | 4083 verify([source]); |
| 2947 } | 4084 } |
| 2948 void test_invalidAssignment_staticVariable() { | 4085 void test_invalidAssignment_staticVariable() { |
| 2949 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", "}", "f() {", " A.x = '0';", "}"])); | 4086 Source source = addSource(EngineTestCase.createSource([ |
| 4087 "class A {", |
| 4088 " static int x;", |
| 4089 "}", |
| 4090 "f() {", |
| 4091 " A.x = '0';", |
| 4092 "}"])); |
| 2950 resolve(source); | 4093 resolve(source); |
| 2951 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 4094 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 2952 verify([source]); | 4095 verify([source]); |
| 2953 } | 4096 } |
| 2954 void test_invalidAssignment_topLevelVariableDeclaration() { | 4097 void test_invalidAssignment_topLevelVariableDeclaration() { |
| 2955 Source source = addSource(EngineTestCase.createSource(["int x = 'string';"])
); | 4098 Source source = addSource(EngineTestCase.createSource(["int x = 'string';"])
); |
| 2956 resolve(source); | 4099 resolve(source); |
| 2957 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 4100 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 2958 verify([source]); | 4101 verify([source]); |
| 2959 } | 4102 } |
| 2960 void test_invalidAssignment_variableDeclaration() { | 4103 void test_invalidAssignment_variableDeclaration() { |
| 2961 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
= 'string';", "}"])); | 4104 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
= 'string';", "}"])); |
| 2962 resolve(source); | 4105 resolve(source); |
| 2963 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 4106 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 2964 verify([source]); | 4107 verify([source]); |
| 2965 } | 4108 } |
| 2966 void test_invocationOfNonFunction_class() { | 4109 void test_invocationOfNonFunction_class() { |
| 2967 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " A();", " }", "}"])); | 4110 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " A();", " }", "}"])); |
| 2968 resolve(source); | 4111 resolve(source); |
| 2969 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 4112 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 2970 } | 4113 } |
| 2971 void test_invocationOfNonFunction_localVariable() { | 4114 void test_invocationOfNonFunction_localVariable() { |
| 2972 Source source = addSource(EngineTestCase.createSource(["f() {", " int x;",
" return x();", "}"])); | 4115 Source source = addSource(EngineTestCase.createSource(["f() {", " int x;",
" return x();", "}"])); |
| 2973 resolve(source); | 4116 resolve(source); |
| 2974 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 4117 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 2975 verify([source]); | 4118 verify([source]); |
| 2976 } | 4119 } |
| 2977 void test_invocationOfNonFunction_ordinaryInvocation() { | 4120 void test_invocationOfNonFunction_ordinaryInvocation() { |
| 2978 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", "}", "class B {", " m() {", " A.x();", " }", "}"])); | 4121 Source source = addSource(EngineTestCase.createSource([ |
| 4122 "class A {", |
| 4123 " static int x;", |
| 4124 "}", |
| 4125 "class B {", |
| 4126 " m() {", |
| 4127 " A.x();", |
| 4128 " }", |
| 4129 "}"])); |
| 2979 resolve(source); | 4130 resolve(source); |
| 2980 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 4131 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 2981 } | 4132 } |
| 2982 void test_invocationOfNonFunction_staticInvocation() { | 4133 void test_invocationOfNonFunction_staticInvocation() { |
| 2983 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int get g => 0;", " f() {", " A.g();", " }", "}"])); | 4134 Source source = addSource(EngineTestCase.createSource([ |
| 4135 "class A {", |
| 4136 " static int get g => 0;", |
| 4137 " f() {", |
| 4138 " A.g();", |
| 4139 " }", |
| 4140 "}"])); |
| 2984 resolve(source); | 4141 resolve(source); |
| 2985 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); | 4142 assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 2986 } | 4143 } |
| 2987 void test_nonBoolCondition_conditional() { | 4144 void test_nonBoolCondition_conditional() { |
| 2988 Source source = addSource(EngineTestCase.createSource(["f() { return 3 ? 2 :
1; }"])); | 4145 Source source = addSource(EngineTestCase.createSource(["f() { return 3 ? 2 :
1; }"])); |
| 2989 resolve(source); | 4146 resolve(source); |
| 2990 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); | 4147 assertErrors([StaticTypeWarningCode.NON_BOOL_CONDITION]); |
| 2991 verify([source]); | 4148 verify([source]); |
| 2992 } | 4149 } |
| 2993 void test_nonBoolCondition_do() { | 4150 void test_nonBoolCondition_do() { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3032 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4189 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3033 verify([source]); | 4190 verify([source]); |
| 3034 } | 4191 } |
| 3035 void test_returnOfInvalidType_expressionFunctionBody_getter() { | 4192 void test_returnOfInvalidType_expressionFunctionBody_getter() { |
| 3036 Source source = addSource(EngineTestCase.createSource(["int get g => '0';"])
); | 4193 Source source = addSource(EngineTestCase.createSource(["int get g => '0';"])
); |
| 3037 resolve(source); | 4194 resolve(source); |
| 3038 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4195 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3039 verify([source]); | 4196 verify([source]); |
| 3040 } | 4197 } |
| 3041 void test_returnOfInvalidType_expressionFunctionBody_localFunction() { | 4198 void test_returnOfInvalidType_expressionFunctionBody_localFunction() { |
| 3042 Source source = addSource(EngineTestCase.createSource(["class A {", " Strin
g m() {", " int f() => '0';", " }", "}"])); | 4199 Source source = addSource(EngineTestCase.createSource([ |
| 4200 "class A {", |
| 4201 " String m() {", |
| 4202 " int f() => '0';", |
| 4203 " }", |
| 4204 "}"])); |
| 3043 resolve(source); | 4205 resolve(source); |
| 3044 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4206 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3045 verify([source]); | 4207 verify([source]); |
| 3046 } | 4208 } |
| 3047 void test_returnOfInvalidType_expressionFunctionBody_method() { | 4209 void test_returnOfInvalidType_expressionFunctionBody_method() { |
| 3048 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() => '0';", "}"])); | 4210 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() => '0';", "}"])); |
| 3049 resolve(source); | 4211 resolve(source); |
| 3050 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4212 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3051 verify([source]); | 4213 verify([source]); |
| 3052 } | 4214 } |
| 3053 void test_returnOfInvalidType_expressionFunctionBody_void() { | 4215 void test_returnOfInvalidType_expressionFunctionBody_void() { |
| 3054 Source source = addSource(EngineTestCase.createSource(["void f() => 42;"])); | 4216 Source source = addSource(EngineTestCase.createSource(["void f() => 42;"])); |
| 3055 resolve(source); | 4217 resolve(source); |
| 3056 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4218 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3057 verify([source]); | 4219 verify([source]); |
| 3058 } | 4220 } |
| 3059 void test_returnOfInvalidType_function() { | 4221 void test_returnOfInvalidType_function() { |
| 3060 Source source = addSource(EngineTestCase.createSource(["int f() { return '0'
; }"])); | 4222 Source source = addSource(EngineTestCase.createSource(["int f() { return '0'
; }"])); |
| 3061 resolve(source); | 4223 resolve(source); |
| 3062 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4224 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3063 verify([source]); | 4225 verify([source]); |
| 3064 } | 4226 } |
| 3065 void test_returnOfInvalidType_getter() { | 4227 void test_returnOfInvalidType_getter() { |
| 3066 Source source = addSource(EngineTestCase.createSource(["int get g { return '
0'; }"])); | 4228 Source source = addSource(EngineTestCase.createSource(["int get g { return '
0'; }"])); |
| 3067 resolve(source); | 4229 resolve(source); |
| 3068 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4230 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3069 verify([source]); | 4231 verify([source]); |
| 3070 } | 4232 } |
| 3071 void test_returnOfInvalidType_localFunction() { | 4233 void test_returnOfInvalidType_localFunction() { |
| 3072 Source source = addSource(EngineTestCase.createSource(["class A {", " Strin
g m() {", " int f() { return '0'; }", " }", "}"])); | 4234 Source source = addSource(EngineTestCase.createSource([ |
| 4235 "class A {", |
| 4236 " String m() {", |
| 4237 " int f() { return '0'; }", |
| 4238 " }", |
| 4239 "}"])); |
| 3073 resolve(source); | 4240 resolve(source); |
| 3074 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4241 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3075 verify([source]); | 4242 verify([source]); |
| 3076 } | 4243 } |
| 3077 void test_returnOfInvalidType_method() { | 4244 void test_returnOfInvalidType_method() { |
| 3078 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() { return '0'; }", "}"])); | 4245 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
() { return '0'; }", "}"])); |
| 3079 resolve(source); | 4246 resolve(source); |
| 3080 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4247 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3081 verify([source]); | 4248 verify([source]); |
| 3082 } | 4249 } |
| 3083 void test_returnOfInvalidType_void() { | 4250 void test_returnOfInvalidType_void() { |
| 3084 Source source = addSource(EngineTestCase.createSource(["void f() { return 42
; }"])); | 4251 Source source = addSource(EngineTestCase.createSource(["void f() { return 42
; }"])); |
| 3085 resolve(source); | 4252 resolve(source); |
| 3086 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); | 4253 assertErrors([StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]); |
| 3087 verify([source]); | 4254 verify([source]); |
| 3088 } | 4255 } |
| 3089 void test_typeArgumentNotMatchingBounds_classTypeAlias() { | 4256 void test_typeArgumentNotMatchingBounds_classTypeAlias() { |
| 3090 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class C {}", "class G<E extends A> {}", "typedef D = G<B> with C;"])); | 4257 Source source = addSource(EngineTestCase.createSource([ |
| 4258 "class A {}", |
| 4259 "class B {}", |
| 4260 "class C {}", |
| 4261 "class G<E extends A> {}", |
| 4262 "typedef D = G<B> with C;"])); |
| 3091 resolve(source); | 4263 resolve(source); |
| 3092 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4264 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3093 verify([source]); | 4265 verify([source]); |
| 3094 } | 4266 } |
| 3095 void test_typeArgumentNotMatchingBounds_extends() { | 4267 void test_typeArgumentNotMatchingBounds_extends() { |
| 3096 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "class C extends G<B>{}"])); | 4268 Source source = addSource(EngineTestCase.createSource([ |
| 4269 "class A {}", |
| 4270 "class B {}", |
| 4271 "class G<E extends A> {}", |
| 4272 "class C extends G<B>{}"])); |
| 3097 resolve(source); | 4273 resolve(source); |
| 3098 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4274 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3099 verify([source]); | 4275 verify([source]); |
| 3100 } | 4276 } |
| 3101 void test_typeArgumentNotMatchingBounds_fieldFormalParameter() { | 4277 void test_typeArgumentNotMatchingBounds_fieldFormalParameter() { |
| 3102 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "class C {", " var f;", " C(G<B> this.f) {}"
, "}"])); | 4278 Source source = addSource(EngineTestCase.createSource([ |
| 4279 "class A {}", |
| 4280 "class B {}", |
| 4281 "class G<E extends A> {}", |
| 4282 "class C {", |
| 4283 " var f;", |
| 4284 " C(G<B> this.f) {}", |
| 4285 "}"])); |
| 3103 resolve(source); | 4286 resolve(source); |
| 3104 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4287 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3105 verify([source]); | 4288 verify([source]); |
| 3106 } | 4289 } |
| 3107 void test_typeArgumentNotMatchingBounds_functionReturnType() { | 4290 void test_typeArgumentNotMatchingBounds_functionReturnType() { |
| 3108 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "G<B> f() {}"])); | 4291 Source source = addSource(EngineTestCase.createSource([ |
| 4292 "class A {}", |
| 4293 "class B {}", |
| 4294 "class G<E extends A> {}", |
| 4295 "G<B> f() {}"])); |
| 3109 resolve(source); | 4296 resolve(source); |
| 3110 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4297 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3111 verify([source]); | 4298 verify([source]); |
| 3112 } | 4299 } |
| 3113 void test_typeArgumentNotMatchingBounds_functionTypeAlias() { | 4300 void test_typeArgumentNotMatchingBounds_functionTypeAlias() { |
| 3114 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "typedef G<B> f();"])); | 4301 Source source = addSource(EngineTestCase.createSource([ |
| 4302 "class A {}", |
| 4303 "class B {}", |
| 4304 "class G<E extends A> {}", |
| 4305 "typedef G<B> f();"])); |
| 3115 resolve(source); | 4306 resolve(source); |
| 3116 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4307 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3117 verify([source]); | 4308 verify([source]); |
| 3118 } | 4309 } |
| 3119 void test_typeArgumentNotMatchingBounds_functionTypedFormalParameter() { | 4310 void test_typeArgumentNotMatchingBounds_functionTypedFormalParameter() { |
| 3120 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "f(G<B> h()) {}"])); | 4311 Source source = addSource(EngineTestCase.createSource([ |
| 4312 "class A {}", |
| 4313 "class B {}", |
| 4314 "class G<E extends A> {}", |
| 4315 "f(G<B> h()) {}"])); |
| 3121 resolve(source); | 4316 resolve(source); |
| 3122 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4317 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3123 verify([source]); | 4318 verify([source]); |
| 3124 } | 4319 } |
| 3125 void test_typeArgumentNotMatchingBounds_implements() { | 4320 void test_typeArgumentNotMatchingBounds_implements() { |
| 3126 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "class C implements G<B>{}"])); | 4321 Source source = addSource(EngineTestCase.createSource([ |
| 4322 "class A {}", |
| 4323 "class B {}", |
| 4324 "class G<E extends A> {}", |
| 4325 "class C implements G<B>{}"])); |
| 3127 resolve(source); | 4326 resolve(source); |
| 3128 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4327 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3129 verify([source]); | 4328 verify([source]); |
| 3130 } | 4329 } |
| 3131 void test_typeArgumentNotMatchingBounds_is() { | 4330 void test_typeArgumentNotMatchingBounds_is() { |
| 3132 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "var b = 1 is G<B>;"])); | 4331 Source source = addSource(EngineTestCase.createSource([ |
| 4332 "class A {}", |
| 4333 "class B {}", |
| 4334 "class G<E extends A> {}", |
| 4335 "var b = 1 is G<B>;"])); |
| 3133 resolve(source); | 4336 resolve(source); |
| 3134 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4337 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3135 verify([source]); | 4338 verify([source]); |
| 3136 } | 4339 } |
| 3137 void test_typeArgumentNotMatchingBounds_methodReturnType() { | 4340 void test_typeArgumentNotMatchingBounds_methodReturnType() { |
| 3138 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "class C {", " G<B> m() {}", "}"])); | 4341 Source source = addSource(EngineTestCase.createSource([ |
| 4342 "class A {}", |
| 4343 "class B {}", |
| 4344 "class G<E extends A> {}", |
| 4345 "class C {", |
| 4346 " G<B> m() {}", |
| 4347 "}"])); |
| 3139 resolve(source); | 4348 resolve(source); |
| 3140 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4349 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3141 verify([source]); | 4350 verify([source]); |
| 3142 } | 4351 } |
| 3143 void test_typeArgumentNotMatchingBounds_new() { | 4352 void test_typeArgumentNotMatchingBounds_new() { |
| 3144 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "f() { return new G<B>(); }"])); | 4353 Source source = addSource(EngineTestCase.createSource([ |
| 4354 "class A {}", |
| 4355 "class B {}", |
| 4356 "class G<E extends A> {}", |
| 4357 "f() { return new G<B>(); }"])); |
| 3145 resolve(source); | 4358 resolve(source); |
| 3146 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4359 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3147 verify([source]); | 4360 verify([source]); |
| 3148 } | 4361 } |
| 3149 void test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound() { | 4362 void test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound() { |
| 3150 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "class C extends B {}", "class G<E extends B> {}", "f() { retur
n new G<A>(); }"])); | 4363 Source source = addSource(EngineTestCase.createSource([ |
| 4364 "class A {}", |
| 4365 "class B extends A {}", |
| 4366 "class C extends B {}", |
| 4367 "class G<E extends B> {}", |
| 4368 "f() { return new G<A>(); }"])); |
| 3151 resolve(source); | 4369 resolve(source); |
| 3152 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4370 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3153 verify([source]); | 4371 verify([source]); |
| 3154 } | 4372 } |
| 3155 void test_typeArgumentNotMatchingBounds_parameter() { | 4373 void test_typeArgumentNotMatchingBounds_parameter() { |
| 3156 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "f(G<B> g) {}"])); | 4374 Source source = addSource(EngineTestCase.createSource([ |
| 4375 "class A {}", |
| 4376 "class B {}", |
| 4377 "class G<E extends A> {}", |
| 4378 "f(G<B> g) {}"])); |
| 3157 resolve(source); | 4379 resolve(source); |
| 3158 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4380 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3159 verify([source]); | 4381 verify([source]); |
| 3160 } | 4382 } |
| 3161 void test_typeArgumentNotMatchingBounds_typeArgumentList() { | 4383 void test_typeArgumentNotMatchingBounds_typeArgumentList() { |
| 3162 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class C<E> {}", "class D<E extends A> {}", "C<D<B>> Var;"])); | 4384 Source source = addSource(EngineTestCase.createSource([ |
| 4385 "class A {}", |
| 4386 "class B {}", |
| 4387 "class C<E> {}", |
| 4388 "class D<E extends A> {}", |
| 4389 "C<D<B>> Var;"])); |
| 3163 resolve(source); | 4390 resolve(source); |
| 3164 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4391 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3165 verify([source]); | 4392 verify([source]); |
| 3166 } | 4393 } |
| 3167 void test_typeArgumentNotMatchingBounds_typeParameter() { | 4394 void test_typeArgumentNotMatchingBounds_typeParameter() { |
| 3168 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class C {}", "class G<E extends A> {}", "class D<F extends G<B>> {}"])); | 4395 Source source = addSource(EngineTestCase.createSource([ |
| 4396 "class A {}", |
| 4397 "class B {}", |
| 4398 "class C {}", |
| 4399 "class G<E extends A> {}", |
| 4400 "class D<F extends G<B>> {}"])); |
| 3169 resolve(source); | 4401 resolve(source); |
| 3170 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4402 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3171 verify([source]); | 4403 verify([source]); |
| 3172 } | 4404 } |
| 3173 void test_typeArgumentNotMatchingBounds_variableDeclaration() { | 4405 void test_typeArgumentNotMatchingBounds_variableDeclaration() { |
| 3174 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "G<B> g;"])); | 4406 Source source = addSource(EngineTestCase.createSource([ |
| 4407 "class A {}", |
| 4408 "class B {}", |
| 4409 "class G<E extends A> {}", |
| 4410 "G<B> g;"])); |
| 3175 resolve(source); | 4411 resolve(source); |
| 3176 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4412 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3177 verify([source]); | 4413 verify([source]); |
| 3178 } | 4414 } |
| 3179 void test_typeArgumentNotMatchingBounds_with() { | 4415 void test_typeArgumentNotMatchingBounds_with() { |
| 3180 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {}", "class C extends Object with G<B>{}"])); | 4416 Source source = addSource(EngineTestCase.createSource([ |
| 4417 "class A {}", |
| 4418 "class B {}", |
| 4419 "class G<E extends A> {}", |
| 4420 "class C extends Object with G<B>{}"])); |
| 3181 resolve(source); | 4421 resolve(source); |
| 3182 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 4422 assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 3183 verify([source]); | 4423 verify([source]); |
| 3184 } | 4424 } |
| 3185 void test_undefinedFunction() { | 4425 void test_undefinedFunction() { |
| 3186 Source source = addSource(EngineTestCase.createSource(["void f() {", " g();
", "}"])); | 4426 Source source = addSource(EngineTestCase.createSource(["void f() {", " g();
", "}"])); |
| 3187 resolve(source); | 4427 resolve(source); |
| 3188 assertErrors([StaticTypeWarningCode.UNDEFINED_FUNCTION]); | 4428 assertErrors([StaticTypeWarningCode.UNDEFINED_FUNCTION]); |
| 3189 } | 4429 } |
| 3190 void test_undefinedGetter() { | 4430 void test_undefinedGetter() { |
| 3191 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e)
{ return e.m; }"])); | 4431 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e)
{ return e.m; }"])); |
| 3192 resolve(source); | 4432 resolve(source); |
| 3193 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); | 4433 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 3194 } | 4434 } |
| 3195 void test_undefinedGetter_static() { | 4435 void test_undefinedGetter_static() { |
| 3196 Source source = addSource(EngineTestCase.createSource(["class A {}", "var a
= A.B;"])); | 4436 Source source = addSource(EngineTestCase.createSource(["class A {}", "var a
= A.B;"])); |
| 3197 resolve(source); | 4437 resolve(source); |
| 3198 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); | 4438 assertErrors([StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 3199 } | 4439 } |
| 3200 void test_undefinedMethod() { | 4440 void test_undefinedMethod() { |
| 3201 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " n();", " }", "}"])); | 4441 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m() {", " n();", " }", "}"])); |
| 3202 resolve(source); | 4442 resolve(source); |
| 3203 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); | 4443 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); |
| 3204 } | 4444 } |
| 3205 void test_undefinedMethod_ignoreTypePropagation() { | 4445 void test_undefinedMethod_ignoreTypePropagation() { |
| 3206 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " m() {}", "}", "class C {", "f() {", " A a = new B();", "
a.m();", " }", "}"])); | 4446 Source source = addSource(EngineTestCase.createSource([ |
| 4447 "class A {}", |
| 4448 "class B extends A {", |
| 4449 " m() {}", |
| 4450 "}", |
| 4451 "class C {", |
| 4452 "f() {", |
| 4453 " A a = new B();", |
| 4454 " a.m();", |
| 4455 " }", |
| 4456 "}"])); |
| 3207 resolve(source); | 4457 resolve(source); |
| 3208 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); | 4458 assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]); |
| 3209 } | 4459 } |
| 3210 void test_undefinedOperator_indexBoth() { | 4460 void test_undefinedOperator_indexBoth() { |
| 3211 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0]++;", "}"])); | 4461 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0]++;", "}"])); |
| 3212 resolve(source); | 4462 resolve(source); |
| 3213 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 4463 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 3214 } | 4464 } |
| 3215 void test_undefinedOperator_indexGetter() { | 4465 void test_undefinedOperator_indexGetter() { |
| 3216 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0];", "}"])); | 4466 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0];", "}"])); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3231 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e1
) { e1.m = 0; }"])); | 4481 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e1
) { e1.m = 0; }"])); |
| 3232 resolve(source); | 4482 resolve(source); |
| 3233 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); | 4483 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); |
| 3234 } | 4484 } |
| 3235 void test_undefinedSetter_static() { | 4485 void test_undefinedSetter_static() { |
| 3236 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {
A.B = 0;}"])); | 4486 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {
A.B = 0;}"])); |
| 3237 resolve(source); | 4487 resolve(source); |
| 3238 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); | 4488 assertErrors([StaticTypeWarningCode.UNDEFINED_SETTER]); |
| 3239 } | 4489 } |
| 3240 void test_undefinedSuperMethod() { | 4490 void test_undefinedSuperMethod() { |
| 3241 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " m() { return super.m(); }", "}"])); | 4491 Source source = addSource(EngineTestCase.createSource([ |
| 4492 "class A {}", |
| 4493 "class B extends A {", |
| 4494 " m() { return super.m(); }", |
| 4495 "}"])); |
| 3242 resolve(source); | 4496 resolve(source); |
| 3243 assertErrors([StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]); | 4497 assertErrors([StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]); |
| 3244 } | 4498 } |
| 3245 void test_wrongNumberOfTypeArguments_tooFew() { | 4499 void test_wrongNumberOfTypeArguments_tooFew() { |
| 3246 Source source = addSource(EngineTestCase.createSource(["class A<E, F> {}", "
A<A> a = null;"])); | 4500 Source source = addSource(EngineTestCase.createSource(["class A<E, F> {}", "
A<A> a = null;"])); |
| 3247 resolve(source); | 4501 resolve(source); |
| 3248 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 4502 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 3249 verify([source]); | 4503 verify([source]); |
| 3250 } | 4504 } |
| 3251 void test_wrongNumberOfTypeArguments_tooMany() { | 4505 void test_wrongNumberOfTypeArguments_tooMany() { |
| 3252 Source source = addSource(EngineTestCase.createSource(["class A<E> {}", "A<A
, A> a = null;"])); | 4506 Source source = addSource(EngineTestCase.createSource(["class A<E> {}", "A<A
, A> a = null;"])); |
| 3253 resolve(source); | 4507 resolve(source); |
| 3254 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 4508 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 3255 verify([source]); | 4509 verify([source]); |
| 3256 } | 4510 } |
| 3257 void test_wrongNumberOfTypeArguments_typeTest_tooFew() { | 4511 void test_wrongNumberOfTypeArguments_typeTest_tooFew() { |
| 3258 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<K, V> {}", "f(p) {", " return p is C<A>;", "}"])); | 4512 Source source = addSource(EngineTestCase.createSource([ |
| 4513 "class A {}", |
| 4514 "class C<K, V> {}", |
| 4515 "f(p) {", |
| 4516 " return p is C<A>;", |
| 4517 "}"])); |
| 3259 resolve(source); | 4518 resolve(source); |
| 3260 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 4519 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 3261 verify([source]); | 4520 verify([source]); |
| 3262 } | 4521 } |
| 3263 void test_wrongNumberOfTypeArguments_typeTest_tooMany() { | 4522 void test_wrongNumberOfTypeArguments_typeTest_tooMany() { |
| 3264 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<E> {}", "f(p) {", " return p is C<A, A>;", "}"])); | 4523 Source source = addSource(EngineTestCase.createSource([ |
| 4524 "class A {}", |
| 4525 "class C<E> {}", |
| 4526 "f(p) {", |
| 4527 " return p is C<A, A>;", |
| 4528 "}"])); |
| 3265 resolve(source); | 4529 resolve(source); |
| 3266 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); | 4530 assertErrors([StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
| 3267 verify([source]); | 4531 verify([source]); |
| 3268 } | 4532 } |
| 3269 static dartSuite() { | 4533 static dartSuite() { |
| 3270 _ut.group('StaticTypeWarningCodeTest', () { | 4534 _ut.group('StaticTypeWarningCodeTest', () { |
| 3271 _ut.test('test_inconsistentMethodInheritance_paramCount', () { | 4535 _ut.test('test_inconsistentMethodInheritance_paramCount', () { |
| 3272 final __test = new StaticTypeWarningCodeTest(); | 4536 final __test = new StaticTypeWarningCodeTest(); |
| 3273 runJUnitTest(__test, __test.test_inconsistentMethodInheritance_paramCoun
t); | 4537 runJUnitTest(__test, __test.test_inconsistentMethodInheritance_paramCoun
t); |
| 3274 }); | 4538 }); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3574 assertErrors([HintCode.DEAD_CODE]); | 4838 assertErrors([HintCode.DEAD_CODE]); |
| 3575 verify([source]); | 4839 verify([source]); |
| 3576 } | 4840 } |
| 3577 void test_deadCode_deadBlock_while_nested() { | 4841 void test_deadCode_deadBlock_while_nested() { |
| 3578 Source source = addSource(EngineTestCase.createSource(["f() {", " while(fal
se) {if(false) {}}", "}"])); | 4842 Source source = addSource(EngineTestCase.createSource(["f() {", " while(fal
se) {if(false) {}}", "}"])); |
| 3579 resolve(source); | 4843 resolve(source); |
| 3580 assertErrors([HintCode.DEAD_CODE]); | 4844 assertErrors([HintCode.DEAD_CODE]); |
| 3581 verify([source]); | 4845 verify([source]); |
| 3582 } | 4846 } |
| 3583 void test_deadCode_deadCatch_catchFollowingCatch() { | 4847 void test_deadCode_deadCatch_catchFollowingCatch() { |
| 3584 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {"
, " try {} catch (e) {} catch (e) {}", "}"])); | 4848 Source source = addSource(EngineTestCase.createSource([ |
| 4849 "class A {}", |
| 4850 "f() {", |
| 4851 " try {} catch (e) {} catch (e) {}", |
| 4852 "}"])); |
| 3585 resolve(source); | 4853 resolve(source); |
| 3586 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); | 4854 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); |
| 3587 verify([source]); | 4855 verify([source]); |
| 3588 } | 4856 } |
| 3589 void test_deadCode_deadCatch_catchFollowingCatch_nested() { | 4857 void test_deadCode_deadCatch_catchFollowingCatch_nested() { |
| 3590 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {"
, " try {} catch (e) {} catch (e) {if(false) {}}", "}"])); | 4858 Source source = addSource(EngineTestCase.createSource([ |
| 4859 "class A {}", |
| 4860 "f() {", |
| 4861 " try {} catch (e) {} catch (e) {if(false) {}}", |
| 4862 "}"])); |
| 3591 resolve(source); | 4863 resolve(source); |
| 3592 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); | 4864 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); |
| 3593 verify([source]); | 4865 verify([source]); |
| 3594 } | 4866 } |
| 3595 void test_deadCode_deadCatch_catchFollowingCatch_object() { | 4867 void test_deadCode_deadCatch_catchFollowingCatch_object() { |
| 3596 Source source = addSource(EngineTestCase.createSource(["f() {", " try {} on
Object catch (e) {} catch (e) {}", "}"])); | 4868 Source source = addSource(EngineTestCase.createSource([ |
| 4869 "f() {", |
| 4870 " try {} on Object catch (e) {} catch (e) {}", |
| 4871 "}"])); |
| 3597 resolve(source); | 4872 resolve(source); |
| 3598 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); | 4873 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); |
| 3599 verify([source]); | 4874 verify([source]); |
| 3600 } | 4875 } |
| 3601 void test_deadCode_deadCatch_catchFollowingCatch_object_nested() { | 4876 void test_deadCode_deadCatch_catchFollowingCatch_object_nested() { |
| 3602 Source source = addSource(EngineTestCase.createSource(["f() {", " try {} on
Object catch (e) {} catch (e) {if(false) {}}", "}"])); | 4877 Source source = addSource(EngineTestCase.createSource([ |
| 4878 "f() {", |
| 4879 " try {} on Object catch (e) {} catch (e) {if(false) {}}", |
| 4880 "}"])); |
| 3603 resolve(source); | 4881 resolve(source); |
| 3604 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); | 4882 assertErrors([HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]); |
| 3605 verify([source]); | 4883 verify([source]); |
| 3606 } | 4884 } |
| 3607 void test_deadCode_deadCatch_onCatchSubtype() { | 4885 void test_deadCode_deadCatch_onCatchSubtype() { |
| 3608 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "f() {", " try {} on A catch (e) {} on B catch (e) {}", "}"]))
; | 4886 Source source = addSource(EngineTestCase.createSource([ |
| 4887 "class A {}", |
| 4888 "class B extends A {}", |
| 4889 "f() {", |
| 4890 " try {} on A catch (e) {} on B catch (e) {}", |
| 4891 "}"])); |
| 3609 resolve(source); | 4892 resolve(source); |
| 3610 assertErrors([HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]); | 4893 assertErrors([HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]); |
| 3611 verify([source]); | 4894 verify([source]); |
| 3612 } | 4895 } |
| 3613 void test_deadCode_deadCatch_onCatchSubtype_nested() { | 4896 void test_deadCode_deadCatch_onCatchSubtype_nested() { |
| 3614 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "f() {", " try {} on A catch (e) {} on B catch (e) {if(false)
{}}", "}"])); | 4897 Source source = addSource(EngineTestCase.createSource([ |
| 4898 "class A {}", |
| 4899 "class B extends A {}", |
| 4900 "f() {", |
| 4901 " try {} on A catch (e) {} on B catch (e) {if(false) {}}", |
| 4902 "}"])); |
| 3615 resolve(source); | 4903 resolve(source); |
| 3616 assertErrors([HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]); | 4904 assertErrors([HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]); |
| 3617 verify([source]); | 4905 verify([source]); |
| 3618 } | 4906 } |
| 3619 void test_deadCode_deadOperandLHS_and() { | 4907 void test_deadCode_deadOperandLHS_and() { |
| 3620 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
false && false;", "}"])); | 4908 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
false && false;", "}"])); |
| 3621 resolve(source); | 4909 resolve(source); |
| 3622 assertErrors([HintCode.DEAD_CODE]); | 4910 assertErrors([HintCode.DEAD_CODE]); |
| 3623 verify([source]); | 4911 verify([source]); |
| 3624 } | 4912 } |
| 3625 void test_deadCode_deadOperandLHS_and_nested() { | 4913 void test_deadCode_deadOperandLHS_and_nested() { |
| 3626 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
false && (false && false);", "}"])); | 4914 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
false && (false && false);", "}"])); |
| 3627 resolve(source); | 4915 resolve(source); |
| 3628 assertErrors([HintCode.DEAD_CODE]); | 4916 assertErrors([HintCode.DEAD_CODE]); |
| 3629 verify([source]); | 4917 verify([source]); |
| 3630 } | 4918 } |
| 3631 void test_deadCode_deadOperandLHS_or() { | 4919 void test_deadCode_deadOperandLHS_or() { |
| 3632 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
true || true;", "}"])); | 4920 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
true || true;", "}"])); |
| 3633 resolve(source); | 4921 resolve(source); |
| 3634 assertErrors([HintCode.DEAD_CODE]); | 4922 assertErrors([HintCode.DEAD_CODE]); |
| 3635 verify([source]); | 4923 verify([source]); |
| 3636 } | 4924 } |
| 3637 void test_deadCode_deadOperandLHS_or_nested() { | 4925 void test_deadCode_deadOperandLHS_or_nested() { |
| 3638 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
true || (false && false);", "}"])); | 4926 Source source = addSource(EngineTestCase.createSource(["f() {", " bool b =
true || (false && false);", "}"])); |
| 3639 resolve(source); | 4927 resolve(source); |
| 3640 assertErrors([HintCode.DEAD_CODE]); | 4928 assertErrors([HintCode.DEAD_CODE]); |
| 3641 verify([source]); | 4929 verify([source]); |
| 3642 } | 4930 } |
| 3643 void test_deadCode_statementAfterReturn_function() { | 4931 void test_deadCode_statementAfterReturn_function() { |
| 3644 Source source = addSource(EngineTestCase.createSource(["f() {", " var one =
1;", " return;", " var two = 2;", "}"])); | 4932 Source source = addSource(EngineTestCase.createSource([ |
| 4933 "f() {", |
| 4934 " var one = 1;", |
| 4935 " return;", |
| 4936 " var two = 2;", |
| 4937 "}"])); |
| 3645 resolve(source); | 4938 resolve(source); |
| 3646 assertErrors([HintCode.DEAD_CODE]); | 4939 assertErrors([HintCode.DEAD_CODE]); |
| 3647 verify([source]); | 4940 verify([source]); |
| 3648 } | 4941 } |
| 3649 void test_deadCode_statementAfterReturn_ifStatement() { | 4942 void test_deadCode_statementAfterReturn_ifStatement() { |
| 3650 Source source = addSource(EngineTestCase.createSource(["f(bool b) {", " if(
b) {", " var one = 1;", " return;", " var two = 2;", " }", "}"])); | 4943 Source source = addSource(EngineTestCase.createSource([ |
| 4944 "f(bool b) {", |
| 4945 " if(b) {", |
| 4946 " var one = 1;", |
| 4947 " return;", |
| 4948 " var two = 2;", |
| 4949 " }", |
| 4950 "}"])); |
| 3651 resolve(source); | 4951 resolve(source); |
| 3652 assertErrors([HintCode.DEAD_CODE]); | 4952 assertErrors([HintCode.DEAD_CODE]); |
| 3653 verify([source]); | 4953 verify([source]); |
| 3654 } | 4954 } |
| 3655 void test_deadCode_statementAfterReturn_method() { | 4955 void test_deadCode_statementAfterReturn_method() { |
| 3656 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
", " var one = 1;", " return;", " var two = 2;", " }", "}"])); | 4956 Source source = addSource(EngineTestCase.createSource([ |
| 4957 "class A {", |
| 4958 " m() {", |
| 4959 " var one = 1;", |
| 4960 " return;", |
| 4961 " var two = 2;", |
| 4962 " }", |
| 4963 "}"])); |
| 3657 resolve(source); | 4964 resolve(source); |
| 3658 assertErrors([HintCode.DEAD_CODE]); | 4965 assertErrors([HintCode.DEAD_CODE]); |
| 3659 verify([source]); | 4966 verify([source]); |
| 3660 } | 4967 } |
| 3661 void test_deadCode_statementAfterReturn_nested() { | 4968 void test_deadCode_statementAfterReturn_nested() { |
| 3662 Source source = addSource(EngineTestCase.createSource(["f() {", " var one =
1;", " return;", " if(false) {}", "}"])); | 4969 Source source = addSource(EngineTestCase.createSource([ |
| 4970 "f() {", |
| 4971 " var one = 1;", |
| 4972 " return;", |
| 4973 " if(false) {}", |
| 4974 "}"])); |
| 3663 resolve(source); | 4975 resolve(source); |
| 3664 assertErrors([HintCode.DEAD_CODE]); | 4976 assertErrors([HintCode.DEAD_CODE]); |
| 3665 verify([source]); | 4977 verify([source]); |
| 3666 } | 4978 } |
| 3667 void test_deadCode_statementAfterReturn_twoReturns() { | 4979 void test_deadCode_statementAfterReturn_twoReturns() { |
| 3668 Source source = addSource(EngineTestCase.createSource(["f() {", " var one =
1;", " return;", " var two = 2;", " return;", " var three = 3;", "}"])); | 4980 Source source = addSource(EngineTestCase.createSource([ |
| 4981 "f() {", |
| 4982 " var one = 1;", |
| 4983 " return;", |
| 4984 " var two = 2;", |
| 4985 " return;", |
| 4986 " var three = 3;", |
| 4987 "}"])); |
| 3669 resolve(source); | 4988 resolve(source); |
| 3670 assertErrors([HintCode.DEAD_CODE]); | 4989 assertErrors([HintCode.DEAD_CODE]); |
| 3671 verify([source]); | 4990 verify([source]); |
| 3672 } | 4991 } |
| 3673 static dartSuite() { | 4992 static dartSuite() { |
| 3674 _ut.group('HintCodeTest', () { | 4993 _ut.group('HintCodeTest', () { |
| 3675 _ut.test('test_deadCode_deadBlock_conditionalElse', () { | 4994 _ut.test('test_deadCode_deadBlock_conditionalElse', () { |
| 3676 final __test = new HintCodeTest(); | 4995 final __test = new HintCodeTest(); |
| 3677 runJUnitTest(__test, __test.test_deadCode_deadBlock_conditionalElse); | 4996 runJUnitTest(__test, __test.test_deadCode_deadBlock_conditionalElse); |
| 3678 }); | 4997 }); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4326 InterfaceType doubleType = classElement("double", numType, []).type; | 5645 InterfaceType doubleType = classElement("double", numType, []).type; |
| 4327 InterfaceType functionType = classElement("Function", objectType, []).type; | 5646 InterfaceType functionType = classElement("Function", objectType, []).type; |
| 4328 InterfaceType intType = classElement("int", numType, []).type; | 5647 InterfaceType intType = classElement("int", numType, []).type; |
| 4329 InterfaceType listType = classElement("List", objectType, ["E"]).type; | 5648 InterfaceType listType = classElement("List", objectType, ["E"]).type; |
| 4330 InterfaceType mapType = classElement("Map", objectType, ["K", "V"]).type; | 5649 InterfaceType mapType = classElement("Map", objectType, ["K", "V"]).type; |
| 4331 InterfaceType stackTraceType = classElement("StackTrace", objectType, []).ty
pe; | 5650 InterfaceType stackTraceType = classElement("StackTrace", objectType, []).ty
pe; |
| 4332 InterfaceType stringType = classElement("String", objectType, []).type; | 5651 InterfaceType stringType = classElement("String", objectType, []).type; |
| 4333 InterfaceType symbolType = classElement("Symbol", objectType, []).type; | 5652 InterfaceType symbolType = classElement("Symbol", objectType, []).type; |
| 4334 InterfaceType typeType = classElement("Type", objectType, []).type; | 5653 InterfaceType typeType = classElement("Type", objectType, []).type; |
| 4335 CompilationUnitElementImpl unit = new CompilationUnitElementImpl("lib.dart")
; | 5654 CompilationUnitElementImpl unit = new CompilationUnitElementImpl("lib.dart")
; |
| 4336 unit.types = <ClassElement> [boolType.element, doubleType.element, functionT
ype.element, intType.element, listType.element, mapType.element, objectType.elem
ent, stackTraceType.element, stringType.element, symbolType.element, typeType.el
ement]; | 5655 unit.types = <ClassElement> [ |
| 5656 boolType.element, |
| 5657 doubleType.element, |
| 5658 functionType.element, |
| 5659 intType.element, |
| 5660 listType.element, |
| 5661 mapType.element, |
| 5662 objectType.element, |
| 5663 stackTraceType.element, |
| 5664 stringType.element, |
| 5665 symbolType.element, |
| 5666 typeType.element]; |
| 4337 LibraryElementImpl library = new LibraryElementImpl(new AnalysisContextImpl(
), ASTFactory.libraryIdentifier2(["lib"])); | 5667 LibraryElementImpl library = new LibraryElementImpl(new AnalysisContextImpl(
), ASTFactory.libraryIdentifier2(["lib"])); |
| 4338 library.definingCompilationUnit = unit; | 5668 library.definingCompilationUnit = unit; |
| 4339 TypeProviderImpl provider = new TypeProviderImpl(library); | 5669 TypeProviderImpl provider = new TypeProviderImpl(library); |
| 4340 JUnitTestCase.assertSame(boolType, provider.boolType); | 5670 JUnitTestCase.assertSame(boolType, provider.boolType); |
| 4341 JUnitTestCase.assertNotNull(provider.bottomType); | 5671 JUnitTestCase.assertNotNull(provider.bottomType); |
| 4342 JUnitTestCase.assertSame(doubleType, provider.doubleType); | 5672 JUnitTestCase.assertSame(doubleType, provider.doubleType); |
| 4343 JUnitTestCase.assertNotNull(provider.dynamicType); | 5673 JUnitTestCase.assertNotNull(provider.dynamicType); |
| 4344 JUnitTestCase.assertSame(functionType, provider.functionType); | 5674 JUnitTestCase.assertSame(functionType, provider.functionType); |
| 4345 JUnitTestCase.assertSame(intType, provider.intType); | 5675 JUnitTestCase.assertSame(intType, provider.intType); |
| 4346 JUnitTestCase.assertSame(listType, provider.listType); | 5676 JUnitTestCase.assertSame(listType, provider.listType); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 } | 6161 } |
| 4832 } | 6162 } |
| 4833 class CompileTimeErrorCodeTest extends ResolverTestCase { | 6163 class CompileTimeErrorCodeTest extends ResolverTestCase { |
| 4834 void fail_compileTimeConstantRaisesException() { | 6164 void fail_compileTimeConstantRaisesException() { |
| 4835 Source source = addSource(EngineTestCase.createSource([])); | 6165 Source source = addSource(EngineTestCase.createSource([])); |
| 4836 resolve(source); | 6166 resolve(source); |
| 4837 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION]); | 6167 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION]); |
| 4838 verify([source]); | 6168 verify([source]); |
| 4839 } | 6169 } |
| 4840 void fail_constEvalThrowsException() { | 6170 void fail_constEvalThrowsException() { |
| 4841 Source source = addSource(EngineTestCase.createSource(["class C {", " const
C();", "}", "f() { return const C(); }"])); | 6171 Source source = addSource(EngineTestCase.createSource([ |
| 6172 "class C {", |
| 6173 " const C();", |
| 6174 "}", |
| 6175 "f() { return const C(); }"])); |
| 4842 resolve(source); | 6176 resolve(source); |
| 4843 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]); | 6177 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]); |
| 4844 verify([source]); | 6178 verify([source]); |
| 4845 } | 6179 } |
| 4846 void fail_extendsOrImplementsDisallowedClass_extends_null() { | 6180 void fail_extendsOrImplementsDisallowedClass_extends_null() { |
| 4847 Source source = addSource(EngineTestCase.createSource(["class A extends Null
{}"])); | 6181 Source source = addSource(EngineTestCase.createSource(["class A extends Null
{}"])); |
| 4848 resolve(source); | 6182 resolve(source); |
| 4849 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); | 6183 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); |
| 4850 verify([source]); | 6184 verify([source]); |
| 4851 } | 6185 } |
| 4852 void fail_extendsOrImplementsDisallowedClass_implements_null() { | 6186 void fail_extendsOrImplementsDisallowedClass_implements_null() { |
| 4853 Source source = addSource(EngineTestCase.createSource(["class A implements N
ull {}"])); | 6187 Source source = addSource(EngineTestCase.createSource(["class A implements N
ull {}"])); |
| 4854 resolve(source); | 6188 resolve(source); |
| 4855 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 6189 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 4856 verify([source]); | 6190 verify([source]); |
| 4857 } | 6191 } |
| 4858 void fail_mixinDeclaresConstructor() { | 6192 void fail_mixinDeclaresConstructor() { |
| 4859 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "class B extends Object mixin A {}"])); | 6193 Source source = addSource(EngineTestCase.createSource([ |
| 6194 "class A {", |
| 6195 " A() {}", |
| 6196 "}", |
| 6197 "class B extends Object mixin A {}"])); |
| 4860 resolve(source); | 6198 resolve(source); |
| 4861 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); | 6199 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| 4862 verify([source]); | 6200 verify([source]); |
| 4863 } | 6201 } |
| 4864 void fail_mixinOfNonClass() { | 6202 void fail_mixinOfNonClass() { |
| 4865 Source source = addSource(EngineTestCase.createSource(["var A;", "class B ex
tends Object mixin A {}"])); | 6203 Source source = addSource(EngineTestCase.createSource(["var A;", "class B ex
tends Object mixin A {}"])); |
| 4866 resolve(source); | 6204 resolve(source); |
| 4867 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); | 6205 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 4868 verify([source]); | 6206 verify([source]); |
| 4869 } | 6207 } |
| 4870 void fail_objectCannotExtendAnotherClass() { | 6208 void fail_objectCannotExtendAnotherClass() { |
| 4871 Source source = addSource(EngineTestCase.createSource([])); | 6209 Source source = addSource(EngineTestCase.createSource([])); |
| 4872 resolve(source); | 6210 resolve(source); |
| 4873 assertErrors([CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]); | 6211 assertErrors([CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]); |
| 4874 verify([source]); | 6212 verify([source]); |
| 4875 } | 6213 } |
| 4876 void fail_recursiveCompileTimeConstant() { | 6214 void fail_recursiveCompileTimeConstant() { |
| 4877 Source source = addSource(EngineTestCase.createSource(["const x = y + 1;", "
const y = x + 1;"])); | 6215 Source source = addSource(EngineTestCase.createSource(["const x = y + 1;", "
const y = x + 1;"])); |
| 4878 resolve(source); | 6216 resolve(source); |
| 4879 assertErrors([CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); | 6217 assertErrors([CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]); |
| 4880 verify([source]); | 6218 verify([source]); |
| 4881 } | 6219 } |
| 4882 void fail_recursiveFunctionTypeAlias_direct() { | |
| 4883 Source source = addSource(EngineTestCase.createSource(["typedef F(F f);"])); | |
| 4884 resolve(source); | |
| 4885 assertErrors([CompileTimeErrorCode.RECURSIVE_FUNCTION_TYPE_ALIAS]); | |
| 4886 verify([source]); | |
| 4887 } | |
| 4888 void fail_recursiveFunctionTypeAlias_indirect() { | |
| 4889 Source source = addSource(EngineTestCase.createSource(["typedef F(G g);", "t
ypedef G(F f);"])); | |
| 4890 resolve(source); | |
| 4891 assertErrors([CompileTimeErrorCode.RECURSIVE_FUNCTION_TYPE_ALIAS]); | |
| 4892 verify([source]); | |
| 4893 } | |
| 4894 void fail_reservedWordAsIdentifier() { | |
| 4895 Source source = addSource(EngineTestCase.createSource(["int class = 2;"])); | |
| 4896 resolve(source); | |
| 4897 assertErrors([CompileTimeErrorCode.RESERVED_WORD_AS_IDENTIFIER]); | |
| 4898 verify([source]); | |
| 4899 } | |
| 4900 void fail_staticTopLevelFunction_topLevel() { | |
| 4901 Source source = addSource(EngineTestCase.createSource(["static f() {}"])); | |
| 4902 resolve(source); | |
| 4903 assertErrors([CompileTimeErrorCode.STATIC_TOP_LEVEL_FUNCTION]); | |
| 4904 verify([source]); | |
| 4905 } | |
| 4906 void fail_staticTopLevelVariable() { | |
| 4907 Source source = addSource(EngineTestCase.createSource(["static int x;"])); | |
| 4908 resolve(source); | |
| 4909 assertErrors([CompileTimeErrorCode.STATIC_TOP_LEVEL_VARIABLE]); | |
| 4910 verify([source]); | |
| 4911 } | |
| 4912 void fail_superInitializerInObject() { | 6220 void fail_superInitializerInObject() { |
| 4913 Source source = addSource(EngineTestCase.createSource([])); | 6221 Source source = addSource(EngineTestCase.createSource([])); |
| 4914 resolve(source); | 6222 resolve(source); |
| 4915 assertErrors([CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]); | 6223 assertErrors([CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]); |
| 4916 verify([source]); | 6224 verify([source]); |
| 4917 } | 6225 } |
| 4918 void fail_uninitializedFinalField() { | |
| 4919 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int i;", "}"])); | |
| 4920 resolve(source); | |
| 4921 assertErrors([CompileTimeErrorCode.UNINITIALIZED_FINAL_FIELD]); | |
| 4922 verify([source]); | |
| 4923 } | |
| 4924 void test_ambiguousExport() { | 6226 void test_ambiguousExport() { |
| 4925 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';", "export 'lib2.dart';"])); | 6227 Source source = addSource(EngineTestCase.createSource([ |
| 6228 "library L;", |
| 6229 "export 'lib1.dart';", |
| 6230 "export 'lib2.dart';"])); |
| 4926 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6231 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4927 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6232 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4928 resolve(source); | 6233 resolve(source); |
| 4929 assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]); | 6234 assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]); |
| 4930 verify([source]); | 6235 verify([source]); |
| 4931 } | 6236 } |
| 4932 void test_ambiguousImport_as() { | 6237 void test_ambiguousImport_as() { |
| 4933 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "f(p) {p as N;}"])); | 6238 Source source = addSource(EngineTestCase.createSource([ |
| 6239 "import 'lib1.dart';", |
| 6240 "import 'lib2.dart';", |
| 6241 "f(p) {p as N;}"])); |
| 4934 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6242 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4935 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6243 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4936 resolve(source); | 6244 resolve(source); |
| 4937 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 6245 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 4938 } | 6246 } |
| 4939 void test_ambiguousImport_extends() { | 6247 void test_ambiguousImport_extends() { |
| 4940 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "class A extends N {}"])); | 6248 Source source = addSource(EngineTestCase.createSource([ |
| 6249 "import 'lib1.dart';", |
| 6250 "import 'lib2.dart';", |
| 6251 "class A extends N {}"])); |
| 4941 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6252 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4942 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6253 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4943 resolve(source); | 6254 resolve(source); |
| 4944 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT, CompileTimeErrorCode.EX
TENDS_NON_CLASS]); | 6255 assertErrors([ |
| 6256 CompileTimeErrorCode.AMBIGUOUS_IMPORT, |
| 6257 CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| 4945 } | 6258 } |
| 4946 void test_ambiguousImport_function() { | 6259 void test_ambiguousImport_function() { |
| 4947 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "g() { return f(); }"])); | 6260 Source source = addSource(EngineTestCase.createSource([ |
| 6261 "import 'lib1.dart';", |
| 6262 "import 'lib2.dart';", |
| 6263 "g() { return f(); }"])); |
| 4948 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f()
{}"])); | 6264 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f()
{}"])); |
| 4949 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f()
{}"])); | 6265 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f()
{}"])); |
| 4950 resolve(source); | 6266 resolve(source); |
| 4951 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT, StaticTypeWarningCode.U
NDEFINED_FUNCTION]); | 6267 assertErrors([ |
| 6268 CompileTimeErrorCode.AMBIGUOUS_IMPORT, |
| 6269 StaticTypeWarningCode.UNDEFINED_FUNCTION]); |
| 4952 } | 6270 } |
| 4953 void test_ambiguousImport_implements() { | 6271 void test_ambiguousImport_implements() { |
| 4954 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "class A implements N {}"])); | 6272 Source source = addSource(EngineTestCase.createSource([ |
| 6273 "import 'lib1.dart';", |
| 6274 "import 'lib2.dart';", |
| 6275 "class A implements N {}"])); |
| 4955 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6276 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4956 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6277 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4957 resolve(source); | 6278 resolve(source); |
| 4958 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT, CompileTimeErrorCode.IM
PLEMENTS_NON_CLASS]); | 6279 assertErrors([ |
| 6280 CompileTimeErrorCode.AMBIGUOUS_IMPORT, |
| 6281 CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 4959 } | 6282 } |
| 4960 void test_ambiguousImport_instanceCreation() { | 6283 void test_ambiguousImport_instanceCreation() { |
| 4961 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'lib1.dart';", "import 'lib2.dart';", "f() {new N();}"])); | 6284 Source source = addSource(EngineTestCase.createSource([ |
| 6285 "library L;", |
| 6286 "import 'lib1.dart';", |
| 6287 "import 'lib2.dart';", |
| 6288 "f() {new N();}"])); |
| 4962 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6289 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4963 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6290 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4964 resolve(source); | 6291 resolve(source); |
| 4965 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 6292 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 4966 } | 6293 } |
| 4967 void test_ambiguousImport_is() { | 6294 void test_ambiguousImport_is() { |
| 4968 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "f(p) {p is N;}"])); | 6295 Source source = addSource(EngineTestCase.createSource([ |
| 6296 "import 'lib1.dart';", |
| 6297 "import 'lib2.dart';", |
| 6298 "f(p) {p is N;}"])); |
| 4969 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6299 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4970 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6300 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4971 resolve(source); | 6301 resolve(source); |
| 4972 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 6302 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 4973 } | 6303 } |
| 4974 void test_ambiguousImport_qualifier() { | 6304 void test_ambiguousImport_qualifier() { |
| 4975 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "g() { N.FOO; }"])); | 6305 Source source = addSource(EngineTestCase.createSource([ |
| 6306 "import 'lib1.dart';", |
| 6307 "import 'lib2.dart';", |
| 6308 "g() { N.FOO; }"])); |
| 4976 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6309 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4977 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6310 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4978 resolve(source); | 6311 resolve(source); |
| 4979 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 6312 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 4980 } | 6313 } |
| 4981 void test_ambiguousImport_typeArgument_instanceCreation() { | 6314 void test_ambiguousImport_typeArgument_instanceCreation() { |
| 4982 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "class A<T> {}", "f() {new A<N>();}"])); | 6315 Source source = addSource(EngineTestCase.createSource([ |
| 6316 "import 'lib1.dart';", |
| 6317 "import 'lib2.dart';", |
| 6318 "class A<T> {}", |
| 6319 "f() {new A<N>();}"])); |
| 4983 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6320 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 4984 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6321 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 4985 resolve(source); | 6322 resolve(source); |
| 4986 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 6323 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 4987 } | 6324 } |
| 4988 void test_ambiguousImport_varRead() { | 6325 void test_ambiguousImport_varRead() { |
| 4989 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "f() { g(v); }", "g(p) {}"])); | 6326 Source source = addSource(EngineTestCase.createSource([ |
| 6327 "import 'lib1.dart';", |
| 6328 "import 'lib2.dart';", |
| 6329 "f() { g(v); }", |
| 6330 "g(p) {}"])); |
| 4990 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); | 6331 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); |
| 4991 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); | 6332 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); |
| 4992 resolve(source); | 6333 resolve(source); |
| 4993 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 6334 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 4994 } | 6335 } |
| 4995 void test_ambiguousImport_varWrite() { | 6336 void test_ambiguousImport_varWrite() { |
| 4996 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "f() { v = 0; }"])); | 6337 Source source = addSource(EngineTestCase.createSource([ |
| 6338 "import 'lib1.dart';", |
| 6339 "import 'lib2.dart';", |
| 6340 "f() { v = 0; }"])); |
| 4997 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); | 6341 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); |
| 4998 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); | 6342 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); |
| 4999 resolve(source); | 6343 resolve(source); |
| 5000 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 6344 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 5001 } | 6345 } |
| 5002 void test_argumentDefinitionTestNonParameter() { | 6346 void test_argumentDefinitionTestNonParameter() { |
| 5003 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); | 6347 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); |
| 5004 resolve(source); | 6348 resolve(source); |
| 5005 assertErrors([ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, CompileTi
meErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); | 6349 assertErrors([ |
| 6350 ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, |
| 6351 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); |
| 6352 verify([source]); |
| 6353 } |
| 6354 void test_argumentTypeNotAssignable_const() { |
| 6355 Source source = addSource(EngineTestCase.createSource([ |
| 6356 "class A {", |
| 6357 " const A(String p);", |
| 6358 "}", |
| 6359 "main() {", |
| 6360 " const A(42);", |
| 6361 "}"])); |
| 6362 resolve(source); |
| 6363 assertErrors([CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 6364 verify([source]); |
| 6365 } |
| 6366 void test_argumentTypeNotAssignable_const_super() { |
| 6367 Source source = addSource(EngineTestCase.createSource([ |
| 6368 "class A {", |
| 6369 " const A(String p);", |
| 6370 "}", |
| 6371 "class B extends A {", |
| 6372 " const B() : super(42);", |
| 6373 "}"])); |
| 6374 resolve(source); |
| 6375 assertErrors([CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 5006 verify([source]); | 6376 verify([source]); |
| 5007 } | 6377 } |
| 5008 void test_builtInIdentifierAsType() { | 6378 void test_builtInIdentifierAsType() { |
| 5009 Source source = addSource(EngineTestCase.createSource(["f() {", " typedef x
;", "}"])); | 6379 Source source = addSource(EngineTestCase.createSource(["f() {", " typedef x
;", "}"])); |
| 5010 resolve(source); | 6380 resolve(source); |
| 5011 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, StaticWarnin
gCode.UNDEFINED_CLASS]); | 6381 assertErrors([ |
| 6382 CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, |
| 6383 StaticWarningCode.UNDEFINED_CLASS]); |
| 5012 verify([source]); | 6384 verify([source]); |
| 5013 } | 6385 } |
| 5014 void test_builtInIdentifierAsTypedefName_classTypeAlias() { | 6386 void test_builtInIdentifierAsTypedefName_classTypeAlias() { |
| 5015 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "typedef as = A with B;"])); | 6387 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "typedef as = A with B;"])); |
| 5016 resolve(source); | 6388 resolve(source); |
| 5017 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); | 6389 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
| 5018 verify([source]); | 6390 verify([source]); |
| 5019 } | 6391 } |
| 5020 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { | 6392 void test_builtInIdentifierAsTypedefName_functionTypeAlias() { |
| 5021 Source source = addSource(EngineTestCase.createSource(["typedef bool as();"]
)); | 6393 Source source = addSource(EngineTestCase.createSource(["typedef bool as();"]
)); |
| 5022 resolve(source); | 6394 resolve(source); |
| 5023 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); | 6395 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
| 5024 verify([source]); | 6396 verify([source]); |
| 5025 } | 6397 } |
| 5026 void test_builtInIdentifierAsTypeName() { | 6398 void test_builtInIdentifierAsTypeName() { |
| 5027 Source source = addSource(EngineTestCase.createSource(["class as {}"])); | 6399 Source source = addSource(EngineTestCase.createSource(["class as {}"])); |
| 5028 resolve(source); | 6400 resolve(source); |
| 5029 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]); | 6401 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]); |
| 5030 verify([source]); | 6402 verify([source]); |
| 5031 } | 6403 } |
| 5032 void test_builtInIdentifierAsTypeVariableName() { | 6404 void test_builtInIdentifierAsTypeVariableName() { |
| 5033 Source source = addSource(EngineTestCase.createSource(["class A<as> {}"])); | 6405 Source source = addSource(EngineTestCase.createSource(["class A<as> {}"])); |
| 5034 resolve(source); | 6406 resolve(source); |
| 5035 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); | 6407 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); |
| 5036 verify([source]); | 6408 verify([source]); |
| 5037 } | 6409 } |
| 5038 void test_caseExpressionTypeImplementsEquals() { | 6410 void test_caseExpressionTypeImplementsEquals() { |
| 5039 Source source = addSource(EngineTestCase.createSource(["class IntWrapper {",
" final int value;", " const IntWrapper(this.value);", " bool operator ==(In
tWrapper x) {", " return value == x.value;", " }", "}", "", "f(var a) {", "
switch(a) {", " case(const IntWrapper(1)) : return 1;", " default: return
0;", " }", "}"])); | 6411 Source source = addSource(EngineTestCase.createSource([ |
| 6412 "class IntWrapper {", |
| 6413 " final int value;", |
| 6414 " const IntWrapper(this.value);", |
| 6415 " bool operator ==(IntWrapper x) {", |
| 6416 " return value == x.value;", |
| 6417 " }", |
| 6418 "}", |
| 6419 "", |
| 6420 "f(var a) {", |
| 6421 " switch(a) {", |
| 6422 " case(const IntWrapper(1)) : return 1;", |
| 6423 " default: return 0;", |
| 6424 " }", |
| 6425 "}"])); |
| 5040 resolve(source); | 6426 resolve(source); |
| 5041 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); | 6427 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| 5042 verify([source]); | 6428 verify([source]); |
| 5043 } | 6429 } |
| 5044 void test_conflictingConstructorNameAndMember_field() { | 6430 void test_conflictingConstructorNameAndMember_field() { |
| 5045 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A.x() {}", "}"])); | 6431 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A.x() {}", "}"])); |
| 5046 resolve(source); | 6432 resolve(source); |
| 5047 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); | 6433 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); |
| 5048 verify([source]); | 6434 verify([source]); |
| 5049 } | 6435 } |
| 5050 void test_conflictingConstructorNameAndMember_method() { | 6436 void test_conflictingConstructorNameAndMember_method() { |
| 5051 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.x();", " void x() {}", "}"])); | 6437 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.x();", " void x() {}", "}"])); |
| 5052 resolve(source); | 6438 resolve(source); |
| 5053 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD])
; | 6439 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD])
; |
| 5054 verify([source]); | 6440 verify([source]); |
| 5055 } | 6441 } |
| 5056 void test_conflictingGetterAndMethod_field_method() { | 6442 void test_conflictingGetterAndMethod_field_method() { |
| 5057 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
;", "}", "class B extends A {", " m() {}", "}"])); | 6443 Source source = addSource(EngineTestCase.createSource([ |
| 6444 "class A {", |
| 6445 " int m;", |
| 6446 "}", |
| 6447 "class B extends A {", |
| 6448 " m() {}", |
| 6449 "}"])); |
| 5058 resolve(source); | 6450 resolve(source); |
| 5059 assertErrors([CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]); | 6451 assertErrors([CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]); |
| 5060 verify([source]); | 6452 verify([source]); |
| 5061 } | 6453 } |
| 5062 void test_conflictingGetterAndMethod_getter_method() { | 6454 void test_conflictingGetterAndMethod_getter_method() { |
| 5063 Source source = addSource(EngineTestCase.createSource(["class A {", " get m
=> 0;", "}", "class B extends A {", " m() {}", "}"])); | 6455 Source source = addSource(EngineTestCase.createSource([ |
| 6456 "class A {", |
| 6457 " get m => 0;", |
| 6458 "}", |
| 6459 "class B extends A {", |
| 6460 " m() {}", |
| 6461 "}"])); |
| 5064 resolve(source); | 6462 resolve(source); |
| 5065 assertErrors([CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]); | 6463 assertErrors([CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]); |
| 5066 verify([source]); | 6464 verify([source]); |
| 5067 } | 6465 } |
| 5068 void test_conflictingGetterAndMethod_method_field() { | 6466 void test_conflictingGetterAndMethod_method_field() { |
| 5069 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "class B extends A {", " int m;", "}"])); | 6467 Source source = addSource(EngineTestCase.createSource([ |
| 6468 "class A {", |
| 6469 " m() {}", |
| 6470 "}", |
| 6471 "class B extends A {", |
| 6472 " int m;", |
| 6473 "}"])); |
| 5070 resolve(source); | 6474 resolve(source); |
| 5071 assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]); | 6475 assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]); |
| 5072 verify([source]); | 6476 verify([source]); |
| 5073 } | 6477 } |
| 5074 void test_conflictingGetterAndMethod_method_getter() { | 6478 void test_conflictingGetterAndMethod_method_getter() { |
| 5075 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "class B extends A {", " get m => 0;", "}"])); | 6479 Source source = addSource(EngineTestCase.createSource([ |
| 6480 "class A {", |
| 6481 " m() {}", |
| 6482 "}", |
| 6483 "class B extends A {", |
| 6484 " get m => 0;", |
| 6485 "}"])); |
| 5076 resolve(source); | 6486 resolve(source); |
| 5077 assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]); | 6487 assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]); |
| 5078 verify([source]); | 6488 verify([source]); |
| 5079 } | 6489 } |
| 5080 void test_constConstructorWithNonFinalField_mixin() { | 6490 void test_constConstructorWithNonFinalField_mixin() { |
| 5081 Source source = addSource(EngineTestCase.createSource(["class A {", " var a
;", "}", "class B extends Object with A {", " const B();", "}"])); | 6491 Source source = addSource(EngineTestCase.createSource([ |
| 6492 "class A {", |
| 6493 " var a;", |
| 6494 "}", |
| 6495 "class B extends Object with A {", |
| 6496 " const B();", |
| 6497 "}"])); |
| 5082 resolve(source); | 6498 resolve(source); |
| 5083 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); | 6499 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); |
| 5084 verify([source]); | 6500 verify([source]); |
| 5085 } | 6501 } |
| 5086 void test_constConstructorWithNonFinalField_super() { | 6502 void test_constConstructorWithNonFinalField_super() { |
| 5087 Source source = addSource(EngineTestCase.createSource(["class A {", " var a
;", "}", "class B extends A {", " const B();", "}"])); | 6503 Source source = addSource(EngineTestCase.createSource([ |
| 6504 "class A {", |
| 6505 " var a;", |
| 6506 "}", |
| 6507 "class B extends A {", |
| 6508 " const B();", |
| 6509 "}"])); |
| 5088 resolve(source); | 6510 resolve(source); |
| 5089 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); | 6511 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); |
| 5090 verify([source]); | 6512 verify([source]); |
| 5091 } | 6513 } |
| 5092 void test_constConstructorWithNonFinalField_this() { | 6514 void test_constConstructorWithNonFinalField_this() { |
| 5093 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " const A();", "}"])); | 6515 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " const A();", "}"])); |
| 5094 resolve(source); | 6516 resolve(source); |
| 5095 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); | 6517 assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]); |
| 5096 verify([source]); | 6518 verify([source]); |
| 5097 } | 6519 } |
| 5098 void test_constEval_newInstance_constConstructor() { | 6520 void test_constEval_newInstance_constConstructor() { |
| 5099 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "const a = new A();"])); | 6521 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "const a = new A();"])); |
| 5100 resolve(source); | 6522 resolve(source); |
| 5101 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); | 6523 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); |
| 5102 verify([source]); | 6524 verify([source]); |
| 5103 } | 6525 } |
| 5104 void test_constEval_propertyExtraction_methodInstance() { | 6526 void test_constEval_propertyExtraction_methodInstance() { |
| 5105 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", " m() {}", "}", "final a = const A();", "const C = a.m;"])); | 6527 Source source = addSource(EngineTestCase.createSource([ |
| 6528 "class A {", |
| 6529 " const A();", |
| 6530 " m() {}", |
| 6531 "}", |
| 6532 "final a = const A();", |
| 6533 "const C = a.m;"])); |
| 5106 resolve(source); | 6534 resolve(source); |
| 5107 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); | 6535 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); |
| 5108 verify([source]); | 6536 verify([source]); |
| 5109 } | 6537 } |
| 5110 void test_constEval_propertyExtraction_methodStatic_targetInstance() { | 6538 void test_constEval_propertyExtraction_methodStatic_targetInstance() { |
| 5111 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", " static m() {}", "}", "final a = const A();", "const C = a.m;"])); | 6539 Source source = addSource(EngineTestCase.createSource([ |
| 6540 "class A {", |
| 6541 " const A();", |
| 6542 " static m() {}", |
| 6543 "}", |
| 6544 "final a = const A();", |
| 6545 "const C = a.m;"])); |
| 5112 resolve(source); | 6546 resolve(source); |
| 5113 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); | 6547 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); |
| 5114 verify([source]); | 6548 verify([source]); |
| 5115 } | 6549 } |
| 5116 void test_constEvalThrowsException_binaryMinus_null() { | 6550 void test_constEvalThrowsException_binaryMinus_null() { |
| 5117 check_constEvalThrowsException_binary_null("null - 5", false); | 6551 check_constEvalThrowsException_binary_null("null - 5", false); |
| 5118 check_constEvalThrowsException_binary_null("5 - null", true); | 6552 check_constEvalThrowsException_binary_null("5 - null", true); |
| 5119 } | 6553 } |
| 5120 void test_constEvalThrowsException_binaryPlus_null() { | 6554 void test_constEvalThrowsException_binaryPlus_null() { |
| 5121 check_constEvalThrowsException_binary_null("null + 5", false); | 6555 check_constEvalThrowsException_binary_null("null + 5", false); |
| 5122 check_constEvalThrowsException_binary_null("5 + null", true); | 6556 check_constEvalThrowsException_binary_null("5 + null", true); |
| 5123 } | 6557 } |
| 5124 void test_constEvalThrowsException_divisionByZero() { | 6558 void test_constEvalThrowsException_divisionByZero() { |
| 5125 Source source = addSource("const C = 1 ~/ 0;"); | 6559 Source source = addSource("const C = 1 ~/ 0;"); |
| 5126 resolve(source); | 6560 resolve(source); |
| 5127 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]); | 6561 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]); |
| 5128 verify([source]); | 6562 verify([source]); |
| 5129 } | 6563 } |
| 5130 void test_constEvalThrowsException_unaryBitNot_null() { | 6564 void test_constEvalThrowsException_unaryBitNot_null() { |
| 5131 Source source = addSource("const C = ~null;"); | 6565 Source source = addSource("const C = ~null;"); |
| 5132 resolve(source); | 6566 resolve(source); |
| 5133 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, StaticTypeWa
rningCode.UNDEFINED_OPERATOR]); | 6567 assertErrors([ |
| 6568 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| 6569 StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 5134 } | 6570 } |
| 5135 void test_constEvalThrowsException_unaryNegated_null() { | 6571 void test_constEvalThrowsException_unaryNegated_null() { |
| 5136 Source source = addSource("const C = -null;"); | 6572 Source source = addSource("const C = -null;"); |
| 5137 resolve(source); | 6573 resolve(source); |
| 5138 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, StaticTypeWa
rningCode.UNDEFINED_OPERATOR]); | 6574 assertErrors([ |
| 6575 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| 6576 StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 5139 } | 6577 } |
| 5140 void test_constEvalThrowsException_unaryNot_null() { | 6578 void test_constEvalThrowsException_unaryNot_null() { |
| 5141 Source source = addSource("const C = !null;"); | 6579 Source source = addSource("const C = !null;"); |
| 5142 resolve(source); | 6580 resolve(source); |
| 5143 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); | 6581 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 5144 verify([source]); | 6582 verify([source]); |
| 5145 } | 6583 } |
| 5146 void test_constEvalTypeBool_binary() { | 6584 void test_constEvalTypeBool_binary() { |
| 5147 check_constEvalTypeBool_withParameter_binary("p && ''"); | 6585 check_constEvalTypeBool_withParameter_binary("p && ''"); |
| 5148 check_constEvalTypeBool_withParameter_binary("p || ''"); | 6586 check_constEvalTypeBool_withParameter_binary("p || ''"); |
| 5149 } | 6587 } |
| 5150 void test_constEvalTypeBool_binary_leftTrue() { | 6588 void test_constEvalTypeBool_binary_leftTrue() { |
| 5151 Source source = addSource("const C = (true || 0);"); | 6589 Source source = addSource("const C = (true || 0);"); |
| 5152 resolve(source); | 6590 resolve(source); |
| 5153 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, HintCode.DEAD_CODE]
); | 6591 assertErrors([ |
| 6592 CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL, |
| 6593 HintCode.DEAD_CODE]); |
| 5154 verify([source]); | 6594 verify([source]); |
| 5155 } | 6595 } |
| 5156 void test_constEvalTypeBoolNumString_equal() { | 6596 void test_constEvalTypeBoolNumString_equal() { |
| 5157 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "class B {", " final a;", " const B(num p) : a = p == const A();"
, "}"])); | 6597 Source source = addSource(EngineTestCase.createSource([ |
| 6598 "class A {", |
| 6599 " const A();", |
| 6600 "}", |
| 6601 "class B {", |
| 6602 " final a;", |
| 6603 " const B(num p) : a = p == const A();", |
| 6604 "}"])); |
| 5158 resolve(source); | 6605 resolve(source); |
| 5159 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]); | 6606 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]); |
| 5160 verify([source]); | 6607 verify([source]); |
| 5161 } | 6608 } |
| 5162 void test_constEvalTypeBoolNumString_notEqual() { | 6609 void test_constEvalTypeBoolNumString_notEqual() { |
| 5163 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "class B {", " final a;", " const B(String p) : a = p != const A(
);", "}"])); | 6610 Source source = addSource(EngineTestCase.createSource([ |
| 6611 "class A {", |
| 6612 " const A();", |
| 6613 "}", |
| 6614 "class B {", |
| 6615 " final a;", |
| 6616 " const B(String p) : a = p != const A();", |
| 6617 "}"])); |
| 5164 resolve(source); | 6618 resolve(source); |
| 5165 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]); | 6619 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]); |
| 5166 verify([source]); | 6620 verify([source]); |
| 5167 } | 6621 } |
| 5168 void test_constEvalTypeInt_binary() { | 6622 void test_constEvalTypeInt_binary() { |
| 5169 check_constEvalTypeInt_withParameter_binary("p ^ ''"); | 6623 check_constEvalTypeInt_withParameter_binary("p ^ ''"); |
| 5170 check_constEvalTypeInt_withParameter_binary("p & ''"); | 6624 check_constEvalTypeInt_withParameter_binary("p & ''"); |
| 5171 check_constEvalTypeInt_withParameter_binary("p | ''"); | 6625 check_constEvalTypeInt_withParameter_binary("p | ''"); |
| 5172 check_constEvalTypeInt_withParameter_binary("p >> ''"); | 6626 check_constEvalTypeInt_withParameter_binary("p >> ''"); |
| 5173 check_constEvalTypeInt_withParameter_binary("p << ''"); | 6627 check_constEvalTypeInt_withParameter_binary("p << ''"); |
| 5174 } | 6628 } |
| 5175 void test_constEvalTypeNum_binary() { | 6629 void test_constEvalTypeNum_binary() { |
| 5176 check_constEvalTypeNum_withParameter_binary("p + ''"); | 6630 check_constEvalTypeNum_withParameter_binary("p + ''"); |
| 5177 check_constEvalTypeNum_withParameter_binary("p - ''"); | 6631 check_constEvalTypeNum_withParameter_binary("p - ''"); |
| 5178 check_constEvalTypeNum_withParameter_binary("p * ''"); | 6632 check_constEvalTypeNum_withParameter_binary("p * ''"); |
| 5179 check_constEvalTypeNum_withParameter_binary("p / ''"); | 6633 check_constEvalTypeNum_withParameter_binary("p / ''"); |
| 5180 check_constEvalTypeNum_withParameter_binary("p ~/ ''"); | 6634 check_constEvalTypeNum_withParameter_binary("p ~/ ''"); |
| 5181 check_constEvalTypeNum_withParameter_binary("p > ''"); | 6635 check_constEvalTypeNum_withParameter_binary("p > ''"); |
| 5182 check_constEvalTypeNum_withParameter_binary("p < ''"); | 6636 check_constEvalTypeNum_withParameter_binary("p < ''"); |
| 5183 check_constEvalTypeNum_withParameter_binary("p >= ''"); | 6637 check_constEvalTypeNum_withParameter_binary("p >= ''"); |
| 5184 check_constEvalTypeNum_withParameter_binary("p <= ''"); | 6638 check_constEvalTypeNum_withParameter_binary("p <= ''"); |
| 5185 check_constEvalTypeNum_withParameter_binary("p % ''"); | 6639 check_constEvalTypeNum_withParameter_binary("p % ''"); |
| 5186 } | 6640 } |
| 6641 void test_constEvalTypeNum_plus_String() { |
| 6642 Source source = addSource("const C = 'a' + 'b';"); |
| 6643 resolve(source); |
| 6644 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_NUM]); |
| 6645 verify([source]); |
| 6646 } |
| 5187 void test_constFormalParameter_fieldFormalParameter() { | 6647 void test_constFormalParameter_fieldFormalParameter() { |
| 5188 Source source = addSource(EngineTestCase.createSource(["class A {", " var x
;", " A(const this.x) {}", "}"])); | 6648 Source source = addSource(EngineTestCase.createSource(["class A {", " var x
;", " A(const this.x) {}", "}"])); |
| 5189 resolve(source); | 6649 resolve(source); |
| 5190 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); | 6650 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); |
| 5191 verify([source]); | 6651 verify([source]); |
| 5192 } | 6652 } |
| 5193 void test_constFormalParameter_simpleFormalParameter() { | 6653 void test_constFormalParameter_simpleFormalParameter() { |
| 5194 Source source = addSource(EngineTestCase.createSource(["f(const x) {}"])); | 6654 Source source = addSource(EngineTestCase.createSource(["f(const x) {}"])); |
| 5195 resolve(source); | 6655 resolve(source); |
| 5196 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); | 6656 assertErrors([CompileTimeErrorCode.CONST_FORMAL_PARAMETER]); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5214 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); | 6674 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); |
| 5215 verify([source]); | 6675 verify([source]); |
| 5216 } | 6676 } |
| 5217 void test_constInstanceField() { | 6677 void test_constInstanceField() { |
| 5218 Source source = addSource(EngineTestCase.createSource(["class C {", " const
int f = 0;", "}"])); | 6678 Source source = addSource(EngineTestCase.createSource(["class C {", " const
int f = 0;", "}"])); |
| 5219 resolve(source); | 6679 resolve(source); |
| 5220 assertErrors([CompileTimeErrorCode.CONST_INSTANCE_FIELD]); | 6680 assertErrors([CompileTimeErrorCode.CONST_INSTANCE_FIELD]); |
| 5221 verify([source]); | 6681 verify([source]); |
| 5222 } | 6682 } |
| 5223 void test_constWithInvalidTypeParameters() { | 6683 void test_constWithInvalidTypeParameters() { |
| 5224 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "f() { return const A<A>(); }"])); | 6684 Source source = addSource(EngineTestCase.createSource([ |
| 6685 "class A {", |
| 6686 " const A();", |
| 6687 "}", |
| 6688 "f() { return const A<A>(); }"])); |
| 5225 resolve(source); | 6689 resolve(source); |
| 5226 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); | 6690 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| 5227 verify([source]); | 6691 verify([source]); |
| 5228 } | 6692 } |
| 5229 void test_constWithInvalidTypeParameters_tooFew() { | 6693 void test_constWithInvalidTypeParameters_tooFew() { |
| 5230 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<K, V> {", " const C();", "}", "f(p) {", " return const C<A>();", "}"])); | 6694 Source source = addSource(EngineTestCase.createSource([ |
| 6695 "class A {}", |
| 6696 "class C<K, V> {", |
| 6697 " const C();", |
| 6698 "}", |
| 6699 "f(p) {", |
| 6700 " return const C<A>();", |
| 6701 "}"])); |
| 5231 resolve(source); | 6702 resolve(source); |
| 5232 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); | 6703 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| 5233 verify([source]); | 6704 verify([source]); |
| 5234 } | 6705 } |
| 5235 void test_constWithInvalidTypeParameters_tooMany() { | 6706 void test_constWithInvalidTypeParameters_tooMany() { |
| 5236 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<E> {", " const C();", "}", "f(p) {", " return const C<A, A>();", "}"])); | 6707 Source source = addSource(EngineTestCase.createSource([ |
| 6708 "class A {}", |
| 6709 "class C<E> {", |
| 6710 " const C();", |
| 6711 "}", |
| 6712 "f(p) {", |
| 6713 " return const C<A, A>();", |
| 6714 "}"])); |
| 5237 resolve(source); | 6715 resolve(source); |
| 5238 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); | 6716 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| 5239 verify([source]); | 6717 verify([source]); |
| 5240 } | 6718 } |
| 5241 void test_constWithNonConst() { | 6719 void test_constWithNonConst() { |
| 5242 Source source = addSource(EngineTestCase.createSource(["class T {", " T(a,
b, {c, d}) {}", "}", "f() { return const T(0, 1, c: 2, d: 3); }"])); | 6720 Source source = addSource(EngineTestCase.createSource([ |
| 6721 "class T {", |
| 6722 " T(a, b, {c, d}) {}", |
| 6723 "}", |
| 6724 "f() { return const T(0, 1, c: 2, d: 3); }"])); |
| 5243 resolve(source); | 6725 resolve(source); |
| 5244 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONST]); | 6726 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONST]); |
| 5245 verify([source]); | 6727 verify([source]); |
| 5246 } | 6728 } |
| 5247 void test_constWithNonConstantArgument_annotation() { | 6729 void test_constWithNonConstantArgument_annotation() { |
| 5248 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A(int p);", "}", "var v = 42;", "@A(v)", "main() {", "}"])); | 6730 Source source = addSource(EngineTestCase.createSource([ |
| 6731 "class A {", |
| 6732 " const A(int p);", |
| 6733 "}", |
| 6734 "var v = 42;", |
| 6735 "@A(v)", |
| 6736 "main() {", |
| 6737 "}"])); |
| 5249 resolve(source); | 6738 resolve(source); |
| 5250 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); | 6739 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); |
| 5251 verify([source]); | 6740 verify([source]); |
| 5252 } | 6741 } |
| 5253 void test_constWithNonConstantArgument_instanceCreation() { | 6742 void test_constWithNonConstantArgument_instanceCreation() { |
| 5254 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A(a);", "}", "f(p) { return const A(p); }"])); | 6743 Source source = addSource(EngineTestCase.createSource([ |
| 6744 "class A {", |
| 6745 " const A(a);", |
| 6746 "}", |
| 6747 "f(p) { return const A(p); }"])); |
| 5255 resolve(source); | 6748 resolve(source); |
| 5256 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); | 6749 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); |
| 5257 verify([source]); | 6750 verify([source]); |
| 5258 } | 6751 } |
| 5259 void test_constWithNonType() { | 6752 void test_constWithNonType() { |
| 5260 Source source = addSource(EngineTestCase.createSource(["int A;", "f() {", "
return const A();", "}"])); | 6753 Source source = addSource(EngineTestCase.createSource(["int A;", "f() {", "
return const A();", "}"])); |
| 5261 resolve(source); | 6754 resolve(source); |
| 5262 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); | 6755 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); |
| 5263 verify([source]); | 6756 verify([source]); |
| 5264 } | 6757 } |
| 5265 void test_constWithNonType_fromLibrary() { | 6758 void test_constWithNonType_fromLibrary() { |
| 5266 Source source1 = addSource2("lib.dart", ""); | 6759 Source source1 = addSource2("lib.dart", ""); |
| 5267 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource(["impor
t 'lib.dart' as lib;", "void f() {", " const lib.A();", "}"])); | 6760 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([ |
| 6761 "import 'lib.dart' as lib;", |
| 6762 "void f() {", |
| 6763 " const lib.A();", |
| 6764 "}"])); |
| 5268 resolve(source1); | 6765 resolve(source1); |
| 5269 resolve(source2); | 6766 resolve(source2); |
| 5270 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); | 6767 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); |
| 5271 verify([source1]); | 6768 verify([source1]); |
| 5272 } | 6769 } |
| 5273 void test_constWithTypeParameters_direct() { | 6770 void test_constWithTypeParameters_direct() { |
| 5274 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " st
atic const V = const A<T>();", " const A();", "}"])); | 6771 Source source = addSource(EngineTestCase.createSource([ |
| 6772 "class A<T> {", |
| 6773 " static const V = const A<T>();", |
| 6774 " const A();", |
| 6775 "}"])); |
| 5275 resolve(source); | 6776 resolve(source); |
| 5276 assertErrors([CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, StaticWarning
Code.TYPE_PARAMETER_REFERENCED_BY_STATIC]); | 6777 assertErrors([ |
| 6778 CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, |
| 6779 StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]); |
| 5277 verify([source]); | 6780 verify([source]); |
| 5278 } | 6781 } |
| 5279 void test_constWithTypeParameters_indirect() { | 6782 void test_constWithTypeParameters_indirect() { |
| 5280 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " st
atic const V = const A<List<T>>();", " const A();", "}"])); | 6783 Source source = addSource(EngineTestCase.createSource([ |
| 6784 "class A<T> {", |
| 6785 " static const V = const A<List<T>>();", |
| 6786 " const A();", |
| 6787 "}"])); |
| 5281 resolve(source); | 6788 resolve(source); |
| 5282 assertErrors([CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, StaticWarning
Code.TYPE_PARAMETER_REFERENCED_BY_STATIC]); | 6789 assertErrors([ |
| 6790 CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, |
| 6791 StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]); |
| 5283 verify([source]); | 6792 verify([source]); |
| 5284 } | 6793 } |
| 5285 void test_constWithUndefinedConstructor() { | 6794 void test_constWithUndefinedConstructor() { |
| 5286 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "f() {", " return const A.noSuchConstructor();", "}"])); | 6795 Source source = addSource(EngineTestCase.createSource([ |
| 6796 "class A {", |
| 6797 " const A();", |
| 6798 "}", |
| 6799 "f() {", |
| 6800 " return const A.noSuchConstructor();", |
| 6801 "}"])); |
| 5287 resolve(source); | 6802 resolve(source); |
| 5288 assertErrors([CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]); | 6803 assertErrors([CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]); |
| 5289 } | 6804 } |
| 5290 void test_constWithUndefinedConstructorDefault() { | 6805 void test_constWithUndefinedConstructorDefault() { |
| 5291 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.name();", "}", "f() {", " return const A();", "}"])); | 6806 Source source = addSource(EngineTestCase.createSource([ |
| 6807 "class A {", |
| 6808 " const A.name();", |
| 6809 "}", |
| 6810 "f() {", |
| 6811 " return const A();", |
| 6812 "}"])); |
| 5292 resolve(source); | 6813 resolve(source); |
| 5293 assertErrors([CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]
); | 6814 assertErrors([CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]
); |
| 5294 verify([source]); | 6815 verify([source]); |
| 5295 } | 6816 } |
| 5296 void test_defaultValueInFunctionTypeAlias() { | 6817 void test_defaultValueInFunctionTypeAlias() { |
| 5297 Source source = addSource(EngineTestCase.createSource(["typedef F([x = 0]);"
])); | 6818 Source source = addSource(EngineTestCase.createSource(["typedef F([x = 0]);"
])); |
| 5298 resolve(source); | 6819 resolve(source); |
| 5299 assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]); | 6820 assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]); |
| 5300 verify([source]); | 6821 verify([source]); |
| 5301 } | 6822 } |
| 5302 void test_duplicateConstructorName_named() { | 6823 void test_duplicateConstructorName_named() { |
| 5303 Source source = addSource(EngineTestCase.createSource(["class A {", " A.a()
{}", " A.a() {}", "}"])); | 6824 Source source = addSource(EngineTestCase.createSource(["class A {", " A.a()
{}", " A.a() {}", "}"])); |
| 5304 resolve(source); | 6825 resolve(source); |
| 5305 assertErrors([CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, CompileTimeEr
rorCode.DUPLICATE_CONSTRUCTOR_NAME]); | 6826 assertErrors([ |
| 6827 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, |
| 6828 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME]); |
| 5306 verify([source]); | 6829 verify([source]); |
| 5307 } | 6830 } |
| 5308 void test_duplicateConstructorName_unnamed() { | 6831 void test_duplicateConstructorName_unnamed() { |
| 5309 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", " A() {}", "}"])); | 6832 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", " A() {}", "}"])); |
| 5310 resolve(source); | 6833 resolve(source); |
| 5311 assertErrors([CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, CompileTim
eErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT]); | 6834 assertErrors([ |
| 6835 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, |
| 6836 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT]); |
| 5312 verify([source]); | 6837 verify([source]); |
| 5313 } | 6838 } |
| 5314 void test_duplicateDefinition() { | 6839 void test_duplicateDefinition() { |
| 5315 Source source = addSource(EngineTestCase.createSource(["f() {", " int m = 0
;", " m(a) {}", "}"])); | 6840 Source source = addSource(EngineTestCase.createSource(["f() {", " int m = 0
;", " m(a) {}", "}"])); |
| 5316 resolve(source); | 6841 resolve(source); |
| 5317 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCod
e.DUPLICATE_DEFINITION]); | 6842 assertErrors([ |
| 6843 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6844 CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5318 verify([source]); | 6845 verify([source]); |
| 5319 } | 6846 } |
| 5320 void test_duplicateDefinition_acrossLibraries() { | 6847 void test_duplicateDefinition_acrossLibraries() { |
| 5321 Source librarySource = addSource2("/lib.dart", EngineTestCase.createSource([
"library lib;", "", "part 'a.dart';", "part 'b.dart';"])); | 6848 Source librarySource = addSource2("/lib.dart", EngineTestCase.createSource([
"library lib;", "", "part 'a.dart';", "part 'b.dart';"])); |
| 5322 Source sourceA = addSource2("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 6849 Source sourceA = addSource2("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 5323 Source sourceB = addSource2("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 6850 Source sourceB = addSource2("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 5324 resolve(librarySource); | 6851 resolve(librarySource); |
| 5325 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 6852 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5326 verify([librarySource, sourceA, sourceB]); | 6853 verify([librarySource, sourceA, sourceB]); |
| 5327 } | 6854 } |
| 5328 void test_duplicateDefinition_classMembers_fields() { | 6855 void test_duplicateDefinition_classMembers_fields() { |
| 5329 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
int a;", " int a;", "}"])); | 6856 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
int a;", " int a;", "}"])); |
| 5330 resolve(librarySource); | 6857 resolve(librarySource); |
| 5331 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCod
e.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeEr
rorCode.DUPLICATE_DEFINITION]); | 6858 assertErrors([ |
| 6859 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6860 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6861 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6862 CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5332 verify([librarySource]); | 6863 verify([librarySource]); |
| 5333 } | 6864 } |
| 5334 void test_duplicateDefinition_classMembers_fields_oneStatic() { | 6865 void test_duplicateDefinition_classMembers_fields_oneStatic() { |
| 5335 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " static int x;", "}"])); | 6866 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " static int x;", "}"])); |
| 5336 resolve(source); | 6867 resolve(source); |
| 5337 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCod
e.DUPLICATE_DEFINITION, CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeEr
rorCode.DUPLICATE_DEFINITION]); | 6868 assertErrors([ |
| 6869 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6870 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6871 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6872 CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5338 verify([source]); | 6873 verify([source]); |
| 5339 } | 6874 } |
| 5340 void test_duplicateDefinition_classMembers_methods() { | 6875 void test_duplicateDefinition_classMembers_methods() { |
| 5341 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
m() {}", " m() {}", "}"])); | 6876 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
m() {}", " m() {}", "}"])); |
| 5342 resolve(librarySource); | 6877 resolve(librarySource); |
| 5343 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCod
e.DUPLICATE_DEFINITION]); | 6878 assertErrors([ |
| 6879 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6880 CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5344 verify([librarySource]); | 6881 verify([librarySource]); |
| 5345 } | 6882 } |
| 5346 void test_duplicateDefinition_localFields() { | 6883 void test_duplicateDefinition_localFields() { |
| 5347 Source librarySource = addSource(EngineTestCase.createSource(["class A {", "
m() {", " int a;", " int a;", " }", "}"])); | 6884 Source librarySource = addSource(EngineTestCase.createSource([ |
| 6885 "class A {", |
| 6886 " m() {", |
| 6887 " int a;", |
| 6888 " int a;", |
| 6889 " }", |
| 6890 "}"])); |
| 5348 resolve(librarySource); | 6891 resolve(librarySource); |
| 5349 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCod
e.DUPLICATE_DEFINITION]); | 6892 assertErrors([ |
| 6893 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6894 CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5350 verify([librarySource]); | 6895 verify([librarySource]); |
| 5351 } | 6896 } |
| 5352 void test_duplicateDefinition_parameterWithFunctionName_local() { | 6897 void test_duplicateDefinition_parameterWithFunctionName_local() { |
| 5353 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); | 6898 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); |
| 5354 resolve(source); | 6899 resolve(source); |
| 5355 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCod
e.DUPLICATE_DEFINITION]); | 6900 assertErrors([ |
| 6901 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6902 CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5356 verify([source]); | 6903 verify([source]); |
| 5357 } | 6904 } |
| 5358 void test_duplicateDefinition_parameterWithFunctionName_topLevel() { | 6905 void test_duplicateDefinition_parameterWithFunctionName_topLevel() { |
| 5359 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); | 6906 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); |
| 5360 resolve(source); | 6907 resolve(source); |
| 5361 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION, CompileTimeErrorCod
e.DUPLICATE_DEFINITION]); | 6908 assertErrors([ |
| 6909 CompileTimeErrorCode.DUPLICATE_DEFINITION, |
| 6910 CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 5362 verify([source]); | 6911 verify([source]); |
| 5363 } | 6912 } |
| 5364 void test_duplicateDefinitionInheritance_instanceMethod_staticMethod() { | 6913 void test_duplicateDefinitionInheritance_instanceMethod_staticMethod() { |
| 5365 Source source = addSource(EngineTestCase.createSource(["class A {", " x() {
}", "}", "class B extends A {", " static x() {}", "}"])); | 6914 Source source = addSource(EngineTestCase.createSource([ |
| 6915 "class A {", |
| 6916 " x() {}", |
| 6917 "}", |
| 6918 "class B extends A {", |
| 6919 " static x() {}", |
| 6920 "}"])); |
| 5366 resolve(source); | 6921 resolve(source); |
| 5367 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); | 6922 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| 5368 verify([source]); | 6923 verify([source]); |
| 5369 } | 6924 } |
| 5370 void test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod()
{ | 6925 void test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod()
{ |
| 5371 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" x();", "}", "abstract class B extends A {", " static x() {}", "}"])); | 6926 Source source = addSource(EngineTestCase.createSource([ |
| 6927 "abstract class A {", |
| 6928 " x();", |
| 6929 "}", |
| 6930 "abstract class B extends A {", |
| 6931 " static x() {}", |
| 6932 "}"])); |
| 5372 resolve(source); | 6933 resolve(source); |
| 5373 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); | 6934 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]); |
| 5374 verify([source]); | 6935 verify([source]); |
| 5375 } | 6936 } |
| 5376 void test_duplicateNamedArgument() { | 6937 void test_duplicateNamedArgument() { |
| 5377 Source source = addSource(EngineTestCase.createSource(["f({a, b}) {}", "main
() {", " f(a: 1, a: 2);", "}"])); | 6938 Source source = addSource(EngineTestCase.createSource(["f({a, b}) {}", "main
() {", " f(a: 1, a: 2);", "}"])); |
| 5378 resolve(source); | 6939 resolve(source); |
| 5379 assertErrors([CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); | 6940 assertErrors([CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]); |
| 5380 verify([source]); | 6941 verify([source]); |
| 5381 } | 6942 } |
| 5382 void test_exportInternalLibrary() { | 6943 void test_exportInternalLibrary() { |
| 5383 Source source = addSource(EngineTestCase.createSource(["export 'dart:_interc
eptors';"])); | 6944 Source source = addSource(EngineTestCase.createSource(["export 'dart:_interc
eptors';"])); |
| 5384 resolve(source); | 6945 resolve(source); |
| 5385 assertErrors([CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]); | 6946 assertErrors([CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]); |
| 5386 verify([source]); | 6947 verify([source]); |
| 5387 } | 6948 } |
| 5388 void test_exportOfNonLibrary() { | 6949 void test_exportOfNonLibrary() { |
| 5389 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';"])); | 6950 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart';"])); |
| 5390 addSource2("/lib1.dart", EngineTestCase.createSource(["part of lib;"])); | 6951 addSource2("/lib1.dart", EngineTestCase.createSource(["part of lib;"])); |
| 5391 resolve(source); | 6952 resolve(source); |
| 5392 assertErrors([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]); | 6953 assertErrors([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]); |
| 5393 verify([source]); | 6954 verify([source]); |
| 5394 } | 6955 } |
| 5395 void test_extendsNonClass_class() { | 6956 void test_extendsNonClass_class() { |
| 5396 Source source = addSource(EngineTestCase.createSource(["int A;", "class B ex
tends A {}"])); | 6957 Source source = addSource(EngineTestCase.createSource(["int A;", "class B ex
tends A {}"])); |
| 5397 resolve(source); | 6958 resolve(source); |
| 5398 assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]); | 6959 assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| 5399 verify([source]); | 6960 verify([source]); |
| 5400 } | 6961 } |
| 6962 void test_extendsNonClass_dynamic() { |
| 6963 Source source = addSource(EngineTestCase.createSource(["class B extends dyna
mic {}"])); |
| 6964 resolve(source); |
| 6965 assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| 6966 verify([source]); |
| 6967 } |
| 5401 void test_extendsOrImplementsDisallowedClass_extends_bool() { | 6968 void test_extendsOrImplementsDisallowedClass_extends_bool() { |
| 5402 Source source = addSource(EngineTestCase.createSource(["class A extends bool
{}"])); | 6969 Source source = addSource(EngineTestCase.createSource(["class A extends bool
{}"])); |
| 5403 resolve(source); | 6970 resolve(source); |
| 5404 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErro
rCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); | 6971 assertErrors([ |
| 6972 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| 6973 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| 5405 verify([source]); | 6974 verify([source]); |
| 5406 } | 6975 } |
| 5407 void test_extendsOrImplementsDisallowedClass_extends_double() { | 6976 void test_extendsOrImplementsDisallowedClass_extends_double() { |
| 5408 Source source = addSource(EngineTestCase.createSource(["class A extends doub
le {}"])); | 6977 Source source = addSource(EngineTestCase.createSource(["class A extends doub
le {}"])); |
| 5409 resolve(source); | 6978 resolve(source); |
| 5410 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErro
rCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); | 6979 assertErrors([ |
| 6980 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| 6981 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| 5411 verify([source]); | 6982 verify([source]); |
| 5412 } | 6983 } |
| 5413 void test_extendsOrImplementsDisallowedClass_extends_int() { | 6984 void test_extendsOrImplementsDisallowedClass_extends_int() { |
| 5414 Source source = addSource(EngineTestCase.createSource(["class A extends int
{}"])); | 6985 Source source = addSource(EngineTestCase.createSource(["class A extends int
{}"])); |
| 5415 resolve(source); | 6986 resolve(source); |
| 5416 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErro
rCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); | 6987 assertErrors([ |
| 6988 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| 6989 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| 5417 verify([source]); | 6990 verify([source]); |
| 5418 } | 6991 } |
| 5419 void test_extendsOrImplementsDisallowedClass_extends_num() { | 6992 void test_extendsOrImplementsDisallowedClass_extends_num() { |
| 5420 Source source = addSource(EngineTestCase.createSource(["class A extends num
{}"])); | 6993 Source source = addSource(EngineTestCase.createSource(["class A extends num
{}"])); |
| 5421 resolve(source); | 6994 resolve(source); |
| 5422 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErro
rCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); | 6995 assertErrors([ |
| 6996 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| 6997 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| 5423 verify([source]); | 6998 verify([source]); |
| 5424 } | 6999 } |
| 5425 void test_extendsOrImplementsDisallowedClass_extends_String() { | 7000 void test_extendsOrImplementsDisallowedClass_extends_String() { |
| 5426 Source source = addSource(EngineTestCase.createSource(["class A extends Stri
ng {}"])); | 7001 Source source = addSource(EngineTestCase.createSource(["class A extends Stri
ng {}"])); |
| 5427 resolve(source); | 7002 resolve(source); |
| 5428 assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, CompileTimeErro
rCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); | 7003 assertErrors([ |
| 7004 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, |
| 7005 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| 5429 verify([source]); | 7006 verify([source]); |
| 5430 } | 7007 } |
| 5431 void test_extendsOrImplementsDisallowedClass_implements_bool() { | 7008 void test_extendsOrImplementsDisallowedClass_implements_bool() { |
| 5432 Source source = addSource(EngineTestCase.createSource(["class A implements b
ool {}"])); | 7009 Source source = addSource(EngineTestCase.createSource(["class A implements b
ool {}"])); |
| 5433 resolve(source); | 7010 resolve(source); |
| 5434 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 7011 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 5435 verify([source]); | 7012 verify([source]); |
| 5436 } | 7013 } |
| 5437 void test_extendsOrImplementsDisallowedClass_implements_double() { | 7014 void test_extendsOrImplementsDisallowedClass_implements_double() { |
| 5438 Source source = addSource(EngineTestCase.createSource(["class A implements d
ouble {}"])); | 7015 Source source = addSource(EngineTestCase.createSource(["class A implements d
ouble {}"])); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5452 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 7029 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 5453 verify([source]); | 7030 verify([source]); |
| 5454 } | 7031 } |
| 5455 void test_extendsOrImplementsDisallowedClass_implements_String() { | 7032 void test_extendsOrImplementsDisallowedClass_implements_String() { |
| 5456 Source source = addSource(EngineTestCase.createSource(["class A implements S
tring {}"])); | 7033 Source source = addSource(EngineTestCase.createSource(["class A implements S
tring {}"])); |
| 5457 resolve(source); | 7034 resolve(source); |
| 5458 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 7035 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 5459 verify([source]); | 7036 verify([source]); |
| 5460 } | 7037 } |
| 5461 void test_extraPositionalArguments_const() { | 7038 void test_extraPositionalArguments_const() { |
| 5462 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "main() {", " const A(0);", "}"])); | 7039 Source source = addSource(EngineTestCase.createSource([ |
| 7040 "class A {", |
| 7041 " const A();", |
| 7042 "}", |
| 7043 "main() {", |
| 7044 " const A(0);", |
| 7045 "}"])); |
| 5463 resolve(source); | 7046 resolve(source); |
| 5464 assertErrors([CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]); | 7047 assertErrors([CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]); |
| 5465 verify([source]); | 7048 verify([source]); |
| 7049 } |
| 7050 void test_extraPositionalArguments_const_super() { |
| 7051 Source source = addSource(EngineTestCase.createSource([ |
| 7052 "class A {", |
| 7053 " const A();", |
| 7054 "}", |
| 7055 "class B extends A {", |
| 7056 " const B() : super(0);", |
| 7057 "}"])); |
| 7058 resolve(source); |
| 7059 assertErrors([CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]); |
| 7060 verify([source]); |
| 5466 } | 7061 } |
| 5467 void test_fieldInitializedByMultipleInitializers() { | 7062 void test_fieldInitializedByMultipleInitializers() { |
| 5468 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A() : x = 0, x = 1 {}", "}"])); | 7063 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A() : x = 0, x = 1 {}", "}"])); |
| 5469 resolve(source); | 7064 resolve(source); |
| 5470 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); | 7065 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S]); |
| 5471 verify([source]); | 7066 verify([source]); |
| 5472 } | 7067 } |
| 5473 void test_fieldInitializedByMultipleInitializers_multipleInits() { | 7068 void test_fieldInitializedByMultipleInitializers_multipleInits() { |
| 5474 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A() : x = 0, x = 1, x = 2 {}", "}"])); | 7069 Source source = addSource(EngineTestCase.createSource([ |
| 7070 "class A {", |
| 7071 " int x;", |
| 7072 " A() : x = 0, x = 1, x = 2 {}", |
| 7073 "}"])); |
| 5475 resolve(source); | 7074 resolve(source); |
| 5476 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); | 7075 assertErrors([ |
| 7076 CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, |
| 7077 CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| 5477 verify([source]); | 7078 verify([source]); |
| 5478 } | 7079 } |
| 5479 void test_fieldInitializedByMultipleInitializers_multipleNames() { | 7080 void test_fieldInitializedByMultipleInitializers_multipleNames() { |
| 5480 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " int y;", " A() : x = 0, x = 1, y = 0, y = 1 {}", "}"])); | 7081 Source source = addSource(EngineTestCase.createSource([ |
| 7082 "class A {", |
| 7083 " int x;", |
| 7084 " int y;", |
| 7085 " A() : x = 0, x = 1, y = 0, y = 1 {}", |
| 7086 "}"])); |
| 5481 resolve(source); | 7087 resolve(source); |
| 5482 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZER
S, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); | 7088 assertErrors([ |
| 7089 CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, |
| 7090 CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]); |
| 5483 verify([source]); | 7091 verify([source]); |
| 5484 } | 7092 } |
| 5485 void test_fieldInitializedInInitializerAndDeclaration_final() { | 7093 void test_fieldInitializedInInitializerAndDeclaration_final() { |
| 5486 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x = 0;", " A() : x = 1 {}", "}"])); | 7094 Source source = addSource(EngineTestCase.createSource([ |
| 7095 "class A {", |
| 7096 " final int x = 0;", |
| 7097 " A() : x = 1 {}", |
| 7098 "}"])); |
| 5487 resolve(source); | 7099 resolve(source); |
| 5488 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); | 7100 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECL
ARATION]); |
| 5489 verify([source]); | 7101 verify([source]); |
| 5490 } | 7102 } |
| 5491 void test_fieldInitializedInParameterAndInitializer() { | 7103 void test_fieldInitializedInParameterAndInitializer() { |
| 5492 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) : x = 1 {}", "}"])); | 7104 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) : x = 1 {}", "}"])); |
| 5493 resolve(source); | 7105 resolve(source); |
| 5494 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); | 7106 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIA
LIZER]); |
| 5495 verify([source]); | 7107 verify([source]); |
| 5496 } | 7108 } |
| 5497 void test_fieldInitializerFactoryConstructor() { | 7109 void test_fieldInitializerFactoryConstructor() { |
| 5498 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " factory A(this.x) {}", "}"])); | 7110 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " factory A(this.x) {}", "}"])); |
| 5499 resolve(source); | 7111 resolve(source); |
| 5500 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR]); | 7112 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR]); |
| 5501 verify([source]); | 7113 verify([source]); |
| 5502 } | 7114 } |
| 5503 void test_fieldInitializerNotAssignable() { | 7115 void test_fieldInitializerNotAssignable() { |
| 5504 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " const A() : x = '';", "}"])); | 7116 Source source = addSource(EngineTestCase.createSource([ |
| 7117 "class A {", |
| 7118 " final int x;", |
| 7119 " const A() : x = '';", |
| 7120 "}"])); |
| 5505 resolve(source); | 7121 resolve(source); |
| 5506 assertErrors([CompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE]); | 7122 assertErrors([CompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE]); |
| 5507 verify([source]); | 7123 verify([source]); |
| 5508 } | 7124 } |
| 5509 void test_fieldInitializerOutsideConstructor() { | 7125 void test_fieldInitializerOutsideConstructor() { |
| 5510 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " m(this.x) {}", "}"])); | 7126 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " m(this.x) {}", "}"])); |
| 5511 resolve(source); | 7127 resolve(source); |
| 5512 assertErrors([ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, Compile
TimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); | 7128 assertErrors([ |
| 7129 ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, |
| 7130 CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| 5513 verify([source]); | 7131 verify([source]); |
| 5514 } | 7132 } |
| 5515 void test_fieldInitializerOutsideConstructor_defaultParameter() { | 7133 void test_fieldInitializerOutsideConstructor_defaultParameter() { |
| 5516 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " m([this.x]) {}", "}"])); | 7134 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " m([this.x]) {}", "}"])); |
| 5517 resolve(source); | 7135 resolve(source); |
| 5518 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); | 7136 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); |
| 5519 verify([source]); | 7137 verify([source]); |
| 5520 } | 7138 } |
| 5521 void test_fieldInitializerRedirectingConstructor_afterRedirection() { | 7139 void test_fieldInitializerRedirectingConstructor_afterRedirection() { |
| 5522 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A.named() {}", " A() : this.named(), x = 42;", "}"])); | 7140 Source source = addSource(EngineTestCase.createSource([ |
| 7141 "class A {", |
| 7142 " int x;", |
| 7143 " A.named() {}", |
| 7144 " A() : this.named(), x = 42;", |
| 7145 "}"])); |
| 5523 resolve(source); | 7146 resolve(source); |
| 5524 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR
]); | 7147 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR
]); |
| 5525 verify([source]); | 7148 verify([source]); |
| 5526 } | 7149 } |
| 5527 void test_fieldInitializerRedirectingConstructor_beforeRedirection() { | 7150 void test_fieldInitializerRedirectingConstructor_beforeRedirection() { |
| 5528 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A.named() {}", " A() : x = 42, this.named();", "}"])); | 7151 Source source = addSource(EngineTestCase.createSource([ |
| 7152 "class A {", |
| 7153 " int x;", |
| 7154 " A.named() {}", |
| 7155 " A() : x = 42, this.named();", |
| 7156 "}"])); |
| 5529 resolve(source); | 7157 resolve(source); |
| 5530 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR
]); | 7158 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR
]); |
| 5531 verify([source]); | 7159 verify([source]); |
| 5532 } | 7160 } |
| 5533 void test_fieldInitializingFormalRedirectingConstructor() { | 7161 void test_fieldInitializingFormalRedirectingConstructor() { |
| 5534 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A.named() {}", " A(this.x) : this.named();", "}"])); | 7162 Source source = addSource(EngineTestCase.createSource([ |
| 7163 "class A {", |
| 7164 " int x;", |
| 7165 " A.named() {}", |
| 7166 " A(this.x) : this.named();", |
| 7167 "}"])); |
| 5535 resolve(source); | 7168 resolve(source); |
| 5536 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR
]); | 7169 assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR
]); |
| 5537 verify([source]); | 7170 verify([source]); |
| 5538 } | 7171 } |
| 5539 | 7172 |
| 5540 /** | 7173 /** |
| 5541 * This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
code, but tests the | 7174 * This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
code, but tests the |
| 5542 * FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provid
ed here to show | 7175 * FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provid
ed here to show |
| 5543 * coverage over all of the permutations of initializers in constructor declar
ations. | 7176 * coverage over all of the permutations of initializers in constructor declar
ations. |
| 5544 * | 7177 * |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5581 } | 7214 } |
| 5582 void test_finalInitializedMultipleTimes_initializingFormals() { | 7215 void test_finalInitializedMultipleTimes_initializingFormals() { |
| 5583 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A(this.x, this.x) {}", "}"])); | 7216 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x;", " A(this.x, this.x) {}", "}"])); |
| 5584 resolve(source); | 7217 resolve(source); |
| 5585 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]); | 7218 assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]); |
| 5586 verify([source]); | 7219 verify([source]); |
| 5587 } | 7220 } |
| 5588 void test_getterAndMethodWithSameName() { | 7221 void test_getterAndMethodWithSameName() { |
| 5589 Source source = addSource(EngineTestCase.createSource(["class A {", " x(y)
{}", " get x => 0;", "}"])); | 7222 Source source = addSource(EngineTestCase.createSource(["class A {", " x(y)
{}", " get x => 0;", "}"])); |
| 5590 resolve(source); | 7223 resolve(source); |
| 5591 assertErrors([CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME, Compile
TimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); | 7224 assertErrors([ |
| 7225 CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME, |
| 7226 CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); |
| 5592 verify([source]); | 7227 verify([source]); |
| 5593 } | 7228 } |
| 5594 void test_implementsDynamic() { | 7229 void test_implementsDynamic() { |
| 5595 Source source = addSource(EngineTestCase.createSource(["class A implements d
ynamic {}"])); | 7230 Source source = addSource(EngineTestCase.createSource(["class A implements d
ynamic {}"])); |
| 5596 resolve(source); | 7231 resolve(source); |
| 5597 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]); | 7232 assertErrors([CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]); |
| 5598 verify([source]); | 7233 verify([source]); |
| 5599 } | 7234 } |
| 5600 void test_implementsNonClass_class() { | 7235 void test_implementsNonClass_class() { |
| 5601 Source source = addSource(EngineTestCase.createSource(["int A;", "class B im
plements A {}"])); | 7236 Source source = addSource(EngineTestCase.createSource(["int A;", "class B im
plements A {}"])); |
| 5602 resolve(source); | 7237 resolve(source); |
| 5603 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); | 7238 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 5604 verify([source]); | 7239 verify([source]); |
| 5605 } | 7240 } |
| 5606 void test_implementsNonClass_typedef() { | 7241 void test_implementsNonClass_typedef() { |
| 5607 Source source = addSource(EngineTestCase.createSource(["class A {}", "int B;
", "typedef C = A implements B;"])); | 7242 Source source = addSource(EngineTestCase.createSource(["class A {}", "int B;
", "typedef C = A implements B;"])); |
| 5608 resolve(source); | 7243 resolve(source); |
| 5609 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); | 7244 assertErrors([CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 5610 verify([source]); | 7245 verify([source]); |
| 5611 } | 7246 } |
| 5612 void test_implementsRepeated() { | 7247 void test_implementsRepeated() { |
| 5613 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B implements A, A {}"])); | 7248 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B implements A, A {}"])); |
| 5614 resolve(source); | 7249 resolve(source); |
| 5615 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED]); | 7250 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED]); |
| 5616 verify([source]); | 7251 verify([source]); |
| 5617 } | 7252 } |
| 5618 void test_implementsRepeated_3times() { | 7253 void test_implementsRepeated_3times() { |
| 5619 Source source = addSource(EngineTestCase.createSource(["class A {} class C{}
", "class B implements A, A, A, A {}"])); | 7254 Source source = addSource(EngineTestCase.createSource([ |
| 7255 "class A {} class C{}", |
| 7256 "class B implements A, A, A, A {}"])); |
| 5620 resolve(source); | 7257 resolve(source); |
| 5621 assertErrors([CompileTimeErrorCode.IMPLEMENTS_REPEATED, CompileTimeErrorCode
.IMPLEMENTS_REPEATED, CompileTimeErrorCode.IMPLEMENTS_REPEATED]); | 7258 assertErrors([ |
| 7259 CompileTimeErrorCode.IMPLEMENTS_REPEATED, |
| 7260 CompileTimeErrorCode.IMPLEMENTS_REPEATED, |
| 7261 CompileTimeErrorCode.IMPLEMENTS_REPEATED]); |
| 7262 verify([source]); |
| 7263 } |
| 7264 void test_implementsSuperClass() { |
| 7265 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A implements A {}"])); |
| 7266 resolve(source); |
| 7267 assertErrors([CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); |
| 7268 verify([source]); |
| 7269 } |
| 7270 void test_implementsSuperClass_Object() { |
| 7271 Source source = addSource(EngineTestCase.createSource(["class A implements O
bject {}"])); |
| 7272 resolve(source); |
| 7273 assertErrors([CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]); |
| 5622 verify([source]); | 7274 verify([source]); |
| 5623 } | 7275 } |
| 5624 void test_implicitThisReferenceInInitializer_field() { | 7276 void test_implicitThisReferenceInInitializer_field() { |
| 5625 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f;", " var f;", "}"])); | 7277 Source source = addSource(EngineTestCase.createSource([ |
| 7278 "class A {", |
| 7279 " var v;", |
| 7280 " A() : v = f;", |
| 7281 " var f;", |
| 7282 "}"])); |
| 5626 resolve(source); | 7283 resolve(source); |
| 5627 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); | 7284 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| 5628 verify([source]); | 7285 verify([source]); |
| 5629 } | 7286 } |
| 5630 void test_implicitThisReferenceInInitializer_field2() { | 7287 void test_implicitThisReferenceInInitializer_field2() { |
| 5631 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x = 0;", " final y = x;", "}"])); | 7288 Source source = addSource(EngineTestCase.createSource(["class A {", " final
x = 0;", " final y = x;", "}"])); |
| 5632 resolve(source); | 7289 resolve(source); |
| 5633 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); | 7290 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| 5634 verify([source]); | 7291 verify([source]); |
| 5635 } | 7292 } |
| 5636 void test_implicitThisReferenceInInitializer_invocation() { | 7293 void test_implicitThisReferenceInInitializer_invocation() { |
| 5637 Source source = addSource(EngineTestCase.createSource(["class A {", " var v
;", " A() : v = f();", " f() {}", "}"])); | 7294 Source source = addSource(EngineTestCase.createSource([ |
| 7295 "class A {", |
| 7296 " var v;", |
| 7297 " A() : v = f();", |
| 7298 " f() {}", |
| 7299 "}"])); |
| 7300 resolve(source); |
| 7301 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| 7302 verify([source]); |
| 7303 } |
| 7304 void test_implicitThisReferenceInInitializer_invocationInStatic() { |
| 7305 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c var F = m();", " m() {}", "}"])); |
| 5638 resolve(source); | 7306 resolve(source); |
| 5639 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); | 7307 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| 5640 verify([source]); | 7308 verify([source]); |
| 5641 } | 7309 } |
| 5642 void test_implicitThisReferenceInInitializer_redirectingConstructorInvocation(
) { | 7310 void test_implicitThisReferenceInInitializer_redirectingConstructorInvocation(
) { |
| 5643 Source source = addSource(EngineTestCase.createSource(["class A {", " A(p)
{}", " A.named() : this(f);", " var f;", "}"])); | 7311 Source source = addSource(EngineTestCase.createSource([ |
| 7312 "class A {", |
| 7313 " A(p) {}", |
| 7314 " A.named() : this(f);", |
| 7315 " var f;", |
| 7316 "}"])); |
| 5644 resolve(source); | 7317 resolve(source); |
| 5645 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); | 7318 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| 5646 verify([source]); | 7319 verify([source]); |
| 5647 } | 7320 } |
| 5648 void test_implicitThisReferenceInInitializer_superConstructorInvocation() { | 7321 void test_implicitThisReferenceInInitializer_superConstructorInvocation() { |
| 5649 Source source = addSource(EngineTestCase.createSource(["class A {", " A(p)
{}", "}", "class B extends A {", " B() : super(f);", " var f;", "}"])); | 7322 Source source = addSource(EngineTestCase.createSource([ |
| 7323 "class A {", |
| 7324 " A(p) {}", |
| 7325 "}", |
| 7326 "class B extends A {", |
| 7327 " B() : super(f);", |
| 7328 " var f;", |
| 7329 "}"])); |
| 5650 resolve(source); | 7330 resolve(source); |
| 5651 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); | 7331 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| 5652 verify([source]); | 7332 verify([source]); |
| 5653 } | 7333 } |
| 5654 void test_importInternalLibrary() { | 7334 void test_importInternalLibrary() { |
| 5655 Source source = addSource(EngineTestCase.createSource(["import 'dart:_interc
eptors';"])); | 7335 Source source = addSource(EngineTestCase.createSource(["import 'dart:_interc
eptors';"])); |
| 5656 resolve(source); | 7336 resolve(source); |
| 5657 assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]); | 7337 assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]); |
| 5658 verify([source]); | 7338 verify([source]); |
| 5659 } | 7339 } |
| 5660 void test_importInternalLibrary_collection() { | 7340 void test_importInternalLibrary_collection() { |
| 5661 Source source = addSource(EngineTestCase.createSource(["import 'dart:_collec
tion-dev';"])); | 7341 Source source = addSource(EngineTestCase.createSource(["import 'dart:_collec
tion-dev';"])); |
| 5662 resolve(source); | 7342 resolve(source); |
| 5663 assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]); | 7343 assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]); |
| 5664 verify([source]); | 7344 verify([source]); |
| 5665 } | 7345 } |
| 5666 void test_importOfNonLibrary() { | 7346 void test_importOfNonLibrary() { |
| 5667 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); | 7347 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); |
| 5668 addSource2("/part.dart", EngineTestCase.createSource(["part of lib;"])); | 7348 addSource2("/part.dart", EngineTestCase.createSource(["part of lib;"])); |
| 5669 resolve(source); | 7349 resolve(source); |
| 5670 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); | 7350 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); |
| 5671 verify([source]); | 7351 verify([source]); |
| 5672 } | 7352 } |
| 5673 void test_inconsistentCaseExpressionTypes() { | 7353 void test_inconsistentCaseExpressionTypes() { |
| 5674 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " swit
ch (p) {", " case 1:", " break;", " case 'a':", " break;", " }"
, "}"])); | 7354 Source source = addSource(EngineTestCase.createSource([ |
| 7355 "f(var p) {", |
| 7356 " switch (p) {", |
| 7357 " case 1:", |
| 7358 " break;", |
| 7359 " case 'a':", |
| 7360 " break;", |
| 7361 " }", |
| 7362 "}"])); |
| 5675 resolve(source); | 7363 resolve(source); |
| 5676 assertErrors([CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); | 7364 assertErrors([CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); |
| 5677 verify([source]); | 7365 verify([source]); |
| 5678 } | 7366 } |
| 5679 void test_inconsistentCaseExpressionTypes_repeated() { | 7367 void test_inconsistentCaseExpressionTypes_repeated() { |
| 5680 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " swit
ch (p) {", " case 1:", " break;", " case 'a':", " break;", "
case 'b':", " break;", " }", "}"])); | 7368 Source source = addSource(EngineTestCase.createSource([ |
| 7369 "f(var p) {", |
| 7370 " switch (p) {", |
| 7371 " case 1:", |
| 7372 " break;", |
| 7373 " case 'a':", |
| 7374 " break;", |
| 7375 " case 'b':", |
| 7376 " break;", |
| 7377 " }", |
| 7378 "}"])); |
| 5681 resolve(source); | 7379 resolve(source); |
| 5682 assertErrors([CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, Compi
leTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); | 7380 assertErrors([ |
| 7381 CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, |
| 7382 CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]); |
| 5683 verify([source]); | 7383 verify([source]); |
| 5684 } | 7384 } |
| 5685 void test_initializerForNonExistant_initializer() { | 7385 void test_initializerForNonExistant_initializer() { |
| 5686 Source source = addSource(EngineTestCase.createSource(["class A {", " A() :
x = 0 {}", "}"])); | 7386 Source source = addSource(EngineTestCase.createSource(["class A {", " A() :
x = 0 {}", "}"])); |
| 5687 resolve(source); | 7387 resolve(source); |
| 5688 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD]); | 7388 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD]); |
| 5689 } | 7389 } |
| 5690 void test_initializerForStaticField() { | 7390 void test_initializerForStaticField() { |
| 5691 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", " A() : x = 0 {}", "}"])); | 7391 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", " A() : x = 0 {}", "}"])); |
| 5692 resolve(source); | 7392 resolve(source); |
| 5693 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]); | 7393 assertErrors([CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]); |
| 5694 verify([source]); | 7394 verify([source]); |
| 5695 } | 7395 } |
| 5696 void test_initializingFormalForNonExistantField() { | 7396 void test_initializingFormalForNonExistantField() { |
| 5697 Source source = addSource(EngineTestCase.createSource(["class A {", " A(thi
s.x) {}", "}"])); | 7397 Source source = addSource(EngineTestCase.createSource(["class A {", " A(thi
s.x) {}", "}"])); |
| 5698 resolve(source); | 7398 resolve(source); |
| 5699 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); | 7399 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 5700 verify([source]); | 7400 verify([source]); |
| 5701 } | 7401 } |
| 5702 void test_initializingFormalForNonExistantField_notInEnclosingClass() { | 7402 void test_initializingFormalForNonExistantField_notInEnclosingClass() { |
| 5703 Source source = addSource(EngineTestCase.createSource(["class A {", "int x;"
, "}", "class B extends A {", " B(this.x) {}", "}"])); | 7403 Source source = addSource(EngineTestCase.createSource([ |
| 7404 "class A {", |
| 7405 "int x;", |
| 7406 "}", |
| 7407 "class B extends A {", |
| 7408 " B(this.x) {}", |
| 7409 "}"])); |
| 5704 resolve(source); | 7410 resolve(source); |
| 5705 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); | 7411 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 5706 verify([source]); | 7412 verify([source]); |
| 5707 } | 7413 } |
| 5708 void test_initializingFormalForNonExistantField_optional() { | 7414 void test_initializingFormalForNonExistantField_optional() { |
| 5709 Source source = addSource(EngineTestCase.createSource(["class A {", " A([th
is.x]) {}", "}"])); | 7415 Source source = addSource(EngineTestCase.createSource(["class A {", " A([th
is.x]) {}", "}"])); |
| 5710 resolve(source); | 7416 resolve(source); |
| 5711 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); | 7417 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIEL
D]); |
| 5712 verify([source]); | 7418 verify([source]); |
| 5713 } | 7419 } |
| 5714 void test_initializingFormalForNonExistantField_static() { | 7420 void test_initializingFormalForNonExistantField_static() { |
| 5715 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", " A([this.x]) {}", "}"])); | 7421 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int x;", " A([this.x]) {}", "}"])); |
| 5716 resolve(source); | 7422 resolve(source); |
| 5717 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]); | 7423 assertErrors([CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]); |
| 5718 verify([source]); | 7424 verify([source]); |
| 5719 } | 7425 } |
| 5720 void test_instanceMemberAccessFromStatic_field() { | 7426 void test_instanceMemberAccessFromStatic_field() { |
| 5721 Source source = addSource(EngineTestCase.createSource(["class A {", " int f
;", " static foo() {", " f;", " }", "}"])); | 7427 Source source = addSource(EngineTestCase.createSource([ |
| 7428 "class A {", |
| 7429 " int f;", |
| 7430 " static foo() {", |
| 7431 " f;", |
| 7432 " }", |
| 7433 "}"])); |
| 5722 resolve(source); | 7434 resolve(source); |
| 5723 assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); | 7435 assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); |
| 5724 verify([source]); | 7436 verify([source]); |
| 5725 } | 7437 } |
| 5726 void test_instanceMemberAccessFromStatic_getter() { | 7438 void test_instanceMemberAccessFromStatic_getter() { |
| 5727 Source source = addSource(EngineTestCase.createSource(["class A {", " get g
=> null;", " static foo() {", " g;", " }", "}"])); | 7439 Source source = addSource(EngineTestCase.createSource([ |
| 7440 "class A {", |
| 7441 " get g => null;", |
| 7442 " static foo() {", |
| 7443 " g;", |
| 7444 " }", |
| 7445 "}"])); |
| 5728 resolve(source); | 7446 resolve(source); |
| 5729 assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); | 7447 assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); |
| 5730 verify([source]); | 7448 verify([source]); |
| 5731 } | 7449 } |
| 5732 void test_instanceMemberAccessFromStatic_method() { | 7450 void test_instanceMemberAccessFromStatic_method() { |
| 5733 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", " static foo() {", " m();", " }", "}"])); | 7451 Source source = addSource(EngineTestCase.createSource([ |
| 7452 "class A {", |
| 7453 " m() {}", |
| 7454 " static foo() {", |
| 7455 " m();", |
| 7456 " }", |
| 7457 "}"])); |
| 5734 resolve(source); | 7458 resolve(source); |
| 5735 assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); | 7459 assertErrors([CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]); |
| 5736 verify([source]); | 7460 verify([source]); |
| 5737 } | 7461 } |
| 5738 void test_invalidAnnotation_getter() { | 7462 void test_invalidAnnotation_getter() { |
| 5739 Source source = addSource(EngineTestCase.createSource(["get V => 0;", "@V",
"main() {", "}"])); | 7463 Source source = addSource(EngineTestCase.createSource(["get V => 0;", "@V",
"main() {", "}"])); |
| 5740 resolve(source); | 7464 resolve(source); |
| 5741 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); | 7465 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); |
| 5742 verify([source]); | 7466 verify([source]); |
| 5743 } | 7467 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5768 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); | 7492 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); |
| 5769 verify([source]); | 7493 verify([source]); |
| 5770 } | 7494 } |
| 5771 void test_invalidAnnotation_notVariableOrConstructorInvocation() { | 7495 void test_invalidAnnotation_notVariableOrConstructorInvocation() { |
| 5772 Source source = addSource(EngineTestCase.createSource(["typedef V();", "@V",
"main() {", "}"])); | 7496 Source source = addSource(EngineTestCase.createSource(["typedef V();", "@V",
"main() {", "}"])); |
| 5773 resolve(source); | 7497 resolve(source); |
| 5774 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); | 7498 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); |
| 5775 verify([source]); | 7499 verify([source]); |
| 5776 } | 7500 } |
| 5777 void test_invalidAnnotation_staticMethodReference() { | 7501 void test_invalidAnnotation_staticMethodReference() { |
| 5778 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c f() {}", "}", "@A.f", "main() {", "}"])); | 7502 Source source = addSource(EngineTestCase.createSource([ |
| 7503 "class A {", |
| 7504 " static f() {}", |
| 7505 "}", |
| 7506 "@A.f", |
| 7507 "main() {", |
| 7508 "}"])); |
| 5779 resolve(source); | 7509 resolve(source); |
| 5780 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); | 7510 assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]); |
| 5781 verify([source]); | 7511 verify([source]); |
| 5782 } | 7512 } |
| 5783 void test_invalidConstructorName_notEnclosingClassName() { | 7513 void test_invalidConstructorName_notEnclosingClassName() { |
| 5784 Source source = addSource(EngineTestCase.createSource(["class A {", " B() :
super();", "}"])); | 7514 Source source = addSource(EngineTestCase.createSource(["class A {", " B() :
super();", "}"])); |
| 5785 resolve(source); | 7515 resolve(source); |
| 5786 assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); | 7516 assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); |
| 5787 } | 7517 } |
| 5788 void test_invalidFactoryNameNotAClass_notClassName() { | 7518 void test_invalidFactoryNameNotAClass_notClassName() { |
| 5789 Source source = addSource(EngineTestCase.createSource(["int B;", "class A {"
, " factory B() {}", "}"])); | 7519 Source source = addSource(EngineTestCase.createSource(["int B;", "class A {"
, " factory B() {}", "}"])); |
| 5790 resolve(source); | 7520 resolve(source); |
| 5791 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); | 7521 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); |
| 5792 verify([source]); | 7522 verify([source]); |
| 5793 } | 7523 } |
| 5794 void test_invalidFactoryNameNotAClass_notEnclosingClassName() { | 7524 void test_invalidFactoryNameNotAClass_notEnclosingClassName() { |
| 5795 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry B() {}", "}"])); | 7525 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry B() {}", "}"])); |
| 5796 resolve(source); | 7526 resolve(source); |
| 5797 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); | 7527 assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]); |
| 5798 } | 7528 } |
| 5799 void test_invalidOverrideNamed_fewerNamedParameters() { | 7529 void test_invalidOverrideNamed_fewerNamedParameters() { |
| 5800 Source source = addSource(EngineTestCase.createSource(["class A {", " m({a,
b}) {}", "}", "class B extends A {", " m({a}) {}", "}"])); | 7530 Source source = addSource(EngineTestCase.createSource([ |
| 7531 "class A {", |
| 7532 " m({a, b}) {}", |
| 7533 "}", |
| 7534 "class B extends A {", |
| 7535 " m({a}) {}", |
| 7536 "}"])); |
| 5801 resolve(source); | 7537 resolve(source); |
| 5802 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]); | 7538 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]); |
| 5803 verify([source]); | 7539 verify([source]); |
| 5804 } | 7540 } |
| 5805 void test_invalidOverrideNamed_missingNamedParameter() { | 7541 void test_invalidOverrideNamed_missingNamedParameter() { |
| 5806 Source source = addSource(EngineTestCase.createSource(["class A {", " m({a,
b}) {}", "}", "class B extends A {", " m({a, c}) {}", "}"])); | 7542 Source source = addSource(EngineTestCase.createSource([ |
| 7543 "class A {", |
| 7544 " m({a, b}) {}", |
| 7545 "}", |
| 7546 "class B extends A {", |
| 7547 " m({a, c}) {}", |
| 7548 "}"])); |
| 5807 resolve(source); | 7549 resolve(source); |
| 5808 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]); | 7550 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]); |
| 5809 verify([source]); | 7551 verify([source]); |
| 5810 } | 7552 } |
| 5811 void test_invalidOverridePositional() { | 7553 void test_invalidOverridePositional() { |
| 5812 Source source = addSource(EngineTestCase.createSource(["class A {", " m([a,
b]) {}", "}", "class B extends A {", " m([a]) {}", "}"])); | 7554 Source source = addSource(EngineTestCase.createSource([ |
| 7555 "class A {", |
| 7556 " m([a, b]) {}", |
| 7557 "}", |
| 7558 "class B extends A {", |
| 7559 " m([a]) {}", |
| 7560 "}"])); |
| 5813 resolve(source); | 7561 resolve(source); |
| 5814 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL]); | 7562 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL]); |
| 5815 verify([source]); | 7563 verify([source]); |
| 5816 } | 7564 } |
| 5817 void test_invalidOverrideRequired() { | 7565 void test_invalidOverrideRequired() { |
| 5818 Source source = addSource(EngineTestCase.createSource(["class A {", " m(a)
{}", "}", "class B extends A {", " m(a, b) {}", "}"])); | 7566 Source source = addSource(EngineTestCase.createSource([ |
| 7567 "class A {", |
| 7568 " m(a) {}", |
| 7569 "}", |
| 7570 "class B extends A {", |
| 7571 " m(a, b) {}", |
| 7572 "}"])); |
| 5819 resolve(source); | 7573 resolve(source); |
| 5820 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED]); | 7574 assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED]); |
| 5821 verify([source]); | 7575 verify([source]); |
| 5822 } | 7576 } |
| 5823 void test_invalidReferenceToThis_factoryConstructor() { | 7577 void test_invalidReferenceToThis_factoryConstructor() { |
| 5824 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() { return this; }", "}"])); | 7578 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() { return this; }", "}"])); |
| 5825 resolve(source); | 7579 resolve(source); |
| 5826 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); | 7580 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| 5827 verify([source]); | 7581 verify([source]); |
| 5828 } | 7582 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5856 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); | 7610 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| 5857 verify([source]); | 7611 verify([source]); |
| 5858 } | 7612 } |
| 5859 void test_invalidReferenceToThis_variableInitializer() { | 7613 void test_invalidReferenceToThis_variableInitializer() { |
| 5860 Source source = addSource("int x = this;"); | 7614 Source source = addSource("int x = this;"); |
| 5861 resolve(source); | 7615 resolve(source); |
| 5862 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); | 7616 assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]); |
| 5863 verify([source]); | 7617 verify([source]); |
| 5864 } | 7618 } |
| 5865 void test_invalidTypeArgumentForKey() { | 7619 void test_invalidTypeArgumentForKey() { |
| 5866 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
", " return const <int, int>{};", " }", "}"])); | 7620 Source source = addSource(EngineTestCase.createSource([ |
| 7621 "class A {", |
| 7622 " m() {", |
| 7623 " return const <int, int>{};", |
| 7624 " }", |
| 7625 "}"])); |
| 5867 resolve(source); | 7626 resolve(source); |
| 5868 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_FOR_KEY]); | 7627 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_FOR_KEY]); |
| 5869 verify([source]); | 7628 verify([source]); |
| 5870 } | 7629 } |
| 5871 void test_invalidTypeArgumentInConstList() { | 7630 void test_invalidTypeArgumentInConstList() { |
| 5872 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return const <E>[];", " }", "}"])); | 7631 Source source = addSource(EngineTestCase.createSource([ |
| 7632 "class A<E> {", |
| 7633 " m() {", |
| 7634 " return const <E>[];", |
| 7635 " }", |
| 7636 "}"])); |
| 5873 resolve(source); | 7637 resolve(source); |
| 5874 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]); | 7638 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]); |
| 5875 verify([source]); | 7639 verify([source]); |
| 5876 } | 7640 } |
| 5877 void test_invalidTypeArgumentInConstMap() { | 7641 void test_invalidTypeArgumentInConstMap() { |
| 5878 Source source = addSource(EngineTestCase.createSource(["class A<E> {", " m(
) {", " return const <String, E>{};", " }", "}"])); | 7642 Source source = addSource(EngineTestCase.createSource([ |
| 7643 "class A<E> {", |
| 7644 " m() {", |
| 7645 " return const <String, E>{};", |
| 7646 " }", |
| 7647 "}"])); |
| 5879 resolve(source); | 7648 resolve(source); |
| 5880 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]); | 7649 assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]); |
| 5881 verify([source]); | 7650 verify([source]); |
| 5882 } | 7651 } |
| 5883 void test_invalidUri_export() { | 7652 void test_invalidUri_export() { |
| 5884 Source source = addSource(EngineTestCase.createSource(["export 'ht:';"])); | 7653 Source source = addSource(EngineTestCase.createSource(["export 'ht:';"])); |
| 5885 resolve(source); | 7654 resolve(source); |
| 5886 assertErrors([CompileTimeErrorCode.INVALID_URI]); | 7655 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 5887 } | 7656 } |
| 5888 void test_invalidUri_import() { | 7657 void test_invalidUri_import() { |
| 5889 Source source = addSource(EngineTestCase.createSource(["import 'ht:';"])); | 7658 Source source = addSource(EngineTestCase.createSource(["import 'ht:';"])); |
| 5890 resolve(source); | 7659 resolve(source); |
| 5891 assertErrors([CompileTimeErrorCode.INVALID_URI]); | 7660 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 5892 } | 7661 } |
| 5893 void test_invalidUri_part() { | 7662 void test_invalidUri_part() { |
| 5894 Source source = addSource(EngineTestCase.createSource(["part 'ht:';"])); | 7663 Source source = addSource(EngineTestCase.createSource(["part 'ht:';"])); |
| 5895 resolve(source); | 7664 resolve(source); |
| 5896 assertErrors([CompileTimeErrorCode.INVALID_URI]); | 7665 assertErrors([CompileTimeErrorCode.INVALID_URI]); |
| 5897 } | 7666 } |
| 5898 void test_labelInOuterScope() { | 7667 void test_labelInOuterScope() { |
| 5899 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m(int i) {", " l: while (i > 0) {", " void f() {", " break l;", "
};", " }", " }", "}"])); | 7668 Source source = addSource(EngineTestCase.createSource([ |
| 7669 "class A {", |
| 7670 " void m(int i) {", |
| 7671 " l: while (i > 0) {", |
| 7672 " void f() {", |
| 7673 " break l;", |
| 7674 " };", |
| 7675 " }", |
| 7676 " }", |
| 7677 "}"])); |
| 5900 resolve(source); | 7678 resolve(source); |
| 5901 assertErrors([CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]); | 7679 assertErrors([CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]); |
| 5902 } | 7680 } |
| 5903 void test_labelUndefined_break() { | 7681 void test_labelUndefined_break() { |
| 5904 Source source = addSource(EngineTestCase.createSource(["f() {", " x: while
(true) {", " break y;", " }", "}"])); | 7682 Source source = addSource(EngineTestCase.createSource([ |
| 7683 "f() {", |
| 7684 " x: while (true) {", |
| 7685 " break y;", |
| 7686 " }", |
| 7687 "}"])); |
| 5905 resolve(source); | 7688 resolve(source); |
| 5906 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); | 7689 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); |
| 5907 } | 7690 } |
| 5908 void test_labelUndefined_continue() { | 7691 void test_labelUndefined_continue() { |
| 5909 Source source = addSource(EngineTestCase.createSource(["f() {", " x: while
(true) {", " continue y;", " }", "}"])); | 7692 Source source = addSource(EngineTestCase.createSource([ |
| 7693 "f() {", |
| 7694 " x: while (true) {", |
| 7695 " continue y;", |
| 7696 " }", |
| 7697 "}"])); |
| 5910 resolve(source); | 7698 resolve(source); |
| 5911 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); | 7699 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); |
| 5912 } | 7700 } |
| 7701 void test_listElementTypeNotAssignable() { |
| 7702 Source source = addSource(EngineTestCase.createSource(["var v = const <Strin
g> [42];"])); |
| 7703 resolve(source); |
| 7704 assertErrors([CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE]); |
| 7705 verify([source]); |
| 7706 } |
| 7707 void test_mapKeyTypeNotAssignable() { |
| 7708 Source source = addSource(EngineTestCase.createSource(["var v = const <Strin
g, int > {1 : 2};"])); |
| 7709 resolve(source); |
| 7710 assertErrors([CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE]); |
| 7711 verify([source]); |
| 7712 } |
| 7713 void test_mapValueTypeNotAssignable() { |
| 7714 Source source = addSource(EngineTestCase.createSource(["var v = const <Strin
g, String> {'a' : 2};"])); |
| 7715 resolve(source); |
| 7716 assertErrors([CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE]); |
| 7717 verify([source]); |
| 7718 } |
| 5913 void test_memberWithClassName_field() { | 7719 void test_memberWithClassName_field() { |
| 5914 Source source = addSource(EngineTestCase.createSource(["class A {", " int A
= 0;", "}"])); | 7720 Source source = addSource(EngineTestCase.createSource(["class A {", " int A
= 0;", "}"])); |
| 5915 resolve(source); | 7721 resolve(source); |
| 5916 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); | 7722 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| 5917 verify([source]); | 7723 verify([source]); |
| 5918 } | 7724 } |
| 5919 void test_memberWithClassName_field2() { | 7725 void test_memberWithClassName_field2() { |
| 5920 Source source = addSource(EngineTestCase.createSource(["class A {", " int z
, A, b = 0;", "}"])); | 7726 Source source = addSource(EngineTestCase.createSource(["class A {", " int z
, A, b = 0;", "}"])); |
| 5921 resolve(source); | 7727 resolve(source); |
| 5922 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); | 7728 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| 5923 verify([source]); | 7729 verify([source]); |
| 5924 } | 7730 } |
| 5925 void test_memberWithClassName_getter() { | 7731 void test_memberWithClassName_getter() { |
| 5926 Source source = addSource(EngineTestCase.createSource(["class A {", " get A
=> 0;", "}"])); | 7732 Source source = addSource(EngineTestCase.createSource(["class A {", " get A
=> 0;", "}"])); |
| 5927 resolve(source); | 7733 resolve(source); |
| 5928 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); | 7734 assertErrors([CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| 5929 verify([source]); | 7735 verify([source]); |
| 5930 } | 7736 } |
| 5931 void test_memberWithClassName_method() { | 7737 void test_memberWithClassName_method() { |
| 5932 } | 7738 } |
| 5933 void test_methodAndGetterWithSameName() { | 7739 void test_methodAndGetterWithSameName() { |
| 5934 Source source = addSource(EngineTestCase.createSource(["class A {", " get x
=> 0;", " x(y) {}", "}"])); | 7740 Source source = addSource(EngineTestCase.createSource(["class A {", " get x
=> 0;", " x(y) {}", "}"])); |
| 5935 resolve(source); | 7741 resolve(source); |
| 5936 assertErrors([CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME, Compile
TimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]); | 7742 assertErrors([ |
| 7743 CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME, |
| 7744 CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]); |
| 5937 verify([source]); | 7745 verify([source]); |
| 5938 } | 7746 } |
| 5939 void test_mixinDeclaresConstructor_classDeclaration() { | 7747 void test_mixinDeclaresConstructor_classDeclaration() { |
| 5940 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "class B extends Object with A {}"])); | 7748 Source source = addSource(EngineTestCase.createSource([ |
| 7749 "class A {", |
| 7750 " A() {}", |
| 7751 "}", |
| 7752 "class B extends Object with A {}"])); |
| 5941 resolve(source); | 7753 resolve(source); |
| 5942 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); | 7754 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| 5943 verify([source]); | 7755 verify([source]); |
| 5944 } | 7756 } |
| 5945 void test_mixinDeclaresConstructor_typedef() { | 7757 void test_mixinDeclaresConstructor_typedef() { |
| 5946 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "typedef B = Object with A;"])); | 7758 Source source = addSource(EngineTestCase.createSource([ |
| 7759 "class A {", |
| 7760 " A() {}", |
| 7761 "}", |
| 7762 "typedef B = Object with A;"])); |
| 5947 resolve(source); | 7763 resolve(source); |
| 5948 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); | 7764 assertErrors([CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| 5949 verify([source]); | 7765 verify([source]); |
| 5950 } | 7766 } |
| 5951 void test_mixinInheritsFromNotObject_classDeclaration_extends() { | 7767 void test_mixinInheritsFromNotObject_classDeclaration_extends() { |
| 5952 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "class C extends Object with B {}"])); | 7768 Source source = addSource(EngineTestCase.createSource([ |
| 7769 "class A {}", |
| 7770 "class B extends A {}", |
| 7771 "class C extends Object with B {}"])); |
| 5953 resolve(source); | 7772 resolve(source); |
| 5954 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); | 7773 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| 5955 verify([source]); | 7774 verify([source]); |
| 5956 } | 7775 } |
| 5957 void test_mixinInheritsFromNotObject_classDeclaration_with() { | 7776 void test_mixinInheritsFromNotObject_classDeclaration_with() { |
| 5958 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends Object with A {}", "class C extends Object with B {}"])); | 7777 Source source = addSource(EngineTestCase.createSource([ |
| 7778 "class A {}", |
| 7779 "class B extends Object with A {}", |
| 7780 "class C extends Object with B {}"])); |
| 5959 resolve(source); | 7781 resolve(source); |
| 5960 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); | 7782 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| 5961 verify([source]); | 7783 verify([source]); |
| 5962 } | 7784 } |
| 5963 void test_mixinInheritsFromNotObject_typedef_extends() { | 7785 void test_mixinInheritsFromNotObject_typedef_extends() { |
| 5964 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "typedef C = Object with B;"])); | 7786 Source source = addSource(EngineTestCase.createSource([ |
| 7787 "class A {}", |
| 7788 "class B extends A {}", |
| 7789 "typedef C = Object with B;"])); |
| 5965 resolve(source); | 7790 resolve(source); |
| 5966 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); | 7791 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| 5967 verify([source]); | 7792 verify([source]); |
| 5968 } | 7793 } |
| 5969 void test_mixinInheritsFromNotObject_typedef_with() { | 7794 void test_mixinInheritsFromNotObject_typedef_with() { |
| 5970 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends Object with A {}", "typedef C = Object with B;"])); | 7795 Source source = addSource(EngineTestCase.createSource([ |
| 7796 "class A {}", |
| 7797 "class B extends Object with A {}", |
| 7798 "typedef C = Object with B;"])); |
| 5971 resolve(source); | 7799 resolve(source); |
| 5972 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); | 7800 assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]); |
| 5973 verify([source]); | 7801 verify([source]); |
| 5974 } | 7802 } |
| 5975 void test_mixinOfNonClass_class() { | 7803 void test_mixinOfNonClass_class() { |
| 5976 Source source = addSource(EngineTestCase.createSource(["int A;", "class B ex
tends Object with A {}"])); | 7804 Source source = addSource(EngineTestCase.createSource(["int A;", "class B ex
tends Object with A {}"])); |
| 5977 resolve(source); | 7805 resolve(source); |
| 5978 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); | 7806 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 5979 verify([source]); | 7807 verify([source]); |
| 5980 } | 7808 } |
| 5981 void test_mixinOfNonClass_typedef() { | 7809 void test_mixinOfNonClass_typedef() { |
| 5982 Source source = addSource(EngineTestCase.createSource(["class A {}", "int B;
", "typedef C = A with B;"])); | 7810 Source source = addSource(EngineTestCase.createSource(["class A {}", "int B;
", "typedef C = A with B;"])); |
| 5983 resolve(source); | 7811 resolve(source); |
| 5984 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); | 7812 assertErrors([CompileTimeErrorCode.MIXIN_OF_NON_CLASS]); |
| 5985 verify([source]); | 7813 verify([source]); |
| 5986 } | 7814 } |
| 5987 void test_mixinReferencesSuper() { | 7815 void test_mixinReferencesSuper() { |
| 5988 Source source = addSource(EngineTestCase.createSource(["class A {", " toStr
ing() => super.toString();", "}", "class B extends Object with A {}"])); | 7816 Source source = addSource(EngineTestCase.createSource([ |
| 7817 "class A {", |
| 7818 " toString() => super.toString();", |
| 7819 "}", |
| 7820 "class B extends Object with A {}"])); |
| 5989 resolve(source); | 7821 resolve(source); |
| 5990 assertErrors([CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]); | 7822 assertErrors([CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]); |
| 5991 verify([source]); | 7823 verify([source]); |
| 5992 } | 7824 } |
| 5993 void test_mixinWithNonClassSuperclass_class() { | 7825 void test_mixinWithNonClassSuperclass_class() { |
| 5994 Source source = addSource(EngineTestCase.createSource(["int A;", "class B {}
", "class C extends A with B {}"])); | 7826 Source source = addSource(EngineTestCase.createSource(["int A;", "class B {}
", "class C extends A with B {}"])); |
| 5995 resolve(source); | 7827 resolve(source); |
| 5996 assertErrors([CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); | 7828 assertErrors([CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); |
| 5997 verify([source]); | 7829 verify([source]); |
| 5998 } | 7830 } |
| 5999 void test_mixinWithNonClassSuperclass_typedef() { | 7831 void test_mixinWithNonClassSuperclass_typedef() { |
| 6000 Source source = addSource(EngineTestCase.createSource(["int A;", "class B {}
", "typedef C = A with B;"])); | 7832 Source source = addSource(EngineTestCase.createSource(["int A;", "class B {}
", "typedef C = A with B;"])); |
| 6001 resolve(source); | 7833 resolve(source); |
| 6002 assertErrors([CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); | 7834 assertErrors([CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]); |
| 6003 verify([source]); | 7835 verify([source]); |
| 6004 } | 7836 } |
| 6005 void test_multipleRedirectingConstructorInvocations() { | 7837 void test_multipleRedirectingConstructorInvocations() { |
| 6006 Source source = addSource(EngineTestCase.createSource(["class A {", " A() :
this.a(), this.b();", " A.a() {}", " A.b() {}", "}"])); | 7838 Source source = addSource(EngineTestCase.createSource([ |
| 7839 "class A {", |
| 7840 " A() : this.a(), this.b();", |
| 7841 " A.a() {}", |
| 7842 " A.b() {}", |
| 7843 "}"])); |
| 6007 resolve(source); | 7844 resolve(source); |
| 6008 assertErrors([CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATI
ONS]); | 7845 assertErrors([CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATI
ONS]); |
| 6009 verify([source]); | 7846 verify([source]); |
| 6010 } | 7847 } |
| 6011 void test_multipleSuperInitializers() { | 7848 void test_multipleSuperInitializers() { |
| 6012 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " B() : super(), super() {}", "}"])); | 7849 Source source = addSource(EngineTestCase.createSource([ |
| 7850 "class A {}", |
| 7851 "class B extends A {", |
| 7852 " B() : super(), super() {}", |
| 7853 "}"])); |
| 6013 resolve(source); | 7854 resolve(source); |
| 6014 assertErrors([CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]); | 7855 assertErrors([CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]); |
| 6015 verify([source]); | 7856 verify([source]); |
| 6016 } | 7857 } |
| 6017 void test_nativeFunctionBodyInNonSDKCode_function() { | 7858 void test_nativeFunctionBodyInNonSDKCode_function() { |
| 6018 Source source = addSource(EngineTestCase.createSource(["int m(a) native 'str
ing';"])); | 7859 Source source = addSource(EngineTestCase.createSource(["int m(a) native 'str
ing';"])); |
| 6019 resolve(source); | 7860 resolve(source); |
| 6020 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); | 7861 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| 6021 verify([source]); | 7862 verify([source]); |
| 6022 } | 7863 } |
| 6023 void test_nativeFunctionBodyInNonSDKCode_method() { | 7864 void test_nativeFunctionBodyInNonSDKCode_method() { |
| 6024 Source source = addSource(EngineTestCase.createSource(["class A{", " static
int m(a) native 'string';", "}"])); | 7865 Source source = addSource(EngineTestCase.createSource(["class A{", " static
int m(a) native 'string';", "}"])); |
| 6025 resolve(source); | 7866 resolve(source); |
| 6026 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); | 7867 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| 6027 verify([source]); | 7868 verify([source]); |
| 6028 } | 7869 } |
| 6029 void test_newWithInvalidTypeParameters() { | 7870 void test_newWithInvalidTypeParameters() { |
| 6030 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {
return new A<A>(); }"])); | 7871 Source source = addSource(EngineTestCase.createSource(["class A {}", "f() {
return new A<A>(); }"])); |
| 6031 resolve(source); | 7872 resolve(source); |
| 6032 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); | 7873 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); |
| 6033 verify([source]); | 7874 verify([source]); |
| 6034 } | 7875 } |
| 6035 void test_newWithInvalidTypeParameters_tooFew() { | 7876 void test_newWithInvalidTypeParameters_tooFew() { |
| 6036 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<K, V> {}", "f(p) {", " return new C<A>();", "}"])); | 7877 Source source = addSource(EngineTestCase.createSource([ |
| 7878 "class A {}", |
| 7879 "class C<K, V> {}", |
| 7880 "f(p) {", |
| 7881 " return new C<A>();", |
| 7882 "}"])); |
| 6037 resolve(source); | 7883 resolve(source); |
| 6038 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); | 7884 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); |
| 6039 verify([source]); | 7885 verify([source]); |
| 6040 } | 7886 } |
| 6041 void test_newWithInvalidTypeParameters_tooMany() { | 7887 void test_newWithInvalidTypeParameters_tooMany() { |
| 6042 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
C<E> {}", "f(p) {", " return new C<A, A>();", "}"])); | 7888 Source source = addSource(EngineTestCase.createSource([ |
| 7889 "class A {}", |
| 7890 "class C<E> {}", |
| 7891 "f(p) {", |
| 7892 " return new C<A, A>();", |
| 7893 "}"])); |
| 6043 resolve(source); | 7894 resolve(source); |
| 6044 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); | 7895 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); |
| 6045 verify([source]); | 7896 verify([source]); |
| 6046 } | 7897 } |
| 6047 void test_noAnnotationConstructorArguments() { | 7898 void test_noAnnotationConstructorArguments() { |
| 6048 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "@A", "main() {", "}"])); | 7899 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "@A", "main() {", "}"])); |
| 6049 resolve(source); | 7900 resolve(source); |
| 6050 assertErrors([CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS]); | 7901 assertErrors([CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS]); |
| 6051 verify([source]); | 7902 verify([source]); |
| 6052 } | 7903 } |
| 6053 void test_noDefaultSuperConstructorExplicit() { | 7904 void test_noDefaultSuperConstructorExplicit() { |
| 6054 Source source = addSource(EngineTestCase.createSource(["class A {", " A(p);
", "}", "class B extends A {", " B() {}", "}"])); | 7905 Source source = addSource(EngineTestCase.createSource([ |
| 7906 "class A {", |
| 7907 " A(p);", |
| 7908 "}", |
| 7909 "class B extends A {", |
| 7910 " B() {}", |
| 7911 "}"])); |
| 6055 resolve(source); | 7912 resolve(source); |
| 6056 assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]); | 7913 assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]); |
| 6057 verify([source]); | 7914 verify([source]); |
| 6058 } | 7915 } |
| 6059 void test_noDefaultSuperConstructorImplicit_superHasParameters() { | 7916 void test_noDefaultSuperConstructorImplicit_superHasParameters() { |
| 6060 Source source = addSource(EngineTestCase.createSource(["class A {", " A(p);
", "}", "class B extends A {", "}"])); | 7917 Source source = addSource(EngineTestCase.createSource(["class A {", " A(p);
", "}", "class B extends A {", "}"])); |
| 6061 resolve(source); | 7918 resolve(source); |
| 6062 assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); | 7919 assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| 6063 verify([source]); | 7920 verify([source]); |
| 6064 } | 7921 } |
| 6065 void test_noDefaultSuperConstructorImplicit_superOnlyNamed() { | 7922 void test_noDefaultSuperConstructorImplicit_superOnlyNamed() { |
| 6066 Source source = addSource(EngineTestCase.createSource(["class A { A.named()
{} }", "class B extends A {}"])); | 7923 Source source = addSource(EngineTestCase.createSource(["class A { A.named()
{} }", "class B extends A {}"])); |
| 6067 resolve(source); | 7924 resolve(source); |
| 6068 assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); | 7925 assertErrors([CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]); |
| 6069 verify([source]); | 7926 verify([source]); |
| 6070 } | 7927 } |
| 6071 void test_nonConstantAnnotationConstructor_named() { | 7928 void test_nonConstantAnnotationConstructor_named() { |
| 6072 Source source = addSource(EngineTestCase.createSource(["class A {", " A.fro
mInt() {}", "}", "@A.fromInt()", "main() {", "}"])); | 7929 Source source = addSource(EngineTestCase.createSource([ |
| 7930 "class A {", |
| 7931 " A.fromInt() {}", |
| 7932 "}", |
| 7933 "@A.fromInt()", |
| 7934 "main() {", |
| 7935 "}"])); |
| 6073 resolve(source); | 7936 resolve(source); |
| 6074 assertErrors([CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]); | 7937 assertErrors([CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]); |
| 6075 verify([source]); | 7938 verify([source]); |
| 6076 } | 7939 } |
| 6077 void test_nonConstantAnnotationConstructor_unnamed() { | 7940 void test_nonConstantAnnotationConstructor_unnamed() { |
| 6078 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "@A()", "main() {", "}"])); | 7941 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "@A()", "main() {", "}"])); |
| 6079 resolve(source); | 7942 resolve(source); |
| 6080 assertErrors([CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]); | 7943 assertErrors([CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]); |
| 6081 verify([source]); | 7944 verify([source]); |
| 6082 } | 7945 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 6110 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); | 7973 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| 6111 verify([source]); | 7974 verify([source]); |
| 6112 } | 7975 } |
| 6113 void test_nonConstantDefaultValue_method_positional() { | 7976 void test_nonConstantDefaultValue_method_positional() { |
| 6114 Source source = addSource(EngineTestCase.createSource(["class A {", " int y
;", " m([x = y]) {}", "}"])); | 7977 Source source = addSource(EngineTestCase.createSource(["class A {", " int y
;", " m([x = y]) {}", "}"])); |
| 6115 resolve(source); | 7978 resolve(source); |
| 6116 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); | 7979 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| 6117 verify([source]); | 7980 verify([source]); |
| 6118 } | 7981 } |
| 6119 void test_nonConstCaseExpression() { | 7982 void test_nonConstCaseExpression() { |
| 6120 Source source = addSource(EngineTestCase.createSource(["f(int p, int q) {",
" switch (p) {", " case 3 + q:", " break;", " }", "}"])); | 7983 Source source = addSource(EngineTestCase.createSource([ |
| 7984 "f(int p, int q) {", |
| 7985 " switch (p) {", |
| 7986 " case 3 + q:", |
| 7987 " break;", |
| 7988 " }", |
| 7989 "}"])); |
| 6121 resolve(source); | 7990 resolve(source); |
| 6122 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); | 7991 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); |
| 6123 verify([source]); | 7992 verify([source]); |
| 6124 } | 7993 } |
| 6125 void test_nonConstListElement() { | 7994 void test_nonConstListElement() { |
| 6126 Source source = addSource(EngineTestCase.createSource(["f(a) {", " return c
onst [a];", "}"])); | 7995 Source source = addSource(EngineTestCase.createSource(["f(a) {", " return c
onst [a];", "}"])); |
| 6127 resolve(source); | 7996 resolve(source); |
| 6128 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); | 7997 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); |
| 6129 verify([source]); | 7998 verify([source]); |
| 6130 } | 7999 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6146 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]); | 8015 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]); |
| 6147 verify([source]); | 8016 verify([source]); |
| 6148 } | 8017 } |
| 6149 void test_nonConstMapValue() { | 8018 void test_nonConstMapValue() { |
| 6150 Source source = addSource(EngineTestCase.createSource(["f(a) {", " return c
onst {'a' : a};", "}"])); | 8019 Source source = addSource(EngineTestCase.createSource(["f(a) {", " return c
onst {'a' : a};", "}"])); |
| 6151 resolve(source); | 8020 resolve(source); |
| 6152 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); | 8021 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); |
| 6153 verify([source]); | 8022 verify([source]); |
| 6154 } | 8023 } |
| 6155 void test_nonConstValueInInitializer_binary_notBool_left() { | 8024 void test_nonConstValueInInitializer_binary_notBool_left() { |
| 6156 Source source = addSource(EngineTestCase.createSource(["class A {", " final
bool a;", " const A(String p) : a = p && true;", "}"])); | 8025 Source source = addSource(EngineTestCase.createSource([ |
| 8026 "class A {", |
| 8027 " final bool a;", |
| 8028 " const A(String p) : a = p && true;", |
| 8029 "}"])); |
| 6157 resolve(source); | 8030 resolve(source); |
| 6158 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 8031 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]); |
| 6159 verify([source]); | 8032 verify([source]); |
| 6160 } | 8033 } |
| 6161 void test_nonConstValueInInitializer_binary_notBool_right() { | 8034 void test_nonConstValueInInitializer_binary_notBool_right() { |
| 6162 Source source = addSource(EngineTestCase.createSource(["class A {", " final
bool a;", " const A(String p) : a = true && p;", "}"])); | 8035 Source source = addSource(EngineTestCase.createSource([ |
| 8036 "class A {", |
| 8037 " final bool a;", |
| 8038 " const A(String p) : a = true && p;", |
| 8039 "}"])); |
| 6163 resolve(source); | 8040 resolve(source); |
| 6164 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 8041 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]); |
| 6165 verify([source]); | 8042 verify([source]); |
| 6166 } | 8043 } |
| 6167 void test_nonConstValueInInitializer_binary_notInt() { | 8044 void test_nonConstValueInInitializer_binary_notInt() { |
| 6168 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int a;", " const A(String p) : a = 5 & p;", "}"])); | 8045 Source source = addSource(EngineTestCase.createSource([ |
| 8046 "class A {", |
| 8047 " final int a;", |
| 8048 " const A(String p) : a = 5 & p;", |
| 8049 "}"])); |
| 6169 resolve(source); | 8050 resolve(source); |
| 6170 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, Static
WarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 8051 assertErrors([ |
| 8052 CompileTimeErrorCode.CONST_EVAL_TYPE_INT, |
| 8053 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 6171 verify([source]); | 8054 verify([source]); |
| 6172 } | 8055 } |
| 6173 void test_nonConstValueInInitializer_binary_notNum() { | 8056 void test_nonConstValueInInitializer_binary_notNum() { |
| 6174 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int a;", " const A(String p) : a = 5 + p;", "}"])); | 8057 Source source = addSource(EngineTestCase.createSource([ |
| 8058 "class A {", |
| 8059 " final int a;", |
| 8060 " const A(String p) : a = 5 + p;", |
| 8061 "}"])); |
| 6175 resolve(source); | 8062 resolve(source); |
| 6176 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, Static
WarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 8063 assertErrors([ |
| 8064 CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, |
| 8065 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 6177 verify([source]); | 8066 verify([source]); |
| 6178 } | 8067 } |
| 6179 void test_nonConstValueInInitializer_field() { | 8068 void test_nonConstValueInInitializer_field() { |
| 6180 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int C;", " final int a;", " const A() : a = C;", "}"])); | 8069 Source source = addSource(EngineTestCase.createSource([ |
| 8070 "class A {", |
| 8071 " static int C;", |
| 8072 " final int a;", |
| 8073 " const A() : a = C;", |
| 8074 "}"])); |
| 6181 resolve(source); | 8075 resolve(source); |
| 6182 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 8076 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| 6183 verify([source]); | 8077 verify([source]); |
| 6184 } | 8078 } |
| 6185 void test_nonConstValueInInitializer_redirecting() { | 8079 void test_nonConstValueInInitializer_redirecting() { |
| 6186 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c var C;", " const A.named(p);", " const A() : this.named(C);", "}"])); | 8080 Source source = addSource(EngineTestCase.createSource([ |
| 8081 "class A {", |
| 8082 " static var C;", |
| 8083 " const A.named(p);", |
| 8084 " const A() : this.named(C);", |
| 8085 "}"])); |
| 6187 resolve(source); | 8086 resolve(source); |
| 6188 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 8087 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| 6189 verify([source]); | 8088 verify([source]); |
| 6190 } | 8089 } |
| 6191 void test_nonConstValueInInitializer_super() { | 8090 void test_nonConstValueInInitializer_super() { |
| 6192 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A(p);", "}", "class B extends A {", " static var C;", " const B() : super(C);
", "}"])); | 8091 Source source = addSource(EngineTestCase.createSource([ |
| 8092 "class A {", |
| 8093 " const A(p);", |
| 8094 "}", |
| 8095 "class B extends A {", |
| 8096 " static var C;", |
| 8097 " const B() : super(C);", |
| 8098 "}"])); |
| 6193 resolve(source); | 8099 resolve(source); |
| 6194 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 8100 assertErrors([CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| 6195 verify([source]); | 8101 verify([source]); |
| 6196 } | 8102 } |
| 6197 void test_nonGenerativeConstructor_explicit() { | 8103 void test_nonGenerativeConstructor_explicit() { |
| 6198 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A.named() {}", "}", "class B extends A {", " B() : super.named();", "}"])); | 8104 Source source = addSource(EngineTestCase.createSource([ |
| 8105 "class A {", |
| 8106 " factory A.named() {}", |
| 8107 "}", |
| 8108 "class B extends A {", |
| 8109 " B() : super.named();", |
| 8110 "}"])); |
| 6199 resolve(source); | 8111 resolve(source); |
| 6200 assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); | 8112 assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); |
| 6201 verify([source]); | 8113 verify([source]); |
| 6202 } | 8114 } |
| 6203 void test_nonGenerativeConstructor_implicit() { | 8115 void test_nonGenerativeConstructor_implicit() { |
| 6204 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() {}", "}", "class B extends A {", " B();", "}"])); | 8116 Source source = addSource(EngineTestCase.createSource([ |
| 8117 "class A {", |
| 8118 " factory A() {}", |
| 8119 "}", |
| 8120 "class B extends A {", |
| 8121 " B();", |
| 8122 "}"])); |
| 6205 resolve(source); | 8123 resolve(source); |
| 6206 assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); | 8124 assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); |
| 6207 verify([source]); | 8125 verify([source]); |
| 6208 } | 8126 } |
| 6209 void test_nonGenerativeConstructor_implicit2() { | 8127 void test_nonGenerativeConstructor_implicit2() { |
| 6210 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() {}", "}", "class B extends A {", "}"])); | 8128 Source source = addSource(EngineTestCase.createSource([ |
| 8129 "class A {", |
| 8130 " factory A() {}", |
| 8131 "}", |
| 8132 "class B extends A {", |
| 8133 "}"])); |
| 6211 resolve(source); | 8134 resolve(source); |
| 6212 assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); | 8135 assertErrors([CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]); |
| 6213 verify([source]); | 8136 verify([source]); |
| 6214 } | 8137 } |
| 6215 void test_notEnoughRequiredArguments_const() { | 8138 void test_notEnoughRequiredArguments_const() { |
| 6216 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A(int p);", "}", "main() {", " const A();", "}"])); | 8139 Source source = addSource(EngineTestCase.createSource([ |
| 8140 "class A {", |
| 8141 " const A(int p);", |
| 8142 "}", |
| 8143 "main() {", |
| 8144 " const A();", |
| 8145 "}"])); |
| 6217 resolve(source); | 8146 resolve(source); |
| 6218 assertErrors([CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); | 8147 assertErrors([CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); |
| 6219 verify([source]); | 8148 verify([source]); |
| 8149 } |
| 8150 void test_notEnoughRequiredArguments_const_super() { |
| 8151 Source source = addSource(EngineTestCase.createSource([ |
| 8152 "class A {", |
| 8153 " const A(int p);", |
| 8154 "}", |
| 8155 "class B extends A {", |
| 8156 " const B() : super();", |
| 8157 "}"])); |
| 8158 resolve(source); |
| 8159 assertErrors([CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); |
| 8160 verify([source]); |
| 6220 } | 8161 } |
| 6221 void test_optionalParameterInOperator_named() { | 8162 void test_optionalParameterInOperator_named() { |
| 6222 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +({p}) {}", "}"])); | 8163 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +({p}) {}", "}"])); |
| 6223 resolve(source); | 8164 resolve(source); |
| 6224 assertErrors([CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]); | 8165 assertErrors([CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]); |
| 6225 verify([source]); | 8166 verify([source]); |
| 6226 } | 8167 } |
| 6227 void test_optionalParameterInOperator_positional() { | 8168 void test_optionalParameterInOperator_positional() { |
| 6228 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +([p]) {}", "}"])); | 8169 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +([p]) {}", "}"])); |
| 6229 resolve(source); | 8170 resolve(source); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6277 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); | 8218 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| 6278 verify([source]); | 8219 verify([source]); |
| 6279 } | 8220 } |
| 6280 void test_privateOptionalParameter_withDefaultValue() { | 8221 void test_privateOptionalParameter_withDefaultValue() { |
| 6281 Source source = addSource(EngineTestCase.createSource(["f({_p : 0}) {}"])); | 8222 Source source = addSource(EngineTestCase.createSource(["f({_p : 0}) {}"])); |
| 6282 resolve(source); | 8223 resolve(source); |
| 6283 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); | 8224 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| 6284 verify([source]); | 8225 verify([source]); |
| 6285 } | 8226 } |
| 6286 void test_recursiveConstructorRedirect() { | 8227 void test_recursiveConstructorRedirect() { |
| 6287 Source source = addSource(EngineTestCase.createSource(["class A {", " A.a()
: this.b();", " A.b() : this.a();", "}"])); | 8228 Source source = addSource(EngineTestCase.createSource([ |
| 8229 "class A {", |
| 8230 " A.a() : this.b();", |
| 8231 " A.b() : this.a();", |
| 8232 "}"])); |
| 6288 resolve(source); | 8233 resolve(source); |
| 6289 assertErrors([CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT, CompileTi
meErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]); | 8234 assertErrors([ |
| 8235 CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT, |
| 8236 CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]); |
| 6290 verify([source]); | 8237 verify([source]); |
| 6291 } | 8238 } |
| 6292 void test_recursiveConstructorRedirect_directSelfReference() { | 8239 void test_recursiveConstructorRedirect_directSelfReference() { |
| 6293 Source source = addSource(EngineTestCase.createSource(["class A {", " A() :
this();", "}"])); | 8240 Source source = addSource(EngineTestCase.createSource(["class A {", " A() :
this();", "}"])); |
| 6294 resolve(source); | 8241 resolve(source); |
| 6295 assertErrors([CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]); | 8242 assertErrors([CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]); |
| 6296 verify([source]); | 8243 verify([source]); |
| 6297 } | 8244 } |
| 6298 void test_recursiveFactoryRedirect() { | 8245 void test_recursiveFactoryRedirect() { |
| 6299 Source source = addSource(EngineTestCase.createSource(["class A implements B
{", " factory A() = C;", "}", "class B implements C {", " factory B() = A;",
"}", "class C implements A {", " factory C() = B;", "}"])); | 8246 Source source = addSource(EngineTestCase.createSource([ |
| 8247 "class A implements B {", |
| 8248 " factory A() = C;", |
| 8249 "}", |
| 8250 "class B implements C {", |
| 8251 " factory B() = A;", |
| 8252 "}", |
| 8253 "class C implements A {", |
| 8254 " factory C() = B;", |
| 8255 "}"])); |
| 6300 resolve(source); | 8256 resolve(source); |
| 6301 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeEr
rorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeErrorCode.RECURSIVE_FACTORY_REDIR
ECT, CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileTimeErrorCode.
RECURSIVE_INTERFACE_INHERITANCE, CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERI
TANCE]); | 8257 assertErrors([ |
| 8258 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8259 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8260 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8261 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8262 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8263 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6302 verify([source]); | 8264 verify([source]); |
| 6303 } | 8265 } |
| 6304 void test_recursiveFactoryRedirect_directSelfReference() { | 8266 void test_recursiveFactoryRedirect_directSelfReference() { |
| 6305 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() = A;", "}"])); | 8267 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() = A;", "}"])); |
| 6306 resolve(source); | 8268 resolve(source); |
| 6307 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]); | 8269 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]); |
| 6308 verify([source]); | 8270 verify([source]); |
| 6309 } | 8271 } |
| 6310 void test_recursiveFactoryRedirect_generic() { | 8272 void test_recursiveFactoryRedirect_generic() { |
| 6311 Source source = addSource(EngineTestCase.createSource(["class A<T> implement
s B<T> {", " factory A() = C;", "}", "class B<T> implements C<T> {", " factory
B() = A;", "}", "class C<T> implements A<T> {", " factory C() = B;", "}"])); | 8273 Source source = addSource(EngineTestCase.createSource([ |
| 8274 "class A<T> implements B<T> {", |
| 8275 " factory A() = C;", |
| 8276 "}", |
| 8277 "class B<T> implements C<T> {", |
| 8278 " factory B() = A;", |
| 8279 "}", |
| 8280 "class C<T> implements A<T> {", |
| 8281 " factory C() = B;", |
| 8282 "}"])); |
| 6312 resolve(source); | 8283 resolve(source); |
| 6313 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeEr
rorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeErrorCode.RECURSIVE_FACTORY_REDIR
ECT, CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileTimeErrorCode.
RECURSIVE_INTERFACE_INHERITANCE, CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERI
TANCE]); | 8284 assertErrors([ |
| 8285 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8286 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8287 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8288 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8289 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8290 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6314 verify([source]); | 8291 verify([source]); |
| 6315 } | 8292 } |
| 6316 void test_recursiveFactoryRedirect_named() { | 8293 void test_recursiveFactoryRedirect_named() { |
| 6317 Source source = addSource(EngineTestCase.createSource(["class A implements B
{", " factory A.nameA() = C.nameC;", "}", "class B implements C {", " factory
B.nameB() = A.nameA;", "}", "class C implements A {", " factory C.nameC() = B.
nameB;", "}"])); | 8294 Source source = addSource(EngineTestCase.createSource([ |
| 8295 "class A implements B {", |
| 8296 " factory A.nameA() = C.nameC;", |
| 8297 "}", |
| 8298 "class B implements C {", |
| 8299 " factory B.nameB() = A.nameA;", |
| 8300 "}", |
| 8301 "class C implements A {", |
| 8302 " factory C.nameC() = B.nameB;", |
| 8303 "}"])); |
| 6318 resolve(source); | 8304 resolve(source); |
| 6319 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeEr
rorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeErrorCode.RECURSIVE_FACTORY_REDIR
ECT, CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileTimeErrorCode.
RECURSIVE_INTERFACE_INHERITANCE, CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERI
TANCE]); | 8305 assertErrors([ |
| 8306 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8307 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8308 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8309 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8310 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8311 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6320 verify([source]); | 8312 verify([source]); |
| 6321 } | 8313 } |
| 6322 | 8314 |
| 6323 /** | 8315 /** |
| 6324 * "A" references "C" which has cycle with "B". But we should not report probl
em for "A" - it is | 8316 * "A" references "C" which has cycle with "B". But we should not report probl
em for "A" - it is |
| 6325 * not the part of a cycle. | 8317 * not the part of a cycle. |
| 6326 */ | 8318 */ |
| 6327 void test_recursiveFactoryRedirect_outsideCycle() { | 8319 void test_recursiveFactoryRedirect_outsideCycle() { |
| 6328 Source source = addSource(EngineTestCase.createSource(["class A {", " facto
ry A() = C;", "}", "class B implements C {", " factory B() = C;", "}", "class C
implements A, B {", " factory C() = B;", "}"])); | 8320 Source source = addSource(EngineTestCase.createSource([ |
| 8321 "class A {", |
| 8322 " factory A() = C;", |
| 8323 "}", |
| 8324 "class B implements C {", |
| 8325 " factory B() = C;", |
| 8326 "}", |
| 8327 "class C implements A, B {", |
| 8328 " factory C() = B;", |
| 8329 "}"])); |
| 6329 resolve(source); | 8330 resolve(source); |
| 6330 assertErrors([CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeEr
rorCode.RECURSIVE_FACTORY_REDIRECT, CompileTimeErrorCode.RECURSIVE_INTERFACE_INH
ERITANCE, CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); | 8331 assertErrors([ |
| 8332 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8333 CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, |
| 8334 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8335 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6331 verify([source]); | 8336 verify([source]); |
| 6332 } | 8337 } |
| 6333 void test_recursiveInterfaceInheritance_extends() { | 8338 void test_recursiveInterfaceInheritance_extends() { |
| 6334 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B extends A {}"])); | 8339 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B extends A {}"])); |
| 6335 resolve(source); | 8340 resolve(source); |
| 6336 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileT
imeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); | 8341 assertErrors([ |
| 8342 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8343 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6337 verify([source]); | 8344 verify([source]); |
| 6338 } | 8345 } |
| 6339 void test_recursiveInterfaceInheritance_extends_implements() { | 8346 void test_recursiveInterfaceInheritance_extends_implements() { |
| 6340 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B implements A {}"])); | 8347 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B implements A {}"])); |
| 6341 resolve(source); | 8348 resolve(source); |
| 6342 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileT
imeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); | 8349 assertErrors([ |
| 8350 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8351 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6343 verify([source]); | 8352 verify([source]); |
| 6344 } | 8353 } |
| 6345 void test_recursiveInterfaceInheritance_implements() { | 8354 void test_recursiveInterfaceInheritance_implements() { |
| 6346 Source source = addSource(EngineTestCase.createSource(["class A implements B
{}", "class B implements A {}"])); | 8355 Source source = addSource(EngineTestCase.createSource(["class A implements B
{}", "class B implements A {}"])); |
| 6347 resolve(source); | 8356 resolve(source); |
| 6348 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileT
imeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); | 8357 assertErrors([ |
| 8358 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8359 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6349 verify([source]); | 8360 verify([source]); |
| 6350 } | 8361 } |
| 6351 void test_recursiveInterfaceInheritance_tail() { | 8362 void test_recursiveInterfaceInheritance_tail() { |
| 6352 Source source = addSource(EngineTestCase.createSource(["abstract class A imp
lements A {}", "class B implements A {}"])); | 8363 Source source = addSource(EngineTestCase.createSource([ |
| 8364 "abstract class A implements A {}", |
| 8365 "class B implements A {}"])); |
| 6353 resolve(source); | 8366 resolve(source); |
| 6354 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_IMPLEMENTS]); | 8367 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_IMPLEMENTS]); |
| 6355 verify([source]); | 8368 verify([source]); |
| 6356 } | 8369 } |
| 6357 void test_recursiveInterfaceInheritance_tail2() { | 8370 void test_recursiveInterfaceInheritance_tail2() { |
| 6358 Source source = addSource(EngineTestCase.createSource(["abstract class A imp
lements B {}", "abstract class B implements A {}", "class C implements A {}"])); | 8371 Source source = addSource(EngineTestCase.createSource([ |
| 8372 "abstract class A implements B {}", |
| 8373 "abstract class B implements A {}", |
| 8374 "class C implements A {}"])); |
| 6359 resolve(source); | 8375 resolve(source); |
| 6360 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileT
imeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); | 8376 assertErrors([ |
| 8377 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8378 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6361 verify([source]); | 8379 verify([source]); |
| 6362 } | 8380 } |
| 6363 void test_recursiveInterfaceInheritance_tail3() { | 8381 void test_recursiveInterfaceInheritance_tail3() { |
| 6364 Source source = addSource(EngineTestCase.createSource(["abstract class A imp
lements B {}", "abstract class B implements C {}", "abstract class C implements
A {}", "class D implements A {}"])); | 8382 Source source = addSource(EngineTestCase.createSource([ |
| 8383 "abstract class A implements B {}", |
| 8384 "abstract class B implements C {}", |
| 8385 "abstract class C implements A {}", |
| 8386 "class D implements A {}"])); |
| 6365 resolve(source); | 8387 resolve(source); |
| 6366 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileT
imeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, CompileTimeErrorCode.RECURSIVE_INT
ERFACE_INHERITANCE]); | 8388 assertErrors([ |
| 8389 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8390 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, |
| 8391 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE]); |
| 6367 verify([source]); | 8392 verify([source]); |
| 6368 } | 8393 } |
| 6369 void test_recursiveInterfaceInheritanceBaseCaseExtends() { | 8394 void test_recursiveInterfaceInheritanceBaseCaseExtends() { |
| 6370 Source source = addSource(EngineTestCase.createSource(["class A extends A {}
"])); | 8395 Source source = addSource(EngineTestCase.createSource(["class A extends A {}
"])); |
| 6371 resolve(source); | 8396 resolve(source); |
| 6372 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_EXTENDS]); | 8397 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_EXTENDS]); |
| 6373 verify([source]); | 8398 verify([source]); |
| 6374 } | 8399 } |
| 6375 void test_recursiveInterfaceInheritanceBaseCaseImplements() { | 8400 void test_recursiveInterfaceInheritanceBaseCaseImplements() { |
| 6376 Source source = addSource(EngineTestCase.createSource(["class A implements A
{}"])); | 8401 Source source = addSource(EngineTestCase.createSource(["class A implements A
{}"])); |
| 6377 resolve(source); | 8402 resolve(source); |
| 6378 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_IMPLEMENTS]); | 8403 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_IMPLEMENTS]); |
| 6379 verify([source]); | 8404 verify([source]); |
| 6380 } | 8405 } |
| 6381 void test_recursiveInterfaceInheritanceBaseCaseImplements_typedef() { | 8406 void test_recursiveInterfaceInheritanceBaseCaseImplements_typedef() { |
| 6382 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
M {}", "typedef B = A with M implements B;"])); | 8407 Source source = addSource(EngineTestCase.createSource([ |
| 8408 "class A {}", |
| 8409 "class M {}", |
| 8410 "typedef B = A with M implements B;"])); |
| 6383 resolve(source); | 8411 resolve(source); |
| 6384 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_IMPLEMENTS]); | 8412 assertErrors([CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE
_IMPLEMENTS]); |
| 6385 verify([source]); | 8413 verify([source]); |
| 6386 } | 8414 } |
| 6387 void test_redirectToNonConstConstructor() { | 8415 void test_redirectToNonConstConstructor() { |
| 6388 Source source = addSource(EngineTestCase.createSource(["class A {", " A.a()
{}", " const factory A.b() = A.a;", "}"])); | 8416 Source source = addSource(EngineTestCase.createSource([ |
| 8417 "class A {", |
| 8418 " A.a() {}", |
| 8419 " const factory A.b() = A.a;", |
| 8420 "}"])); |
| 6389 resolve(source); | 8421 resolve(source); |
| 6390 assertErrors([CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]); | 8422 assertErrors([CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]); |
| 6391 verify([source]); | 8423 verify([source]); |
| 6392 } | 8424 } |
| 6393 void test_referenceToDeclaredVariableInInitializer_closure() { | 8425 void test_referenceToDeclaredVariableInInitializer_closure() { |
| 6394 Source source = addSource(EngineTestCase.createSource(["f() {", " var x = (
x) {};", "}"])); | 8426 Source source = addSource(EngineTestCase.createSource(["f() {", " var x = (
x) {};", "}"])); |
| 6395 resolve(source); | 8427 resolve(source); |
| 6396 assertErrors([CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN_INITIAL
IZER]); | 8428 assertErrors([CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN_INITIAL
IZER]); |
| 6397 verify([source]); | 8429 verify([source]); |
| 6398 } | 8430 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 6419 resolve(source); | 8451 resolve(source); |
| 6420 assertErrors([CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); | 8452 assertErrors([CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); |
| 6421 verify([source]); | 8453 verify([source]); |
| 6422 } | 8454 } |
| 6423 void test_returnInGenerativeConstructor() { | 8455 void test_returnInGenerativeConstructor() { |
| 6424 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
return 0; }", "}"])); | 8456 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
return 0; }", "}"])); |
| 6425 resolve(source); | 8457 resolve(source); |
| 6426 assertErrors([CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]); | 8458 assertErrors([CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]); |
| 6427 verify([source]); | 8459 verify([source]); |
| 6428 } | 8460 } |
| 8461 void test_returnInGenerativeConstructor_expressionFunctionBody() { |
| 8462 Source source = addSource(EngineTestCase.createSource(["class A {", " A() =
> null;", "}"])); |
| 8463 resolve(source); |
| 8464 assertErrors([CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]); |
| 8465 verify([source]); |
| 8466 } |
| 6429 void test_superInInvalidContext_binaryExpression() { | 8467 void test_superInInvalidContext_binaryExpression() { |
| 6430 Source source = addSource(EngineTestCase.createSource(["var v = super + 0;"]
)); | 8468 Source source = addSource(EngineTestCase.createSource(["var v = super + 0;"]
)); |
| 6431 resolve(source); | 8469 resolve(source); |
| 6432 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8470 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6433 } | 8471 } |
| 6434 void test_superInInvalidContext_constructorFieldInitializer() { | 8472 void test_superInInvalidContext_constructorFieldInitializer() { |
| 6435 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "class B extends A {", " var f;", " B() : f = super.m();", "}"])); | 8473 Source source = addSource(EngineTestCase.createSource([ |
| 8474 "class A {", |
| 8475 " m() {}", |
| 8476 "}", |
| 8477 "class B extends A {", |
| 8478 " var f;", |
| 8479 " B() : f = super.m();", |
| 8480 "}"])); |
| 6436 resolve(source); | 8481 resolve(source); |
| 6437 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8482 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6438 } | 8483 } |
| 6439 void test_superInInvalidContext_factoryConstructor() { | 8484 void test_superInInvalidContext_factoryConstructor() { |
| 6440 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "class B extends A {", " factory B() {", " super.m();", " }", "}"]
)); | 8485 Source source = addSource(EngineTestCase.createSource([ |
| 8486 "class A {", |
| 8487 " m() {}", |
| 8488 "}", |
| 8489 "class B extends A {", |
| 8490 " factory B() {", |
| 8491 " super.m();", |
| 8492 " }", |
| 8493 "}"])); |
| 6441 resolve(source); | 8494 resolve(source); |
| 6442 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8495 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6443 } | 8496 } |
| 6444 void test_superInInvalidContext_instanceVariableInitializer() { | 8497 void test_superInInvalidContext_instanceVariableInitializer() { |
| 6445 Source source = addSource(EngineTestCase.createSource(["class A {", " var a
;", "}", "class B extends A {", " var b = super.a;", "}"])); | 8498 Source source = addSource(EngineTestCase.createSource([ |
| 8499 "class A {", |
| 8500 " var a;", |
| 8501 "}", |
| 8502 "class B extends A {", |
| 8503 " var b = super.a;", |
| 8504 "}"])); |
| 6446 resolve(source); | 8505 resolve(source); |
| 6447 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8506 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6448 } | 8507 } |
| 6449 void test_superInInvalidContext_staticMethod() { | 8508 void test_superInInvalidContext_staticMethod() { |
| 6450 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c m() {}", "}", "class B extends A {", " static n() { return super.m(); }", "}"
])); | 8509 Source source = addSource(EngineTestCase.createSource([ |
| 8510 "class A {", |
| 8511 " static m() {}", |
| 8512 "}", |
| 8513 "class B extends A {", |
| 8514 " static n() { return super.m(); }", |
| 8515 "}"])); |
| 6451 resolve(source); | 8516 resolve(source); |
| 6452 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8517 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6453 } | 8518 } |
| 6454 void test_superInInvalidContext_staticVariableInitializer() { | 8519 void test_superInInvalidContext_staticVariableInitializer() { |
| 6455 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int a = 0;", "}", "class B extends A {", " static int b = super.a;", "}"])); | 8520 Source source = addSource(EngineTestCase.createSource([ |
| 8521 "class A {", |
| 8522 " static int a = 0;", |
| 8523 "}", |
| 8524 "class B extends A {", |
| 8525 " static int b = super.a;", |
| 8526 "}"])); |
| 6456 resolve(source); | 8527 resolve(source); |
| 6457 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8528 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6458 } | 8529 } |
| 6459 void test_superInInvalidContext_topLevelFunction() { | 8530 void test_superInInvalidContext_topLevelFunction() { |
| 6460 Source source = addSource(EngineTestCase.createSource(["f() {", " super.f()
;", "}"])); | 8531 Source source = addSource(EngineTestCase.createSource(["f() {", " super.f()
;", "}"])); |
| 6461 resolve(source); | 8532 resolve(source); |
| 6462 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8533 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6463 } | 8534 } |
| 6464 void test_superInInvalidContext_topLevelVariableInitializer() { | 8535 void test_superInInvalidContext_topLevelVariableInitializer() { |
| 6465 Source source = addSource(EngineTestCase.createSource(["var v = super.y;"]))
; | 8536 Source source = addSource(EngineTestCase.createSource(["var v = super.y;"]))
; |
| 6466 resolve(source); | 8537 resolve(source); |
| 6467 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); | 8538 assertErrors([CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]); |
| 6468 } | 8539 } |
| 6469 void test_superInRedirectingConstructor_redirectionSuper() { | 8540 void test_superInRedirectingConstructor_redirectionSuper() { |
| 6470 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {", " B() : this.name(), super();", " B.name() {}", "}"])); | 8541 Source source = addSource(EngineTestCase.createSource([ |
| 8542 "class A {}", |
| 8543 "class B {", |
| 8544 " B() : this.name(), super();", |
| 8545 " B.name() {}", |
| 8546 "}"])); |
| 6471 resolve(source); | 8547 resolve(source); |
| 6472 assertErrors([CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]); | 8548 assertErrors([CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]); |
| 6473 verify([source]); | 8549 verify([source]); |
| 6474 } | 8550 } |
| 6475 void test_superInRedirectingConstructor_superRedirection() { | 8551 void test_superInRedirectingConstructor_superRedirection() { |
| 6476 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {", " B() : super(), this.name();", " B.name() {}", "}"])); | 8552 Source source = addSource(EngineTestCase.createSource([ |
| 8553 "class A {}", |
| 8554 "class B {", |
| 8555 " B() : super(), this.name();", |
| 8556 " B.name() {}", |
| 8557 "}"])); |
| 6477 resolve(source); | 8558 resolve(source); |
| 6478 assertErrors([CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]); | 8559 assertErrors([CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]); |
| 6479 verify([source]); | 8560 verify([source]); |
| 6480 } | 8561 } |
| 6481 void test_typeAliasCannotReferenceItself_parameterType_named() { | 8562 void test_typeAliasCannotReferenceItself_parameterType_named() { |
| 6482 Source source = addSource(EngineTestCase.createSource(["typedef A({A a});"])
); | 8563 Source source = addSource(EngineTestCase.createSource(["typedef A({A a});"])
); |
| 6483 resolve(source); | 8564 resolve(source); |
| 6484 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8565 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 6485 verify([source]); | 8566 verify([source]); |
| 6486 } | 8567 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 6498 } | 8579 } |
| 6499 void test_typeAliasCannotReferenceItself_returnType() { | 8580 void test_typeAliasCannotReferenceItself_returnType() { |
| 6500 Source source = addSource(EngineTestCase.createSource(["typedef A A();"])); | 8581 Source source = addSource(EngineTestCase.createSource(["typedef A A();"])); |
| 6501 resolve(source); | 8582 resolve(source); |
| 6502 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8583 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 6503 verify([source]); | 8584 verify([source]); |
| 6504 } | 8585 } |
| 6505 void test_typeAliasCannotReferenceItself_returnType_indirect() { | 8586 void test_typeAliasCannotReferenceItself_returnType_indirect() { |
| 6506 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "ty
pedef A B();"])); | 8587 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "ty
pedef A B();"])); |
| 6507 resolve(source); | 8588 resolve(source); |
| 6508 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, Compi
leTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8589 assertErrors([ |
| 8590 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
| 8591 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 6509 verify([source]); | 8592 verify([source]); |
| 6510 } | 8593 } |
| 6511 void test_typeAliasCannotReferenceItself_typeVariableBounds() { | 8594 void test_typeAliasCannotReferenceItself_typeVariableBounds() { |
| 6512 Source source = addSource(EngineTestCase.createSource(["typedef A<T extends
A>();"])); | 8595 Source source = addSource(EngineTestCase.createSource(["typedef A<T extends
A>();"])); |
| 6513 resolve(source); | 8596 resolve(source); |
| 6514 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8597 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 6515 verify([source]); | 8598 verify([source]); |
| 6516 } | 8599 } |
| 6517 void test_typeArgumentNotMatchingBounds_const() { | 8600 void test_typeArgumentNotMatchingBounds_const() { |
| 6518 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {}", "class G<E extends A> {", " const G();", "}", "f() { return const G<B>()
; }"])); | 8601 Source source = addSource(EngineTestCase.createSource([ |
| 8602 "class A {}", |
| 8603 "class B {}", |
| 8604 "class G<E extends A> {", |
| 8605 " const G();", |
| 8606 "}", |
| 8607 "f() { return const G<B>(); }"])); |
| 6519 resolve(source); | 8608 resolve(source); |
| 6520 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); | 8609 assertErrors([CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| 6521 verify([source]); | 8610 verify([source]); |
| 6522 } | 8611 } |
| 6523 void test_undefinedClass_const() { | 8612 void test_undefinedClass_const() { |
| 6524 Source source = addSource(EngineTestCase.createSource(["f() {", " return co
nst A();", "}"])); | 8613 Source source = addSource(EngineTestCase.createSource(["f() {", " return co
nst A();", "}"])); |
| 6525 resolve(source); | 8614 resolve(source); |
| 6526 assertErrors([CompileTimeErrorCode.UNDEFINED_CLASS]); | 8615 assertErrors([CompileTimeErrorCode.UNDEFINED_CLASS]); |
| 6527 verify([source]); | 8616 verify([source]); |
| 6528 } | 8617 } |
| 6529 void test_undefinedConstructorInInitializer_explicit_named() { | 8618 void test_undefinedConstructorInInitializer_explicit_named() { |
| 6530 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {", " B() : super.named();", "}"])); | 8619 Source source = addSource(EngineTestCase.createSource([ |
| 8620 "class A {}", |
| 8621 "class B extends A {", |
| 8622 " B() : super.named();", |
| 8623 "}"])); |
| 6531 resolve(source); | 8624 resolve(source); |
| 6532 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]); | 8625 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]); |
| 6533 } | 8626 } |
| 6534 void test_undefinedConstructorInInitializer_explicit_unnamed() { | 8627 void test_undefinedConstructorInInitializer_explicit_unnamed() { |
| 6535 Source source = addSource(EngineTestCase.createSource(["class A {", " A.nam
ed() {}", "}", "class B extends A {", " B() : super();", "}"])); | 8628 Source source = addSource(EngineTestCase.createSource([ |
| 8629 "class A {", |
| 8630 " A.named() {}", |
| 8631 "}", |
| 8632 "class B extends A {", |
| 8633 " B() : super();", |
| 8634 "}"])); |
| 6536 resolve(source); | 8635 resolve(source); |
| 6537 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFA
ULT]); | 8636 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFA
ULT]); |
| 6538 verify([source]); | 8637 verify([source]); |
| 6539 } | 8638 } |
| 6540 void test_undefinedConstructorInInitializer_implicit() { | 8639 void test_undefinedConstructorInInitializer_implicit() { |
| 6541 Source source = addSource(EngineTestCase.createSource(["class A {", " A.nam
ed() {}", "}", "class B extends A {", " B();", "}"])); | 8640 Source source = addSource(EngineTestCase.createSource([ |
| 8641 "class A {", |
| 8642 " A.named() {}", |
| 8643 "}", |
| 8644 "class B extends A {", |
| 8645 " B();", |
| 8646 "}"])); |
| 6542 resolve(source); | 8647 resolve(source); |
| 6543 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFA
ULT]); | 8648 assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFA
ULT]); |
| 6544 verify([source]); | 8649 verify([source]); |
| 6545 } | 8650 } |
| 6546 void test_undefinedNamedParameter() { | 8651 void test_undefinedNamedParameter() { |
| 6547 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A();", "}", "main() {", " const A(p: 0);", "}"])); | 8652 Source source = addSource(EngineTestCase.createSource([ |
| 8653 "class A {", |
| 8654 " const A();", |
| 8655 "}", |
| 8656 "main() {", |
| 8657 " const A(p: 0);", |
| 8658 "}"])); |
| 6548 resolve(source); | 8659 resolve(source); |
| 6549 assertErrors([CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]); | 8660 assertErrors([CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]); |
| 6550 } | 8661 } |
| 6551 void test_uriDoesNotExist_export() { | 8662 void test_uriDoesNotExist_export() { |
| 6552 Source source = addSource(EngineTestCase.createSource(["export 'unknown.dart
';"])); | 8663 Source source = addSource(EngineTestCase.createSource(["export 'unknown.dart
';"])); |
| 6553 resolve(source); | 8664 resolve(source); |
| 6554 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); | 8665 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| 6555 } | 8666 } |
| 6556 void test_uriDoesNotExist_import() { | 8667 void test_uriDoesNotExist_import() { |
| 6557 Source source = addSource(EngineTestCase.createSource(["import 'unknown.dart
';"])); | 8668 Source source = addSource(EngineTestCase.createSource(["import 'unknown.dart
';"])); |
| 6558 resolve(source); | 8669 resolve(source); |
| 6559 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); | 8670 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| 6560 } | 8671 } |
| 6561 void test_uriDoesNotExist_part() { | 8672 void test_uriDoesNotExist_part() { |
| 6562 Source source = addSource(EngineTestCase.createSource(["part 'unknown.dart';
"])); | 8673 Source source = addSource(EngineTestCase.createSource(["part 'unknown.dart';
"])); |
| 6563 resolve(source); | 8674 resolve(source); |
| 6564 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); | 8675 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| 6565 } | 8676 } |
| 6566 void test_uriWithInterpolation_constant() { | 8677 void test_uriWithInterpolation_constant() { |
| 6567 Source source = addSource(EngineTestCase.createSource(["import 'stuff_\$plat
form.dart';"])); | 8678 Source source = addSource(EngineTestCase.createSource(["import 'stuff_\$plat
form.dart';"])); |
| 6568 resolve(source); | 8679 resolve(source); |
| 6569 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION, StaticWarningCode
.UNDEFINED_IDENTIFIER]); | 8680 assertErrors([ |
| 8681 CompileTimeErrorCode.URI_WITH_INTERPOLATION, |
| 8682 StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 6570 } | 8683 } |
| 6571 void test_uriWithInterpolation_nonConstant() { | 8684 void test_uriWithInterpolation_nonConstant() { |
| 6572 Source source = addSource(EngineTestCase.createSource(["library lib;", "part
'\${'a'}.dart';"])); | 8685 Source source = addSource(EngineTestCase.createSource(["library lib;", "part
'\${'a'}.dart';"])); |
| 6573 resolve(source); | 8686 resolve(source); |
| 6574 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION]); | 8687 assertErrors([CompileTimeErrorCode.URI_WITH_INTERPOLATION]); |
| 6575 } | 8688 } |
| 6576 void test_wrongNumberOfParametersForOperator_minus() { | 8689 void test_wrongNumberOfParametersForOperator_minus() { |
| 6577 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor -(a, b) {}", "}"])); | 8690 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor -(a, b) {}", "}"])); |
| 6578 resolve(source); | 8691 resolve(source); |
| 6579 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_M
INUS]); | 8692 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_M
INUS]); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6649 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); | 8762 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]); |
| 6650 verify([source]); | 8763 verify([source]); |
| 6651 } | 8764 } |
| 6652 void check_constEvalThrowsException_binary_null(String expr, bool resolved) { | 8765 void check_constEvalThrowsException_binary_null(String expr, bool resolved) { |
| 6653 Source source = addSource("const C = ${expr};"); | 8766 Source source = addSource("const C = ${expr};"); |
| 6654 resolve(source); | 8767 resolve(source); |
| 6655 if (resolved) { | 8768 if (resolved) { |
| 6656 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); | 8769 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 6657 verify([source]); | 8770 verify([source]); |
| 6658 } else { | 8771 } else { |
| 6659 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, StaticType
WarningCode.UNDEFINED_OPERATOR]); | 8772 assertErrors([ |
| 8773 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, |
| 8774 StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 6660 } | 8775 } |
| 6661 reset(); | 8776 reset(); |
| 6662 } | 8777 } |
| 6663 void check_constEvalTypeBool_withParameter_binary(String expr) { | 8778 void check_constEvalTypeBool_withParameter_binary(String expr) { |
| 6664 Source source = addSource(EngineTestCase.createSource(["class A {", " final
a;", " const A(bool p) : a = ${expr};", "}"])); | 8779 Source source = addSource(EngineTestCase.createSource([ |
| 8780 "class A {", |
| 8781 " final a;", |
| 8782 " const A(bool p) : a = ${expr};", |
| 8783 "}"])); |
| 6665 resolve(source); | 8784 resolve(source); |
| 6666 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]); | 8785 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]); |
| 6667 verify([source]); | 8786 verify([source]); |
| 6668 reset(); | 8787 reset(); |
| 6669 } | 8788 } |
| 6670 void check_constEvalTypeInt_withParameter_binary(String expr) { | 8789 void check_constEvalTypeInt_withParameter_binary(String expr) { |
| 6671 Source source = addSource(EngineTestCase.createSource(["class A {", " final
a;", " const A(int p) : a = ${expr};", "}"])); | 8790 Source source = addSource(EngineTestCase.createSource([ |
| 8791 "class A {", |
| 8792 " final a;", |
| 8793 " const A(int p) : a = ${expr};", |
| 8794 "}"])); |
| 6672 resolve(source); | 8795 resolve(source); |
| 6673 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_INT, StaticWarningCode.AR
GUMENT_TYPE_NOT_ASSIGNABLE]); | 8796 assertErrors([ |
| 8797 CompileTimeErrorCode.CONST_EVAL_TYPE_INT, |
| 8798 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 6674 verify([source]); | 8799 verify([source]); |
| 6675 reset(); | 8800 reset(); |
| 6676 } | 8801 } |
| 6677 void check_constEvalTypeNum_withParameter_binary(String expr) { | 8802 void check_constEvalTypeNum_withParameter_binary(String expr) { |
| 6678 Source source = addSource(EngineTestCase.createSource(["class A {", " final
a;", " const A(num p) : a = ${expr};", "}"])); | 8803 Source source = addSource(EngineTestCase.createSource([ |
| 8804 "class A {", |
| 8805 " final a;", |
| 8806 " const A(num p) : a = ${expr};", |
| 8807 "}"])); |
| 6679 resolve(source); | 8808 resolve(source); |
| 6680 assertErrors([CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, StaticWarningCode.AR
GUMENT_TYPE_NOT_ASSIGNABLE]); | 8809 assertErrors([ |
| 8810 CompileTimeErrorCode.CONST_EVAL_TYPE_NUM, |
| 8811 CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 6681 verify([source]); | 8812 verify([source]); |
| 6682 reset(); | 8813 reset(); |
| 6683 } | 8814 } |
| 6684 void check_wrongNumberOfParametersForOperator(String name, String parameters)
{ | 8815 void check_wrongNumberOfParametersForOperator(String name, String parameters)
{ |
| 6685 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor ${name}(${parameters}) {}", "}"])); | 8816 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor ${name}(${parameters}) {}", "}"])); |
| 6686 resolve(source); | 8817 resolve(source); |
| 6687 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR])
; | 8818 assertErrors([CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR])
; |
| 6688 verify([source]); | 8819 verify([source]); |
| 6689 reset(); | 8820 reset(); |
| 6690 } | 8821 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6735 runJUnitTest(__test, __test.test_ambiguousImport_varRead); | 8866 runJUnitTest(__test, __test.test_ambiguousImport_varRead); |
| 6736 }); | 8867 }); |
| 6737 _ut.test('test_ambiguousImport_varWrite', () { | 8868 _ut.test('test_ambiguousImport_varWrite', () { |
| 6738 final __test = new CompileTimeErrorCodeTest(); | 8869 final __test = new CompileTimeErrorCodeTest(); |
| 6739 runJUnitTest(__test, __test.test_ambiguousImport_varWrite); | 8870 runJUnitTest(__test, __test.test_ambiguousImport_varWrite); |
| 6740 }); | 8871 }); |
| 6741 _ut.test('test_argumentDefinitionTestNonParameter', () { | 8872 _ut.test('test_argumentDefinitionTestNonParameter', () { |
| 6742 final __test = new CompileTimeErrorCodeTest(); | 8873 final __test = new CompileTimeErrorCodeTest(); |
| 6743 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); | 8874 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); |
| 6744 }); | 8875 }); |
| 8876 _ut.test('test_argumentTypeNotAssignable_const', () { |
| 8877 final __test = new CompileTimeErrorCodeTest(); |
| 8878 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); |
| 8879 }); |
| 8880 _ut.test('test_argumentTypeNotAssignable_const_super', () { |
| 8881 final __test = new CompileTimeErrorCodeTest(); |
| 8882 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const_super); |
| 8883 }); |
| 6745 _ut.test('test_builtInIdentifierAsType', () { | 8884 _ut.test('test_builtInIdentifierAsType', () { |
| 6746 final __test = new CompileTimeErrorCodeTest(); | 8885 final __test = new CompileTimeErrorCodeTest(); |
| 6747 runJUnitTest(__test, __test.test_builtInIdentifierAsType); | 8886 runJUnitTest(__test, __test.test_builtInIdentifierAsType); |
| 6748 }); | 8887 }); |
| 6749 _ut.test('test_builtInIdentifierAsTypeName', () { | 8888 _ut.test('test_builtInIdentifierAsTypeName', () { |
| 6750 final __test = new CompileTimeErrorCodeTest(); | 8889 final __test = new CompileTimeErrorCodeTest(); |
| 6751 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeName); | 8890 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeName); |
| 6752 }); | 8891 }); |
| 6753 _ut.test('test_builtInIdentifierAsTypeVariableName', () { | 8892 _ut.test('test_builtInIdentifierAsTypeVariableName', () { |
| 6754 final __test = new CompileTimeErrorCodeTest(); | 8893 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6843 runJUnitTest(__test, __test.test_constEvalTypeBool_binary_leftTrue); | 8982 runJUnitTest(__test, __test.test_constEvalTypeBool_binary_leftTrue); |
| 6844 }); | 8983 }); |
| 6845 _ut.test('test_constEvalTypeInt_binary', () { | 8984 _ut.test('test_constEvalTypeInt_binary', () { |
| 6846 final __test = new CompileTimeErrorCodeTest(); | 8985 final __test = new CompileTimeErrorCodeTest(); |
| 6847 runJUnitTest(__test, __test.test_constEvalTypeInt_binary); | 8986 runJUnitTest(__test, __test.test_constEvalTypeInt_binary); |
| 6848 }); | 8987 }); |
| 6849 _ut.test('test_constEvalTypeNum_binary', () { | 8988 _ut.test('test_constEvalTypeNum_binary', () { |
| 6850 final __test = new CompileTimeErrorCodeTest(); | 8989 final __test = new CompileTimeErrorCodeTest(); |
| 6851 runJUnitTest(__test, __test.test_constEvalTypeNum_binary); | 8990 runJUnitTest(__test, __test.test_constEvalTypeNum_binary); |
| 6852 }); | 8991 }); |
| 8992 _ut.test('test_constEvalTypeNum_plus_String', () { |
| 8993 final __test = new CompileTimeErrorCodeTest(); |
| 8994 runJUnitTest(__test, __test.test_constEvalTypeNum_plus_String); |
| 8995 }); |
| 6853 _ut.test('test_constEval_newInstance_constConstructor', () { | 8996 _ut.test('test_constEval_newInstance_constConstructor', () { |
| 6854 final __test = new CompileTimeErrorCodeTest(); | 8997 final __test = new CompileTimeErrorCodeTest(); |
| 6855 runJUnitTest(__test, __test.test_constEval_newInstance_constConstructor)
; | 8998 runJUnitTest(__test, __test.test_constEval_newInstance_constConstructor)
; |
| 6856 }); | 8999 }); |
| 6857 _ut.test('test_constEval_propertyExtraction_methodInstance', () { | 9000 _ut.test('test_constEval_propertyExtraction_methodInstance', () { |
| 6858 final __test = new CompileTimeErrorCodeTest(); | 9001 final __test = new CompileTimeErrorCodeTest(); |
| 6859 runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodInst
ance); | 9002 runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodInst
ance); |
| 6860 }); | 9003 }); |
| 6861 _ut.test('test_constEval_propertyExtraction_methodStatic_targetInstance',
() { | 9004 _ut.test('test_constEval_propertyExtraction_methodStatic_targetInstance',
() { |
| 6862 final __test = new CompileTimeErrorCodeTest(); | 9005 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6995 runJUnitTest(__test, __test.test_exportInternalLibrary); | 9138 runJUnitTest(__test, __test.test_exportInternalLibrary); |
| 6996 }); | 9139 }); |
| 6997 _ut.test('test_exportOfNonLibrary', () { | 9140 _ut.test('test_exportOfNonLibrary', () { |
| 6998 final __test = new CompileTimeErrorCodeTest(); | 9141 final __test = new CompileTimeErrorCodeTest(); |
| 6999 runJUnitTest(__test, __test.test_exportOfNonLibrary); | 9142 runJUnitTest(__test, __test.test_exportOfNonLibrary); |
| 7000 }); | 9143 }); |
| 7001 _ut.test('test_extendsNonClass_class', () { | 9144 _ut.test('test_extendsNonClass_class', () { |
| 7002 final __test = new CompileTimeErrorCodeTest(); | 9145 final __test = new CompileTimeErrorCodeTest(); |
| 7003 runJUnitTest(__test, __test.test_extendsNonClass_class); | 9146 runJUnitTest(__test, __test.test_extendsNonClass_class); |
| 7004 }); | 9147 }); |
| 9148 _ut.test('test_extendsNonClass_dynamic', () { |
| 9149 final __test = new CompileTimeErrorCodeTest(); |
| 9150 runJUnitTest(__test, __test.test_extendsNonClass_dynamic); |
| 9151 }); |
| 7005 _ut.test('test_extendsOrImplementsDisallowedClass_extends_String', () { | 9152 _ut.test('test_extendsOrImplementsDisallowedClass_extends_String', () { |
| 7006 final __test = new CompileTimeErrorCodeTest(); | 9153 final __test = new CompileTimeErrorCodeTest(); |
| 7007 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_String); | 9154 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_String); |
| 7008 }); | 9155 }); |
| 7009 _ut.test('test_extendsOrImplementsDisallowedClass_extends_bool', () { | 9156 _ut.test('test_extendsOrImplementsDisallowedClass_extends_bool', () { |
| 7010 final __test = new CompileTimeErrorCodeTest(); | 9157 final __test = new CompileTimeErrorCodeTest(); |
| 7011 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_bool); | 9158 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_exte
nds_bool); |
| 7012 }); | 9159 }); |
| 7013 _ut.test('test_extendsOrImplementsDisallowedClass_extends_double', () { | 9160 _ut.test('test_extendsOrImplementsDisallowedClass_extends_double', () { |
| 7014 final __test = new CompileTimeErrorCodeTest(); | 9161 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 7039 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_int); | 9186 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_int); |
| 7040 }); | 9187 }); |
| 7041 _ut.test('test_extendsOrImplementsDisallowedClass_implements_num', () { | 9188 _ut.test('test_extendsOrImplementsDisallowedClass_implements_num', () { |
| 7042 final __test = new CompileTimeErrorCodeTest(); | 9189 final __test = new CompileTimeErrorCodeTest(); |
| 7043 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_num); | 9190 runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_impl
ements_num); |
| 7044 }); | 9191 }); |
| 7045 _ut.test('test_extraPositionalArguments_const', () { | 9192 _ut.test('test_extraPositionalArguments_const', () { |
| 7046 final __test = new CompileTimeErrorCodeTest(); | 9193 final __test = new CompileTimeErrorCodeTest(); |
| 7047 runJUnitTest(__test, __test.test_extraPositionalArguments_const); | 9194 runJUnitTest(__test, __test.test_extraPositionalArguments_const); |
| 7048 }); | 9195 }); |
| 9196 _ut.test('test_extraPositionalArguments_const_super', () { |
| 9197 final __test = new CompileTimeErrorCodeTest(); |
| 9198 runJUnitTest(__test, __test.test_extraPositionalArguments_const_super); |
| 9199 }); |
| 7049 _ut.test('test_fieldInitializedByMultipleInitializers', () { | 9200 _ut.test('test_fieldInitializedByMultipleInitializers', () { |
| 7050 final __test = new CompileTimeErrorCodeTest(); | 9201 final __test = new CompileTimeErrorCodeTest(); |
| 7051 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers)
; | 9202 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers)
; |
| 7052 }); | 9203 }); |
| 7053 _ut.test('test_fieldInitializedByMultipleInitializers_multipleInits', () { | 9204 _ut.test('test_fieldInitializedByMultipleInitializers_multipleInits', () { |
| 7054 final __test = new CompileTimeErrorCodeTest(); | 9205 final __test = new CompileTimeErrorCodeTest(); |
| 7055 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers_
multipleInits); | 9206 runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers_
multipleInits); |
| 7056 }); | 9207 }); |
| 7057 _ut.test('test_fieldInitializedByMultipleInitializers_multipleNames', () { | 9208 _ut.test('test_fieldInitializedByMultipleInitializers_multipleNames', () { |
| 7058 final __test = new CompileTimeErrorCodeTest(); | 9209 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7131 runJUnitTest(__test, __test.test_implementsNonClass_typedef); | 9282 runJUnitTest(__test, __test.test_implementsNonClass_typedef); |
| 7132 }); | 9283 }); |
| 7133 _ut.test('test_implementsRepeated', () { | 9284 _ut.test('test_implementsRepeated', () { |
| 7134 final __test = new CompileTimeErrorCodeTest(); | 9285 final __test = new CompileTimeErrorCodeTest(); |
| 7135 runJUnitTest(__test, __test.test_implementsRepeated); | 9286 runJUnitTest(__test, __test.test_implementsRepeated); |
| 7136 }); | 9287 }); |
| 7137 _ut.test('test_implementsRepeated_3times', () { | 9288 _ut.test('test_implementsRepeated_3times', () { |
| 7138 final __test = new CompileTimeErrorCodeTest(); | 9289 final __test = new CompileTimeErrorCodeTest(); |
| 7139 runJUnitTest(__test, __test.test_implementsRepeated_3times); | 9290 runJUnitTest(__test, __test.test_implementsRepeated_3times); |
| 7140 }); | 9291 }); |
| 9292 _ut.test('test_implementsSuperClass', () { |
| 9293 final __test = new CompileTimeErrorCodeTest(); |
| 9294 runJUnitTest(__test, __test.test_implementsSuperClass); |
| 9295 }); |
| 9296 _ut.test('test_implementsSuperClass_Object', () { |
| 9297 final __test = new CompileTimeErrorCodeTest(); |
| 9298 runJUnitTest(__test, __test.test_implementsSuperClass_Object); |
| 9299 }); |
| 7141 _ut.test('test_implicitThisReferenceInInitializer_field', () { | 9300 _ut.test('test_implicitThisReferenceInInitializer_field', () { |
| 7142 final __test = new CompileTimeErrorCodeTest(); | 9301 final __test = new CompileTimeErrorCodeTest(); |
| 7143 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_fiel
d); | 9302 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_fiel
d); |
| 7144 }); | 9303 }); |
| 7145 _ut.test('test_implicitThisReferenceInInitializer_field2', () { | 9304 _ut.test('test_implicitThisReferenceInInitializer_field2', () { |
| 7146 final __test = new CompileTimeErrorCodeTest(); | 9305 final __test = new CompileTimeErrorCodeTest(); |
| 7147 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_fiel
d2); | 9306 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_fiel
d2); |
| 7148 }); | 9307 }); |
| 7149 _ut.test('test_implicitThisReferenceInInitializer_invocation', () { | 9308 _ut.test('test_implicitThisReferenceInInitializer_invocation', () { |
| 7150 final __test = new CompileTimeErrorCodeTest(); | 9309 final __test = new CompileTimeErrorCodeTest(); |
| 7151 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_invo
cation); | 9310 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_invo
cation); |
| 7152 }); | 9311 }); |
| 9312 _ut.test('test_implicitThisReferenceInInitializer_invocationInStatic', ()
{ |
| 9313 final __test = new CompileTimeErrorCodeTest(); |
| 9314 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_invo
cationInStatic); |
| 9315 }); |
| 7153 _ut.test('test_implicitThisReferenceInInitializer_redirectingConstructorIn
vocation', () { | 9316 _ut.test('test_implicitThisReferenceInInitializer_redirectingConstructorIn
vocation', () { |
| 7154 final __test = new CompileTimeErrorCodeTest(); | 9317 final __test = new CompileTimeErrorCodeTest(); |
| 7155 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_redi
rectingConstructorInvocation); | 9318 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_redi
rectingConstructorInvocation); |
| 7156 }); | 9319 }); |
| 7157 _ut.test('test_implicitThisReferenceInInitializer_superConstructorInvocati
on', () { | 9320 _ut.test('test_implicitThisReferenceInInitializer_superConstructorInvocati
on', () { |
| 7158 final __test = new CompileTimeErrorCodeTest(); | 9321 final __test = new CompileTimeErrorCodeTest(); |
| 7159 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_supe
rConstructorInvocation); | 9322 runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_supe
rConstructorInvocation); |
| 7160 }); | 9323 }); |
| 7161 _ut.test('test_importInternalLibrary', () { | 9324 _ut.test('test_importInternalLibrary', () { |
| 7162 final __test = new CompileTimeErrorCodeTest(); | 9325 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7327 runJUnitTest(__test, __test.test_labelInOuterScope); | 9490 runJUnitTest(__test, __test.test_labelInOuterScope); |
| 7328 }); | 9491 }); |
| 7329 _ut.test('test_labelUndefined_break', () { | 9492 _ut.test('test_labelUndefined_break', () { |
| 7330 final __test = new CompileTimeErrorCodeTest(); | 9493 final __test = new CompileTimeErrorCodeTest(); |
| 7331 runJUnitTest(__test, __test.test_labelUndefined_break); | 9494 runJUnitTest(__test, __test.test_labelUndefined_break); |
| 7332 }); | 9495 }); |
| 7333 _ut.test('test_labelUndefined_continue', () { | 9496 _ut.test('test_labelUndefined_continue', () { |
| 7334 final __test = new CompileTimeErrorCodeTest(); | 9497 final __test = new CompileTimeErrorCodeTest(); |
| 7335 runJUnitTest(__test, __test.test_labelUndefined_continue); | 9498 runJUnitTest(__test, __test.test_labelUndefined_continue); |
| 7336 }); | 9499 }); |
| 9500 _ut.test('test_listElementTypeNotAssignable', () { |
| 9501 final __test = new CompileTimeErrorCodeTest(); |
| 9502 runJUnitTest(__test, __test.test_listElementTypeNotAssignable); |
| 9503 }); |
| 9504 _ut.test('test_mapKeyTypeNotAssignable', () { |
| 9505 final __test = new CompileTimeErrorCodeTest(); |
| 9506 runJUnitTest(__test, __test.test_mapKeyTypeNotAssignable); |
| 9507 }); |
| 9508 _ut.test('test_mapValueTypeNotAssignable', () { |
| 9509 final __test = new CompileTimeErrorCodeTest(); |
| 9510 runJUnitTest(__test, __test.test_mapValueTypeNotAssignable); |
| 9511 }); |
| 7337 _ut.test('test_memberWithClassName_field', () { | 9512 _ut.test('test_memberWithClassName_field', () { |
| 7338 final __test = new CompileTimeErrorCodeTest(); | 9513 final __test = new CompileTimeErrorCodeTest(); |
| 7339 runJUnitTest(__test, __test.test_memberWithClassName_field); | 9514 runJUnitTest(__test, __test.test_memberWithClassName_field); |
| 7340 }); | 9515 }); |
| 7341 _ut.test('test_memberWithClassName_field2', () { | 9516 _ut.test('test_memberWithClassName_field2', () { |
| 7342 final __test = new CompileTimeErrorCodeTest(); | 9517 final __test = new CompileTimeErrorCodeTest(); |
| 7343 runJUnitTest(__test, __test.test_memberWithClassName_field2); | 9518 runJUnitTest(__test, __test.test_memberWithClassName_field2); |
| 7344 }); | 9519 }); |
| 7345 _ut.test('test_memberWithClassName_getter', () { | 9520 _ut.test('test_memberWithClassName_getter', () { |
| 7346 final __test = new CompileTimeErrorCodeTest(); | 9521 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7535 runJUnitTest(__test, __test.test_nonGenerativeConstructor_implicit); | 9710 runJUnitTest(__test, __test.test_nonGenerativeConstructor_implicit); |
| 7536 }); | 9711 }); |
| 7537 _ut.test('test_nonGenerativeConstructor_implicit2', () { | 9712 _ut.test('test_nonGenerativeConstructor_implicit2', () { |
| 7538 final __test = new CompileTimeErrorCodeTest(); | 9713 final __test = new CompileTimeErrorCodeTest(); |
| 7539 runJUnitTest(__test, __test.test_nonGenerativeConstructor_implicit2); | 9714 runJUnitTest(__test, __test.test_nonGenerativeConstructor_implicit2); |
| 7540 }); | 9715 }); |
| 7541 _ut.test('test_notEnoughRequiredArguments_const', () { | 9716 _ut.test('test_notEnoughRequiredArguments_const', () { |
| 7542 final __test = new CompileTimeErrorCodeTest(); | 9717 final __test = new CompileTimeErrorCodeTest(); |
| 7543 runJUnitTest(__test, __test.test_notEnoughRequiredArguments_const); | 9718 runJUnitTest(__test, __test.test_notEnoughRequiredArguments_const); |
| 7544 }); | 9719 }); |
| 9720 _ut.test('test_notEnoughRequiredArguments_const_super', () { |
| 9721 final __test = new CompileTimeErrorCodeTest(); |
| 9722 runJUnitTest(__test, __test.test_notEnoughRequiredArguments_const_super)
; |
| 9723 }); |
| 7545 _ut.test('test_optionalParameterInOperator_named', () { | 9724 _ut.test('test_optionalParameterInOperator_named', () { |
| 7546 final __test = new CompileTimeErrorCodeTest(); | 9725 final __test = new CompileTimeErrorCodeTest(); |
| 7547 runJUnitTest(__test, __test.test_optionalParameterInOperator_named); | 9726 runJUnitTest(__test, __test.test_optionalParameterInOperator_named); |
| 7548 }); | 9727 }); |
| 7549 _ut.test('test_optionalParameterInOperator_positional', () { | 9728 _ut.test('test_optionalParameterInOperator_positional', () { |
| 7550 final __test = new CompileTimeErrorCodeTest(); | 9729 final __test = new CompileTimeErrorCodeTest(); |
| 7551 runJUnitTest(__test, __test.test_optionalParameterInOperator_positional)
; | 9730 runJUnitTest(__test, __test.test_optionalParameterInOperator_positional)
; |
| 7552 }); | 9731 }); |
| 7553 _ut.test('test_partOfNonPart', () { | 9732 _ut.test('test_partOfNonPart', () { |
| 7554 final __test = new CompileTimeErrorCodeTest(); | 9733 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7667 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_unqualifiedInvocation); | 9846 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_unqualifiedInvocation); |
| 7668 }); | 9847 }); |
| 7669 _ut.test('test_rethrowOutsideCatch', () { | 9848 _ut.test('test_rethrowOutsideCatch', () { |
| 7670 final __test = new CompileTimeErrorCodeTest(); | 9849 final __test = new CompileTimeErrorCodeTest(); |
| 7671 runJUnitTest(__test, __test.test_rethrowOutsideCatch); | 9850 runJUnitTest(__test, __test.test_rethrowOutsideCatch); |
| 7672 }); | 9851 }); |
| 7673 _ut.test('test_returnInGenerativeConstructor', () { | 9852 _ut.test('test_returnInGenerativeConstructor', () { |
| 7674 final __test = new CompileTimeErrorCodeTest(); | 9853 final __test = new CompileTimeErrorCodeTest(); |
| 7675 runJUnitTest(__test, __test.test_returnInGenerativeConstructor); | 9854 runJUnitTest(__test, __test.test_returnInGenerativeConstructor); |
| 7676 }); | 9855 }); |
| 9856 _ut.test('test_returnInGenerativeConstructor_expressionFunctionBody', () { |
| 9857 final __test = new CompileTimeErrorCodeTest(); |
| 9858 runJUnitTest(__test, __test.test_returnInGenerativeConstructor_expressio
nFunctionBody); |
| 9859 }); |
| 7677 _ut.test('test_superInInvalidContext_binaryExpression', () { | 9860 _ut.test('test_superInInvalidContext_binaryExpression', () { |
| 7678 final __test = new CompileTimeErrorCodeTest(); | 9861 final __test = new CompileTimeErrorCodeTest(); |
| 7679 runJUnitTest(__test, __test.test_superInInvalidContext_binaryExpression)
; | 9862 runJUnitTest(__test, __test.test_superInInvalidContext_binaryExpression)
; |
| 7680 }); | 9863 }); |
| 7681 _ut.test('test_superInInvalidContext_constructorFieldInitializer', () { | 9864 _ut.test('test_superInInvalidContext_constructorFieldInitializer', () { |
| 7682 final __test = new CompileTimeErrorCodeTest(); | 9865 final __test = new CompileTimeErrorCodeTest(); |
| 7683 runJUnitTest(__test, __test.test_superInInvalidContext_constructorFieldI
nitializer); | 9866 runJUnitTest(__test, __test.test_superInInvalidContext_constructorFieldI
nitializer); |
| 7684 }); | 9867 }); |
| 7685 _ut.test('test_superInInvalidContext_factoryConstructor', () { | 9868 _ut.test('test_superInInvalidContext_factoryConstructor', () { |
| 7686 final __test = new CompileTimeErrorCodeTest(); | 9869 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7962 } | 10145 } |
| 7963 return "<unknown file- ASTNode is null>"; | 10146 return "<unknown file- ASTNode is null>"; |
| 7964 } | 10147 } |
| 7965 } | 10148 } |
| 7966 /** | 10149 /** |
| 7967 * The class `StrictModeTest` contains tests to ensure that the correct errors a
nd warnings | 10150 * The class `StrictModeTest` contains tests to ensure that the correct errors a
nd warnings |
| 7968 * are reported when the analysis engine is run in strict mode. | 10151 * are reported when the analysis engine is run in strict mode. |
| 7969 */ | 10152 */ |
| 7970 class StrictModeTest extends ResolverTestCase { | 10153 class StrictModeTest extends ResolverTestCase { |
| 7971 void fail_for() { | 10154 void fail_for() { |
| 7972 Source source = addSource(EngineTestCase.createSource(["int f(List<int> list
) {", " num sum = 0;", " for (num i = 0; i < list.length; i++) {", " sum +=
list[i];", " }", "}"])); | 10155 Source source = addSource(EngineTestCase.createSource([ |
| 10156 "int f(List<int> list) {", |
| 10157 " num sum = 0;", |
| 10158 " for (num i = 0; i < list.length; i++) {", |
| 10159 " sum += list[i];", |
| 10160 " }", |
| 10161 "}"])); |
| 7973 resolve(source); | 10162 resolve(source); |
| 7974 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10163 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 7975 } | 10164 } |
| 7976 void setUp() { | 10165 void setUp() { |
| 7977 super.setUp(); | 10166 super.setUp(); |
| 7978 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 10167 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 7979 options.strictMode = true; | 10168 options.strictMode = true; |
| 7980 analysisContext.analysisOptions = options; | 10169 analysisContext.analysisOptions = options; |
| 7981 } | 10170 } |
| 7982 void test_assert_is() { | 10171 void test_assert_is() { |
| 7983 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
assert (n is int);", " return n & 0x0F;", "}"])); | 10172 Source source = addSource(EngineTestCase.createSource([ |
| 10173 "int f(num n) {", |
| 10174 " assert (n is int);", |
| 10175 " return n & 0x0F;", |
| 10176 "}"])); |
| 7984 resolve(source); | 10177 resolve(source); |
| 7985 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10178 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 7986 } | 10179 } |
| 7987 void test_conditional_and_is() { | 10180 void test_conditional_and_is() { |
| 7988 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
return (n is int && n > 0) ? n & 0x0F : 0;", "}"])); | 10181 Source source = addSource(EngineTestCase.createSource([ |
| 10182 "int f(num n) {", |
| 10183 " return (n is int && n > 0) ? n & 0x0F : 0;", |
| 10184 "}"])); |
| 7989 resolve(source); | 10185 resolve(source); |
| 7990 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10186 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 7991 } | 10187 } |
| 7992 void test_conditional_is() { | 10188 void test_conditional_is() { |
| 7993 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
return (n is int) ? n & 0x0F : 0;", "}"])); | 10189 Source source = addSource(EngineTestCase.createSource([ |
| 10190 "int f(num n) {", |
| 10191 " return (n is int) ? n & 0x0F : 0;", |
| 10192 "}"])); |
| 7994 resolve(source); | 10193 resolve(source); |
| 7995 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10194 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 7996 } | 10195 } |
| 7997 void test_conditional_isNot() { | 10196 void test_conditional_isNot() { |
| 7998 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
return (n is! int) ? 0 : n & 0x0F;", "}"])); | 10197 Source source = addSource(EngineTestCase.createSource([ |
| 10198 "int f(num n) {", |
| 10199 " return (n is! int) ? 0 : n & 0x0F;", |
| 10200 "}"])); |
| 7999 resolve(source); | 10201 resolve(source); |
| 8000 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10202 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8001 } | 10203 } |
| 8002 void test_conditional_or_is() { | 10204 void test_conditional_or_is() { |
| 8003 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
return (n is! int || n < 0) ? 0 : n & 0x0F;", "}"])); | 10205 Source source = addSource(EngineTestCase.createSource([ |
| 10206 "int f(num n) {", |
| 10207 " return (n is! int || n < 0) ? 0 : n & 0x0F;", |
| 10208 "}"])); |
| 8004 resolve(source); | 10209 resolve(source); |
| 8005 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10210 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8006 } | 10211 } |
| 8007 void test_forEach() { | 10212 void test_forEach() { |
| 8008 Source source = addSource(EngineTestCase.createSource(["int f(List<int> list
) {", " num sum = 0;", " for (num n in list) {", " sum += n & 0x0F;", " }"
, "}"])); | 10213 Source source = addSource(EngineTestCase.createSource([ |
| 10214 "int f(List<int> list) {", |
| 10215 " num sum = 0;", |
| 10216 " for (num n in list) {", |
| 10217 " sum += n & 0x0F;", |
| 10218 " }", |
| 10219 "}"])); |
| 8009 resolve(source); | 10220 resolve(source); |
| 8010 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10221 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8011 } | 10222 } |
| 8012 void test_if_and_is() { | 10223 void test_if_and_is() { |
| 8013 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
if (n is int && n > 0) {", " return n & 0x0F;", " }", " return 0;", "}"])); | 10224 Source source = addSource(EngineTestCase.createSource([ |
| 10225 "int f(num n) {", |
| 10226 " if (n is int && n > 0) {", |
| 10227 " return n & 0x0F;", |
| 10228 " }", |
| 10229 " return 0;", |
| 10230 "}"])); |
| 8014 resolve(source); | 10231 resolve(source); |
| 8015 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10232 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8016 } | 10233 } |
| 8017 void test_if_is() { | 10234 void test_if_is() { |
| 8018 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
if (n is int) {", " return n & 0x0F;", " }", " return 0;", "}"])); | 10235 Source source = addSource(EngineTestCase.createSource([ |
| 10236 "int f(num n) {", |
| 10237 " if (n is int) {", |
| 10238 " return n & 0x0F;", |
| 10239 " }", |
| 10240 " return 0;", |
| 10241 "}"])); |
| 8019 resolve(source); | 10242 resolve(source); |
| 8020 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10243 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8021 } | 10244 } |
| 8022 void test_if_isNot() { | 10245 void test_if_isNot() { |
| 8023 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
if (n is! int) {", " return 0;", " } else {", " return n & 0x0F;", " }",
"}"])); | 10246 Source source = addSource(EngineTestCase.createSource([ |
| 10247 "int f(num n) {", |
| 10248 " if (n is! int) {", |
| 10249 " return 0;", |
| 10250 " } else {", |
| 10251 " return n & 0x0F;", |
| 10252 " }", |
| 10253 "}"])); |
| 8024 resolve(source); | 10254 resolve(source); |
| 8025 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10255 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8026 } | 10256 } |
| 8027 void test_if_isNot_abrupt() { | 10257 void test_if_isNot_abrupt() { |
| 8028 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
if (n is! int) {", " return 0;", " }", " return n & 0x0F;", "}"])); | 10258 Source source = addSource(EngineTestCase.createSource([ |
| 10259 "int f(num n) {", |
| 10260 " if (n is! int) {", |
| 10261 " return 0;", |
| 10262 " }", |
| 10263 " return n & 0x0F;", |
| 10264 "}"])); |
| 8029 resolve(source); | 10265 resolve(source); |
| 8030 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10266 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8031 } | 10267 } |
| 8032 void test_if_or_is() { | 10268 void test_if_or_is() { |
| 8033 Source source = addSource(EngineTestCase.createSource(["int f(num n) {", "
if (n is! int || n < 0) {", " return 0;", " } else {", " return n & 0x0F;
", " }", "}"])); | 10269 Source source = addSource(EngineTestCase.createSource([ |
| 10270 "int f(num n) {", |
| 10271 " if (n is! int || n < 0) {", |
| 10272 " return 0;", |
| 10273 " } else {", |
| 10274 " return n & 0x0F;", |
| 10275 " }", |
| 10276 "}"])); |
| 8034 resolve(source); | 10277 resolve(source); |
| 8035 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10278 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8036 } | 10279 } |
| 8037 void test_localVar() { | 10280 void test_localVar() { |
| 8038 Source source = addSource(EngineTestCase.createSource(["int f() {", " num n
= 1234;", " return n & 0x0F;", "}"])); | 10281 Source source = addSource(EngineTestCase.createSource(["int f() {", " num n
= 1234;", " return n & 0x0F;", "}"])); |
| 8039 resolve(source); | 10282 resolve(source); |
| 8040 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 10283 assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 8041 } | 10284 } |
| 8042 static dartSuite() { | 10285 static dartSuite() { |
| 8043 _ut.group('StrictModeTest', () { | 10286 _ut.group('StrictModeTest', () { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8131 void fail_visitImportDirective_combinators_noPrefix() { | 10374 void fail_visitImportDirective_combinators_noPrefix() { |
| 8132 JUnitTestCase.fail("Not yet tested"); | 10375 JUnitTestCase.fail("Not yet tested"); |
| 8133 ImportDirective directive = ASTFactory.importDirective2(null, null, [ASTFact
ory.showCombinator2(["A"])]); | 10376 ImportDirective directive = ASTFactory.importDirective2(null, null, [ASTFact
ory.showCombinator2(["A"])]); |
| 8134 resolveNode(directive, []); | 10377 resolveNode(directive, []); |
| 8135 _listener.assertNoErrors(); | 10378 _listener.assertNoErrors(); |
| 8136 } | 10379 } |
| 8137 void fail_visitImportDirective_combinators_prefix() { | 10380 void fail_visitImportDirective_combinators_prefix() { |
| 8138 JUnitTestCase.fail("Not yet tested"); | 10381 JUnitTestCase.fail("Not yet tested"); |
| 8139 String prefixName = "p"; | 10382 String prefixName = "p"; |
| 8140 _definingLibrary.imports = <ImportElement> [ElementFactory.importFor(null, E
lementFactory.prefix(prefixName), [])]; | 10383 _definingLibrary.imports = <ImportElement> [ElementFactory.importFor(null, E
lementFactory.prefix(prefixName), [])]; |
| 8141 ImportDirective directive = ASTFactory.importDirective2(null, prefixName, [A
STFactory.showCombinator2(["A"]), ASTFactory.hideCombinator2(["B"])]); | 10384 ImportDirective directive = ASTFactory.importDirective2(null, prefixName, [ |
| 10385 ASTFactory.showCombinator2(["A"]), |
| 10386 ASTFactory.hideCombinator2(["B"])]); |
| 8142 resolveNode(directive, []); | 10387 resolveNode(directive, []); |
| 8143 _listener.assertNoErrors(); | 10388 _listener.assertNoErrors(); |
| 8144 } | 10389 } |
| 8145 void fail_visitRedirectingConstructorInvocation() { | 10390 void fail_visitRedirectingConstructorInvocation() { |
| 8146 JUnitTestCase.fail("Not yet tested"); | 10391 JUnitTestCase.fail("Not yet tested"); |
| 8147 _listener.assertNoErrors(); | 10392 _listener.assertNoErrors(); |
| 8148 } | 10393 } |
| 8149 void setUp() { | 10394 void setUp() { |
| 8150 _listener = new GatheringErrorListener(); | 10395 _listener = new GatheringErrorListener(); |
| 8151 _typeProvider = new TestTypeProvider(); | 10396 _typeProvider = new TestTypeProvider(); |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8885 } | 11130 } |
| 8886 class PubSuggestionCodeTest extends ResolverTestCase { | 11131 class PubSuggestionCodeTest extends ResolverTestCase { |
| 8887 void test_import_package() { | 11132 void test_import_package() { |
| 8888 Source source = addSource(EngineTestCase.createSource(["import 'package:some
package/other.dart';"])); | 11133 Source source = addSource(EngineTestCase.createSource(["import 'package:some
package/other.dart';"])); |
| 8889 resolve(source); | 11134 resolve(source); |
| 8890 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); | 11135 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]); |
| 8891 } | 11136 } |
| 8892 void test_import_packageWithDotDot() { | 11137 void test_import_packageWithDotDot() { |
| 8893 Source source = addSource(EngineTestCase.createSource(["import 'package:some
package/../other.dart';"])); | 11138 Source source = addSource(EngineTestCase.createSource(["import 'package:some
package/../other.dart';"])); |
| 8894 resolve(source); | 11139 resolve(source); |
| 8895 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST, PubSuggestionCode.PAC
KAGE_IMPORT_CONTAINS_DOT_DOT]); | 11140 assertErrors([ |
| 11141 CompileTimeErrorCode.URI_DOES_NOT_EXIST, |
| 11142 PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT]); |
| 8896 } | 11143 } |
| 8897 void test_import_packageWithLeadingDotDot() { | 11144 void test_import_packageWithLeadingDotDot() { |
| 8898 Source source = addSource(EngineTestCase.createSource(["import 'package:../o
ther.dart';"])); | 11145 Source source = addSource(EngineTestCase.createSource(["import 'package:../o
ther.dart';"])); |
| 8899 resolve(source); | 11146 resolve(source); |
| 8900 assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST, PubSuggestionCode.PAC
KAGE_IMPORT_CONTAINS_DOT_DOT]); | 11147 assertErrors([ |
| 11148 CompileTimeErrorCode.URI_DOES_NOT_EXIST, |
| 11149 PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT]); |
| 8901 } | 11150 } |
| 8902 void test_import_referenceIntoLibDirectory() { | 11151 void test_import_referenceIntoLibDirectory() { |
| 8903 cacheSource("/myproj/pubspec.yaml", ""); | 11152 cacheSource("/myproj/pubspec.yaml", ""); |
| 8904 cacheSource("/myproj/lib/other.dart", ""); | 11153 cacheSource("/myproj/lib/other.dart", ""); |
| 8905 Source source = addSource2("/myproj/web/test.dart", EngineTestCase.createSou
rce(["import '../lib/other.dart';"])); | 11154 Source source = addSource2("/myproj/web/test.dart", EngineTestCase.createSou
rce(["import '../lib/other.dart';"])); |
| 8906 resolve(source); | 11155 resolve(source); |
| 8907 assertErrors([PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSI
DE]); | 11156 assertErrors([PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSI
DE]); |
| 8908 } | 11157 } |
| 8909 void test_import_referenceIntoLibDirectory_no_pubspec() { | 11158 void test_import_referenceIntoLibDirectory_no_pubspec() { |
| 8910 cacheSource("/myproj/lib/other.dart", ""); | 11159 cacheSource("/myproj/lib/other.dart", ""); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8986 }); | 11235 }); |
| 8987 _ut.test('test_import_valid_outside_lib', () { | 11236 _ut.test('test_import_valid_outside_lib', () { |
| 8988 final __test = new PubSuggestionCodeTest(); | 11237 final __test = new PubSuggestionCodeTest(); |
| 8989 runJUnitTest(__test, __test.test_import_valid_outside_lib); | 11238 runJUnitTest(__test, __test.test_import_valid_outside_lib); |
| 8990 }); | 11239 }); |
| 8991 }); | 11240 }); |
| 8992 } | 11241 } |
| 8993 } | 11242 } |
| 8994 class StaticWarningCodeTest extends ResolverTestCase { | 11243 class StaticWarningCodeTest extends ResolverTestCase { |
| 8995 void fail_argumentTypeNotAssignable_invocation_functionParameter_generic() { | 11244 void fail_argumentTypeNotAssignable_invocation_functionParameter_generic() { |
| 8996 Source source = addSource(EngineTestCase.createSource(["class A<K, V> {", "
m(f(K k), V v) {", " f(v);", " }", "}"])); | 11245 Source source = addSource(EngineTestCase.createSource([ |
| 11246 "class A<K, V> {", |
| 11247 " m(f(K k), V v) {", |
| 11248 " f(v);", |
| 11249 " }", |
| 11250 "}"])); |
| 8997 resolve(source); | 11251 resolve(source); |
| 8998 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11252 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 8999 verify([source]); | 11253 verify([source]); |
| 9000 } | 11254 } |
| 9001 void fail_commentReferenceConstructorNotVisible() { | 11255 void fail_commentReferenceConstructorNotVisible() { |
| 9002 Source source = addSource(EngineTestCase.createSource([])); | 11256 Source source = addSource(EngineTestCase.createSource([])); |
| 9003 resolve(source); | 11257 resolve(source); |
| 9004 assertErrors([StaticWarningCode.COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE]); | 11258 assertErrors([StaticWarningCode.COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE]); |
| 9005 verify([source]); | 11259 verify([source]); |
| 9006 } | 11260 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 9021 resolve(source); | 11275 resolve(source); |
| 9022 assertErrors([StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_IDENTIFIER]); | 11276 assertErrors([StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_IDENTIFIER]); |
| 9023 verify([source]); | 11277 verify([source]); |
| 9024 } | 11278 } |
| 9025 void fail_commentReferenceUriNotLibrary() { | 11279 void fail_commentReferenceUriNotLibrary() { |
| 9026 Source source = addSource(EngineTestCase.createSource([])); | 11280 Source source = addSource(EngineTestCase.createSource([])); |
| 9027 resolve(source); | 11281 resolve(source); |
| 9028 assertErrors([StaticWarningCode.COMMENT_REFERENCE_URI_NOT_LIBRARY]); | 11282 assertErrors([StaticWarningCode.COMMENT_REFERENCE_URI_NOT_LIBRARY]); |
| 9029 verify([source]); | 11283 verify([source]); |
| 9030 } | 11284 } |
| 9031 void fail_finalNotInitialized_inConstructor() { | |
| 9032 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() {}", "}"])); | |
| 9033 resolve(source); | |
| 9034 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); | |
| 9035 verify([source]); | |
| 9036 } | |
| 9037 void fail_invalidFactoryName() { | 11285 void fail_invalidFactoryName() { |
| 9038 Source source = addSource(EngineTestCase.createSource([])); | 11286 Source source = addSource(EngineTestCase.createSource([])); |
| 9039 resolve(source); | 11287 resolve(source); |
| 9040 assertErrors([StaticWarningCode.INVALID_FACTORY_NAME]); | 11288 assertErrors([StaticWarningCode.INVALID_FACTORY_NAME]); |
| 9041 verify([source]); | 11289 verify([source]); |
| 9042 } | 11290 } |
| 9043 void fail_invocationOfNonFunction() { | 11291 void fail_invocationOfNonFunction() { |
| 9044 Source source = addSource(EngineTestCase.createSource([])); | 11292 Source source = addSource(EngineTestCase.createSource([])); |
| 9045 resolve(source); | 11293 resolve(source); |
| 9046 assertErrors([StaticWarningCode.INVOCATION_OF_NON_FUNCTION]); | 11294 assertErrors([StaticWarningCode.INVOCATION_OF_NON_FUNCTION]); |
| 9047 verify([source]); | 11295 verify([source]); |
| 9048 } | 11296 } |
| 9049 void fail_mismatchedAccessorTypes_getterAndSuperSetter() { | 11297 void fail_mismatchedAccessorTypes_getterAndSuperSetter() { |
| 9050 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et g { return 0; }", " set g(int v) {}", "}", "class B extends A {", " set g(S
tring v) {}", "}"])); | 11298 Source source = addSource(EngineTestCase.createSource([ |
| 11299 "class A {", |
| 11300 " int get g { return 0; }", |
| 11301 " set g(int v) {}", |
| 11302 "}", |
| 11303 "class B extends A {", |
| 11304 " set g(String v) {}", |
| 11305 "}"])); |
| 9051 resolve(source); | 11306 resolve(source); |
| 9052 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); | 11307 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); |
| 9053 verify([source]); | 11308 verify([source]); |
| 9054 } | 11309 } |
| 9055 void fail_mismatchedAccessorTypes_superGetterAndSetter() { | 11310 void fail_mismatchedAccessorTypes_superGetterAndSetter() { |
| 9056 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et g { return 0; }", " set g(int v) {}", "}", "class B extends A {", " String
get g { return ''; }", "}"])); | 11311 Source source = addSource(EngineTestCase.createSource([ |
| 11312 "class A {", |
| 11313 " int get g { return 0; }", |
| 11314 " set g(int v) {}", |
| 11315 "}", |
| 11316 "class B extends A {", |
| 11317 " String get g { return ''; }", |
| 11318 "}"])); |
| 9057 resolve(source); | 11319 resolve(source); |
| 9058 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); | 11320 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); |
| 9059 verify([source]); | 11321 verify([source]); |
| 9060 } | 11322 } |
| 9061 void fail_undefinedGetter() { | 11323 void fail_undefinedGetter() { |
| 9062 Source source = addSource(EngineTestCase.createSource([])); | 11324 Source source = addSource(EngineTestCase.createSource([])); |
| 9063 resolve(source); | 11325 resolve(source); |
| 9064 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); | 11326 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); |
| 9065 verify([source]); | 11327 verify([source]); |
| 9066 } | 11328 } |
| 9067 void fail_undefinedIdentifier_commentReference() { | 11329 void fail_undefinedIdentifier_commentReference() { |
| 9068 Source source = addSource(EngineTestCase.createSource(["/** [m] xxx [new B.c
] */", "class A {", "}"])); | 11330 Source source = addSource(EngineTestCase.createSource(["/** [m] xxx [new B.c
] */", "class A {", "}"])); |
| 9069 resolve(source); | 11331 resolve(source); |
| 9070 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER, StaticWarningCode.UNDE
FINED_IDENTIFIER]); | 11332 assertErrors([ |
| 11333 StaticWarningCode.UNDEFINED_IDENTIFIER, |
| 11334 StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 9071 } | 11335 } |
| 9072 void fail_undefinedIdentifier_function() { | 11336 void fail_undefinedIdentifier_function() { |
| 9073 Source source = addSource(EngineTestCase.createSource(["int a() => b;"])); | 11337 Source source = addSource(EngineTestCase.createSource(["int a() => b;"])); |
| 9074 resolve(source); | 11338 resolve(source); |
| 9075 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 11339 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 9076 verify([source]); | 11340 verify([source]); |
| 9077 } | 11341 } |
| 9078 void fail_undefinedSetter() { | 11342 void fail_undefinedSetter() { |
| 9079 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " C.m = 0;", "}"])); | 11343 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " C.m = 0;", "}"])); |
| 9080 resolve(source); | 11344 resolve(source); |
| 9081 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); | 11345 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); |
| 9082 verify([source]); | 11346 verify([source]); |
| 9083 } | 11347 } |
| 9084 void fail_undefinedStaticMethodOrGetter_getter() { | 11348 void fail_undefinedStaticMethodOrGetter_getter() { |
| 9085 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m);", "}"])); | 11349 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m);", "}"])); |
| 9086 resolve(source); | 11350 resolve(source); |
| 9087 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | 11351 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 9088 verify([source]); | 11352 verify([source]); |
| 9089 } | 11353 } |
| 9090 void fail_undefinedStaticMethodOrGetter_method() { | 11354 void fail_undefinedStaticMethodOrGetter_method() { |
| 9091 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m());", "}"])); | 11355 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m());", "}"])); |
| 9092 resolve(source); | 11356 resolve(source); |
| 9093 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | 11357 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 9094 verify([source]); | 11358 verify([source]); |
| 9095 } | 11359 } |
| 9096 void test_ambiguousImport_typeAnnotation() { | 11360 void test_ambiguousImport_typeAnnotation() { |
| 9097 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "typedef N FT(N p);", "N f(N p) {", " N v;", "}", "cla
ss A {", " N m() {}", "}", "class B<T extends N> {}"])); | 11361 Source source = addSource(EngineTestCase.createSource([ |
| 11362 "import 'lib1.dart';", |
| 11363 "import 'lib2.dart';", |
| 11364 "typedef N FT(N p);", |
| 11365 "N f(N p) {", |
| 11366 " N v;", |
| 11367 "}", |
| 11368 "class A {", |
| 11369 " N m() {}", |
| 11370 "}", |
| 11371 "class B<T extends N> {}"])); |
| 9098 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 11372 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 9099 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 11373 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 9100 resolve(source); | 11374 resolve(source); |
| 9101 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT, StaticWarningCode.AMBIGUOU
S_IMPORT, StaticWarningCode.AMBIGUOUS_IMPORT, StaticWarningCode.AMBIGUOUS_IMPORT
, StaticWarningCode.AMBIGUOUS_IMPORT, StaticWarningCode.AMBIGUOUS_IMPORT, Static
WarningCode.AMBIGUOUS_IMPORT]); | 11375 assertErrors([ |
| 11376 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11377 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11378 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11379 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11380 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11381 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11382 StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 9102 } | 11383 } |
| 9103 void test_ambiguousImport_typeArgument_annotation() { | 11384 void test_ambiguousImport_typeArgument_annotation() { |
| 9104 Source source = addSource(EngineTestCase.createSource(["import 'lib1.dart';"
, "import 'lib2.dart';", "class A<T> {}", "A<N> f() {}"])); | 11385 Source source = addSource(EngineTestCase.createSource([ |
| 11386 "import 'lib1.dart';", |
| 11387 "import 'lib2.dart';", |
| 11388 "class A<T> {}", |
| 11389 "A<N> f() {}"])); |
| 9105 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 11390 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 9106 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 11391 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 9107 resolve(source); | 11392 resolve(source); |
| 9108 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); | 11393 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 9109 } | 11394 } |
| 9110 void test_argumentTypeNotAssignable_annotation_namedConstructor() { | 11395 void test_argumentTypeNotAssignable_annotation_namedConstructor() { |
| 9111 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A.fromInt(int p);", "}", "@A.fromInt('0')", "main() {", "}"])); | 11396 Source source = addSource(EngineTestCase.createSource([ |
| 11397 "class A {", |
| 11398 " const A.fromInt(int p);", |
| 11399 "}", |
| 11400 "@A.fromInt('0')", |
| 11401 "main() {", |
| 11402 "}"])); |
| 9112 resolve(source); | 11403 resolve(source); |
| 9113 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11404 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9114 verify([source]); | 11405 verify([source]); |
| 9115 } | 11406 } |
| 9116 void test_argumentTypeNotAssignable_annotation_unnamedConstructor() { | 11407 void test_argumentTypeNotAssignable_annotation_unnamedConstructor() { |
| 9117 Source source = addSource(EngineTestCase.createSource(["class A {", " const
A(int p);", "}", "@A('0')", "main() {", "}"])); | 11408 Source source = addSource(EngineTestCase.createSource([ |
| 11409 "class A {", |
| 11410 " const A(int p);", |
| 11411 "}", |
| 11412 "@A('0')", |
| 11413 "main() {", |
| 11414 "}"])); |
| 9118 resolve(source); | 11415 resolve(source); |
| 9119 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11416 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9120 verify([source]); | 11417 verify([source]); |
| 9121 } | 11418 } |
| 9122 void test_argumentTypeNotAssignable_binary() { | 11419 void test_argumentTypeNotAssignable_binary() { |
| 9123 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(int p) {}", "}", "f(A a) {", " a + '0';", "}"])); | 11420 Source source = addSource(EngineTestCase.createSource([ |
| 11421 "class A {", |
| 11422 " operator +(int p) {}", |
| 11423 "}", |
| 11424 "f(A a) {", |
| 11425 " a + '0';", |
| 11426 "}"])); |
| 9124 resolve(source); | 11427 resolve(source); |
| 9125 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11428 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9126 verify([source]); | 11429 verify([source]); |
| 9127 } | 11430 } |
| 9128 void test_argumentTypeNotAssignable_index() { | 11431 void test_argumentTypeNotAssignable_index() { |
| 9129 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor [](int index) {}", "}", "f(A a) {", " a['0'];", "}"])); | 11432 Source source = addSource(EngineTestCase.createSource([ |
| 11433 "class A {", |
| 11434 " operator [](int index) {}", |
| 11435 "}", |
| 11436 "f(A a) {", |
| 11437 " a['0'];", |
| 11438 "}"])); |
| 9130 resolve(source); | 11439 resolve(source); |
| 9131 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11440 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9132 verify([source]); | 11441 verify([source]); |
| 9133 } | 11442 } |
| 9134 void test_argumentTypeNotAssignable_invocation_callParameter() { | 11443 void test_argumentTypeNotAssignable_invocation_callParameter() { |
| 9135 Source source = addSource(EngineTestCase.createSource(["class A {", " call(
int p) {}", "}", "f(A a) {", " a('0');", "}"])); | 11444 Source source = addSource(EngineTestCase.createSource([ |
| 11445 "class A {", |
| 11446 " call(int p) {}", |
| 11447 "}", |
| 11448 "f(A a) {", |
| 11449 " a('0');", |
| 11450 "}"])); |
| 9136 resolve(source); | 11451 resolve(source); |
| 9137 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11452 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9138 verify([source]); | 11453 verify([source]); |
| 9139 } | 11454 } |
| 9140 void test_argumentTypeNotAssignable_invocation_callVariable() { | 11455 void test_argumentTypeNotAssignable_invocation_callVariable() { |
| 9141 Source source = addSource(EngineTestCase.createSource(["class A {", " call(
int p) {}", "}", "main() {", " A a = new A();", " a('0');", "}"])); | 11456 Source source = addSource(EngineTestCase.createSource([ |
| 11457 "class A {", |
| 11458 " call(int p) {}", |
| 11459 "}", |
| 11460 "main() {", |
| 11461 " A a = new A();", |
| 11462 " a('0');", |
| 11463 "}"])); |
| 9142 resolve(source); | 11464 resolve(source); |
| 9143 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11465 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9144 verify([source]); | 11466 verify([source]); |
| 9145 } | 11467 } |
| 9146 void test_argumentTypeNotAssignable_invocation_functionParameter() { | 11468 void test_argumentTypeNotAssignable_invocation_functionParameter() { |
| 9147 Source source = addSource(EngineTestCase.createSource(["a(b(int p)) {", " b
('0');", "}"])); | 11469 Source source = addSource(EngineTestCase.createSource(["a(b(int p)) {", " b
('0');", "}"])); |
| 9148 resolve(source); | 11470 resolve(source); |
| 9149 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11471 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9150 verify([source]); | 11472 verify([source]); |
| 9151 } | 11473 } |
| 9152 void test_argumentTypeNotAssignable_invocation_generic() { | 11474 void test_argumentTypeNotAssignable_invocation_generic() { |
| 9153 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " m(
T t) {}", "}", "f(A<String> a) {", " a.m(1);", "}"])); | 11475 Source source = addSource(EngineTestCase.createSource([ |
| 11476 "class A<T> {", |
| 11477 " m(T t) {}", |
| 11478 "}", |
| 11479 "f(A<String> a) {", |
| 11480 " a.m(1);", |
| 11481 "}"])); |
| 9154 resolve(source); | 11482 resolve(source); |
| 9155 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11483 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9156 verify([source]); | 11484 verify([source]); |
| 9157 } | 11485 } |
| 9158 void test_argumentTypeNotAssignable_invocation_named() { | 11486 void test_argumentTypeNotAssignable_invocation_named() { |
| 9159 Source source = addSource(EngineTestCase.createSource(["f({String p}) {}", "
main() {", " f(p: 42);", "}"])); | 11487 Source source = addSource(EngineTestCase.createSource(["f({String p}) {}", "
main() {", " f(p: 42);", "}"])); |
| 9160 resolve(source); | 11488 resolve(source); |
| 9161 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11489 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9162 verify([source]); | 11490 verify([source]); |
| 9163 } | 11491 } |
| 9164 void test_argumentTypeNotAssignable_invocation_optional() { | 11492 void test_argumentTypeNotAssignable_invocation_optional() { |
| 9165 Source source = addSource(EngineTestCase.createSource(["f([String p]) {}", "
main() {", " f(42);", "}"])); | 11493 Source source = addSource(EngineTestCase.createSource(["f([String p]) {}", "
main() {", " f(42);", "}"])); |
| 9166 resolve(source); | 11494 resolve(source); |
| 9167 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11495 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9168 verify([source]); | 11496 verify([source]); |
| 9169 } | 11497 } |
| 9170 void test_argumentTypeNotAssignable_invocation_required() { | 11498 void test_argumentTypeNotAssignable_invocation_required() { |
| 9171 Source source = addSource(EngineTestCase.createSource(["f(String p) {}", "ma
in() {", " f(42);", "}"])); | 11499 Source source = addSource(EngineTestCase.createSource(["f(String p) {}", "ma
in() {", " f(42);", "}"])); |
| 9172 resolve(source); | 11500 resolve(source); |
| 9173 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11501 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9174 verify([source]); | 11502 verify([source]); |
| 9175 } | 11503 } |
| 9176 void test_argumentTypeNotAssignable_invocation_typedef_generic() { | 11504 void test_argumentTypeNotAssignable_invocation_typedef_generic() { |
| 9177 Source source = addSource(EngineTestCase.createSource(["typedef A<T>(T p);",
"f(A<int> a) {", " a('1');", "}"])); | 11505 Source source = addSource(EngineTestCase.createSource(["typedef A<T>(T p);",
"f(A<int> a) {", " a('1');", "}"])); |
| 9178 resolve(source); | 11506 resolve(source); |
| 9179 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11507 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9180 verify([source]); | 11508 verify([source]); |
| 9181 } | 11509 } |
| 9182 void test_argumentTypeNotAssignable_invocation_typedef_local() { | 11510 void test_argumentTypeNotAssignable_invocation_typedef_local() { |
| 9183 Source source = addSource(EngineTestCase.createSource(["typedef A(int p);",
"A getA() => null;", "main() {", " A a = getA();", " a('1');", "}"])); | 11511 Source source = addSource(EngineTestCase.createSource([ |
| 11512 "typedef A(int p);", |
| 11513 "A getA() => null;", |
| 11514 "main() {", |
| 11515 " A a = getA();", |
| 11516 " a('1');", |
| 11517 "}"])); |
| 9184 resolve(source); | 11518 resolve(source); |
| 9185 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11519 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9186 verify([source]); | 11520 verify([source]); |
| 9187 } | 11521 } |
| 9188 void test_argumentTypeNotAssignable_invocation_typedef_parameter() { | 11522 void test_argumentTypeNotAssignable_invocation_typedef_parameter() { |
| 9189 Source source = addSource(EngineTestCase.createSource(["typedef A(int p);",
"f(A a) {", " a('1');", "}"])); | 11523 Source source = addSource(EngineTestCase.createSource(["typedef A(int p);",
"f(A a) {", " a('1');", "}"])); |
| 9190 resolve(source); | 11524 resolve(source); |
| 9191 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11525 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9192 verify([source]); | 11526 verify([source]); |
| 9193 } | 11527 } |
| 9194 void test_argumentTypeNotAssignable_new_generic() { | 11528 void test_argumentTypeNotAssignable_new_generic() { |
| 9195 Source source = addSource(EngineTestCase.createSource(["class A<T> {", " A(
T p) {}", "}", "main() {", " new A<String>(42);", "}"])); | 11529 Source source = addSource(EngineTestCase.createSource([ |
| 11530 "class A<T> {", |
| 11531 " A(T p) {}", |
| 11532 "}", |
| 11533 "main() {", |
| 11534 " new A<String>(42);", |
| 11535 "}"])); |
| 9196 resolve(source); | 11536 resolve(source); |
| 9197 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11537 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9198 verify([source]); | 11538 verify([source]); |
| 9199 } | 11539 } |
| 9200 void test_argumentTypeNotAssignable_new_optional() { | 11540 void test_argumentTypeNotAssignable_new_optional() { |
| 9201 Source source = addSource(EngineTestCase.createSource(["class A {", " A([St
ring p]) {}", "}", "main() {", " new A(42);", "}"])); | 11541 Source source = addSource(EngineTestCase.createSource([ |
| 11542 "class A {", |
| 11543 " A([String p]) {}", |
| 11544 "}", |
| 11545 "main() {", |
| 11546 " new A(42);", |
| 11547 "}"])); |
| 9202 resolve(source); | 11548 resolve(source); |
| 9203 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11549 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9204 verify([source]); | 11550 verify([source]); |
| 9205 } | 11551 } |
| 9206 void test_argumentTypeNotAssignable_new_required() { | 11552 void test_argumentTypeNotAssignable_new_required() { |
| 9207 Source source = addSource(EngineTestCase.createSource(["class A {", " A(Str
ing p) {}", "}", "main() {", " new A(42);", "}"])); | 11553 Source source = addSource(EngineTestCase.createSource([ |
| 11554 "class A {", |
| 11555 " A(String p) {}", |
| 11556 "}", |
| 11557 "main() {", |
| 11558 " new A(42);", |
| 11559 "}"])); |
| 9208 resolve(source); | 11560 resolve(source); |
| 9209 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11561 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 9210 verify([source]); | 11562 verify([source]); |
| 9211 } | 11563 } |
| 9212 void test_assignmentToFinal_instanceVariable() { | 11564 void test_assignmentToFinal_instanceVariable() { |
| 9213 Source source = addSource(EngineTestCase.createSource(["class A {", " final
v = 0;", "}", "f() {", " A a = new A();", " a.v = 1;", "}"])); | 11565 Source source = addSource(EngineTestCase.createSource([ |
| 11566 "class A {", |
| 11567 " final v = 0;", |
| 11568 "}", |
| 11569 "f() {", |
| 11570 " A a = new A();", |
| 11571 " a.v = 1;", |
| 11572 "}"])); |
| 9214 resolve(source); | 11573 resolve(source); |
| 9215 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11574 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9216 verify([source]); | 11575 verify([source]); |
| 9217 } | 11576 } |
| 9218 void test_assignmentToFinal_localVariable() { | 11577 void test_assignmentToFinal_localVariable() { |
| 9219 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " x = 1;", "}"])); | 11578 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " x = 1;", "}"])); |
| 9220 resolve(source); | 11579 resolve(source); |
| 9221 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11580 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9222 verify([source]); | 11581 verify([source]); |
| 9223 } | 11582 } |
| 9224 void test_assignmentToFinal_prefixMinusMinus() { | 11583 void test_assignmentToFinal_prefixMinusMinus() { |
| 9225 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " --x;", "}"])); | 11584 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " --x;", "}"])); |
| 9226 resolve(source); | 11585 resolve(source); |
| 9227 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11586 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9228 verify([source]); | 11587 verify([source]); |
| 9229 } | 11588 } |
| 9230 void test_assignmentToFinal_prefixPlusPlus() { | 11589 void test_assignmentToFinal_prefixPlusPlus() { |
| 9231 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " ++x;", "}"])); | 11590 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " ++x;", "}"])); |
| 9232 resolve(source); | 11591 resolve(source); |
| 9233 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11592 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9234 verify([source]); | 11593 verify([source]); |
| 9235 } | 11594 } |
| 9236 void test_assignmentToFinal_propertyAccess() { | 11595 void test_assignmentToFinal_propertyAccess() { |
| 9237 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et x => 0;", "}", "class B {", " static A a;", "}", "main() {", " B.a.x = 0;",
"}"])); | 11596 Source source = addSource(EngineTestCase.createSource([ |
| 11597 "class A {", |
| 11598 " int get x => 0;", |
| 11599 "}", |
| 11600 "class B {", |
| 11601 " static A a;", |
| 11602 "}", |
| 11603 "main() {", |
| 11604 " B.a.x = 0;", |
| 11605 "}"])); |
| 9238 resolve(source); | 11606 resolve(source); |
| 9239 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11607 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9240 verify([source]); | 11608 verify([source]); |
| 9241 } | 11609 } |
| 9242 void test_assignmentToFinal_suffixMinusMinus() { | 11610 void test_assignmentToFinal_suffixMinusMinus() { |
| 9243 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " x--;", "}"])); | 11611 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " x--;", "}"])); |
| 9244 resolve(source); | 11612 resolve(source); |
| 9245 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11613 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9246 verify([source]); | 11614 verify([source]); |
| 9247 } | 11615 } |
| 9248 void test_assignmentToFinal_suffixPlusPlus() { | 11616 void test_assignmentToFinal_suffixPlusPlus() { |
| 9249 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " x++;", "}"])); | 11617 Source source = addSource(EngineTestCase.createSource(["f() {", " final x =
0;", " x++;", "}"])); |
| 9250 resolve(source); | 11618 resolve(source); |
| 9251 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11619 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9252 verify([source]); | 11620 verify([source]); |
| 9253 } | 11621 } |
| 9254 void test_assignmentToFinal_topLevelVariable() { | 11622 void test_assignmentToFinal_topLevelVariable() { |
| 9255 Source source = addSource(EngineTestCase.createSource(["final x = 0;", "f()
{ x = 1; }"])); | 11623 Source source = addSource(EngineTestCase.createSource(["final x = 0;", "f()
{ x = 1; }"])); |
| 9256 resolve(source); | 11624 resolve(source); |
| 9257 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); | 11625 assertErrors([StaticWarningCode.ASSIGNMENT_TO_FINAL]); |
| 9258 verify([source]); | 11626 verify([source]); |
| 9259 } | 11627 } |
| 11628 void test_assignmentToMethod() { |
| 11629 Source source = addSource(EngineTestCase.createSource([ |
| 11630 "class A {", |
| 11631 " m() {}", |
| 11632 "}", |
| 11633 "f(A a) {", |
| 11634 " a.m = () {};", |
| 11635 "}"])); |
| 11636 resolve(source); |
| 11637 assertErrors([StaticWarningCode.ASSIGNMENT_TO_METHOD]); |
| 11638 verify([source]); |
| 11639 } |
| 9260 void test_caseBlockNotTerminated() { | 11640 void test_caseBlockNotTerminated() { |
| 9261 Source source = addSource(EngineTestCase.createSource(["f(int p) {", " swit
ch (p) {", " case 0:", " f(p);", " case 1:", " break;", " }", "
}"])); | 11641 Source source = addSource(EngineTestCase.createSource([ |
| 11642 "f(int p) {", |
| 11643 " switch (p) {", |
| 11644 " case 0:", |
| 11645 " f(p);", |
| 11646 " case 1:", |
| 11647 " break;", |
| 11648 " }", |
| 11649 "}"])); |
| 9262 resolve(source); | 11650 resolve(source); |
| 9263 assertErrors([StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]); | 11651 assertErrors([StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]); |
| 9264 verify([source]); | 11652 verify([source]); |
| 9265 } | 11653 } |
| 9266 void test_castToNonType() { | 11654 void test_castToNonType() { |
| 9267 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(Stri
ng s) { var x = s as A; }"])); | 11655 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(Stri
ng s) { var x = s as A; }"])); |
| 9268 resolve(source); | 11656 resolve(source); |
| 9269 assertErrors([StaticWarningCode.CAST_TO_NON_TYPE]); | 11657 assertErrors([StaticWarningCode.CAST_TO_NON_TYPE]); |
| 9270 verify([source]); | 11658 verify([source]); |
| 9271 } | 11659 } |
| 9272 void test_concreteClassWithAbstractMember() { | 11660 void test_concreteClassWithAbstractMember() { |
| 9273 Source source = addSource(EngineTestCase.createSource(["class A {", " m();"
, "}"])); | 11661 Source source = addSource(EngineTestCase.createSource(["class A {", " m();"
, "}"])); |
| 9274 resolve(source); | 11662 resolve(source); |
| 9275 assertErrors([StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER]); | 11663 assertErrors([StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER]); |
| 9276 verify([source]); | 11664 verify([source]); |
| 9277 } | 11665 } |
| 9278 void test_conflictingInstanceGetterAndSuperclassMember_direct_field() { | 11666 void test_conflictingInstanceGetterAndSuperclassMember_direct_field() { |
| 9279 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int v;", "}", "class B extends A {", " get v => 0;", "}"])); | 11667 Source source = addSource(EngineTestCase.createSource([ |
| 11668 "class A {", |
| 11669 " static int v;", |
| 11670 "}", |
| 11671 "class B extends A {", |
| 11672 " get v => 0;", |
| 11673 "}"])); |
| 9280 resolve(source); | 11674 resolve(source); |
| 9281 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); | 11675 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); |
| 9282 verify([source]); | 11676 verify([source]); |
| 9283 } | 11677 } |
| 9284 void test_conflictingInstanceGetterAndSuperclassMember_direct_getter() { | 11678 void test_conflictingInstanceGetterAndSuperclassMember_direct_getter() { |
| 9285 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c get v => 0;", "}", "class B extends A {", " get v => 0;", "}"])); | 11679 Source source = addSource(EngineTestCase.createSource([ |
| 11680 "class A {", |
| 11681 " static get v => 0;", |
| 11682 "}", |
| 11683 "class B extends A {", |
| 11684 " get v => 0;", |
| 11685 "}"])); |
| 9286 resolve(source); | 11686 resolve(source); |
| 9287 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); | 11687 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); |
| 9288 verify([source]); | 11688 verify([source]); |
| 9289 } | 11689 } |
| 9290 void test_conflictingInstanceGetterAndSuperclassMember_direct_method() { | 11690 void test_conflictingInstanceGetterAndSuperclassMember_direct_method() { |
| 9291 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c v() {}", "}", "class B extends A {", " get v => 0;", "}"])); | 11691 Source source = addSource(EngineTestCase.createSource([ |
| 11692 "class A {", |
| 11693 " static v() {}", |
| 11694 "}", |
| 11695 "class B extends A {", |
| 11696 " get v => 0;", |
| 11697 "}"])); |
| 9292 resolve(source); | 11698 resolve(source); |
| 9293 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); | 11699 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); |
| 9294 verify([source]); | 11700 verify([source]); |
| 9295 } | 11701 } |
| 9296 void test_conflictingInstanceGetterAndSuperclassMember_direct_setter() { | 11702 void test_conflictingInstanceGetterAndSuperclassMember_direct_setter() { |
| 9297 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c set v(x) {}", "}", "class B extends A {", " get v => 0;", "}"])); | 11703 Source source = addSource(EngineTestCase.createSource([ |
| 11704 "class A {", |
| 11705 " static set v(x) {}", |
| 11706 "}", |
| 11707 "class B extends A {", |
| 11708 " get v => 0;", |
| 11709 "}"])); |
| 9298 resolve(source); | 11710 resolve(source); |
| 9299 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); | 11711 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); |
| 9300 verify([source]); | 11712 verify([source]); |
| 9301 } | 11713 } |
| 9302 void test_conflictingInstanceGetterAndSuperclassMember_indirect() { | 11714 void test_conflictingInstanceGetterAndSuperclassMember_indirect() { |
| 9303 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int v;", "}", "class B extends A {}", "class C extends B {", " get v => 0;",
"}"])); | 11715 Source source = addSource(EngineTestCase.createSource([ |
| 11716 "class A {", |
| 11717 " static int v;", |
| 11718 "}", |
| 11719 "class B extends A {}", |
| 11720 "class C extends B {", |
| 11721 " get v => 0;", |
| 11722 "}"])); |
| 9304 resolve(source); | 11723 resolve(source); |
| 9305 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); | 11724 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); |
| 9306 verify([source]); | 11725 verify([source]); |
| 9307 } | 11726 } |
| 9308 void test_conflictingInstanceGetterAndSuperclassMember_mixin() { | 11727 void test_conflictingInstanceGetterAndSuperclassMember_mixin() { |
| 9309 Source source = addSource(EngineTestCase.createSource(["class M {", " stati
c int v;", "}", "class B extends Object with M {", " get v => 0;", "}"])); | 11728 Source source = addSource(EngineTestCase.createSource([ |
| 11729 "class M {", |
| 11730 " static int v;", |
| 11731 "}", |
| 11732 "class B extends Object with M {", |
| 11733 " get v => 0;", |
| 11734 "}"])); |
| 9310 resolve(source); | 11735 resolve(source); |
| 9311 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); | 11736 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_M
EMBER]); |
| 9312 verify([source]); | 11737 verify([source]); |
| 9313 } | 11738 } |
| 9314 void test_conflictingInstanceSetterAndSuperclassMember() { | 11739 void test_conflictingInstanceSetterAndSuperclassMember() { |
| 9315 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int v;", "}", "class B extends A {", " set v(x) {}", "}"])); | 11740 Source source = addSource(EngineTestCase.createSource([ |
| 11741 "class A {", |
| 11742 " static int v;", |
| 11743 "}", |
| 11744 "class B extends A {", |
| 11745 " set v(x) {}", |
| 11746 "}"])); |
| 9316 resolve(source); | 11747 resolve(source); |
| 9317 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_M
EMBER]); | 11748 assertErrors([StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_M
EMBER]); |
| 9318 verify([source]); | 11749 verify([source]); |
| 9319 } | 11750 } |
| 9320 void test_conflictingStaticGetterAndInstanceSetter_mixin() { | 11751 void test_conflictingStaticGetterAndInstanceSetter_mixin() { |
| 9321 Source source = addSource(EngineTestCase.createSource(["class A {", " set x
(int p) {}", "}", "class B extends Object with A {", " static get x => 0;", "}"
])); | 11752 Source source = addSource(EngineTestCase.createSource([ |
| 11753 "class A {", |
| 11754 " set x(int p) {}", |
| 11755 "}", |
| 11756 "class B extends Object with A {", |
| 11757 " static get x => 0;", |
| 11758 "}"])); |
| 9322 resolve(source); | 11759 resolve(source); |
| 9323 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); | 11760 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); |
| 9324 verify([source]); | 11761 verify([source]); |
| 9325 } | 11762 } |
| 9326 void test_conflictingStaticGetterAndInstanceSetter_superClass() { | 11763 void test_conflictingStaticGetterAndInstanceSetter_superClass() { |
| 9327 Source source = addSource(EngineTestCase.createSource(["class A {", " set x
(int p) {}", "}", "class B extends A {", " static get x => 0;", "}"])); | 11764 Source source = addSource(EngineTestCase.createSource([ |
| 11765 "class A {", |
| 11766 " set x(int p) {}", |
| 11767 "}", |
| 11768 "class B extends A {", |
| 11769 " static get x => 0;", |
| 11770 "}"])); |
| 9328 resolve(source); | 11771 resolve(source); |
| 9329 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); | 11772 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); |
| 9330 verify([source]); | 11773 verify([source]); |
| 9331 } | 11774 } |
| 9332 void test_conflictingStaticGetterAndInstanceSetter_thisClass() { | 11775 void test_conflictingStaticGetterAndInstanceSetter_thisClass() { |
| 9333 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c get x => 0;", " set x(int p) {}", "}"])); | 11776 Source source = addSource(EngineTestCase.createSource([ |
| 11777 "class A {", |
| 11778 " static get x => 0;", |
| 11779 " set x(int p) {}", |
| 11780 "}"])); |
| 9334 resolve(source); | 11781 resolve(source); |
| 9335 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); | 11782 assertErrors([StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTE
R]); |
| 9336 verify([source]); | 11783 verify([source]); |
| 9337 } | 11784 } |
| 9338 void test_conflictingStaticSetterAndInstanceMember_thisClass_getter() { | 11785 void test_conflictingStaticSetterAndInstanceMember_thisClass_getter() { |
| 9339 Source source = addSource(EngineTestCase.createSource(["class A {", " get x
=> 0;", " static set x(int p) {}", "}"])); | 11786 Source source = addSource(EngineTestCase.createSource([ |
| 11787 "class A {", |
| 11788 " get x => 0;", |
| 11789 " static set x(int p) {}", |
| 11790 "}"])); |
| 9340 resolve(source); | 11791 resolve(source); |
| 9341 assertErrors([StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBE
R]); | 11792 assertErrors([StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBE
R]); |
| 9342 verify([source]); | 11793 verify([source]); |
| 9343 } | 11794 } |
| 9344 void test_conflictingStaticSetterAndInstanceMember_thisClass_method() { | 11795 void test_conflictingStaticSetterAndInstanceMember_thisClass_method() { |
| 9345 Source source = addSource(EngineTestCase.createSource(["class A {", " x() {
}", " static set x(int p) {}", "}"])); | 11796 Source source = addSource(EngineTestCase.createSource(["class A {", " x() {
}", " static set x(int p) {}", "}"])); |
| 9346 resolve(source); | 11797 resolve(source); |
| 9347 assertErrors([StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBE
R]); | 11798 assertErrors([StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBE
R]); |
| 9348 verify([source]); | 11799 verify([source]); |
| 9349 } | 11800 } |
| 9350 void test_constWithAbstractClass() { | 11801 void test_constWithAbstractClass() { |
| 9351 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" const A();", "}", "void f() {", " A a = const A();", "}"])); | 11802 Source source = addSource(EngineTestCase.createSource([ |
| 11803 "abstract class A {", |
| 11804 " const A();", |
| 11805 "}", |
| 11806 "void f() {", |
| 11807 " A a = const A();", |
| 11808 "}"])); |
| 9352 resolve(source); | 11809 resolve(source); |
| 9353 assertErrors([StaticWarningCode.CONST_WITH_ABSTRACT_CLASS]); | 11810 assertErrors([StaticWarningCode.CONST_WITH_ABSTRACT_CLASS]); |
| 9354 verify([source]); | 11811 verify([source]); |
| 9355 } | 11812 } |
| 9356 void test_equalKeysInMap() { | 11813 void test_equalKeysInMap() { |
| 9357 Source source = addSource(EngineTestCase.createSource(["var m = {'a' : 0, 'b
' : 1, 'a' : 2};"])); | 11814 Source source = addSource(EngineTestCase.createSource(["var m = {'a' : 0, 'b
' : 1, 'a' : 2};"])); |
| 9358 resolve(source); | 11815 resolve(source); |
| 9359 assertErrors([StaticWarningCode.EQUAL_KEYS_IN_MAP]); | 11816 assertErrors([StaticWarningCode.EQUAL_KEYS_IN_MAP]); |
| 9360 verify([source]); | 11817 verify([source]); |
| 9361 } | 11818 } |
| 9362 void test_exportDuplicatedLibraryName() { | 11819 void test_exportDuplicatedLibraryName() { |
| 9363 Source source = addSource(EngineTestCase.createSource(["library test;", "exp
ort 'lib1.dart';", "export 'lib2.dart';"])); | 11820 Source source = addSource(EngineTestCase.createSource([ |
| 11821 "library test;", |
| 11822 "export 'lib1.dart';", |
| 11823 "export 'lib2.dart';"])); |
| 9364 addSource2("/lib1.dart", "library lib;"); | 11824 addSource2("/lib1.dart", "library lib;"); |
| 9365 addSource2("/lib2.dart", "library lib;"); | 11825 addSource2("/lib2.dart", "library lib;"); |
| 9366 resolve(source); | 11826 resolve(source); |
| 9367 assertErrors([StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAME]); | 11827 assertErrors([StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAME]); |
| 9368 verify([source]); | 11828 verify([source]); |
| 9369 } | 11829 } |
| 9370 void test_extraPositionalArguments() { | 11830 void test_extraPositionalArguments() { |
| 9371 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {",
" f(0, 1, '2');", "}"])); | 11831 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {",
" f(0, 1, '2');", "}"])); |
| 9372 resolve(source); | 11832 resolve(source); |
| 9373 assertErrors([StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]); | 11833 assertErrors([StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]); |
| 9374 verify([source]); | 11834 verify([source]); |
| 9375 } | 11835 } |
| 9376 void test_fieldInitializerNotAssignable() { | 11836 void test_fieldInitializerNotAssignable() { |
| 9377 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A() : x = '';", "}"])); | 11837 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A() : x = '';", "}"])); |
| 9378 resolve(source); | 11838 resolve(source); |
| 9379 assertErrors([StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE]); | 11839 assertErrors([StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE]); |
| 9380 verify([source]); | 11840 verify([source]); |
| 9381 } | 11841 } |
| 9382 void test_fieldInitializingFormalNotAssignable() { | 11842 void test_fieldInitializingFormalNotAssignable() { |
| 9383 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(String this.x) {}", "}"])); | 11843 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(String this.x) {}", "}"])); |
| 9384 resolve(source); | 11844 resolve(source); |
| 9385 assertErrors([StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE]); | 11845 assertErrors([StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE]); |
| 9386 verify([source]); | 11846 verify([source]); |
| 9387 } | 11847 } |
| 11848 void test_finalNotInitialized_inConstructor() { |
| 11849 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() {}", "}"])); |
| 11850 resolve(source); |
| 11851 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); |
| 11852 verify([source]); |
| 11853 } |
| 9388 void test_finalNotInitialized_instanceField_const_static() { | 11854 void test_finalNotInitialized_instanceField_const_static() { |
| 9389 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c const F;", "}"])); | 11855 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c const F;", "}"])); |
| 9390 resolve(source); | 11856 resolve(source); |
| 9391 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); | 11857 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); |
| 9392 verify([source]); | 11858 verify([source]); |
| 9393 } | 11859 } |
| 9394 void test_finalNotInitialized_instanceField_final() { | 11860 void test_finalNotInitialized_instanceField_final() { |
| 9395 Source source = addSource(EngineTestCase.createSource(["class A {", " final
F;", "}"])); | 11861 Source source = addSource(EngineTestCase.createSource(["class A {", " final
F;", "}"])); |
| 9396 resolve(source); | 11862 resolve(source); |
| 9397 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); | 11863 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 9421 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); | 11887 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); |
| 9422 verify([source]); | 11888 verify([source]); |
| 9423 } | 11889 } |
| 9424 void test_finalNotInitialized_local_final() { | 11890 void test_finalNotInitialized_local_final() { |
| 9425 Source source = addSource(EngineTestCase.createSource(["f() {", " final int
x;", "}"])); | 11891 Source source = addSource(EngineTestCase.createSource(["f() {", " final int
x;", "}"])); |
| 9426 resolve(source); | 11892 resolve(source); |
| 9427 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); | 11893 assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]); |
| 9428 verify([source]); | 11894 verify([source]); |
| 9429 } | 11895 } |
| 9430 void test_importDuplicatedLibraryName() { | 11896 void test_importDuplicatedLibraryName() { |
| 9431 Source source = addSource(EngineTestCase.createSource(["library test;", "imp
ort 'lib1.dart';", "import 'lib2.dart';"])); | 11897 Source source = addSource(EngineTestCase.createSource([ |
| 11898 "library test;", |
| 11899 "import 'lib1.dart';", |
| 11900 "import 'lib2.dart';"])); |
| 9432 addSource2("/lib1.dart", "library lib;"); | 11901 addSource2("/lib1.dart", "library lib;"); |
| 9433 addSource2("/lib2.dart", "library lib;"); | 11902 addSource2("/lib2.dart", "library lib;"); |
| 9434 resolve(source); | 11903 resolve(source); |
| 9435 assertErrors([StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME]); | 11904 assertErrors([StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME]); |
| 9436 verify([source]); | 11905 verify([source]); |
| 9437 } | 11906 } |
| 9438 void test_inconsistentMethodInheritanceGetterAndMethod() { | 11907 void test_inconsistentMethodInheritanceGetterAndMethod() { |
| 9439 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" int x();", "}", "abstract class B {", " int get x;", "}", "class C implemen
ts A, B {", "}"])); | 11908 Source source = addSource(EngineTestCase.createSource([ |
| 11909 "abstract class A {", |
| 11910 " int x();", |
| 11911 "}", |
| 11912 "abstract class B {", |
| 11913 " int get x;", |
| 11914 "}", |
| 11915 "class C implements A, B {", |
| 11916 "}"])); |
| 9440 resolve(source); | 11917 resolve(source); |
| 9441 assertErrors([StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_M
ETHOD]); | 11918 assertErrors([StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_M
ETHOD]); |
| 9442 verify([source]); | 11919 verify([source]); |
| 9443 } | 11920 } |
| 9444 void test_instanceMethodNameCollidesWithSuperclassStatic_field() { | 11921 void test_instanceMethodNameCollidesWithSuperclassStatic_field() { |
| 9445 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c var n;", "}", "class B extends A {", " void n() {}", "}"])); | 11922 Source source = addSource(EngineTestCase.createSource([ |
| 11923 "class A {", |
| 11924 " static var n;", |
| 11925 "}", |
| 11926 "class B extends A {", |
| 11927 " void n() {}", |
| 11928 "}"])); |
| 9446 resolve(source); | 11929 resolve(source); |
| 9447 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 11930 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9448 verify([source]); | 11931 verify([source]); |
| 9449 } | 11932 } |
| 9450 void test_instanceMethodNameCollidesWithSuperclassStatic_field2() { | 11933 void test_instanceMethodNameCollidesWithSuperclassStatic_field2() { |
| 9451 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c var n;", "}", "class B extends A {", "}", "class C extends B {", " void n() {
}", "}"])); | 11934 Source source = addSource(EngineTestCase.createSource([ |
| 11935 "class A {", |
| 11936 " static var n;", |
| 11937 "}", |
| 11938 "class B extends A {", |
| 11939 "}", |
| 11940 "class C extends B {", |
| 11941 " void n() {}", |
| 11942 "}"])); |
| 9452 resolve(source); | 11943 resolve(source); |
| 9453 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 11944 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9454 verify([source]); | 11945 verify([source]); |
| 9455 } | 11946 } |
| 9456 void test_instanceMethodNameCollidesWithSuperclassStatic_getter() { | 11947 void test_instanceMethodNameCollidesWithSuperclassStatic_getter() { |
| 9457 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c get n {return 0;}", "}", "class B extends A {", " void n() {}", "}"])); | 11948 Source source = addSource(EngineTestCase.createSource([ |
| 11949 "class A {", |
| 11950 " static get n {return 0;}", |
| 11951 "}", |
| 11952 "class B extends A {", |
| 11953 " void n() {}", |
| 11954 "}"])); |
| 9458 resolve(source); | 11955 resolve(source); |
| 9459 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 11956 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9460 verify([source]); | 11957 verify([source]); |
| 9461 } | 11958 } |
| 9462 void test_instanceMethodNameCollidesWithSuperclassStatic_getter2() { | 11959 void test_instanceMethodNameCollidesWithSuperclassStatic_getter2() { |
| 9463 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c get n {return 0;}", "}", "class B extends A {", "}", "class C extends B {", "
void n() {}", "}"])); | 11960 Source source = addSource(EngineTestCase.createSource([ |
| 11961 "class A {", |
| 11962 " static get n {return 0;}", |
| 11963 "}", |
| 11964 "class B extends A {", |
| 11965 "}", |
| 11966 "class C extends B {", |
| 11967 " void n() {}", |
| 11968 "}"])); |
| 9464 resolve(source); | 11969 resolve(source); |
| 9465 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 11970 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9466 verify([source]); | 11971 verify([source]); |
| 9467 } | 11972 } |
| 9468 void test_instanceMethodNameCollidesWithSuperclassStatic_method() { | 11973 void test_instanceMethodNameCollidesWithSuperclassStatic_method() { |
| 9469 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c n () {}", "}", "class B extends A {", " void n() {}", "}"])); | 11974 Source source = addSource(EngineTestCase.createSource([ |
| 11975 "class A {", |
| 11976 " static n () {}", |
| 11977 "}", |
| 11978 "class B extends A {", |
| 11979 " void n() {}", |
| 11980 "}"])); |
| 9470 resolve(source); | 11981 resolve(source); |
| 9471 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 11982 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9472 verify([source]); | 11983 verify([source]); |
| 9473 } | 11984 } |
| 9474 void test_instanceMethodNameCollidesWithSuperclassStatic_method2() { | 11985 void test_instanceMethodNameCollidesWithSuperclassStatic_method2() { |
| 9475 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c n () {}", "}", "class B extends A {", "}", "class C extends B {", " void n()
{}", "}"])); | 11986 Source source = addSource(EngineTestCase.createSource([ |
| 11987 "class A {", |
| 11988 " static n () {}", |
| 11989 "}", |
| 11990 "class B extends A {", |
| 11991 "}", |
| 11992 "class C extends B {", |
| 11993 " void n() {}", |
| 11994 "}"])); |
| 9476 resolve(source); | 11995 resolve(source); |
| 9477 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 11996 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9478 verify([source]); | 11997 verify([source]); |
| 9479 } | 11998 } |
| 9480 void test_instanceMethodNameCollidesWithSuperclassStatic_setter() { | 11999 void test_instanceMethodNameCollidesWithSuperclassStatic_setter() { |
| 9481 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c set n(int x) {}", "}", "class B extends A {", " void n() {}", "}"])); | 12000 Source source = addSource(EngineTestCase.createSource([ |
| 12001 "class A {", |
| 12002 " static set n(int x) {}", |
| 12003 "}", |
| 12004 "class B extends A {", |
| 12005 " void n() {}", |
| 12006 "}"])); |
| 9482 resolve(source); | 12007 resolve(source); |
| 9483 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 12008 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9484 verify([source]); | 12009 verify([source]); |
| 9485 } | 12010 } |
| 9486 void test_instanceMethodNameCollidesWithSuperclassStatic_setter2() { | 12011 void test_instanceMethodNameCollidesWithSuperclassStatic_setter2() { |
| 9487 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c set n(int x) {}", "}", "class B extends A {", "}", "class C extends B {", " v
oid n() {}", "}"])); | 12012 Source source = addSource(EngineTestCase.createSource([ |
| 12013 "class A {", |
| 12014 " static set n(int x) {}", |
| 12015 "}", |
| 12016 "class B extends A {", |
| 12017 "}", |
| 12018 "class C extends B {", |
| 12019 " void n() {}", |
| 12020 "}"])); |
| 9488 resolve(source); | 12021 resolve(source); |
| 9489 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); | 12022 assertErrors([StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLAS
S_STATIC]); |
| 9490 verify([source]); | 12023 verify([source]); |
| 9491 } | 12024 } |
| 9492 void test_invalidGetterOverrideReturnType() { | 12025 void test_invalidGetterOverrideReturnType() { |
| 9493 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et g { return 0; }", "}", "class B extends A {", " String get g { return 'a'; }
", "}"])); | 12026 Source source = addSource(EngineTestCase.createSource([ |
| 12027 "class A {", |
| 12028 " int get g { return 0; }", |
| 12029 "}", |
| 12030 "class B extends A {", |
| 12031 " String get g { return 'a'; }", |
| 12032 "}"])); |
| 9494 resolve(source); | 12033 resolve(source); |
| 9495 assertErrors([StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE]); | 12034 assertErrors([StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE]); |
| 9496 verify([source]); | 12035 verify([source]); |
| 9497 } | 12036 } |
| 12037 void test_invalidGetterOverrideReturnType_implicit() { |
| 12038 Source source = addSource(EngineTestCase.createSource([ |
| 12039 "class A {", |
| 12040 " String f;", |
| 12041 "}", |
| 12042 "class B extends A {", |
| 12043 " int f;", |
| 12044 "}"])); |
| 12045 resolve(source); |
| 12046 assertErrors([ |
| 12047 StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE, |
| 12048 StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]); |
| 12049 verify([source]); |
| 12050 } |
| 9498 void test_invalidMethodOverrideNamedParamType() { | 12051 void test_invalidMethodOverrideNamedParamType() { |
| 9499 Source source = addSource(EngineTestCase.createSource(["class A {", " m({in
t a}) {}", "}", "class B implements A {", " m({String a}) {}", "}"])); | 12052 Source source = addSource(EngineTestCase.createSource([ |
| 12053 "class A {", |
| 12054 " m({int a}) {}", |
| 12055 "}", |
| 12056 "class B implements A {", |
| 12057 " m({String a}) {}", |
| 12058 "}"])); |
| 9500 resolve(source); | 12059 resolve(source); |
| 9501 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE]); | 12060 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE]); |
| 9502 verify([source]); | 12061 verify([source]); |
| 9503 } | 12062 } |
| 9504 void test_invalidMethodOverrideNormalParamType() { | 12063 void test_invalidMethodOverrideNormalParamType() { |
| 9505 Source source = addSource(EngineTestCase.createSource(["class A {", " m(int
a) {}", "}", "class B implements A {", " m(String a) {}", "}"])); | 12064 Source source = addSource(EngineTestCase.createSource([ |
| 12065 "class A {", |
| 12066 " m(int a) {}", |
| 12067 "}", |
| 12068 "class B implements A {", |
| 12069 " m(String a) {}", |
| 12070 "}"])); |
| 9506 resolve(source); | 12071 resolve(source); |
| 9507 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]); | 12072 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]); |
| 9508 verify([source]); | 12073 verify([source]); |
| 9509 } | 12074 } |
| 9510 void test_invalidMethodOverrideOptionalParamType() { | 12075 void test_invalidMethodOverrideOptionalParamType() { |
| 9511 Source source = addSource(EngineTestCase.createSource(["class A {", " m([in
t a]) {}", "}", "class B implements A {", " m([String a]) {}", "}"])); | 12076 Source source = addSource(EngineTestCase.createSource([ |
| 12077 "class A {", |
| 12078 " m([int a]) {}", |
| 12079 "}", |
| 12080 "class B implements A {", |
| 12081 " m([String a]) {}", |
| 12082 "}"])); |
| 9512 resolve(source); | 12083 resolve(source); |
| 9513 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE]
); | 12084 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE]
); |
| 9514 verify([source]); | 12085 verify([source]); |
| 9515 } | 12086 } |
| 9516 void test_invalidMethodOverrideReturnType_interface() { | 12087 void test_invalidMethodOverrideReturnType_interface() { |
| 9517 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() { return 0; }", "}", "class B implements A {", " String m() { return 'a'; }"
, "}"])); | 12088 Source source = addSource(EngineTestCase.createSource([ |
| 12089 "class A {", |
| 12090 " int m() { return 0; }", |
| 12091 "}", |
| 12092 "class B implements A {", |
| 12093 " String m() { return 'a'; }", |
| 12094 "}"])); |
| 9518 resolve(source); | 12095 resolve(source); |
| 9519 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); | 12096 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); |
| 9520 verify([source]); | 12097 verify([source]); |
| 9521 } | 12098 } |
| 9522 void test_invalidMethodOverrideReturnType_interface2() { | 12099 void test_invalidMethodOverrideReturnType_interface2() { |
| 9523 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" int m();", "}", "abstract class B implements A {", "}", "class C implements
B {", " String m() { return 'a'; }", "}"])); | 12100 Source source = addSource(EngineTestCase.createSource([ |
| 12101 "abstract class A {", |
| 12102 " int m();", |
| 12103 "}", |
| 12104 "abstract class B implements A {", |
| 12105 "}", |
| 12106 "class C implements B {", |
| 12107 " String m() { return 'a'; }", |
| 12108 "}"])); |
| 9524 resolve(source); | 12109 resolve(source); |
| 9525 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); | 12110 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); |
| 9526 verify([source]); | 12111 verify([source]); |
| 9527 } | 12112 } |
| 9528 void test_invalidMethodOverrideReturnType_mixin() { | 12113 void test_invalidMethodOverrideReturnType_mixin() { |
| 9529 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() { return 0; }", "}", "class B extends Object with A {", " String m() { retur
n 'a'; }", "}"])); | 12114 Source source = addSource(EngineTestCase.createSource([ |
| 12115 "class A {", |
| 12116 " int m() { return 0; }", |
| 12117 "}", |
| 12118 "class B extends Object with A {", |
| 12119 " String m() { return 'a'; }", |
| 12120 "}"])); |
| 9530 resolve(source); | 12121 resolve(source); |
| 9531 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); | 12122 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); |
| 9532 verify([source]); | 12123 verify([source]); |
| 9533 } | 12124 } |
| 9534 void test_invalidMethodOverrideReturnType_superclass() { | 12125 void test_invalidMethodOverrideReturnType_superclass() { |
| 9535 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() { return 0; }", "}", "class B extends A {", " String m() { return 'a'; }", "
}"])); | 12126 Source source = addSource(EngineTestCase.createSource([ |
| 12127 "class A {", |
| 12128 " int m() { return 0; }", |
| 12129 "}", |
| 12130 "class B extends A {", |
| 12131 " String m() { return 'a'; }", |
| 12132 "}"])); |
| 9536 resolve(source); | 12133 resolve(source); |
| 9537 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); | 12134 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); |
| 9538 verify([source]); | 12135 verify([source]); |
| 9539 } | 12136 } |
| 9540 void test_invalidMethodOverrideReturnType_superclass2() { | 12137 void test_invalidMethodOverrideReturnType_superclass2() { |
| 9541 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() { return 0; }", "}", "class B extends A {", "}", "class C extends B {", " St
ring m() { return 'a'; }", "}"])); | 12138 Source source = addSource(EngineTestCase.createSource([ |
| 12139 "class A {", |
| 12140 " int m() { return 0; }", |
| 12141 "}", |
| 12142 "class B extends A {", |
| 12143 "}", |
| 12144 "class C extends B {", |
| 12145 " String m() { return 'a'; }", |
| 12146 "}"])); |
| 9542 resolve(source); | 12147 resolve(source); |
| 9543 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); | 12148 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); |
| 9544 verify([source]); | 12149 verify([source]); |
| 9545 } | 12150 } |
| 9546 void test_invalidMethodOverrideReturnType_void() { | 12151 void test_invalidMethodOverrideReturnType_void() { |
| 9547 Source source = addSource(EngineTestCase.createSource(["class A {", " int m
() {}", "}", "class B extends A {", " void m() {}", "}"])); | 12152 Source source = addSource(EngineTestCase.createSource([ |
| 12153 "class A {", |
| 12154 " int m() {}", |
| 12155 "}", |
| 12156 "class B extends A {", |
| 12157 " void m() {}", |
| 12158 "}"])); |
| 9548 resolve(source); | 12159 resolve(source); |
| 9549 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); | 12160 assertErrors([StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]); |
| 9550 verify([source]); | 12161 verify([source]); |
| 9551 } | 12162 } |
| 9552 void test_invalidOverrideDifferentDefaultValues_named() { | 12163 void test_invalidOverrideDifferentDefaultValues_named() { |
| 9553 Source source = addSource(EngineTestCase.createSource(["class A {", " m({in
t p : 0}) {}", "}", "class B extends A {", " m({int p : 1}) {}", "}"])); | 12164 Source source = addSource(EngineTestCase.createSource([ |
| 12165 "class A {", |
| 12166 " m({int p : 0}) {}", |
| 12167 "}", |
| 12168 "class B extends A {", |
| 12169 " m({int p : 1}) {}", |
| 12170 "}"])); |
| 9554 resolve(source); | 12171 resolve(source); |
| 9555 assertErrors([StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NA
MED]); | 12172 assertErrors([StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NA
MED]); |
| 9556 verify([source]); | 12173 verify([source]); |
| 9557 } | 12174 } |
| 9558 void test_invalidOverrideDifferentDefaultValues_positional() { | 12175 void test_invalidOverrideDifferentDefaultValues_positional() { |
| 9559 Source source = addSource(EngineTestCase.createSource(["class A {", " m([in
t p = 0]) {}", "}", "class B extends A {", " m([int p = 1]) {}", "}"])); | 12176 Source source = addSource(EngineTestCase.createSource([ |
| 12177 "class A {", |
| 12178 " m([int p = 0]) {}", |
| 12179 "}", |
| 12180 "class B extends A {", |
| 12181 " m([int p = 1]) {}", |
| 12182 "}"])); |
| 9560 resolve(source); | 12183 resolve(source); |
| 9561 assertErrors([StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_PO
SITIONAL]); | 12184 assertErrors([StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_PO
SITIONAL]); |
| 9562 verify([source]); | 12185 verify([source]); |
| 9563 } | 12186 } |
| 9564 void test_invalidSetterOverrideNormalParamType() { | 12187 void test_invalidSetterOverrideNormalParamType() { |
| 9565 Source source = addSource(EngineTestCase.createSource(["class A {", " void
set s(int v) {}", "}", "class B extends A {", " void set s(String v) {}", "}"])
); | 12188 Source source = addSource(EngineTestCase.createSource([ |
| 12189 "class A {", |
| 12190 " void set s(int v) {}", |
| 12191 "}", |
| 12192 "class B extends A {", |
| 12193 " void set s(String v) {}", |
| 12194 "}"])); |
| 9566 resolve(source); | 12195 resolve(source); |
| 9567 assertErrors([StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]); | 12196 assertErrors([StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]); |
| 9568 verify([source]); | 12197 verify([source]); |
| 9569 } | 12198 } |
| 12199 void test_listElementTypeNotAssignable() { |
| 12200 Source source = addSource(EngineTestCase.createSource(["var v = <String> [42
];"])); |
| 12201 resolve(source); |
| 12202 assertErrors([StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE]); |
| 12203 verify([source]); |
| 12204 } |
| 12205 void test_mapKeyTypeNotAssignable() { |
| 12206 Source source = addSource(EngineTestCase.createSource(["var v = <String, int
> {1 : 2};"])); |
| 12207 resolve(source); |
| 12208 assertErrors([StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE]); |
| 12209 verify([source]); |
| 12210 } |
| 12211 void test_mapValueTypeNotAssignable() { |
| 12212 Source source = addSource(EngineTestCase.createSource(["var v = <String, Str
ing> {'a' : 2};"])); |
| 12213 resolve(source); |
| 12214 assertErrors([StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE]); |
| 12215 verify([source]); |
| 12216 } |
| 9570 void test_mismatchedAccessorTypes_class() { | 12217 void test_mismatchedAccessorTypes_class() { |
| 9571 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et g { return 0; }", " set g(String v) {}", "}"])); | 12218 Source source = addSource(EngineTestCase.createSource([ |
| 12219 "class A {", |
| 12220 " int get g { return 0; }", |
| 12221 " set g(String v) {}", |
| 12222 "}"])); |
| 9572 resolve(source); | 12223 resolve(source); |
| 9573 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); | 12224 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); |
| 9574 verify([source]); | 12225 verify([source]); |
| 9575 } | 12226 } |
| 9576 void test_mismatchedAccessorTypes_topLevel() { | 12227 void test_mismatchedAccessorTypes_topLevel() { |
| 9577 Source source = addSource(EngineTestCase.createSource(["int get g { return 0
; }", "set g(String v) {}"])); | 12228 Source source = addSource(EngineTestCase.createSource(["int get g { return 0
; }", "set g(String v) {}"])); |
| 9578 resolve(source); | 12229 resolve(source); |
| 9579 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); | 12230 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); |
| 9580 verify([source]); | 12231 verify([source]); |
| 9581 } | 12232 } |
| 9582 void test_newWithAbstractClass() { | 12233 void test_newWithAbstractClass() { |
| 9583 Source source = addSource(EngineTestCase.createSource(["abstract class A {}"
, "void f() {", " A a = new A();", "}"])); | 12234 Source source = addSource(EngineTestCase.createSource([ |
| 12235 "abstract class A {}", |
| 12236 "void f() {", |
| 12237 " A a = new A();", |
| 12238 "}"])); |
| 9584 resolve(source); | 12239 resolve(source); |
| 9585 assertErrors([StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); | 12240 assertErrors([StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); |
| 9586 verify([source]); | 12241 verify([source]); |
| 9587 } | 12242 } |
| 9588 void test_newWithNonType() { | 12243 void test_newWithNonType() { |
| 9589 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "void f
() {", " var a = new A();", "}"])); | 12244 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "void f
() {", " var a = new A();", "}"])); |
| 9590 resolve(source); | 12245 resolve(source); |
| 9591 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); | 12246 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); |
| 9592 verify([source]); | 12247 verify([source]); |
| 9593 } | 12248 } |
| 9594 void test_newWithNonType_fromLibrary() { | 12249 void test_newWithNonType_fromLibrary() { |
| 9595 Source source1 = addSource2("lib.dart", ""); | 12250 Source source1 = addSource2("lib.dart", ""); |
| 9596 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource(["impor
t 'lib.dart' as lib;", "void f() {", " var a = new lib.A();", "}"])); | 12251 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([ |
| 12252 "import 'lib.dart' as lib;", |
| 12253 "void f() {", |
| 12254 " var a = new lib.A();", |
| 12255 "}"])); |
| 9597 resolve(source1); | 12256 resolve(source1); |
| 9598 resolve(source2); | 12257 resolve(source2); |
| 9599 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); | 12258 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); |
| 9600 verify([source1]); | 12259 verify([source1]); |
| 9601 } | 12260 } |
| 9602 void test_newWithUndefinedConstructor() { | 12261 void test_newWithUndefinedConstructor() { |
| 9603 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "f() {", " new A.name();", "}"])); | 12262 Source source = addSource(EngineTestCase.createSource([ |
| 12263 "class A {", |
| 12264 " A() {}", |
| 12265 "}", |
| 12266 "f() {", |
| 12267 " new A.name();", |
| 12268 "}"])); |
| 9604 resolve(source); | 12269 resolve(source); |
| 9605 assertErrors([StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR]); | 12270 assertErrors([StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR]); |
| 9606 } | 12271 } |
| 9607 void test_newWithUndefinedConstructorDefault() { | 12272 void test_newWithUndefinedConstructorDefault() { |
| 9608 Source source = addSource(EngineTestCase.createSource(["class A {", " A.nam
e() {}", "}", "f() {", " new A();", "}"])); | 12273 Source source = addSource(EngineTestCase.createSource([ |
| 12274 "class A {", |
| 12275 " A.name() {}", |
| 12276 "}", |
| 12277 "f() {", |
| 12278 " new A();", |
| 12279 "}"])); |
| 9609 resolve(source); | 12280 resolve(source); |
| 9610 assertErrors([StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]); | 12281 assertErrors([StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]); |
| 9611 verify([source]); | 12282 verify([source]); |
| 9612 } | 12283 } |
| 9613 void test_nonAbstractClassInheritsAbstractMemberFivePlus() { | 12284 void test_nonAbstractClassInheritsAbstractMemberFivePlus() { |
| 9614 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", " n();", " o();", " p();", " q();", "}", "class C extends A {", "
}"])); | 12285 Source source = addSource(EngineTestCase.createSource([ |
| 12286 "abstract class A {", |
| 12287 " m();", |
| 12288 " n();", |
| 12289 " o();", |
| 12290 " p();", |
| 12291 " q();", |
| 12292 "}", |
| 12293 "class C extends A {", |
| 12294 "}"])); |
| 9615 resolve(source); | 12295 resolve(source); |
| 9616 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
FIVE_PLUS]); | 12296 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
FIVE_PLUS]); |
| 9617 verify([source]); | 12297 verify([source]); |
| 9618 } | 12298 } |
| 9619 void test_nonAbstractClassInheritsAbstractMemberFour() { | 12299 void test_nonAbstractClassInheritsAbstractMemberFour() { |
| 9620 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", " n();", " o();", " p();", "}", "class C extends A {", "}"])); | 12300 Source source = addSource(EngineTestCase.createSource([ |
| 12301 "abstract class A {", |
| 12302 " m();", |
| 12303 " n();", |
| 12304 " o();", |
| 12305 " p();", |
| 12306 "}", |
| 12307 "class C extends A {", |
| 12308 "}"])); |
| 9621 resolve(source); | 12309 resolve(source); |
| 9622 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
FOUR]); | 12310 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
FOUR]); |
| 9623 verify([source]); | 12311 verify([source]); |
| 9624 } | 12312 } |
| 9625 void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterface() { | 12313 void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterface() { |
| 9626 Source source = addSource(EngineTestCase.createSource(["class I {", " int g
et g {return 1;}", "}", "class C implements I {", "}"])); | 12314 Source source = addSource(EngineTestCase.createSource([ |
| 12315 "class I {", |
| 12316 " int get g {return 1;}", |
| 12317 "}", |
| 12318 "class C implements I {", |
| 12319 "}"])); |
| 9627 resolve(source); | 12320 resolve(source); |
| 9628 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12321 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9629 verify([source]); | 12322 verify([source]); |
| 9630 } | 12323 } |
| 9631 void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromSuperclass() { | 12324 void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromSuperclass() { |
| 9632 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" int get g;", "}", "class C extends A {", "}"])); | 12325 Source source = addSource(EngineTestCase.createSource([ |
| 12326 "abstract class A {", |
| 12327 " int get g;", |
| 12328 "}", |
| 12329 "class C extends A {", |
| 12330 "}"])); |
| 9633 resolve(source); | 12331 resolve(source); |
| 9634 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12332 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9635 verify([source]); | 12333 verify([source]); |
| 9636 } | 12334 } |
| 9637 void test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterface() { | 12335 void test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterface() { |
| 9638 Source source = addSource(EngineTestCase.createSource(["class I {", " m(p)
{}", "}", "class C implements I {", "}"])); | 12336 Source source = addSource(EngineTestCase.createSource([ |
| 12337 "class I {", |
| 12338 " m(p) {}", |
| 12339 "}", |
| 12340 "class C implements I {", |
| 12341 "}"])); |
| 9639 resolve(source); | 12342 resolve(source); |
| 9640 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12343 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9641 verify([source]); | 12344 verify([source]); |
| 9642 } | 12345 } |
| 9643 void test_nonAbstractClassInheritsAbstractMemberOne_method_fromSuperclass() { | 12346 void test_nonAbstractClassInheritsAbstractMemberOne_method_fromSuperclass() { |
| 9644 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m(p);", "}", "class C extends A {", "}"])); | 12347 Source source = addSource(EngineTestCase.createSource([ |
| 12348 "abstract class A {", |
| 12349 " m(p);", |
| 12350 "}", |
| 12351 "class C extends A {", |
| 12352 "}"])); |
| 9645 resolve(source); | 12353 resolve(source); |
| 9646 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12354 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9647 verify([source]); | 12355 verify([source]); |
| 9648 } | 12356 } |
| 9649 void test_nonAbstractClassInheritsAbstractMemberOne_method_optionalParamCount(
) { | 12357 void test_nonAbstractClassInheritsAbstractMemberOne_method_optionalParamCount(
) { |
| 9650 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" int x(int a);", "}", "abstract class B {", " int x(int a, [int b]);", "}",
"class C implements A, B {", "}"])); | 12358 Source source = addSource(EngineTestCase.createSource([ |
| 12359 "abstract class A {", |
| 12360 " int x(int a);", |
| 12361 "}", |
| 12362 "abstract class B {", |
| 12363 " int x(int a, [int b]);", |
| 12364 "}", |
| 12365 "class C implements A, B {", |
| 12366 "}"])); |
| 9651 resolve(source); | 12367 resolve(source); |
| 9652 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12368 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9653 verify([source]); | 12369 verify([source]); |
| 9654 } | 12370 } |
| 9655 void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface() { | 12371 void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface() { |
| 9656 Source source = addSource(EngineTestCase.createSource(["class I {", " set s
(int i) {}", "}", "class C implements I {", "}"])); | 12372 Source source = addSource(EngineTestCase.createSource([ |
| 12373 "class I {", |
| 12374 " set s(int i) {}", |
| 12375 "}", |
| 12376 "class C implements I {", |
| 12377 "}"])); |
| 9657 resolve(source); | 12378 resolve(source); |
| 9658 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12379 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9659 verify([source]); | 12380 verify([source]); |
| 9660 } | 12381 } |
| 9661 void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromSuperclass() { | 12382 void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromSuperclass() { |
| 9662 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" set s(int i);", "}", "class C extends A {", "}"])); | 12383 Source source = addSource(EngineTestCase.createSource([ |
| 12384 "abstract class A {", |
| 12385 " set s(int i);", |
| 12386 "}", |
| 12387 "class C extends A {", |
| 12388 "}"])); |
| 9663 resolve(source); | 12389 resolve(source); |
| 9664 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12390 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9665 verify([source]); | 12391 verify([source]); |
| 9666 } | 12392 } |
| 9667 void test_nonAbstractClassInheritsAbstractMemberOne_superclasses_interface() { | 12393 void test_nonAbstractClassInheritsAbstractMemberOne_superclasses_interface() { |
| 9668 Source source = addSource(EngineTestCase.createSource(["class A {", " get a
=> 'a';", "}", "abstract class B implements A {", " get b => 'b';", "}", "clas
s C extends B {", "}"])); | 12394 Source source = addSource(EngineTestCase.createSource([ |
| 12395 "class A {", |
| 12396 " get a => 'a';", |
| 12397 "}", |
| 12398 "abstract class B implements A {", |
| 12399 " get b => 'b';", |
| 12400 "}", |
| 12401 "class C extends B {", |
| 12402 "}"])); |
| 9669 resolve(source); | 12403 resolve(source); |
| 9670 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); | 12404 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
ONE]); |
| 9671 verify([source]); | 12405 verify([source]); |
| 9672 } | 12406 } |
| 9673 void test_nonAbstractClassInheritsAbstractMemberThree() { | 12407 void test_nonAbstractClassInheritsAbstractMemberThree() { |
| 9674 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", " n();", " o();", "}", "class C extends A {", "}"])); | 12408 Source source = addSource(EngineTestCase.createSource([ |
| 12409 "abstract class A {", |
| 12410 " m();", |
| 12411 " n();", |
| 12412 " o();", |
| 12413 "}", |
| 12414 "class C extends A {", |
| 12415 "}"])); |
| 9675 resolve(source); | 12416 resolve(source); |
| 9676 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
THREE]); | 12417 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
THREE]); |
| 9677 verify([source]); | 12418 verify([source]); |
| 9678 } | 12419 } |
| 9679 void test_nonAbstractClassInheritsAbstractMemberTwo() { | 12420 void test_nonAbstractClassInheritsAbstractMemberTwo() { |
| 9680 Source source = addSource(EngineTestCase.createSource(["abstract class A {",
" m();", " n();", "}", "class C extends A {", "}"])); | 12421 Source source = addSource(EngineTestCase.createSource([ |
| 12422 "abstract class A {", |
| 12423 " m();", |
| 12424 " n();", |
| 12425 "}", |
| 12426 "class C extends A {", |
| 12427 "}"])); |
| 9681 resolve(source); | 12428 resolve(source); |
| 9682 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
TWO]); | 12429 assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_
TWO]); |
| 9683 verify([source]); | 12430 verify([source]); |
| 9684 } | 12431 } |
| 9685 void test_nonTypeInCatchClause_noElement() { | 12432 void test_nonTypeInCatchClause_noElement() { |
| 9686 Source source = addSource(EngineTestCase.createSource(["f() {", " try {", "
} on T catch (e) {", " }", "}"])); | 12433 Source source = addSource(EngineTestCase.createSource(["f() {", " try {", "
} on T catch (e) {", " }", "}"])); |
| 9687 resolve(source); | 12434 resolve(source); |
| 9688 assertErrors([StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); | 12435 assertErrors([StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); |
| 9689 verify([source]); | 12436 verify([source]); |
| 9690 } | 12437 } |
| 9691 void test_nonTypeInCatchClause_notType() { | 12438 void test_nonTypeInCatchClause_notType() { |
| 9692 Source source = addSource(EngineTestCase.createSource(["var T = 0;", "f() {"
, " try {", " } on T catch (e) {", " }", "}"])); | 12439 Source source = addSource(EngineTestCase.createSource([ |
| 12440 "var T = 0;", |
| 12441 "f() {", |
| 12442 " try {", |
| 12443 " } on T catch (e) {", |
| 12444 " }", |
| 12445 "}"])); |
| 9693 resolve(source); | 12446 resolve(source); |
| 9694 assertErrors([StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); | 12447 assertErrors([StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]); |
| 9695 verify([source]); | 12448 verify([source]); |
| 9696 } | 12449 } |
| 9697 void test_nonVoidReturnForOperator() { | 12450 void test_nonVoidReturnForOperator() { |
| 9698 Source source = addSource(EngineTestCase.createSource(["class A {", " int o
perator []=(a, b) {}", "}"])); | 12451 Source source = addSource(EngineTestCase.createSource(["class A {", " int o
perator []=(a, b) {}", "}"])); |
| 9699 resolve(source); | 12452 resolve(source); |
| 9700 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR]); | 12453 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR]); |
| 9701 verify([source]); | 12454 verify([source]); |
| 9702 } | 12455 } |
| 9703 void test_nonVoidReturnForSetter_function() { | 12456 void test_nonVoidReturnForSetter_function() { |
| 9704 Source source = addSource(EngineTestCase.createSource(["int set x(int v) {",
" return 42;", "}"])); | 12457 Source source = addSource(EngineTestCase.createSource(["int set x(int v) {",
" return 42;", "}"])); |
| 9705 resolve(source); | 12458 resolve(source); |
| 9706 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); | 12459 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); |
| 9707 verify([source]); | 12460 verify([source]); |
| 9708 } | 12461 } |
| 9709 void test_nonVoidReturnForSetter_method() { | 12462 void test_nonVoidReturnForSetter_method() { |
| 9710 Source source = addSource(EngineTestCase.createSource(["class A {", " int s
et x(int v) {", " return 42;", " }", "}"])); | 12463 Source source = addSource(EngineTestCase.createSource([ |
| 12464 "class A {", |
| 12465 " int set x(int v) {", |
| 12466 " return 42;", |
| 12467 " }", |
| 12468 "}"])); |
| 9711 resolve(source); | 12469 resolve(source); |
| 9712 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); | 12470 assertErrors([StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]); |
| 9713 verify([source]); | 12471 verify([source]); |
| 9714 } | 12472 } |
| 9715 void test_notAType() { | 12473 void test_notAType() { |
| 9716 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {",
" f v = null;", "}"])); | 12474 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {",
" f v = null;", "}"])); |
| 9717 resolve(source); | 12475 resolve(source); |
| 9718 assertErrors([StaticWarningCode.NOT_A_TYPE]); | 12476 assertErrors([StaticWarningCode.NOT_A_TYPE]); |
| 9719 verify([source]); | 12477 verify([source]); |
| 9720 } | 12478 } |
| 9721 void test_notEnoughRequiredArguments() { | 12479 void test_notEnoughRequiredArguments() { |
| 9722 Source source = addSource(EngineTestCase.createSource(["f(int a, String b) {
}", "main() {", " f();", "}"])); | 12480 Source source = addSource(EngineTestCase.createSource(["f(int a, String b) {
}", "main() {", " f();", "}"])); |
| 9723 resolve(source); | 12481 resolve(source); |
| 9724 assertErrors([StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); | 12482 assertErrors([StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); |
| 9725 verify([source]); | 12483 verify([source]); |
| 9726 } | 12484 } |
| 9727 void test_partOfDifferentLibrary() { | 12485 void test_partOfDifferentLibrary() { |
| 9728 Source source = addSource(EngineTestCase.createSource(["library lib;", "part
'part.dart';"])); | 12486 Source source = addSource(EngineTestCase.createSource(["library lib;", "part
'part.dart';"])); |
| 9729 addSource2("/part.dart", EngineTestCase.createSource(["part of lub;"])); | 12487 addSource2("/part.dart", EngineTestCase.createSource(["part of lub;"])); |
| 9730 resolve(source); | 12488 resolve(source); |
| 9731 assertErrors([StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]); | 12489 assertErrors([StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]); |
| 9732 verify([source]); | 12490 verify([source]); |
| 9733 } | 12491 } |
| 9734 void test_redirectToInvalidFunctionType() { | 12492 void test_redirectToInvalidFunctionType() { |
| 9735 Source source = addSource(EngineTestCase.createSource(["class A implements B
{", " A(int p) {}", "}", "class B {", " B() = A;", "}"])); | 12493 Source source = addSource(EngineTestCase.createSource([ |
| 12494 "class A implements B {", |
| 12495 " A(int p) {}", |
| 12496 "}", |
| 12497 "class B {", |
| 12498 " factory B() = A;", |
| 12499 "}"])); |
| 9736 resolve(source); | 12500 resolve(source); |
| 9737 assertErrors([StaticWarningCode.REDIRECT_TO_INVALID_FUNCTION_TYPE]); | 12501 assertErrors([StaticWarningCode.REDIRECT_TO_INVALID_FUNCTION_TYPE]); |
| 9738 verify([source]); | 12502 verify([source]); |
| 9739 } | 12503 } |
| 9740 void test_redirectToInvalidReturnType() { | 12504 void test_redirectToInvalidReturnType() { |
| 9741 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "class B {", " B() = A;", "}"])); | 12505 Source source = addSource(EngineTestCase.createSource([ |
| 12506 "class A {", |
| 12507 " A() {}", |
| 12508 "}", |
| 12509 "class B {", |
| 12510 " factory B() = A;", |
| 12511 "}"])); |
| 9742 resolve(source); | 12512 resolve(source); |
| 9743 assertErrors([StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE]); | 12513 assertErrors([StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE]); |
| 9744 verify([source]); | 12514 verify([source]); |
| 9745 } | 12515 } |
| 9746 void test_redirectToMissingConstructor_named() { | 12516 void test_redirectToMissingConstructor_named() { |
| 9747 Source source = addSource(EngineTestCase.createSource(["class A implements B
{", " A() {}", "}", "class B {", " B() = A.name;", "}"])); | 12517 Source source = addSource(EngineTestCase.createSource([ |
| 12518 "class A implements B{", |
| 12519 " A() {}", |
| 12520 "}", |
| 12521 "class B {", |
| 12522 " factory B() = A.name;", |
| 12523 "}"])); |
| 9748 resolve(source); | 12524 resolve(source); |
| 9749 assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); | 12525 assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); |
| 9750 } | 12526 } |
| 9751 void test_redirectToMissingConstructor_unnamed() { | 12527 void test_redirectToMissingConstructor_unnamed() { |
| 9752 Source source = addSource(EngineTestCase.createSource(["class A implements B
{", " A.name() {}", "}", "class B {", " B() = A;", "}"])); | 12528 Source source = addSource(EngineTestCase.createSource([ |
| 12529 "class A implements B{", |
| 12530 " A.name() {}", |
| 12531 "}", |
| 12532 "class B {", |
| 12533 " factory B() = A;", |
| 12534 "}"])); |
| 9753 resolve(source); | 12535 resolve(source); |
| 9754 assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); | 12536 assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]); |
| 9755 } | 12537 } |
| 9756 void test_redirectToNonClass_notAType() { | 12538 void test_redirectToNonClass_notAType() { |
| 9757 Source source = addSource(EngineTestCase.createSource(["class B {", " int A
;", " B() = A;", "}"])); | 12539 Source source = addSource(EngineTestCase.createSource(["class B {", " int A
;", " factory B() = A;", "}"])); |
| 9758 resolve(source); | 12540 resolve(source); |
| 9759 assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]); | 12541 assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]); |
| 9760 verify([source]); | 12542 verify([source]); |
| 9761 } | 12543 } |
| 9762 void test_redirectToNonClass_undefinedIdentifier() { | 12544 void test_redirectToNonClass_undefinedIdentifier() { |
| 9763 Source source = addSource(EngineTestCase.createSource(["class B {", " B() =
A;", "}"])); | 12545 Source source = addSource(EngineTestCase.createSource(["class B {", " facto
ry B() = A;", "}"])); |
| 9764 resolve(source); | 12546 resolve(source); |
| 9765 assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]); | 12547 assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]); |
| 9766 verify([source]); | 12548 verify([source]); |
| 9767 } | 12549 } |
| 9768 void test_returnWithoutValue() { | 12550 void test_returnWithoutValue() { |
| 9769 Source source = addSource(EngineTestCase.createSource(["int f() { return; }"
])); | 12551 Source source = addSource(EngineTestCase.createSource(["int f() { return; }"
])); |
| 9770 resolve(source); | 12552 resolve(source); |
| 9771 assertErrors([StaticWarningCode.RETURN_WITHOUT_VALUE]); | 12553 assertErrors([StaticWarningCode.RETURN_WITHOUT_VALUE]); |
| 9772 verify([source]); | 12554 verify([source]); |
| 9773 } | 12555 } |
| 9774 void test_staticAccessToInstanceMember_method_invocation() { | 12556 void test_staticAccessToInstanceMember_method_invocation() { |
| 9775 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "main() {", " A.m();", "}"])); | 12557 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "main() {", " A.m();", "}"])); |
| 9776 resolve(source); | 12558 resolve(source); |
| 9777 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); | 12559 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); |
| 9778 verify([source]); | 12560 verify([source]); |
| 9779 } | 12561 } |
| 9780 void test_staticAccessToInstanceMember_method_reference() { | 12562 void test_staticAccessToInstanceMember_method_reference() { |
| 9781 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "main() {", " A.m;", "}"])); | 12563 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", "}", "main() {", " A.m;", "}"])); |
| 9782 resolve(source); | 12564 resolve(source); |
| 9783 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); | 12565 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); |
| 9784 verify([source]); | 12566 verify([source]); |
| 9785 } | 12567 } |
| 9786 void test_staticAccessToInstanceMember_propertyAccess_field() { | 12568 void test_staticAccessToInstanceMember_propertyAccess_field() { |
| 9787 Source source = addSource(EngineTestCase.createSource(["class A {", " var f
;", "}", "main() {", " A.f;", "}"])); | 12569 Source source = addSource(EngineTestCase.createSource(["class A {", " var f
;", "}", "main() {", " A.f;", "}"])); |
| 9788 resolve(source); | 12570 resolve(source); |
| 9789 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); | 12571 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); |
| 9790 verify([source]); | 12572 verify([source]); |
| 9791 } | 12573 } |
| 9792 void test_staticAccessToInstanceMember_propertyAccess_getter() { | 12574 void test_staticAccessToInstanceMember_propertyAccess_getter() { |
| 9793 Source source = addSource(EngineTestCase.createSource(["class A {", " get f
=> 42;", "}", "main() {", " A.f;", "}"])); | 12575 Source source = addSource(EngineTestCase.createSource([ |
| 12576 "class A {", |
| 12577 " get f => 42;", |
| 12578 "}", |
| 12579 "main() {", |
| 12580 " A.f;", |
| 12581 "}"])); |
| 9794 resolve(source); | 12582 resolve(source); |
| 9795 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); | 12583 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); |
| 9796 verify([source]); | 12584 verify([source]); |
| 9797 } | 12585 } |
| 9798 void test_staticAccessToInstanceMember_propertyAccess_setter() { | 12586 void test_staticAccessToInstanceMember_propertyAccess_setter() { |
| 9799 Source source = addSource(EngineTestCase.createSource(["class A {", " set f
(x) {}", "}", "main() {", " A.f = 42;", "}"])); | 12587 Source source = addSource(EngineTestCase.createSource([ |
| 12588 "class A {", |
| 12589 " set f(x) {}", |
| 12590 "}", |
| 12591 "main() {", |
| 12592 " A.f = 42;", |
| 12593 "}"])); |
| 9800 resolve(source); | 12594 resolve(source); |
| 9801 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); | 12595 assertErrors([StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]); |
| 9802 verify([source]); | 12596 verify([source]); |
| 9803 } | 12597 } |
| 9804 void test_switchExpressionNotAssignable() { | 12598 void test_switchExpressionNotAssignable() { |
| 9805 Source source = addSource(EngineTestCase.createSource(["f(int p) {", " swit
ch (p) {", " case 'a': break;", " }", "}"])); | 12599 Source source = addSource(EngineTestCase.createSource([ |
| 12600 "f(int p) {", |
| 12601 " switch (p) {", |
| 12602 " case 'a': break;", |
| 12603 " }", |
| 12604 "}"])); |
| 9806 resolve(source); | 12605 resolve(source); |
| 9807 assertErrors([StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]); | 12606 assertErrors([StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]); |
| 9808 verify([source]); | 12607 verify([source]); |
| 9809 } | 12608 } |
| 9810 void test_typeParameterReferencedByStatic_field() { | 12609 void test_typeParameterReferencedByStatic_field() { |
| 9811 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic K k;", "}"])); | 12610 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic K k;", "}"])); |
| 9812 resolve(source); | 12611 resolve(source); |
| 9813 assertErrors([StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]); | 12612 assertErrors([StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]); |
| 9814 verify([source]); | 12613 verify([source]); |
| 9815 } | 12614 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9859 resolve(source); | 12658 resolve(source); |
| 9860 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); | 12659 assertErrors([StaticWarningCode.UNDEFINED_CLASS]); |
| 9861 } | 12660 } |
| 9862 void test_undefinedClassBoolean_variableDeclaration() { | 12661 void test_undefinedClassBoolean_variableDeclaration() { |
| 9863 Source source = addSource(EngineTestCase.createSource(["f() { boolean v; }"]
)); | 12662 Source source = addSource(EngineTestCase.createSource(["f() { boolean v; }"]
)); |
| 9864 resolve(source); | 12663 resolve(source); |
| 9865 assertErrors([StaticWarningCode.UNDEFINED_CLASS_BOOLEAN]); | 12664 assertErrors([StaticWarningCode.UNDEFINED_CLASS_BOOLEAN]); |
| 9866 } | 12665 } |
| 9867 void test_undefinedGetter_fromLibrary() { | 12666 void test_undefinedGetter_fromLibrary() { |
| 9868 Source source1 = addSource2("lib.dart", ""); | 12667 Source source1 = addSource2("lib.dart", ""); |
| 9869 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource(["impor
t 'lib.dart' as lib;", "void f() {", " var g = lib.gg;", "}"])); | 12668 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([ |
| 12669 "import 'lib.dart' as lib;", |
| 12670 "void f() {", |
| 12671 " var g = lib.gg;", |
| 12672 "}"])); |
| 9870 resolve(source1); | 12673 resolve(source1); |
| 9871 resolve(source2); | 12674 resolve(source2); |
| 9872 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); | 12675 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); |
| 9873 verify([source1]); | 12676 verify([source1]); |
| 9874 } | 12677 } |
| 9875 void test_undefinedIdentifier_initializer() { | 12678 void test_undefinedIdentifier_initializer() { |
| 9876 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); | 12679 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); |
| 9877 resolve(source); | 12680 resolve(source); |
| 9878 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 12681 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 9879 } | 12682 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9995 runJUnitTest(__test, __test.test_assignmentToFinal_suffixMinusMinus); | 12798 runJUnitTest(__test, __test.test_assignmentToFinal_suffixMinusMinus); |
| 9996 }); | 12799 }); |
| 9997 _ut.test('test_assignmentToFinal_suffixPlusPlus', () { | 12800 _ut.test('test_assignmentToFinal_suffixPlusPlus', () { |
| 9998 final __test = new StaticWarningCodeTest(); | 12801 final __test = new StaticWarningCodeTest(); |
| 9999 runJUnitTest(__test, __test.test_assignmentToFinal_suffixPlusPlus); | 12802 runJUnitTest(__test, __test.test_assignmentToFinal_suffixPlusPlus); |
| 10000 }); | 12803 }); |
| 10001 _ut.test('test_assignmentToFinal_topLevelVariable', () { | 12804 _ut.test('test_assignmentToFinal_topLevelVariable', () { |
| 10002 final __test = new StaticWarningCodeTest(); | 12805 final __test = new StaticWarningCodeTest(); |
| 10003 runJUnitTest(__test, __test.test_assignmentToFinal_topLevelVariable); | 12806 runJUnitTest(__test, __test.test_assignmentToFinal_topLevelVariable); |
| 10004 }); | 12807 }); |
| 12808 _ut.test('test_assignmentToMethod', () { |
| 12809 final __test = new StaticWarningCodeTest(); |
| 12810 runJUnitTest(__test, __test.test_assignmentToMethod); |
| 12811 }); |
| 10005 _ut.test('test_caseBlockNotTerminated', () { | 12812 _ut.test('test_caseBlockNotTerminated', () { |
| 10006 final __test = new StaticWarningCodeTest(); | 12813 final __test = new StaticWarningCodeTest(); |
| 10007 runJUnitTest(__test, __test.test_caseBlockNotTerminated); | 12814 runJUnitTest(__test, __test.test_caseBlockNotTerminated); |
| 10008 }); | 12815 }); |
| 10009 _ut.test('test_castToNonType', () { | 12816 _ut.test('test_castToNonType', () { |
| 10010 final __test = new StaticWarningCodeTest(); | 12817 final __test = new StaticWarningCodeTest(); |
| 10011 runJUnitTest(__test, __test.test_castToNonType); | 12818 runJUnitTest(__test, __test.test_castToNonType); |
| 10012 }); | 12819 }); |
| 10013 _ut.test('test_concreteClassWithAbstractMember', () { | 12820 _ut.test('test_concreteClassWithAbstractMember', () { |
| 10014 final __test = new StaticWarningCodeTest(); | 12821 final __test = new StaticWarningCodeTest(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10079 runJUnitTest(__test, __test.test_extraPositionalArguments); | 12886 runJUnitTest(__test, __test.test_extraPositionalArguments); |
| 10080 }); | 12887 }); |
| 10081 _ut.test('test_fieldInitializerNotAssignable', () { | 12888 _ut.test('test_fieldInitializerNotAssignable', () { |
| 10082 final __test = new StaticWarningCodeTest(); | 12889 final __test = new StaticWarningCodeTest(); |
| 10083 runJUnitTest(__test, __test.test_fieldInitializerNotAssignable); | 12890 runJUnitTest(__test, __test.test_fieldInitializerNotAssignable); |
| 10084 }); | 12891 }); |
| 10085 _ut.test('test_fieldInitializingFormalNotAssignable', () { | 12892 _ut.test('test_fieldInitializingFormalNotAssignable', () { |
| 10086 final __test = new StaticWarningCodeTest(); | 12893 final __test = new StaticWarningCodeTest(); |
| 10087 runJUnitTest(__test, __test.test_fieldInitializingFormalNotAssignable); | 12894 runJUnitTest(__test, __test.test_fieldInitializingFormalNotAssignable); |
| 10088 }); | 12895 }); |
| 12896 _ut.test('test_finalNotInitialized_inConstructor', () { |
| 12897 final __test = new StaticWarningCodeTest(); |
| 12898 runJUnitTest(__test, __test.test_finalNotInitialized_inConstructor); |
| 12899 }); |
| 10089 _ut.test('test_finalNotInitialized_instanceField_const_static', () { | 12900 _ut.test('test_finalNotInitialized_instanceField_const_static', () { |
| 10090 final __test = new StaticWarningCodeTest(); | 12901 final __test = new StaticWarningCodeTest(); |
| 10091 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_const
_static); | 12902 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_const
_static); |
| 10092 }); | 12903 }); |
| 10093 _ut.test('test_finalNotInitialized_instanceField_final', () { | 12904 _ut.test('test_finalNotInitialized_instanceField_final', () { |
| 10094 final __test = new StaticWarningCodeTest(); | 12905 final __test = new StaticWarningCodeTest(); |
| 10095 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final
); | 12906 runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final
); |
| 10096 }); | 12907 }); |
| 10097 _ut.test('test_finalNotInitialized_instanceField_final_static', () { | 12908 _ut.test('test_finalNotInitialized_instanceField_final_static', () { |
| 10098 final __test = new StaticWarningCodeTest(); | 12909 final __test = new StaticWarningCodeTest(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10151 runJUnitTest(__test, __test.test_instanceMethodNameCollidesWithSuperclas
sStatic_setter); | 12962 runJUnitTest(__test, __test.test_instanceMethodNameCollidesWithSuperclas
sStatic_setter); |
| 10152 }); | 12963 }); |
| 10153 _ut.test('test_instanceMethodNameCollidesWithSuperclassStatic_setter2', ()
{ | 12964 _ut.test('test_instanceMethodNameCollidesWithSuperclassStatic_setter2', ()
{ |
| 10154 final __test = new StaticWarningCodeTest(); | 12965 final __test = new StaticWarningCodeTest(); |
| 10155 runJUnitTest(__test, __test.test_instanceMethodNameCollidesWithSuperclas
sStatic_setter2); | 12966 runJUnitTest(__test, __test.test_instanceMethodNameCollidesWithSuperclas
sStatic_setter2); |
| 10156 }); | 12967 }); |
| 10157 _ut.test('test_invalidGetterOverrideReturnType', () { | 12968 _ut.test('test_invalidGetterOverrideReturnType', () { |
| 10158 final __test = new StaticWarningCodeTest(); | 12969 final __test = new StaticWarningCodeTest(); |
| 10159 runJUnitTest(__test, __test.test_invalidGetterOverrideReturnType); | 12970 runJUnitTest(__test, __test.test_invalidGetterOverrideReturnType); |
| 10160 }); | 12971 }); |
| 12972 _ut.test('test_invalidGetterOverrideReturnType_implicit', () { |
| 12973 final __test = new StaticWarningCodeTest(); |
| 12974 runJUnitTest(__test, __test.test_invalidGetterOverrideReturnType_implici
t); |
| 12975 }); |
| 10161 _ut.test('test_invalidMethodOverrideNamedParamType', () { | 12976 _ut.test('test_invalidMethodOverrideNamedParamType', () { |
| 10162 final __test = new StaticWarningCodeTest(); | 12977 final __test = new StaticWarningCodeTest(); |
| 10163 runJUnitTest(__test, __test.test_invalidMethodOverrideNamedParamType); | 12978 runJUnitTest(__test, __test.test_invalidMethodOverrideNamedParamType); |
| 10164 }); | 12979 }); |
| 10165 _ut.test('test_invalidMethodOverrideNormalParamType', () { | 12980 _ut.test('test_invalidMethodOverrideNormalParamType', () { |
| 10166 final __test = new StaticWarningCodeTest(); | 12981 final __test = new StaticWarningCodeTest(); |
| 10167 runJUnitTest(__test, __test.test_invalidMethodOverrideNormalParamType); | 12982 runJUnitTest(__test, __test.test_invalidMethodOverrideNormalParamType); |
| 10168 }); | 12983 }); |
| 10169 _ut.test('test_invalidMethodOverrideOptionalParamType', () { | 12984 _ut.test('test_invalidMethodOverrideOptionalParamType', () { |
| 10170 final __test = new StaticWarningCodeTest(); | 12985 final __test = new StaticWarningCodeTest(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 10199 runJUnitTest(__test, __test.test_invalidOverrideDifferentDefaultValues_n
amed); | 13014 runJUnitTest(__test, __test.test_invalidOverrideDifferentDefaultValues_n
amed); |
| 10200 }); | 13015 }); |
| 10201 _ut.test('test_invalidOverrideDifferentDefaultValues_positional', () { | 13016 _ut.test('test_invalidOverrideDifferentDefaultValues_positional', () { |
| 10202 final __test = new StaticWarningCodeTest(); | 13017 final __test = new StaticWarningCodeTest(); |
| 10203 runJUnitTest(__test, __test.test_invalidOverrideDifferentDefaultValues_p
ositional); | 13018 runJUnitTest(__test, __test.test_invalidOverrideDifferentDefaultValues_p
ositional); |
| 10204 }); | 13019 }); |
| 10205 _ut.test('test_invalidSetterOverrideNormalParamType', () { | 13020 _ut.test('test_invalidSetterOverrideNormalParamType', () { |
| 10206 final __test = new StaticWarningCodeTest(); | 13021 final __test = new StaticWarningCodeTest(); |
| 10207 runJUnitTest(__test, __test.test_invalidSetterOverrideNormalParamType); | 13022 runJUnitTest(__test, __test.test_invalidSetterOverrideNormalParamType); |
| 10208 }); | 13023 }); |
| 13024 _ut.test('test_listElementTypeNotAssignable', () { |
| 13025 final __test = new StaticWarningCodeTest(); |
| 13026 runJUnitTest(__test, __test.test_listElementTypeNotAssignable); |
| 13027 }); |
| 13028 _ut.test('test_mapKeyTypeNotAssignable', () { |
| 13029 final __test = new StaticWarningCodeTest(); |
| 13030 runJUnitTest(__test, __test.test_mapKeyTypeNotAssignable); |
| 13031 }); |
| 13032 _ut.test('test_mapValueTypeNotAssignable', () { |
| 13033 final __test = new StaticWarningCodeTest(); |
| 13034 runJUnitTest(__test, __test.test_mapValueTypeNotAssignable); |
| 13035 }); |
| 10209 _ut.test('test_mismatchedAccessorTypes_class', () { | 13036 _ut.test('test_mismatchedAccessorTypes_class', () { |
| 10210 final __test = new StaticWarningCodeTest(); | 13037 final __test = new StaticWarningCodeTest(); |
| 10211 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_class); | 13038 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_class); |
| 10212 }); | 13039 }); |
| 10213 _ut.test('test_mismatchedAccessorTypes_topLevel', () { | 13040 _ut.test('test_mismatchedAccessorTypes_topLevel', () { |
| 10214 final __test = new StaticWarningCodeTest(); | 13041 final __test = new StaticWarningCodeTest(); |
| 10215 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_topLevel); | 13042 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_topLevel); |
| 10216 }); | 13043 }); |
| 10217 _ut.test('test_newWithAbstractClass', () { | 13044 _ut.test('test_newWithAbstractClass', () { |
| 10218 final __test = new StaticWarningCodeTest(); | 13045 final __test = new StaticWarningCodeTest(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10424 }); | 13251 }); |
| 10425 _ut.test('test_undefinedNamedParameter', () { | 13252 _ut.test('test_undefinedNamedParameter', () { |
| 10426 final __test = new StaticWarningCodeTest(); | 13253 final __test = new StaticWarningCodeTest(); |
| 10427 runJUnitTest(__test, __test.test_undefinedNamedParameter); | 13254 runJUnitTest(__test, __test.test_undefinedNamedParameter); |
| 10428 }); | 13255 }); |
| 10429 }); | 13256 }); |
| 10430 } | 13257 } |
| 10431 } | 13258 } |
| 10432 class ErrorResolverTest extends ResolverTestCase { | 13259 class ErrorResolverTest extends ResolverTestCase { |
| 10433 void test_breakLabelOnSwitchMember() { | 13260 void test_breakLabelOnSwitchMember() { |
| 10434 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m(int i) {", " switch (i) {", " l: case 0:", " break;", " ca
se 1:", " break l;", " }", " }", "}"])); | 13261 Source source = addSource(EngineTestCase.createSource([ |
| 13262 "class A {", |
| 13263 " void m(int i) {", |
| 13264 " switch (i) {", |
| 13265 " l: case 0:", |
| 13266 " break;", |
| 13267 " case 1:", |
| 13268 " break l;", |
| 13269 " }", |
| 13270 " }", |
| 13271 "}"])); |
| 10435 resolve(source); | 13272 resolve(source); |
| 10436 assertErrors([ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER]); | 13273 assertErrors([ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER]); |
| 10437 verify([source]); | 13274 verify([source]); |
| 10438 } | 13275 } |
| 10439 void test_continueLabelOnSwitch() { | 13276 void test_continueLabelOnSwitch() { |
| 10440 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m(int i) {", " l: switch (i) {", " case 0:", " continue l;", "
}", " }", "}"])); | 13277 Source source = addSource(EngineTestCase.createSource([ |
| 13278 "class A {", |
| 13279 " void m(int i) {", |
| 13280 " l: switch (i) {", |
| 13281 " case 0:", |
| 13282 " continue l;", |
| 13283 " }", |
| 13284 " }", |
| 13285 "}"])); |
| 10441 resolve(source); | 13286 resolve(source); |
| 10442 assertErrors([ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH]); | 13287 assertErrors([ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH]); |
| 10443 verify([source]); | 13288 verify([source]); |
| 10444 } | 13289 } |
| 10445 static dartSuite() { | 13290 static dartSuite() { |
| 10446 _ut.group('ErrorResolverTest', () { | 13291 _ut.group('ErrorResolverTest', () { |
| 10447 _ut.test('test_breakLabelOnSwitchMember', () { | 13292 _ut.test('test_breakLabelOnSwitchMember', () { |
| 10448 final __test = new ErrorResolverTest(); | 13293 final __test = new ErrorResolverTest(); |
| 10449 runJUnitTest(__test, __test.test_breakLabelOnSwitchMember); | 13294 runJUnitTest(__test, __test.test_breakLabelOnSwitchMember); |
| 10450 }); | 13295 }); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10574 if (_intType == null) { | 13419 if (_intType == null) { |
| 10575 initializeNumericTypes(); | 13420 initializeNumericTypes(); |
| 10576 } | 13421 } |
| 10577 return _intType; | 13422 return _intType; |
| 10578 } | 13423 } |
| 10579 InterfaceType get iterableType { | 13424 InterfaceType get iterableType { |
| 10580 if (_iterableType == null) { | 13425 if (_iterableType == null) { |
| 10581 ClassElementImpl iterableElement = ElementFactory.classElement2("Iterable"
, ["E"]); | 13426 ClassElementImpl iterableElement = ElementFactory.classElement2("Iterable"
, ["E"]); |
| 10582 _iterableType = iterableElement.type; | 13427 _iterableType = iterableElement.type; |
| 10583 Type2 eType = iterableElement.typeVariables[0].type; | 13428 Type2 eType = iterableElement.typeVariables[0].type; |
| 10584 iterableElement.accessors = <PropertyAccessorElement> [ElementFactory.gett
erElement("iterator", false, iteratorType.substitute4(<Type2> [eType])), Element
Factory.getterElement("last", false, eType)]; | 13429 iterableElement.accessors = <PropertyAccessorElement> [ |
| 13430 ElementFactory.getterElement("iterator", false, iteratorType.substitut
e4(<Type2> [eType])), |
| 13431 ElementFactory.getterElement("last", false, eType)]; |
| 10585 propagateTypeArguments(iterableElement); | 13432 propagateTypeArguments(iterableElement); |
| 10586 } | 13433 } |
| 10587 return _iterableType; | 13434 return _iterableType; |
| 10588 } | 13435 } |
| 10589 InterfaceType get iteratorType { | 13436 InterfaceType get iteratorType { |
| 10590 if (_iteratorType == null) { | 13437 if (_iteratorType == null) { |
| 10591 ClassElementImpl iteratorElement = ElementFactory.classElement2("Iterator"
, ["E"]); | 13438 ClassElementImpl iteratorElement = ElementFactory.classElement2("Iterator"
, ["E"]); |
| 10592 _iteratorType = iteratorElement.type; | 13439 _iteratorType = iteratorElement.type; |
| 10593 Type2 eType = iteratorElement.typeVariables[0].type; | 13440 Type2 eType = iteratorElement.typeVariables[0].type; |
| 10594 iteratorElement.accessors = <PropertyAccessorElement> [ElementFactory.gett
erElement("current", false, eType)]; | 13441 iteratorElement.accessors = <PropertyAccessorElement> [ElementFactory.gett
erElement("current", false, eType)]; |
| 10595 propagateTypeArguments(iteratorElement); | 13442 propagateTypeArguments(iteratorElement); |
| 10596 } | 13443 } |
| 10597 return _iteratorType; | 13444 return _iteratorType; |
| 10598 } | 13445 } |
| 10599 InterfaceType get listType { | 13446 InterfaceType get listType { |
| 10600 if (_listType == null) { | 13447 if (_listType == null) { |
| 10601 ClassElementImpl listElement = ElementFactory.classElement2("List", ["E"])
; | 13448 ClassElementImpl listElement = ElementFactory.classElement2("List", ["E"])
; |
| 10602 listElement.constructors = <ConstructorElement> [ElementFactory.constructo
rElement(listElement, null)]; | 13449 listElement.constructors = <ConstructorElement> [ElementFactory.constructo
rElement(listElement, null)]; |
| 10603 _listType = listElement.type; | 13450 _listType = listElement.type; |
| 10604 Type2 eType = listElement.typeVariables[0].type; | 13451 Type2 eType = listElement.typeVariables[0].type; |
| 10605 InterfaceType iterableType = this.iterableType.substitute4(<Type2> [eType]
); | 13452 InterfaceType iterableType = this.iterableType.substitute4(<Type2> [eType]
); |
| 10606 listElement.interfaces = <InterfaceType> [iterableType]; | 13453 listElement.interfaces = <InterfaceType> [iterableType]; |
| 10607 listElement.accessors = <PropertyAccessorElement> [ElementFactory.getterEl
ement("length", false, intType)]; | 13454 listElement.accessors = <PropertyAccessorElement> [ElementFactory.getterEl
ement("length", false, intType)]; |
| 10608 listElement.methods = <MethodElement> [ElementFactory.methodElement("[]",
eType, [intType]), ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [i
ntType, eType]), ElementFactory.methodElement("add", VoidTypeImpl.instance, [eTy
pe])]; | 13455 listElement.methods = <MethodElement> [ |
| 13456 ElementFactory.methodElement("[]", eType, [intType]), |
| 13457 ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [intType, e
Type]), |
| 13458 ElementFactory.methodElement("add", VoidTypeImpl.instance, [eType])]; |
| 10609 propagateTypeArguments(listElement); | 13459 propagateTypeArguments(listElement); |
| 10610 } | 13460 } |
| 10611 return _listType; | 13461 return _listType; |
| 10612 } | 13462 } |
| 10613 InterfaceType get mapType { | 13463 InterfaceType get mapType { |
| 10614 if (_mapType == null) { | 13464 if (_mapType == null) { |
| 10615 ClassElementImpl mapElement = ElementFactory.classElement2("Map", ["K", "V
"]); | 13465 ClassElementImpl mapElement = ElementFactory.classElement2("Map", ["K", "V
"]); |
| 10616 _mapType = mapElement.type; | 13466 _mapType = mapElement.type; |
| 10617 mapElement.accessors = <PropertyAccessorElement> [ElementFactory.getterEle
ment("length", false, intType)]; | 13467 mapElement.accessors = <PropertyAccessorElement> [ElementFactory.getterEle
ment("length", false, intType)]; |
| 10618 propagateTypeArguments(mapElement); | 13468 propagateTypeArguments(mapElement); |
| 10619 } | 13469 } |
| 10620 return _mapType; | 13470 return _mapType; |
| 10621 } | 13471 } |
| 10622 InterfaceType get numType { | 13472 InterfaceType get numType { |
| 10623 if (_numType == null) { | 13473 if (_numType == null) { |
| 10624 initializeNumericTypes(); | 13474 initializeNumericTypes(); |
| 10625 } | 13475 } |
| 10626 return _numType; | 13476 return _numType; |
| 10627 } | 13477 } |
| 10628 InterfaceType get objectType { | 13478 InterfaceType get objectType { |
| 10629 if (_objectType == null) { | 13479 if (_objectType == null) { |
| 10630 ClassElementImpl objectElement = ElementFactory.object; | 13480 ClassElementImpl objectElement = ElementFactory.object; |
| 10631 _objectType = objectElement.type; | 13481 _objectType = objectElement.type; |
| 10632 if (objectElement.methods.length == 0) { | 13482 if (objectElement.methods.length == 0) { |
| 10633 objectElement.constructors = <ConstructorElement> [ElementFactory.constr
uctorElement(objectElement, null)]; | 13483 objectElement.constructors = <ConstructorElement> [ElementFactory.constr
uctorElement(objectElement, null)]; |
| 10634 objectElement.methods = <MethodElement> [ElementFactory.methodElement("t
oString", stringType, []), ElementFactory.methodElement("==", boolType, [_object
Type]), ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicType])
]; | 13484 objectElement.methods = <MethodElement> [ |
| 10635 objectElement.accessors = <PropertyAccessorElement> [ElementFactory.gett
erElement("hashCode", false, intType), ElementFactory.getterElement("runtimeType
", false, typeType)]; | 13485 ElementFactory.methodElement("toString", stringType, []), |
| 13486 ElementFactory.methodElement("==", boolType, [_objectType]), |
| 13487 ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicTy
pe])]; |
| 13488 objectElement.accessors = <PropertyAccessorElement> [ |
| 13489 ElementFactory.getterElement("hashCode", false, intType), |
| 13490 ElementFactory.getterElement("runtimeType", false, typeType)]; |
| 10636 } | 13491 } |
| 10637 } | 13492 } |
| 10638 return _objectType; | 13493 return _objectType; |
| 10639 } | 13494 } |
| 10640 InterfaceType get stackTraceType { | 13495 InterfaceType get stackTraceType { |
| 10641 if (_stackTraceType == null) { | 13496 if (_stackTraceType == null) { |
| 10642 _stackTraceType = ElementFactory.classElement2("StackTrace", []).type; | 13497 _stackTraceType = ElementFactory.classElement2("StackTrace", []).type; |
| 10643 } | 13498 } |
| 10644 return _stackTraceType; | 13499 return _stackTraceType; |
| 10645 } | 13500 } |
| 10646 InterfaceType get stringType { | 13501 InterfaceType get stringType { |
| 10647 if (_stringType == null) { | 13502 if (_stringType == null) { |
| 10648 _stringType = ElementFactory.classElement2("String", []).type; | 13503 _stringType = ElementFactory.classElement2("String", []).type; |
| 10649 ClassElementImpl stringElement = _stringType.element as ClassElementImpl; | 13504 ClassElementImpl stringElement = _stringType.element as ClassElementImpl; |
| 10650 stringElement.accessors = <PropertyAccessorElement> [ElementFactory.getter
Element("isEmpty", false, boolType), ElementFactory.getterElement("length", fals
e, intType), ElementFactory.getterElement("codeUnits", false, listType.substitut
e4(<Type2> [intType]))]; | 13505 stringElement.accessors = <PropertyAccessorElement> [ |
| 10651 stringElement.methods = <MethodElement> [ElementFactory.methodElement("toL
owerCase", _stringType, []), ElementFactory.methodElement("toUpperCase", _string
Type, [])]; | 13506 ElementFactory.getterElement("isEmpty", false, boolType), |
| 13507 ElementFactory.getterElement("length", false, intType), |
| 13508 ElementFactory.getterElement("codeUnits", false, listType.substitute4(
<Type2> [intType]))]; |
| 13509 stringElement.methods = <MethodElement> [ |
| 13510 ElementFactory.methodElement("+", _stringType, [_stringType]), |
| 13511 ElementFactory.methodElement("toLowerCase", _stringType, []), |
| 13512 ElementFactory.methodElement("toUpperCase", _stringType, [])]; |
| 10652 } | 13513 } |
| 10653 return _stringType; | 13514 return _stringType; |
| 10654 } | 13515 } |
| 10655 InterfaceType get symbolType { | 13516 InterfaceType get symbolType { |
| 10656 if (_symbolType == null) { | 13517 if (_symbolType == null) { |
| 10657 _symbolType = ElementFactory.classElement2("Symbol", []).type; | 13518 _symbolType = ElementFactory.classElement2("Symbol", []).type; |
| 10658 } | 13519 } |
| 10659 return _symbolType; | 13520 return _symbolType; |
| 10660 } | 13521 } |
| 10661 InterfaceType get typeType { | 13522 InterfaceType get typeType { |
| 10662 if (_typeType == null) { | 13523 if (_typeType == null) { |
| 10663 _typeType = ElementFactory.classElement2("Type", []).type; | 13524 _typeType = ElementFactory.classElement2("Type", []).type; |
| 10664 } | 13525 } |
| 10665 return _typeType; | 13526 return _typeType; |
| 10666 } | 13527 } |
| 10667 | 13528 |
| 10668 /** | 13529 /** |
| 10669 * Initialize the numeric types. They are created as a group so that we can (a
) create the right | 13530 * Initialize the numeric types. They are created as a group so that we can (a
) create the right |
| 10670 * hierarchy and (b) add members to them. | 13531 * hierarchy and (b) add members to them. |
| 10671 */ | 13532 */ |
| 10672 void initializeNumericTypes() { | 13533 void initializeNumericTypes() { |
| 10673 ClassElementImpl numElement = ElementFactory.classElement2("num", []); | 13534 ClassElementImpl numElement = ElementFactory.classElement2("num", []); |
| 10674 _numType = numElement.type; | 13535 _numType = numElement.type; |
| 10675 ClassElementImpl intElement = ElementFactory.classElement("int", _numType, [
]); | 13536 ClassElementImpl intElement = ElementFactory.classElement("int", _numType, [
]); |
| 10676 _intType = intElement.type; | 13537 _intType = intElement.type; |
| 10677 ClassElementImpl doubleElement = ElementFactory.classElement("double", _numT
ype, []); | 13538 ClassElementImpl doubleElement = ElementFactory.classElement("double", _numT
ype, []); |
| 10678 _doubleType = doubleElement.type; | 13539 _doubleType = doubleElement.type; |
| 10679 boolType; | 13540 boolType; |
| 10680 stringType; | 13541 stringType; |
| 10681 numElement.methods = <MethodElement> [ElementFactory.methodElement("+", _num
Type, [_numType]), ElementFactory.methodElement("-", _numType, [_numType]), Elem
entFactory.methodElement("*", _numType, [_numType]), ElementFactory.methodElemen
t("%", _numType, [_numType]), ElementFactory.methodElement("/", _doubleType, [_n
umType]), ElementFactory.methodElement("~/", _numType, [_numType]), ElementFacto
ry.methodElement("-", _numType, []), ElementFactory.methodElement("remainder", _
numType, [_numType]), ElementFactory.methodElement("<", _boolType, [_numType]),
ElementFactory.methodElement("<=", _boolType, [_numType]), ElementFactory.method
Element(">", _boolType, [_numType]), ElementFactory.methodElement(">=", _boolTyp
e, [_numType]), ElementFactory.methodElement("isNaN", _boolType, []), ElementFac
tory.methodElement("isNegative", _boolType, []), ElementFactory.methodElement("i
sInfinite", _boolType, []), ElementFactory.methodElement("abs", _numType, []), E
lementFactory.methodElement("floor", _numType, []), ElementFactory.methodElement
("ceil", _numType, []), ElementFactory.methodElement("round", _numType, []), Ele
mentFactory.methodElement("truncate", _numType, []), ElementFactory.methodElemen
t("toInt", _intType, []), ElementFactory.methodElement("toDouble", _doubleType,
[]), ElementFactory.methodElement("toStringAsFixed", _stringType, [_intType]), E
lementFactory.methodElement("toStringAsExponential", _stringType, [_intType]), E
lementFactory.methodElement("toStringAsPrecision", _stringType, [_intType]), Ele
mentFactory.methodElement("toRadixString", _stringType, [_intType])]; | 13542 numElement.methods = <MethodElement> [ |
| 10682 intElement.methods = <MethodElement> [ElementFactory.methodElement("&", _int
Type, [_intType]), ElementFactory.methodElement("|", _intType, [_intType]), Elem
entFactory.methodElement("^", _intType, [_intType]), ElementFactory.methodElemen
t("~", _intType, []), ElementFactory.methodElement("<<", _intType, [_intType]),
ElementFactory.methodElement(">>", _intType, [_intType]), ElementFactory.methodE
lement("-", _intType, []), ElementFactory.methodElement("abs", _intType, []), El
ementFactory.methodElement("round", _intType, []), ElementFactory.methodElement(
"floor", _intType, []), ElementFactory.methodElement("ceil", _intType, []), Elem
entFactory.methodElement("truncate", _intType, []), ElementFactory.methodElement
("toString", _stringType, [])]; | 13543 ElementFactory.methodElement("+", _numType, [_numType]), |
| 10683 List<FieldElement> fields = <FieldElement> [ElementFactory.fieldElement("NAN
", true, false, true, _doubleType), ElementFactory.fieldElement("INFINITY", true
, false, true, _doubleType), ElementFactory.fieldElement("NEGATIVE_INFINITY", tr
ue, false, true, _doubleType), ElementFactory.fieldElement("MIN_POSITIVE", true,
false, true, _doubleType), ElementFactory.fieldElement("MAX_FINITE", true, fals
e, true, _doubleType)]; | 13544 ElementFactory.methodElement("-", _numType, [_numType]), |
| 13545 ElementFactory.methodElement("*", _numType, [_numType]), |
| 13546 ElementFactory.methodElement("%", _numType, [_numType]), |
| 13547 ElementFactory.methodElement("/", _doubleType, [_numType]), |
| 13548 ElementFactory.methodElement("~/", _numType, [_numType]), |
| 13549 ElementFactory.methodElement("-", _numType, []), |
| 13550 ElementFactory.methodElement("remainder", _numType, [_numType]), |
| 13551 ElementFactory.methodElement("<", _boolType, [_numType]), |
| 13552 ElementFactory.methodElement("<=", _boolType, [_numType]), |
| 13553 ElementFactory.methodElement(">", _boolType, [_numType]), |
| 13554 ElementFactory.methodElement(">=", _boolType, [_numType]), |
| 13555 ElementFactory.methodElement("isNaN", _boolType, []), |
| 13556 ElementFactory.methodElement("isNegative", _boolType, []), |
| 13557 ElementFactory.methodElement("isInfinite", _boolType, []), |
| 13558 ElementFactory.methodElement("abs", _numType, []), |
| 13559 ElementFactory.methodElement("floor", _numType, []), |
| 13560 ElementFactory.methodElement("ceil", _numType, []), |
| 13561 ElementFactory.methodElement("round", _numType, []), |
| 13562 ElementFactory.methodElement("truncate", _numType, []), |
| 13563 ElementFactory.methodElement("toInt", _intType, []), |
| 13564 ElementFactory.methodElement("toDouble", _doubleType, []), |
| 13565 ElementFactory.methodElement("toStringAsFixed", _stringType, [_intType])
, |
| 13566 ElementFactory.methodElement("toStringAsExponential", _stringType, [_int
Type]), |
| 13567 ElementFactory.methodElement("toStringAsPrecision", _stringType, [_intTy
pe]), |
| 13568 ElementFactory.methodElement("toRadixString", _stringType, [_intType])]; |
| 13569 intElement.methods = <MethodElement> [ |
| 13570 ElementFactory.methodElement("&", _intType, [_intType]), |
| 13571 ElementFactory.methodElement("|", _intType, [_intType]), |
| 13572 ElementFactory.methodElement("^", _intType, [_intType]), |
| 13573 ElementFactory.methodElement("~", _intType, []), |
| 13574 ElementFactory.methodElement("<<", _intType, [_intType]), |
| 13575 ElementFactory.methodElement(">>", _intType, [_intType]), |
| 13576 ElementFactory.methodElement("-", _intType, []), |
| 13577 ElementFactory.methodElement("abs", _intType, []), |
| 13578 ElementFactory.methodElement("round", _intType, []), |
| 13579 ElementFactory.methodElement("floor", _intType, []), |
| 13580 ElementFactory.methodElement("ceil", _intType, []), |
| 13581 ElementFactory.methodElement("truncate", _intType, []), |
| 13582 ElementFactory.methodElement("toString", _stringType, [])]; |
| 13583 List<FieldElement> fields = <FieldElement> [ |
| 13584 ElementFactory.fieldElement("NAN", true, false, true, _doubleType), |
| 13585 ElementFactory.fieldElement("INFINITY", true, false, true, _doubleType), |
| 13586 ElementFactory.fieldElement("NEGATIVE_INFINITY", true, false, true, _dou
bleType), |
| 13587 ElementFactory.fieldElement("MIN_POSITIVE", true, false, true, _doubleTy
pe), |
| 13588 ElementFactory.fieldElement("MAX_FINITE", true, false, true, _doubleType
)]; |
| 10684 doubleElement.fields = fields; | 13589 doubleElement.fields = fields; |
| 10685 int fieldCount = fields.length; | 13590 int fieldCount = fields.length; |
| 10686 List<PropertyAccessorElement> accessors = new List<PropertyAccessorElement>(
fieldCount); | 13591 List<PropertyAccessorElement> accessors = new List<PropertyAccessorElement>(
fieldCount); |
| 10687 for (int i = 0; i < fieldCount; i++) { | 13592 for (int i = 0; i < fieldCount; i++) { |
| 10688 accessors[i] = fields[i].getter; | 13593 accessors[i] = fields[i].getter; |
| 10689 } | 13594 } |
| 10690 doubleElement.accessors = accessors; | 13595 doubleElement.accessors = accessors; |
| 10691 doubleElement.methods = <MethodElement> [ElementFactory.methodElement("remai
nder", _doubleType, [_numType]), ElementFactory.methodElement("+", _doubleType,
[_numType]), ElementFactory.methodElement("-", _doubleType, [_numType]), Element
Factory.methodElement("*", _doubleType, [_numType]), ElementFactory.methodElemen
t("%", _doubleType, [_numType]), ElementFactory.methodElement("/", _doubleType,
[_numType]), ElementFactory.methodElement("~/", _doubleType, [_numType]), Elemen
tFactory.methodElement("-", _doubleType, []), ElementFactory.methodElement("abs"
, _doubleType, []), ElementFactory.methodElement("round", _doubleType, []), Elem
entFactory.methodElement("floor", _doubleType, []), ElementFactory.methodElement
("ceil", _doubleType, []), ElementFactory.methodElement("truncate", _doubleType,
[]), ElementFactory.methodElement("toString", _stringType, [])]; | 13596 doubleElement.methods = <MethodElement> [ |
| 13597 ElementFactory.methodElement("remainder", _doubleType, [_numType]), |
| 13598 ElementFactory.methodElement("+", _doubleType, [_numType]), |
| 13599 ElementFactory.methodElement("-", _doubleType, [_numType]), |
| 13600 ElementFactory.methodElement("*", _doubleType, [_numType]), |
| 13601 ElementFactory.methodElement("%", _doubleType, [_numType]), |
| 13602 ElementFactory.methodElement("/", _doubleType, [_numType]), |
| 13603 ElementFactory.methodElement("~/", _doubleType, [_numType]), |
| 13604 ElementFactory.methodElement("-", _doubleType, []), |
| 13605 ElementFactory.methodElement("abs", _doubleType, []), |
| 13606 ElementFactory.methodElement("round", _doubleType, []), |
| 13607 ElementFactory.methodElement("floor", _doubleType, []), |
| 13608 ElementFactory.methodElement("ceil", _doubleType, []), |
| 13609 ElementFactory.methodElement("truncate", _doubleType, []), |
| 13610 ElementFactory.methodElement("toString", _stringType, [])]; |
| 10692 } | 13611 } |
| 10693 | 13612 |
| 10694 /** | 13613 /** |
| 10695 * Given a class element representing a class with type parameters, propagate
those type | 13614 * Given a class element representing a class with type parameters, propagate
those type |
| 10696 * parameters to all of the accessors, methods and constructors defined for th
e class. | 13615 * parameters to all of the accessors, methods and constructors defined for th
e class. |
| 10697 * | 13616 * |
| 10698 * @param classElement the element representing the class with type parameters | 13617 * @param classElement the element representing the class with type parameters |
| 10699 */ | 13618 */ |
| 10700 void propagateTypeArguments(ClassElementImpl classElement) { | 13619 void propagateTypeArguments(ClassElementImpl classElement) { |
| 10701 List<Type2> typeArguments = TypeVariableTypeImpl.getTypes(classElement.typeV
ariables); | 13620 List<Type2> typeArguments = TypeVariableTypeImpl.getTypes(classElement.typeV
ariables); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 10725 * @return the analysis context that was created | 13644 * @return the analysis context that was created |
| 10726 */ | 13645 */ |
| 10727 static AnalysisContextImpl contextWithCore() { | 13646 static AnalysisContextImpl contextWithCore() { |
| 10728 AnalysisContextImpl sdkContext = DirectoryBasedDartSdk.defaultSdk.context as
AnalysisContextImpl; | 13647 AnalysisContextImpl sdkContext = DirectoryBasedDartSdk.defaultSdk.context as
AnalysisContextImpl; |
| 10729 SourceFactory sourceFactory = sdkContext.sourceFactory; | 13648 SourceFactory sourceFactory = sdkContext.sourceFactory; |
| 10730 TestTypeProvider provider = new TestTypeProvider(); | 13649 TestTypeProvider provider = new TestTypeProvider(); |
| 10731 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d
art"); | 13650 CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.d
art"); |
| 10732 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 13651 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 10733 sdkContext.setContents(coreSource, ""); | 13652 sdkContext.setContents(coreSource, ""); |
| 10734 coreUnit.source = coreSource; | 13653 coreUnit.source = coreSource; |
| 10735 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]; | 13654 coreUnit.types = <ClassElement> [ |
| 13655 provider.boolType.element, |
| 13656 provider.doubleType.element, |
| 13657 provider.functionType.element, |
| 13658 provider.intType.element, |
| 13659 provider.listType.element, |
| 13660 provider.mapType.element, |
| 13661 provider.numType.element, |
| 13662 provider.objectType.element, |
| 13663 provider.stackTraceType.element, |
| 13664 provider.stringType.element, |
| 13665 provider.typeType.element]; |
| 10736 LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "core"])); | 13666 LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "core"])); |
| 10737 coreLibrary.definingCompilationUnit = coreUnit; | 13667 coreLibrary.definingCompilationUnit = coreUnit; |
| 10738 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); | 13668 CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_d
artium.dart"); |
| 10739 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 13669 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
| 10740 sdkContext.setContents(htmlSource, ""); | 13670 sdkContext.setContents(htmlSource, ""); |
| 10741 htmlUnit.source = htmlSource; | 13671 htmlUnit.source = htmlSource; |
| 10742 ClassElementImpl elementElement = ElementFactory.classElement2("Element", []
); | 13672 ClassElementImpl elementElement = ElementFactory.classElement2("Element", []
); |
| 10743 InterfaceType elementType = elementElement.type; | 13673 InterfaceType elementType = elementElement.type; |
| 10744 ClassElementImpl documentElement = ElementFactory.classElement("Document", e
lementType, []); | 13674 ClassElementImpl documentElement = ElementFactory.classElement("Document", e
lementType, []); |
| 10745 ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocu
ment", documentElement.type, []); | 13675 ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocu
ment", documentElement.type, []); |
| 10746 htmlDocumentElement.methods = <MethodElement> [ElementFactory.methodElement(
"query", elementType, <Type2> [provider.stringType])]; | 13676 htmlDocumentElement.methods = <MethodElement> [ElementFactory.methodElement(
"query", elementType, <Type2> [provider.stringType])]; |
| 10747 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, [])]; | 13677 htmlUnit.types = <ClassElement> [ |
| 13678 ElementFactory.classElement("AnchorElement", elementType, []), |
| 13679 ElementFactory.classElement("BodyElement", elementType, []), |
| 13680 ElementFactory.classElement("ButtonElement", elementType, []), |
| 13681 ElementFactory.classElement("DivElement", elementType, []), |
| 13682 documentElement, |
| 13683 elementElement, |
| 13684 htmlDocumentElement, |
| 13685 ElementFactory.classElement("InputElement", elementType, []), |
| 13686 ElementFactory.classElement("SelectElement", elementType, [])]; |
| 10748 htmlUnit.functions = <FunctionElement> [ElementFactory.functionElement3("que
ry", elementElement, <ClassElement> [provider.stringType.element], ClassElementI
mpl.EMPTY_ARRAY)]; | 13687 htmlUnit.functions = <FunctionElement> [ElementFactory.functionElement3("que
ry", elementElement, <ClassElement> [provider.stringType.element], ClassElementI
mpl.EMPTY_ARRAY)]; |
| 10749 TopLevelVariableElementImpl document = ElementFactory.topLevelVariableElemen
t3("document", true, htmlDocumentElement.type); | 13688 TopLevelVariableElementImpl document = ElementFactory.topLevelVariableElemen
t3("document", true, htmlDocumentElement.type); |
| 10750 htmlUnit.topLevelVariables = <TopLevelVariableElement> [document]; | 13689 htmlUnit.topLevelVariables = <TopLevelVariableElement> [document]; |
| 10751 htmlUnit.accessors = <PropertyAccessorElement> [document.getter]; | 13690 htmlUnit.accessors = <PropertyAccessorElement> [document.getter]; |
| 10752 LibraryElementImpl htmlLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "dom", "html"])); | 13691 LibraryElementImpl htmlLibrary = new LibraryElementImpl(sdkContext, ASTFacto
ry.libraryIdentifier2(["dart", "dom", "html"])); |
| 10753 htmlLibrary.definingCompilationUnit = htmlUnit; | 13692 htmlLibrary.definingCompilationUnit = htmlUnit; |
| 10754 Map<Source, LibraryElement> elementMap = new Map<Source, LibraryElement>(); | 13693 Map<Source, LibraryElement> elementMap = new Map<Source, LibraryElement>(); |
| 10755 elementMap[coreSource] = coreLibrary; | 13694 elementMap[coreSource] = coreLibrary; |
| 10756 elementMap[htmlSource] = htmlLibrary; | 13695 elementMap[htmlSource] = htmlLibrary; |
| 10757 sdkContext.recordLibraryElements(elementMap); | 13696 sdkContext.recordLibraryElements(elementMap); |
| 10758 AnalysisContextImpl context = new DelegatingAnalysisContextImpl(); | 13697 AnalysisContextImpl context = new DelegatingAnalysisContextImpl(); |
| 10759 sourceFactory = new SourceFactory.con2([new DartUriResolver(sdkContext.sourc
eFactory.dartSdk), new FileUriResolver()]); | 13698 sourceFactory = new SourceFactory.con2([ |
| 13699 new DartUriResolver(sdkContext.sourceFactory.dartSdk), |
| 13700 new FileUriResolver()]); |
| 10760 context.sourceFactory = sourceFactory; | 13701 context.sourceFactory = sourceFactory; |
| 10761 return context; | 13702 return context; |
| 10762 } | 13703 } |
| 10763 } | 13704 } |
| 10764 class LibraryImportScopeTest extends ResolverTestCase { | 13705 class LibraryImportScopeTest extends ResolverTestCase { |
| 10765 void test_conflictingImports() { | 13706 void test_conflictingImports() { |
| 10766 AnalysisContext context = new AnalysisContextImpl(); | 13707 AnalysisContext context = new AnalysisContextImpl(); |
| 10767 String typeNameA = "A"; | 13708 String typeNameA = "A"; |
| 10768 String typeNameB = "B"; | 13709 String typeNameB = "B"; |
| 10769 String typeNameC = "C"; | 13710 String typeNameC = "C"; |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11513 Type2 resultType = analyze(node); | 14454 Type2 resultType = analyze(node); |
| 11514 assertType2(_typeProvider.mapType.substitute4(<Type2> [_typeProvider.dynamic
Type, _typeProvider.dynamicType]), resultType); | 14455 assertType2(_typeProvider.mapType.substitute4(<Type2> [_typeProvider.dynamic
Type, _typeProvider.dynamicType]), resultType); |
| 11515 _listener.assertNoErrors(); | 14456 _listener.assertNoErrors(); |
| 11516 } | 14457 } |
| 11517 void test_visitMapLiteral_nonEmpty() { | 14458 void test_visitMapLiteral_nonEmpty() { |
| 11518 Expression node = ASTFactory.mapLiteral2([ASTFactory.mapLiteralEntry("k", re
solvedInteger(0))]); | 14459 Expression node = ASTFactory.mapLiteral2([ASTFactory.mapLiteralEntry("k", re
solvedInteger(0))]); |
| 11519 Type2 resultType = analyze(node); | 14460 Type2 resultType = analyze(node); |
| 11520 assertType2(_typeProvider.mapType.substitute4(<Type2> [_typeProvider.dynamic
Type, _typeProvider.dynamicType]), resultType); | 14461 assertType2(_typeProvider.mapType.substitute4(<Type2> [_typeProvider.dynamic
Type, _typeProvider.dynamicType]), resultType); |
| 11521 _listener.assertNoErrors(); | 14462 _listener.assertNoErrors(); |
| 11522 } | 14463 } |
| 14464 void test_visitMethodInvocation_then() { |
| 14465 Expression node = ASTFactory.methodInvocation(null, "then", []); |
| 14466 analyze(node); |
| 14467 _listener.assertNoErrors(); |
| 14468 } |
| 11523 void test_visitNamedExpression() { | 14469 void test_visitNamedExpression() { |
| 11524 Expression node = ASTFactory.namedExpression2("n", resolvedString("a")); | 14470 Expression node = ASTFactory.namedExpression2("n", resolvedString("a")); |
| 11525 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); | 14471 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); |
| 11526 _listener.assertNoErrors(); | 14472 _listener.assertNoErrors(); |
| 11527 } | 14473 } |
| 11528 void test_visitNullLiteral() { | 14474 void test_visitNullLiteral() { |
| 11529 Expression node = ASTFactory.nullLiteral(); | 14475 Expression node = ASTFactory.nullLiteral(); |
| 11530 JUnitTestCase.assertSame(_typeProvider.bottomType, analyze(node)); | 14476 JUnitTestCase.assertSame(_typeProvider.bottomType, analyze(node)); |
| 11531 _listener.assertNoErrors(); | 14477 _listener.assertNoErrors(); |
| 11532 } | 14478 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11628 node.propertyName.element = setter; | 14574 node.propertyName.element = setter; |
| 11629 JUnitTestCase.assertSame(boolType, analyze(node)); | 14575 JUnitTestCase.assertSame(boolType, analyze(node)); |
| 11630 _listener.assertNoErrors(); | 14576 _listener.assertNoErrors(); |
| 11631 } | 14577 } |
| 11632 void test_visitSimpleStringLiteral() { | 14578 void test_visitSimpleStringLiteral() { |
| 11633 Expression node = resolvedString("a"); | 14579 Expression node = resolvedString("a"); |
| 11634 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); | 14580 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); |
| 11635 _listener.assertNoErrors(); | 14581 _listener.assertNoErrors(); |
| 11636 } | 14582 } |
| 11637 void test_visitStringInterpolation() { | 14583 void test_visitStringInterpolation() { |
| 11638 Expression node = ASTFactory.string([ASTFactory.interpolationString("a", "a"
), ASTFactory.interpolationExpression(resolvedString("b")), ASTFactory.interpola
tionString("c", "c")]); | 14584 Expression node = ASTFactory.string([ |
| 14585 ASTFactory.interpolationString("a", "a"), |
| 14586 ASTFactory.interpolationExpression(resolvedString("b")), |
| 14587 ASTFactory.interpolationString("c", "c")]); |
| 11639 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); | 14588 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); |
| 11640 _listener.assertNoErrors(); | 14589 _listener.assertNoErrors(); |
| 11641 } | 14590 } |
| 11642 void test_visitSuperExpression() { | 14591 void test_visitSuperExpression() { |
| 11643 InterfaceType superType = ElementFactory.classElement2("A", []).type; | 14592 InterfaceType superType = ElementFactory.classElement2("A", []).type; |
| 11644 InterfaceType thisType = ElementFactory.classElement("B", superType, []).typ
e; | 14593 InterfaceType thisType = ElementFactory.classElement("B", superType, []).typ
e; |
| 11645 Expression node = ASTFactory.superExpression(); | 14594 Expression node = ASTFactory.superExpression(); |
| 11646 JUnitTestCase.assertSame(thisType, analyze2(node, thisType)); | 14595 JUnitTestCase.assertSame(thisType, analyze2(node, thisType)); |
| 11647 _listener.assertNoErrors(); | 14596 _listener.assertNoErrors(); |
| 11648 } | 14597 } |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12061 runJUnitTest(__test, __test.test_visitListLiteral_nonEmpty); | 15010 runJUnitTest(__test, __test.test_visitListLiteral_nonEmpty); |
| 12062 }); | 15011 }); |
| 12063 _ut.test('test_visitMapLiteral_empty', () { | 15012 _ut.test('test_visitMapLiteral_empty', () { |
| 12064 final __test = new StaticTypeAnalyzerTest(); | 15013 final __test = new StaticTypeAnalyzerTest(); |
| 12065 runJUnitTest(__test, __test.test_visitMapLiteral_empty); | 15014 runJUnitTest(__test, __test.test_visitMapLiteral_empty); |
| 12066 }); | 15015 }); |
| 12067 _ut.test('test_visitMapLiteral_nonEmpty', () { | 15016 _ut.test('test_visitMapLiteral_nonEmpty', () { |
| 12068 final __test = new StaticTypeAnalyzerTest(); | 15017 final __test = new StaticTypeAnalyzerTest(); |
| 12069 runJUnitTest(__test, __test.test_visitMapLiteral_nonEmpty); | 15018 runJUnitTest(__test, __test.test_visitMapLiteral_nonEmpty); |
| 12070 }); | 15019 }); |
| 15020 _ut.test('test_visitMethodInvocation_then', () { |
| 15021 final __test = new StaticTypeAnalyzerTest(); |
| 15022 runJUnitTest(__test, __test.test_visitMethodInvocation_then); |
| 15023 }); |
| 12071 _ut.test('test_visitNamedExpression', () { | 15024 _ut.test('test_visitNamedExpression', () { |
| 12072 final __test = new StaticTypeAnalyzerTest(); | 15025 final __test = new StaticTypeAnalyzerTest(); |
| 12073 runJUnitTest(__test, __test.test_visitNamedExpression); | 15026 runJUnitTest(__test, __test.test_visitNamedExpression); |
| 12074 }); | 15027 }); |
| 12075 _ut.test('test_visitNullLiteral', () { | 15028 _ut.test('test_visitNullLiteral', () { |
| 12076 final __test = new StaticTypeAnalyzerTest(); | 15029 final __test = new StaticTypeAnalyzerTest(); |
| 12077 runJUnitTest(__test, __test.test_visitNullLiteral); | 15030 runJUnitTest(__test, __test.test_visitNullLiteral); |
| 12078 }); | 15031 }); |
| 12079 _ut.test('test_visitParenthesizedExpression', () { | 15032 _ut.test('test_visitParenthesizedExpression', () { |
| 12080 final __test = new StaticTypeAnalyzerTest(); | 15033 final __test = new StaticTypeAnalyzerTest(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12154 }); | 15107 }); |
| 12155 _ut.test('test_visitThrowExpression_withoutValue', () { | 15108 _ut.test('test_visitThrowExpression_withoutValue', () { |
| 12156 final __test = new StaticTypeAnalyzerTest(); | 15109 final __test = new StaticTypeAnalyzerTest(); |
| 12157 runJUnitTest(__test, __test.test_visitThrowExpression_withoutValue); | 15110 runJUnitTest(__test, __test.test_visitThrowExpression_withoutValue); |
| 12158 }); | 15111 }); |
| 12159 }); | 15112 }); |
| 12160 } | 15113 } |
| 12161 } | 15114 } |
| 12162 class NonHintCodeTest extends ResolverTestCase { | 15115 class NonHintCodeTest extends ResolverTestCase { |
| 12163 void test_deadCode_deadCatch_onCatchSubtype() { | 15116 void test_deadCode_deadCatch_onCatchSubtype() { |
| 12164 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B extends A {}", "f() {", " try {} on B catch (e) {} on A catch (e) {} catch (e
) {}", "}"])); | 15117 Source source = addSource(EngineTestCase.createSource([ |
| 15118 "class A {}", |
| 15119 "class B extends A {}", |
| 15120 "f() {", |
| 15121 " try {} on B catch (e) {} on A catch (e) {} catch (e) {}", |
| 15122 "}"])); |
| 12165 resolve(source); | 15123 resolve(source); |
| 12166 assertNoErrors(); | 15124 assertNoErrors(); |
| 12167 verify([source]); | 15125 verify([source]); |
| 12168 } | 15126 } |
| 12169 static dartSuite() { | 15127 static dartSuite() { |
| 12170 _ut.group('NonHintCodeTest', () { | 15128 _ut.group('NonHintCodeTest', () { |
| 12171 _ut.test('test_deadCode_deadCatch_onCatchSubtype', () { | 15129 _ut.test('test_deadCode_deadCatch_onCatchSubtype', () { |
| 12172 final __test = new NonHintCodeTest(); | 15130 final __test = new NonHintCodeTest(); |
| 12173 runJUnitTest(__test, __test.test_deadCode_deadCatch_onCatchSubtype); | 15131 runJUnitTest(__test, __test.test_deadCode_deadCatch_onCatchSubtype); |
| 12174 }); | 15132 }); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12231 class LibraryElementBuilderTest extends EngineTestCase { | 15189 class LibraryElementBuilderTest extends EngineTestCase { |
| 12232 | 15190 |
| 12233 /** | 15191 /** |
| 12234 * The source factory used to create [Source]. | 15192 * The source factory used to create [Source]. |
| 12235 */ | 15193 */ |
| 12236 SourceFactory _sourceFactory; | 15194 SourceFactory _sourceFactory; |
| 12237 void setUp() { | 15195 void setUp() { |
| 12238 _sourceFactory = new SourceFactory.con2([new FileUriResolver()]); | 15196 _sourceFactory = new SourceFactory.con2([new FileUriResolver()]); |
| 12239 } | 15197 } |
| 12240 void test_accessorsAcrossFiles() { | 15198 void test_accessorsAcrossFiles() { |
| 12241 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "part 'first.dart';", "part 'second.dart';"])); | 15199 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource([ |
| 15200 "library lib;", |
| 15201 "part 'first.dart';", |
| 15202 "part 'second.dart';"])); |
| 12242 addSource("/first.dart", EngineTestCase.createSource(["part of lib;", "int g
et V => 0;"])); | 15203 addSource("/first.dart", EngineTestCase.createSource(["part of lib;", "int g
et V => 0;"])); |
| 12243 addSource("/second.dart", EngineTestCase.createSource(["part of lib;", "void
set V(int v) {}"])); | 15204 addSource("/second.dart", EngineTestCase.createSource(["part of lib;", "void
set V(int v) {}"])); |
| 12244 LibraryElement element = buildLibrary(librarySource, []); | 15205 LibraryElement element = buildLibrary(librarySource, []); |
| 12245 JUnitTestCase.assertNotNull(element); | 15206 JUnitTestCase.assertNotNull(element); |
| 12246 List<CompilationUnitElement> sourcedUnits = element.parts; | 15207 List<CompilationUnitElement> sourcedUnits = element.parts; |
| 12247 EngineTestCase.assertLength(2, sourcedUnits); | 15208 EngineTestCase.assertLength(2, sourcedUnits); |
| 12248 List<PropertyAccessorElement> firstAccessors = sourcedUnits[0].accessors; | 15209 List<PropertyAccessorElement> firstAccessors = sourcedUnits[0].accessors; |
| 12249 EngineTestCase.assertLength(1, firstAccessors); | 15210 EngineTestCase.assertLength(1, firstAccessors); |
| 12250 List<PropertyAccessorElement> secondAccessors = sourcedUnits[1].accessors; | 15211 List<PropertyAccessorElement> secondAccessors = sourcedUnits[1].accessors; |
| 12251 EngineTestCase.assertLength(1, secondAccessors); | 15212 EngineTestCase.assertLength(1, secondAccessors); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12283 LibraryElement element = buildLibrary(librarySource, [ResolverErrorCode.MISS
ING_LIBRARY_DIRECTIVE_WITH_PART]); | 15244 LibraryElement element = buildLibrary(librarySource, [ResolverErrorCode.MISS
ING_LIBRARY_DIRECTIVE_WITH_PART]); |
| 12284 JUnitTestCase.assertNotNull(element); | 15245 JUnitTestCase.assertNotNull(element); |
| 12285 } | 15246 } |
| 12286 void test_missingPartOfDirective() { | 15247 void test_missingPartOfDirective() { |
| 12287 addSource("/a.dart", "class A {}"); | 15248 addSource("/a.dart", "class A {}"); |
| 12288 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';"])); | 15249 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';"])); |
| 12289 LibraryElement element = buildLibrary(librarySource, [CompileTimeErrorCode.P
ART_OF_NON_PART]); | 15250 LibraryElement element = buildLibrary(librarySource, [CompileTimeErrorCode.P
ART_OF_NON_PART]); |
| 12290 JUnitTestCase.assertNotNull(element); | 15251 JUnitTestCase.assertNotNull(element); |
| 12291 } | 15252 } |
| 12292 void test_multipleFiles() { | 15253 void test_multipleFiles() { |
| 12293 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "part 'first.dart';", "part 'second.dart';", "", "class A {}"])); | 15254 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource([ |
| 15255 "library lib;", |
| 15256 "part 'first.dart';", |
| 15257 "part 'second.dart';", |
| 15258 "", |
| 15259 "class A {}"])); |
| 12294 addSource("/first.dart", EngineTestCase.createSource(["part of lib;", "class
B {}"])); | 15260 addSource("/first.dart", EngineTestCase.createSource(["part of lib;", "class
B {}"])); |
| 12295 addSource("/second.dart", EngineTestCase.createSource(["part of lib;", "clas
s C {}"])); | 15261 addSource("/second.dart", EngineTestCase.createSource(["part of lib;", "clas
s C {}"])); |
| 12296 LibraryElement element = buildLibrary(librarySource, []); | 15262 LibraryElement element = buildLibrary(librarySource, []); |
| 12297 JUnitTestCase.assertNotNull(element); | 15263 JUnitTestCase.assertNotNull(element); |
| 12298 List<CompilationUnitElement> sourcedUnits = element.parts; | 15264 List<CompilationUnitElement> sourcedUnits = element.parts; |
| 12299 EngineTestCase.assertLength(2, sourcedUnits); | 15265 EngineTestCase.assertLength(2, sourcedUnits); |
| 12300 assertTypes(element.definingCompilationUnit, ["A"]); | 15266 assertTypes(element.definingCompilationUnit, ["A"]); |
| 12301 if (sourcedUnits[0].name == "first.dart") { | 15267 if (sourcedUnits[0].name == "first.dart") { |
| 12302 assertTypes(sourcedUnits[0], ["B"]); | 15268 assertTypes(sourcedUnits[0], ["B"]); |
| 12303 assertTypes(sourcedUnits[1], ["C"]); | 15269 assertTypes(sourcedUnits[1], ["C"]); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12355 * Build the element model for the library whose defining compilation unit has
the given source. | 15321 * Build the element model for the library whose defining compilation unit has
the given source. |
| 12356 * | 15322 * |
| 12357 * @param librarySource the source of the defining compilation unit for the li
brary | 15323 * @param librarySource the source of the defining compilation unit for the li
brary |
| 12358 * @param expectedErrorCodes the errors that are expected to be found while bu
ilding the element | 15324 * @param expectedErrorCodes the errors that are expected to be found while bu
ilding the element |
| 12359 * model | 15325 * model |
| 12360 * @return the element model that was built for the library | 15326 * @return the element model that was built for the library |
| 12361 * @throws Exception if the element model could not be built | 15327 * @throws Exception if the element model could not be built |
| 12362 */ | 15328 */ |
| 12363 LibraryElement buildLibrary(Source librarySource, List<ErrorCode> expectedErro
rCodes) { | 15329 LibraryElement buildLibrary(Source librarySource, List<ErrorCode> expectedErro
rCodes) { |
| 12364 AnalysisContextImpl context = new AnalysisContextImpl(); | 15330 AnalysisContextImpl context = new AnalysisContextImpl(); |
| 12365 context.sourceFactory = new SourceFactory.con2([new DartUriResolver(Director
yBasedDartSdk.defaultSdk), new FileUriResolver()]); | 15331 context.sourceFactory = new SourceFactory.con2([ |
| 15332 new DartUriResolver(DirectoryBasedDartSdk.defaultSdk), |
| 15333 new FileUriResolver()]); |
| 12366 LibraryResolver resolver = new LibraryResolver(context); | 15334 LibraryResolver resolver = new LibraryResolver(context); |
| 12367 LibraryElementBuilder builder = new LibraryElementBuilder(resolver); | 15335 LibraryElementBuilder builder = new LibraryElementBuilder(resolver); |
| 12368 Library library = resolver.createLibrary(librarySource) as Library; | 15336 Library library = resolver.createLibrary(librarySource) as Library; |
| 12369 LibraryElement element = builder.buildLibrary(library); | 15337 LibraryElement element = builder.buildLibrary(library); |
| 12370 GatheringErrorListener listener = new GatheringErrorListener(); | 15338 GatheringErrorListener listener = new GatheringErrorListener(); |
| 12371 listener.addAll(resolver.errorListener); | 15339 listener.addAll(resolver.errorListener); |
| 12372 listener.assertErrors2(expectedErrorCodes); | 15340 listener.assertErrors2(expectedErrorCodes); |
| 12373 return element; | 15341 return element; |
| 12374 } | 15342 } |
| 12375 static dartSuite() { | 15343 static dartSuite() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12489 ScopeTest_TestScope(LibraryElement definingLibrary, AnalysisErrorListener erro
rListener) { | 15457 ScopeTest_TestScope(LibraryElement definingLibrary, AnalysisErrorListener erro
rListener) { |
| 12490 this._definingLibrary = definingLibrary; | 15458 this._definingLibrary = definingLibrary; |
| 12491 this._errorListener = errorListener; | 15459 this._errorListener = errorListener; |
| 12492 } | 15460 } |
| 12493 LibraryElement get definingLibrary => _definingLibrary; | 15461 LibraryElement get definingLibrary => _definingLibrary; |
| 12494 AnalysisErrorListener get errorListener => _errorListener; | 15462 AnalysisErrorListener get errorListener => _errorListener; |
| 12495 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => localLookup(name, referencingLibrary); | 15463 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => localLookup(name, referencingLibrary); |
| 12496 } | 15464 } |
| 12497 class SimpleResolverTest extends ResolverTestCase { | 15465 class SimpleResolverTest extends ResolverTestCase { |
| 12498 void fail_staticInvocation() { | 15466 void fail_staticInvocation() { |
| 12499 Source source = addSource(EngineTestCase.createSource(["class A {", " stati
c int get g => (a,b) => 0;", "}", "class B {", " f() {", " A.g(1,0);", " }"
, "}"])); | 15467 Source source = addSource(EngineTestCase.createSource([ |
| 15468 "class A {", |
| 15469 " static int get g => (a,b) => 0;", |
| 15470 "}", |
| 15471 "class B {", |
| 15472 " f() {", |
| 15473 " A.g(1,0);", |
| 15474 " }", |
| 15475 "}"])); |
| 12500 resolve(source); | 15476 resolve(source); |
| 12501 assertNoErrors(); | 15477 assertNoErrors(); |
| 12502 verify([source]); | 15478 verify([source]); |
| 12503 } | 15479 } |
| 12504 void test_argumentResolution_required_matching() { | 15480 void test_argumentResolution_required_matching() { |
| 12505 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, 3);", " }", " void g(a, b, c) {}", "}"])); | 15481 Source source = addSource(EngineTestCase.createSource([ |
| 15482 "class A {", |
| 15483 " void f() {", |
| 15484 " g(1, 2, 3);", |
| 15485 " }", |
| 15486 " void g(a, b, c) {}", |
| 15487 "}"])); |
| 12506 validateArgumentResolution(source, [0, 1, 2]); | 15488 validateArgumentResolution(source, [0, 1, 2]); |
| 12507 } | 15489 } |
| 12508 void test_argumentResolution_required_tooFew() { | 15490 void test_argumentResolution_required_tooFew() { |
| 12509 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2);", " }", " void g(a, b, c) {}", "}"])); | 15491 Source source = addSource(EngineTestCase.createSource([ |
| 15492 "class A {", |
| 15493 " void f() {", |
| 15494 " g(1, 2);", |
| 15495 " }", |
| 15496 " void g(a, b, c) {}", |
| 15497 "}"])); |
| 12510 validateArgumentResolution(source, [0, 1]); | 15498 validateArgumentResolution(source, [0, 1]); |
| 12511 } | 15499 } |
| 12512 void test_argumentResolution_required_tooMany() { | 15500 void test_argumentResolution_required_tooMany() { |
| 12513 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, 3);", " }", " void g(a, b) {}", "}"])); | 15501 Source source = addSource(EngineTestCase.createSource([ |
| 15502 "class A {", |
| 15503 " void f() {", |
| 15504 " g(1, 2, 3);", |
| 15505 " }", |
| 15506 " void g(a, b) {}", |
| 15507 "}"])); |
| 12514 validateArgumentResolution(source, [0, 1, -1]); | 15508 validateArgumentResolution(source, [0, 1, -1]); |
| 12515 } | 15509 } |
| 12516 void test_argumentResolution_requiredAndNamed_extra() { | 15510 void test_argumentResolution_requiredAndNamed_extra() { |
| 12517 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, c: 3, d: 4);", " }", " void g(a, b, {c}) {}", "}"])); | 15511 Source source = addSource(EngineTestCase.createSource([ |
| 15512 "class A {", |
| 15513 " void f() {", |
| 15514 " g(1, 2, c: 3, d: 4);", |
| 15515 " }", |
| 15516 " void g(a, b, {c}) {}", |
| 15517 "}"])); |
| 12518 validateArgumentResolution(source, [0, 1, 2, -1]); | 15518 validateArgumentResolution(source, [0, 1, 2, -1]); |
| 12519 } | 15519 } |
| 12520 void test_argumentResolution_requiredAndNamed_matching() { | 15520 void test_argumentResolution_requiredAndNamed_matching() { |
| 12521 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, c: 3);", " }", " void g(a, b, {c}) {}", "}"])); | 15521 Source source = addSource(EngineTestCase.createSource([ |
| 15522 "class A {", |
| 15523 " void f() {", |
| 15524 " g(1, 2, c: 3);", |
| 15525 " }", |
| 15526 " void g(a, b, {c}) {}", |
| 15527 "}"])); |
| 12522 validateArgumentResolution(source, [0, 1, 2]); | 15528 validateArgumentResolution(source, [0, 1, 2]); |
| 12523 } | 15529 } |
| 12524 void test_argumentResolution_requiredAndNamed_missing() { | 15530 void test_argumentResolution_requiredAndNamed_missing() { |
| 12525 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, d: 3);", " }", " void g(a, b, {c, d}) {}", "}"])); | 15531 Source source = addSource(EngineTestCase.createSource([ |
| 15532 "class A {", |
| 15533 " void f() {", |
| 15534 " g(1, 2, d: 3);", |
| 15535 " }", |
| 15536 " void g(a, b, {c, d}) {}", |
| 15537 "}"])); |
| 12526 validateArgumentResolution(source, [0, 1, 3]); | 15538 validateArgumentResolution(source, [0, 1, 3]); |
| 12527 } | 15539 } |
| 12528 void test_argumentResolution_requiredAndPositional_fewer() { | 15540 void test_argumentResolution_requiredAndPositional_fewer() { |
| 12529 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, 3);", " }", " void g(a, b, [c, d]) {}", "}"])); | 15541 Source source = addSource(EngineTestCase.createSource([ |
| 15542 "class A {", |
| 15543 " void f() {", |
| 15544 " g(1, 2, 3);", |
| 15545 " }", |
| 15546 " void g(a, b, [c, d]) {}", |
| 15547 "}"])); |
| 12530 validateArgumentResolution(source, [0, 1, 2]); | 15548 validateArgumentResolution(source, [0, 1, 2]); |
| 12531 } | 15549 } |
| 12532 void test_argumentResolution_requiredAndPositional_matching() { | 15550 void test_argumentResolution_requiredAndPositional_matching() { |
| 12533 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, 3, 4);", " }", " void g(a, b, [c, d]) {}", "}"])); | 15551 Source source = addSource(EngineTestCase.createSource([ |
| 15552 "class A {", |
| 15553 " void f() {", |
| 15554 " g(1, 2, 3, 4);", |
| 15555 " }", |
| 15556 " void g(a, b, [c, d]) {}", |
| 15557 "}"])); |
| 12534 validateArgumentResolution(source, [0, 1, 2, 3]); | 15558 validateArgumentResolution(source, [0, 1, 2, 3]); |
| 12535 } | 15559 } |
| 12536 void test_argumentResolution_requiredAndPositional_more() { | 15560 void test_argumentResolution_requiredAndPositional_more() { |
| 12537 Source source = addSource(EngineTestCase.createSource(["class A {", " void
f() {", " g(1, 2, 3, 4);", " }", " void g(a, b, [c]) {}", "}"])); | 15561 Source source = addSource(EngineTestCase.createSource([ |
| 15562 "class A {", |
| 15563 " void f() {", |
| 15564 " g(1, 2, 3, 4);", |
| 15565 " }", |
| 15566 " void g(a, b, [c]) {}", |
| 15567 "}"])); |
| 12538 validateArgumentResolution(source, [0, 1, 2, -1]); | 15568 validateArgumentResolution(source, [0, 1, 2, -1]); |
| 12539 } | 15569 } |
| 12540 void test_class_definesCall() { | 15570 void test_class_definesCall() { |
| 12541 Source source = addSource(EngineTestCase.createSource(["class A {", " int c
all(int x) { return x; }", "}", "int f(A a) {", " return a(0);", "}"])); | 15571 Source source = addSource(EngineTestCase.createSource([ |
| 15572 "class A {", |
| 15573 " int call(int x) { return x; }", |
| 15574 "}", |
| 15575 "int f(A a) {", |
| 15576 " return a(0);", |
| 15577 "}"])); |
| 12542 resolve(source); | 15578 resolve(source); |
| 12543 assertNoErrors(); | 15579 assertNoErrors(); |
| 12544 verify([source]); | 15580 verify([source]); |
| 12545 } | 15581 } |
| 12546 void test_class_extends_implements() { | 15582 void test_class_extends_implements() { |
| 12547 Source source = addSource(EngineTestCase.createSource(["class A extends B im
plements C {}", "class B {}", "class C {}"])); | 15583 Source source = addSource(EngineTestCase.createSource([ |
| 15584 "class A extends B implements C {}", |
| 15585 "class B {}", |
| 15586 "class C {}"])); |
| 12548 resolve(source); | 15587 resolve(source); |
| 12549 assertNoErrors(); | 15588 assertNoErrors(); |
| 12550 verify([source]); | 15589 verify([source]); |
| 12551 } | 15590 } |
| 12552 void test_commentReference_class() { | 15591 void test_commentReference_class() { |
| 12553 Source source = addSource(EngineTestCase.createSource(["f() {}", "/** [A] [n
ew A] [A.n] [new A.n] [m] [f] */", "class A {", " A() {}", " A.n() {}", " m()
{}", "}"])); | 15592 Source source = addSource(EngineTestCase.createSource([ |
| 15593 "f() {}", |
| 15594 "/** [A] [new A] [A.n] [new A.n] [m] [f] */", |
| 15595 "class A {", |
| 15596 " A() {}", |
| 15597 " A.n() {}", |
| 15598 " m() {}", |
| 15599 "}"])); |
| 12554 resolve(source); | 15600 resolve(source); |
| 12555 assertNoErrors(); | 15601 assertNoErrors(); |
| 12556 verify([source]); | 15602 verify([source]); |
| 12557 } | 15603 } |
| 12558 void test_commentReference_parameter() { | 15604 void test_commentReference_parameter() { |
| 12559 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", " A.n() {}", " /** [e] [f] */", " m(e, f()) {}", "}"])); | 15605 Source source = addSource(EngineTestCase.createSource([ |
| 15606 "class A {", |
| 15607 " A() {}", |
| 15608 " A.n() {}", |
| 15609 " /** [e] [f] */", |
| 15610 " m(e, f()) {}", |
| 15611 "}"])); |
| 12560 resolve(source); | 15612 resolve(source); |
| 12561 assertNoErrors(); | 15613 assertNoErrors(); |
| 12562 verify([source]); | 15614 verify([source]); |
| 12563 } | 15615 } |
| 12564 void test_commentReference_singleLine() { | 15616 void test_commentReference_singleLine() { |
| 12565 Source source = addSource(EngineTestCase.createSource(["/// [A]", "class A {
}"])); | 15617 Source source = addSource(EngineTestCase.createSource(["/// [A]", "class A {
}"])); |
| 12566 resolve(source); | 15618 resolve(source); |
| 12567 assertNoErrors(); | 15619 assertNoErrors(); |
| 12568 verify([source]); | 15620 verify([source]); |
| 12569 } | 15621 } |
| 12570 void test_empty() { | 15622 void test_empty() { |
| 12571 Source source = addSource(""); | 15623 Source source = addSource(""); |
| 12572 resolve(source); | 15624 resolve(source); |
| 12573 assertNoErrors(); | 15625 assertNoErrors(); |
| 12574 verify([source]); | 15626 verify([source]); |
| 12575 } | 15627 } |
| 12576 void test_extractedMethodAsConstant() { | 15628 void test_extractedMethodAsConstant() { |
| 12577 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]) {}", "}"])); | 15629 Source source = addSource(EngineTestCase.createSource([ |
| 15630 "abstract class Comparable<T> {", |
| 15631 " int compareTo(T other);", |
| 15632 " static int compare(Comparable a, Comparable b) => a.compareTo(b);", |
| 15633 "}", |
| 15634 "class A {", |
| 15635 " void sort([compare = Comparable.compare]) {}", |
| 15636 "}"])); |
| 12578 resolve(source); | 15637 resolve(source); |
| 12579 assertNoErrors(); | 15638 assertNoErrors(); |
| 12580 verify([source]); | 15639 verify([source]); |
| 12581 } | 15640 } |
| 12582 void test_fieldFormalParameter() { | 15641 void test_fieldFormalParameter() { |
| 12583 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); | 15642 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " A(this.x) {}", "}"])); |
| 12584 resolve(source); | 15643 resolve(source); |
| 12585 assertNoErrors(); | 15644 assertNoErrors(); |
| 12586 verify([source]); | 15645 verify([source]); |
| 12587 } | 15646 } |
| 12588 void test_forEachLoops_nonConflicting() { | 15647 void test_forEachLoops_nonConflicting() { |
| 12589 Source source = addSource(EngineTestCase.createSource(["f() {", " List list
= [1,2,3];", " for (int x in list) {}", " for (int x in list) {}", "}"])); | 15648 Source source = addSource(EngineTestCase.createSource([ |
| 15649 "f() {", |
| 15650 " List list = [1,2,3];", |
| 15651 " for (int x in list) {}", |
| 15652 " for (int x in list) {}", |
| 15653 "}"])); |
| 12590 resolve(source); | 15654 resolve(source); |
| 12591 assertNoErrors(); | 15655 assertNoErrors(); |
| 12592 verify([source]); | 15656 verify([source]); |
| 12593 } | 15657 } |
| 12594 void test_forLoops_nonConflicting() { | 15658 void test_forLoops_nonConflicting() { |
| 12595 Source source = addSource(EngineTestCase.createSource(["f() {", " for (int
i = 0; i < 3; i++) {", " }", " for (int i = 0; i < 3; i++) {", " }", "}"])); | 15659 Source source = addSource(EngineTestCase.createSource([ |
| 15660 "f() {", |
| 15661 " for (int i = 0; i < 3; i++) {", |
| 15662 " }", |
| 15663 " for (int i = 0; i < 3; i++) {", |
| 15664 " }", |
| 15665 "}"])); |
| 12596 resolve(source); | 15666 resolve(source); |
| 12597 assertNoErrors(); | 15667 assertNoErrors(); |
| 12598 verify([source]); | 15668 verify([source]); |
| 12599 } | 15669 } |
| 12600 void test_functionTypeAlias() { | 15670 void test_functionTypeAlias() { |
| 12601 Source source = addSource(EngineTestCase.createSource(["typedef bool P(e);",
"class A {", " P p;", " m(e) {", " if (p(e)) {}", " }", "}"])); | 15671 Source source = addSource(EngineTestCase.createSource([ |
| 15672 "typedef bool P(e);", |
| 15673 "class A {", |
| 15674 " P p;", |
| 15675 " m(e) {", |
| 15676 " if (p(e)) {}", |
| 15677 " }", |
| 15678 "}"])); |
| 12602 resolve(source); | 15679 resolve(source); |
| 12603 assertNoErrors(); | 15680 assertNoErrors(); |
| 12604 verify([source]); | 15681 verify([source]); |
| 12605 } | 15682 } |
| 12606 void test_getterAndSetterWithDifferentTypes() { | 15683 void test_getterAndSetterWithDifferentTypes() { |
| 12607 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();", "}"])); | 15684 Source source = addSource(EngineTestCase.createSource([ |
| 15685 "class A {", |
| 15686 " int get f => 0;", |
| 15687 " void set f(String s) {}", |
| 15688 "}", |
| 15689 "g (A a) {", |
| 15690 " a.f = a.f.toString();", |
| 15691 "}"])); |
| 12608 resolve(source); | 15692 resolve(source); |
| 12609 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); | 15693 assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]); |
| 12610 verify([source]); | 15694 verify([source]); |
| 12611 } | 15695 } |
| 12612 void test_hasReferenceToSuper() { | 15696 void test_hasReferenceToSuper() { |
| 12613 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {toString() => super.toString();}"])); | 15697 Source source = addSource(EngineTestCase.createSource(["class A {}", "class
B {toString() => super.toString();}"])); |
| 12614 LibraryElement library = resolve(source); | 15698 LibraryElement library = resolve(source); |
| 12615 JUnitTestCase.assertNotNull(library); | 15699 JUnitTestCase.assertNotNull(library); |
| 12616 CompilationUnitElement unit = library.definingCompilationUnit; | 15700 CompilationUnitElement unit = library.definingCompilationUnit; |
| 12617 JUnitTestCase.assertNotNull(unit); | 15701 JUnitTestCase.assertNotNull(unit); |
| 12618 List<ClassElement> classes = unit.types; | 15702 List<ClassElement> classes = unit.types; |
| 12619 EngineTestCase.assertLength(2, classes); | 15703 EngineTestCase.assertLength(2, classes); |
| 12620 JUnitTestCase.assertFalse(classes[0].hasReferenceToSuper()); | 15704 JUnitTestCase.assertFalse(classes[0].hasReferenceToSuper()); |
| 12621 JUnitTestCase.assertTrue(classes[1].hasReferenceToSuper()); | 15705 JUnitTestCase.assertTrue(classes[1].hasReferenceToSuper()); |
| 12622 assertNoErrors(); | 15706 assertNoErrors(); |
| 12623 verify([source]); | 15707 verify([source]); |
| 12624 } | 15708 } |
| 12625 void test_import_hide() { | 15709 void test_import_hide() { |
| 12626 addSource2("lib1.dart", EngineTestCase.createSource(["library lib1;", "set f
oo(value) {}"])); | 15710 addSource2("lib1.dart", EngineTestCase.createSource(["library lib1;", "set f
oo(value) {}"])); |
| 12627 addSource2("lib2.dart", EngineTestCase.createSource(["library lib2;", "set f
oo(value) {}"])); | 15711 addSource2("lib2.dart", EngineTestCase.createSource(["library lib2;", "set f
oo(value) {}"])); |
| 12628 Source source = addSource2("lib3.dart", EngineTestCase.createSource(["import
'lib1.dart' hide foo;", "import 'lib2.dart';", "", "main() {", " foo = 0;", "}
"])); | 15712 Source source = addSource2("lib3.dart", EngineTestCase.createSource([ |
| 15713 "import 'lib1.dart' hide foo;", |
| 15714 "import 'lib2.dart';", |
| 15715 "", |
| 15716 "main() {", |
| 15717 " foo = 0;", |
| 15718 "}"])); |
| 12629 resolve(source); | 15719 resolve(source); |
| 12630 assertNoErrors(); | 15720 assertNoErrors(); |
| 12631 verify([source]); | 15721 verify([source]); |
| 12632 } | 15722 } |
| 12633 void test_import_prefix() { | 15723 void test_import_prefix() { |
| 12634 addSource2("/two.dart", EngineTestCase.createSource(["library two;", "f(int
x) {", " return x * x;", "}"])); | 15724 addSource2("/two.dart", EngineTestCase.createSource(["library two;", "f(int
x) {", " return x * x;", "}"])); |
| 12635 Source source = addSource2("/one.dart", EngineTestCase.createSource(["librar
y one;", "import 'two.dart' as _two;", "main() {", " _two.f(0);", "}"])); | 15725 Source source = addSource2("/one.dart", EngineTestCase.createSource([ |
| 15726 "library one;", |
| 15727 "import 'two.dart' as _two;", |
| 15728 "main() {", |
| 15729 " _two.f(0);", |
| 15730 "}"])); |
| 12636 resolve(source); | 15731 resolve(source); |
| 12637 assertNoErrors(); | 15732 assertNoErrors(); |
| 12638 verify([source]); | 15733 verify([source]); |
| 12639 } | 15734 } |
| 12640 void test_indexExpression_typeParameters() { | 15735 void test_indexExpression_typeParameters() { |
| 12641 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];", "}"])); | 15736 Source source = addSource(EngineTestCase.createSource([ |
| 15737 "f() {", |
| 15738 " List<int> a;", |
| 15739 " a[0];", |
| 15740 " List<List<int>> b;", |
| 15741 " b[0][0];", |
| 15742 " List<List<List<int>>> c;", |
| 15743 " c[0][0][0];", |
| 15744 "}"])); |
| 12642 resolve(source); | 15745 resolve(source); |
| 12643 assertNoErrors(); | 15746 assertNoErrors(); |
| 12644 verify([source]); | 15747 verify([source]); |
| 12645 } | 15748 } |
| 12646 void test_indexExpression_typeParameters_invalidAssignmentWarning() { | 15749 void test_indexExpression_typeParameters_invalidAssignmentWarning() { |
| 12647 Source source = addSource(EngineTestCase.createSource(["f() {", " List<List
<int>> b;", " b[0][0] = 'hi';", "}"])); | 15750 Source source = addSource(EngineTestCase.createSource(["f() {", " List<List
<int>> b;", " b[0][0] = 'hi';", "}"])); |
| 12648 resolve(source); | 15751 resolve(source); |
| 12649 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); | 15752 assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]); |
| 12650 verify([source]); | 15753 verify([source]); |
| 12651 } | 15754 } |
| 12652 void test_indirectOperatorThroughCall() { | 15755 void test_indirectOperatorThroughCall() { |
| 12653 Source source = addSource(EngineTestCase.createSource(["class A {", " B cal
l() { return new B(); }", "}", "", "class B {", " int operator [](int i) { retu
rn i; }", "}", "", "A f = new A();", "", "g(int x) {}", "", "main() {", " g(f()
[0]);", "}"])); | 15756 Source source = addSource(EngineTestCase.createSource([ |
| 15757 "class A {", |
| 15758 " B call() { return new B(); }", |
| 15759 "}", |
| 15760 "", |
| 15761 "class B {", |
| 15762 " int operator [](int i) { return i; }", |
| 15763 "}", |
| 15764 "", |
| 15765 "A f = new A();", |
| 15766 "", |
| 15767 "g(int x) {}", |
| 15768 "", |
| 15769 "main() {", |
| 15770 " g(f()[0]);", |
| 15771 "}"])); |
| 12654 resolve(source); | 15772 resolve(source); |
| 12655 assertNoErrors(); | 15773 assertNoErrors(); |
| 12656 verify([source]); | 15774 verify([source]); |
| 12657 } | 15775 } |
| 12658 void test_invoke_dynamicThroughGetter() { | 15776 void test_invoke_dynamicThroughGetter() { |
| 12659 Source source = addSource(EngineTestCase.createSource(["class A {", " List
get X => [() => 0];", " m(A a) {", " X.last;", " }", "}"])); | 15777 Source source = addSource(EngineTestCase.createSource([ |
| 15778 "class A {", |
| 15779 " List get X => [() => 0];", |
| 15780 " m(A a) {", |
| 15781 " X.last;", |
| 15782 " }", |
| 15783 "}"])); |
| 12660 resolve(source); | 15784 resolve(source); |
| 12661 assertNoErrors(); | 15785 assertNoErrors(); |
| 12662 verify([source]); | 15786 verify([source]); |
| 12663 } | 15787 } |
| 12664 void test_isValidMixin_badSuperclass() { | 15788 void test_isValidMixin_badSuperclass() { |
| 12665 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B {}"])); | 15789 Source source = addSource(EngineTestCase.createSource(["class A extends B {}
", "class B {}"])); |
| 12666 LibraryElement library = resolve(source); | 15790 LibraryElement library = resolve(source); |
| 12667 JUnitTestCase.assertNotNull(library); | 15791 JUnitTestCase.assertNotNull(library); |
| 12668 CompilationUnitElement unit = library.definingCompilationUnit; | 15792 CompilationUnitElement unit = library.definingCompilationUnit; |
| 12669 JUnitTestCase.assertNotNull(unit); | 15793 JUnitTestCase.assertNotNull(unit); |
| 12670 List<ClassElement> classes = unit.types; | 15794 List<ClassElement> classes = unit.types; |
| 12671 EngineTestCase.assertLength(2, classes); | 15795 EngineTestCase.assertLength(2, classes); |
| 12672 JUnitTestCase.assertFalse(classes[0].isValidMixin); | 15796 JUnitTestCase.assertFalse(classes[0].isValidMixin); |
| 12673 assertNoErrors(); | 15797 assertNoErrors(); |
| 12674 verify([source]); | 15798 verify([source]); |
| 12675 } | 15799 } |
| 12676 void test_isValidMixin_constructor() { | 15800 void test_isValidMixin_constructor() { |
| 12677 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}"])); | 15801 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}"])); |
| 12678 LibraryElement library = resolve(source); | 15802 LibraryElement library = resolve(source); |
| 12679 JUnitTestCase.assertNotNull(library); | 15803 JUnitTestCase.assertNotNull(library); |
| 12680 CompilationUnitElement unit = library.definingCompilationUnit; | 15804 CompilationUnitElement unit = library.definingCompilationUnit; |
| 12681 JUnitTestCase.assertNotNull(unit); | 15805 JUnitTestCase.assertNotNull(unit); |
| 12682 List<ClassElement> classes = unit.types; | 15806 List<ClassElement> classes = unit.types; |
| 12683 EngineTestCase.assertLength(1, classes); | 15807 EngineTestCase.assertLength(1, classes); |
| 12684 JUnitTestCase.assertFalse(classes[0].isValidMixin); | 15808 JUnitTestCase.assertFalse(classes[0].isValidMixin); |
| 12685 assertNoErrors(); | 15809 assertNoErrors(); |
| 12686 verify([source]); | 15810 verify([source]); |
| 12687 } | 15811 } |
| 12688 void test_isValidMixin_super() { | 15812 void test_isValidMixin_super() { |
| 12689 Source source = addSource(EngineTestCase.createSource(["class A {", " toStr
ing() {", " return super.toString();", " }", "}"])); | 15813 Source source = addSource(EngineTestCase.createSource([ |
| 15814 "class A {", |
| 15815 " toString() {", |
| 15816 " return super.toString();", |
| 15817 " }", |
| 15818 "}"])); |
| 12690 LibraryElement library = resolve(source); | 15819 LibraryElement library = resolve(source); |
| 12691 JUnitTestCase.assertNotNull(library); | 15820 JUnitTestCase.assertNotNull(library); |
| 12692 CompilationUnitElement unit = library.definingCompilationUnit; | 15821 CompilationUnitElement unit = library.definingCompilationUnit; |
| 12693 JUnitTestCase.assertNotNull(unit); | 15822 JUnitTestCase.assertNotNull(unit); |
| 12694 List<ClassElement> classes = unit.types; | 15823 List<ClassElement> classes = unit.types; |
| 12695 EngineTestCase.assertLength(1, classes); | 15824 EngineTestCase.assertLength(1, classes); |
| 12696 JUnitTestCase.assertFalse(classes[0].isValidMixin); | 15825 JUnitTestCase.assertFalse(classes[0].isValidMixin); |
| 12697 assertNoErrors(); | 15826 assertNoErrors(); |
| 12698 verify([source]); | 15827 verify([source]); |
| 12699 } | 15828 } |
| 12700 void test_isValidMixin_valid() { | 15829 void test_isValidMixin_valid() { |
| 12701 Source source = addSource(EngineTestCase.createSource(["class A {}"])); | 15830 Source source = addSource(EngineTestCase.createSource(["class A {}"])); |
| 12702 LibraryElement library = resolve(source); | 15831 LibraryElement library = resolve(source); |
| 12703 JUnitTestCase.assertNotNull(library); | 15832 JUnitTestCase.assertNotNull(library); |
| 12704 CompilationUnitElement unit = library.definingCompilationUnit; | 15833 CompilationUnitElement unit = library.definingCompilationUnit; |
| 12705 JUnitTestCase.assertNotNull(unit); | 15834 JUnitTestCase.assertNotNull(unit); |
| 12706 List<ClassElement> classes = unit.types; | 15835 List<ClassElement> classes = unit.types; |
| 12707 EngineTestCase.assertLength(1, classes); | 15836 EngineTestCase.assertLength(1, classes); |
| 12708 JUnitTestCase.assertTrue(classes[0].isValidMixin); | 15837 JUnitTestCase.assertTrue(classes[0].isValidMixin); |
| 12709 assertNoErrors(); | 15838 assertNoErrors(); |
| 12710 verify([source]); | 15839 verify([source]); |
| 12711 } | 15840 } |
| 12712 void test_labels_switch() { | 15841 void test_labels_switch() { |
| 12713 Source source = addSource(EngineTestCase.createSource(["void doSwitch(int ta
rget) {", " switch (target) {", " l0: case 0:", " continue l1;", " l
1: case 1:", " continue l0;", " default:", " continue l1;", " }",
"}"])); | 15842 Source source = addSource(EngineTestCase.createSource([ |
| 15843 "void doSwitch(int target) {", |
| 15844 " switch (target) {", |
| 15845 " l0: case 0:", |
| 15846 " continue l1;", |
| 15847 " l1: case 1:", |
| 15848 " continue l0;", |
| 15849 " default:", |
| 15850 " continue l1;", |
| 15851 " }", |
| 15852 "}"])); |
| 12714 LibraryElement library = resolve(source); | 15853 LibraryElement library = resolve(source); |
| 12715 JUnitTestCase.assertNotNull(library); | 15854 JUnitTestCase.assertNotNull(library); |
| 12716 assertNoErrors(); | 15855 assertNoErrors(); |
| 12717 verify([source]); | 15856 verify([source]); |
| 12718 } | 15857 } |
| 12719 void test_metadata_class() { | 15858 void test_metadata_class() { |
| 12720 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); | 15859 Source source = addSource(EngineTestCase.createSource(["const A = null;", "@
A class C {}"])); |
| 12721 LibraryElement library = resolve(source); | 15860 LibraryElement library = resolve(source); |
| 12722 JUnitTestCase.assertNotNull(library); | 15861 JUnitTestCase.assertNotNull(library); |
| 12723 CompilationUnitElement unit = library.definingCompilationUnit; | 15862 CompilationUnitElement unit = library.definingCompilationUnit; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12760 JUnitTestCase.assertNotNull(unit); | 15899 JUnitTestCase.assertNotNull(unit); |
| 12761 List<ClassElement> classes = unit.types; | 15900 List<ClassElement> classes = unit.types; |
| 12762 EngineTestCase.assertLength(1, classes); | 15901 EngineTestCase.assertLength(1, classes); |
| 12763 MethodElement method = classes[0].methods[0]; | 15902 MethodElement method = classes[0].methods[0]; |
| 12764 List<ElementAnnotation> annotations = method.metadata; | 15903 List<ElementAnnotation> annotations = method.metadata; |
| 12765 EngineTestCase.assertLength(1, annotations); | 15904 EngineTestCase.assertLength(1, annotations); |
| 12766 assertNoErrors(); | 15905 assertNoErrors(); |
| 12767 verify([source]); | 15906 verify([source]); |
| 12768 } | 15907 } |
| 12769 void test_method_fromMixin() { | 15908 void test_method_fromMixin() { |
| 12770 Source source = addSource(EngineTestCase.createSource(["class B {", " bar()
=> 1;", "}", "class A {", " foo() => 2;", "}", "", "class C extends B with A {
", " bar() => super.bar();", " foo() => super.foo();", "}"])); | 15909 Source source = addSource(EngineTestCase.createSource([ |
| 15910 "class B {", |
| 15911 " bar() => 1;", |
| 15912 "}", |
| 15913 "class A {", |
| 15914 " foo() => 2;", |
| 15915 "}", |
| 15916 "", |
| 15917 "class C extends B with A {", |
| 15918 " bar() => super.bar();", |
| 15919 " foo() => super.foo();", |
| 15920 "}"])); |
| 12771 resolve(source); | 15921 resolve(source); |
| 12772 assertNoErrors(); | 15922 assertNoErrors(); |
| 12773 verify([source]); | 15923 verify([source]); |
| 12774 } | 15924 } |
| 12775 void test_method_fromSuperclassMixin() { | 15925 void test_method_fromSuperclassMixin() { |
| 12776 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m1() {}", "}", "class B extends Object with A {", "}", "class C extends B {", "}
", "f(C c) {", " c.m1();", "}"])); | 15926 Source source = addSource(EngineTestCase.createSource([ |
| 15927 "class A {", |
| 15928 " void m1() {}", |
| 15929 "}", |
| 15930 "class B extends Object with A {", |
| 15931 "}", |
| 15932 "class C extends B {", |
| 15933 "}", |
| 15934 "f(C c) {", |
| 15935 " c.m1();", |
| 15936 "}"])); |
| 12777 resolve(source); | 15937 resolve(source); |
| 12778 assertNoErrors(); | 15938 assertNoErrors(); |
| 12779 verify([source]); | 15939 verify([source]); |
| 12780 } | 15940 } |
| 12781 void test_methodCascades() { | 15941 void test_methodCascades() { |
| 12782 Source source = addSource(EngineTestCase.createSource(["class A {", " void
m1() {}", " void m2() {}", " void m() {", " A a = new A();", " a..m1()",
" ..m2();", " }", "}"])); | 15942 Source source = addSource(EngineTestCase.createSource([ |
| 15943 "class A {", |
| 15944 " void m1() {}", |
| 15945 " void m2() {}", |
| 15946 " void m() {", |
| 15947 " A a = new A();", |
| 15948 " a..m1()", |
| 15949 " ..m2();", |
| 15950 " }", |
| 15951 "}"])); |
| 12783 resolve(source); | 15952 resolve(source); |
| 12784 assertNoErrors(); | 15953 assertNoErrors(); |
| 12785 verify([source]); | 15954 verify([source]); |
| 12786 } | 15955 } |
| 12787 void test_methodCascades_withSetter() { | 15956 void test_methodCascades_withSetter() { |
| 12788 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();", " }", "}"])); | 15957 Source source = addSource(EngineTestCase.createSource([ |
| 15958 "class A {", |
| 15959 " String name;", |
| 15960 " void m1() {}", |
| 15961 " void m2() {}", |
| 15962 " void m() {", |
| 15963 " A a = new A();", |
| 15964 " a..m1()", |
| 15965 " ..name = 'name'", |
| 15966 " ..m2();", |
| 15967 " }", |
| 15968 "}"])); |
| 12789 resolve(source); | 15969 resolve(source); |
| 12790 assertNoErrors(); | 15970 assertNoErrors(); |
| 12791 verify([source]); | 15971 verify([source]); |
| 12792 } | 15972 } |
| 12793 void test_resolveAgainstNull() { | 15973 void test_resolveAgainstNull() { |
| 12794 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " retu
rn null == p;", "}"])); | 15974 Source source = addSource(EngineTestCase.createSource(["f(var p) {", " retu
rn null == p;", "}"])); |
| 12795 resolve(source); | 15975 resolve(source); |
| 12796 assertNoErrors(); | 15976 assertNoErrors(); |
| 12797 verify([source]); | 15977 verify([source]); |
| 12798 } | 15978 } |
| 12799 void test_setter_inherited() { | 15979 void test_setter_inherited() { |
| 12800 Source source = addSource(EngineTestCase.createSource(["class A {", " int g
et x => 0;", " set x(int p) {}", "}", "class B extends A {", " int get x => su
per.x == null ? 0 : super.x;", " int f() => x = 1;", "}"])); | 15980 Source source = addSource(EngineTestCase.createSource([ |
| 15981 "class A {", |
| 15982 " int get x => 0;", |
| 15983 " set x(int p) {}", |
| 15984 "}", |
| 15985 "class B extends A {", |
| 15986 " int get x => super.x == null ? 0 : super.x;", |
| 15987 " int f() => x = 1;", |
| 15988 "}"])); |
| 12801 resolve(source); | 15989 resolve(source); |
| 12802 assertNoErrors(); | 15990 assertNoErrors(); |
| 12803 verify([source]); | 15991 verify([source]); |
| 12804 } | 15992 } |
| 12805 void test_setter_static() { | 15993 void test_setter_static() { |
| 12806 Source source = addSource(EngineTestCase.createSource(["set s(x) {", "}", ""
, "main() {", " s = 123;", "}"])); | 15994 Source source = addSource(EngineTestCase.createSource(["set s(x) {", "}", ""
, "main() {", " s = 123;", "}"])); |
| 12807 resolve(source); | 15995 resolve(source); |
| 12808 assertNoErrors(); | 15996 assertNoErrors(); |
| 12809 verify([source]); | 15997 verify([source]); |
| 12810 } | 15998 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13054 // ErrorResolverTest.dartSuite(); | 16242 // ErrorResolverTest.dartSuite(); |
| 13055 // HintCodeTest.dartSuite(); | 16243 // HintCodeTest.dartSuite(); |
| 13056 // NonHintCodeTest.dartSuite(); | 16244 // NonHintCodeTest.dartSuite(); |
| 13057 // NonErrorResolverTest.dartSuite(); | 16245 // NonErrorResolverTest.dartSuite(); |
| 13058 // SimpleResolverTest.dartSuite(); | 16246 // SimpleResolverTest.dartSuite(); |
| 13059 // StaticTypeWarningCodeTest.dartSuite(); | 16247 // StaticTypeWarningCodeTest.dartSuite(); |
| 13060 // StaticWarningCodeTest.dartSuite(); | 16248 // StaticWarningCodeTest.dartSuite(); |
| 13061 // StrictModeTest.dartSuite(); | 16249 // StrictModeTest.dartSuite(); |
| 13062 // TypePropagationTest.dartSuite(); | 16250 // TypePropagationTest.dartSuite(); |
| 13063 } | 16251 } |
| OLD | NEW |