| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.test.src.summary.resynthesize_ast_test; | 5 library analyzer.test.src.summary.resynthesize_ast_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 await super.test_blockBodiedLambdas_nestedLambdas_topLevel(); | 155 await super.test_blockBodiedLambdas_nestedLambdas_topLevel(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 @override | 158 @override |
| 159 @failingTest | 159 @failingTest |
| 160 test_blockBodiedLambdas_syncStar_topLevel() async { | 160 test_blockBodiedLambdas_syncStar_topLevel() async { |
| 161 await super.test_blockBodiedLambdas_syncStar_topLevel(); | 161 await super.test_blockBodiedLambdas_syncStar_topLevel(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 @override | 164 @override |
| 165 test_canInferAlsoFromStaticAndInstanceFieldsFlagOn() async { | |
| 166 variablesWithNotConstInitializers.add('a2'); | |
| 167 await super.test_canInferAlsoFromStaticAndInstanceFieldsFlagOn(); | |
| 168 } | |
| 169 | |
| 170 @override | |
| 171 @failingTest | 165 @failingTest |
| 172 test_circularReference_viaClosures_initializerTypes() async { | 166 test_circularReference_viaClosures_initializerTypes() async { |
| 173 await super.test_circularReference_viaClosures_initializerTypes(); | 167 await super.test_circularReference_viaClosures_initializerTypes(); |
| 174 } | 168 } |
| 175 | 169 |
| 176 test_infer_extractIndex_custom() async { | 170 test_infer_extractIndex_custom() async { |
| 177 var unit = await checkFileElement(''' | 171 var unit = await checkFileElement(''' |
| 178 class A { | 172 class A { |
| 179 String operator [](_) => null; | 173 String operator [](_) => null; |
| 180 } | 174 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 210 } |
| 217 class B { | 211 class B { |
| 218 C c = new C(); | 212 C c = new C(); |
| 219 } | 213 } |
| 220 class C { | 214 class C { |
| 221 int d; | 215 int d; |
| 222 } | 216 } |
| 223 var a = new A(); | 217 var a = new A(); |
| 224 var v = a.b.c.d; | 218 var v = a.b.c.d; |
| 225 '''); | 219 '''); |
| 226 expect(unit.topLevelVariables[1].type.toString(), 'int'); | 220 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); |
| 227 } | 221 } |
| 228 | 222 |
| 229 test_infer_extractProperty_getter_sequence_generic() async { | 223 test_infer_extractProperty_getter_sequence_generic() async { |
| 230 var unit = await checkFileElement(r''' | 224 var unit = await checkFileElement(r''' |
| 231 class A<T> { | 225 class A<T> { |
| 232 B<T> b = new B<T>(); | 226 B<T> b = new B<T>(); |
| 233 } | 227 } |
| 234 class B<K> { | 228 class B<K> { |
| 235 C<List<K>, int> c = new C<List<K>, int>(); | 229 C<List<K>, int> c = new C<List<K>, int>(); |
| 236 } | 230 } |
| 237 class C<K, V> { | 231 class C<K, V> { |
| 238 Map<K, V> d; | 232 Map<K, V> d; |
| 239 } | 233 } |
| 240 var a = new A<double>(); | 234 var a = new A<double>(); |
| 241 var v = a.b.c.d; | 235 var v = a.b.c.d; |
| 242 '''); | 236 '''); |
| 243 expect(unit.topLevelVariables[1].type.toString(), 'Map<List<double>, int>'); | 237 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); |
| 244 } | 238 } |
| 245 | 239 |
| 246 test_infer_extractProperty_getter_sequence_withUnresolved() async { | 240 test_infer_extractProperty_getter_sequence_withUnresolved() async { |
| 247 var unit = await checkFileElement(r''' | 241 var unit = await checkFileElement(r''' |
| 248 class A { | 242 class A { |
| 249 B b = new B(); | 243 B b = new B(); |
| 250 } | 244 } |
| 251 class B { | 245 class B { |
| 252 int c; | 246 int c; |
| 253 } | 247 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 282 } | 276 } |
| 283 class B { | 277 class B { |
| 284 C c = new C(); | 278 C c = new C(); |
| 285 } | 279 } |
| 286 class C { | 280 class C { |
| 287 int m(double p1, String p2) => 42; | 281 int m(double p1, String p2) => 42; |
| 288 } | 282 } |
| 289 var a = new A(); | 283 var a = new A(); |
| 290 var v = a.b.c.m; | 284 var v = a.b.c.m; |
| 291 '''); | 285 '''); |
| 292 expect(unit.topLevelVariables[1].type.toString(), '(double, String) → int'); | 286 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); |
| 293 } | 287 } |
| 294 | 288 |
| 295 test_infer_invokeConstructor_factoryRedirected() async { | 289 test_infer_invokeConstructor_factoryRedirected() async { |
| 296 await checkFileElement(r''' | 290 await checkFileElement(r''' |
| 297 class A { | 291 class A { |
| 298 factory A() = B; | 292 factory A() = B; |
| 299 } | 293 } |
| 300 class B implements A {} | 294 class B implements A {} |
| 301 var a = new A(); | 295 var a = new A(); |
| 302 '''); | 296 '''); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 } | 412 } |
| 419 class B<K> { | 413 class B<K> { |
| 420 C<List<K>, int> c = new C<List<K>, int>(); | 414 C<List<K>, int> c = new C<List<K>, int>(); |
| 421 } | 415 } |
| 422 class C<K, V> { | 416 class C<K, V> { |
| 423 Map<K, V> m() => null; | 417 Map<K, V> m() => null; |
| 424 } | 418 } |
| 425 var a = new A<double>(); | 419 var a = new A<double>(); |
| 426 var v = a.b.c.m(); | 420 var v = a.b.c.m(); |
| 427 '''); | 421 '''); |
| 428 expect(unit.topLevelVariables[1].type.toString(), 'Map<List<double>, int>'); | 422 expect(unit.topLevelVariables[1].type.toString(), 'dynamic'); |
| 429 } | 423 } |
| 430 | 424 |
| 431 test_infer_invokeMethodRef_method_gg() async { | 425 test_infer_invokeMethodRef_method_gg() async { |
| 432 var unit = await checkFileElement(r''' | 426 var unit = await checkFileElement(r''' |
| 433 class A<K> { | 427 class A<K> { |
| 434 /*=Map<K, V>*/ m/*<V>*/(/*=V*/ a) => null; | 428 /*=Map<K, V>*/ m/*<V>*/(/*=V*/ a) => null; |
| 435 } | 429 } |
| 436 var a = new A<int>(); | 430 var a = new A<int>(); |
| 437 var b = a.m(1.0); | 431 var b = a.m(1.0); |
| 438 '''); | 432 '''); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 464 class B { | 458 class B { |
| 465 int m() => 0; | 459 int m() => 0; |
| 466 } | 460 } |
| 467 var a = new A(); | 461 var a = new A(); |
| 468 ''', | 462 ''', |
| 469 name: '/a.dart'); | 463 name: '/a.dart'); |
| 470 var unit = await checkFileElement(r''' | 464 var unit = await checkFileElement(r''' |
| 471 import 'a.dart' as p; | 465 import 'a.dart' as p; |
| 472 var b = p.a.b.m(); | 466 var b = p.a.b.m(); |
| 473 '''); | 467 '''); |
| 474 expect(unit.topLevelVariables[0].type.toString(), 'int'); | 468 expect(unit.topLevelVariables[0].type.toString(), 'dynamic'); |
| 475 } | 469 } |
| 476 | 470 |
| 477 test_infer_invokeMethodRef_method_withInferredTypeInLibraryCycle() async { | 471 test_infer_invokeMethodRef_method_withInferredTypeInLibraryCycle() async { |
| 478 var unit = await checkFileElement(''' | 472 var unit = await checkFileElement(''' |
| 479 class Base { | 473 class Base { |
| 480 int m() => 0; | 474 int m() => 0; |
| 481 } | 475 } |
| 482 class A extends Base { | 476 class A extends Base { |
| 483 m() => 0; // Inferred return type: int | 477 m() => 0; // Inferred return type: int |
| 484 } | 478 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 509 '''); | 503 '''); |
| 510 // Since a.dart is in a separate library file from the compilation unit | 504 // Since a.dart is in a separate library file from the compilation unit |
| 511 // containing `a` and `b`, its types are inferred first; then `a` and `b`'s | 505 // containing `a` and `b`, its types are inferred first; then `a` and `b`'s |
| 512 // types are inferred. So the inferred return type of `int` should be | 506 // types are inferred. So the inferred return type of `int` should be |
| 513 // propagated to `b`. | 507 // propagated to `b`. |
| 514 expect(unit.topLevelVariables[1].type.toString(), 'int'); | 508 expect(unit.topLevelVariables[1].type.toString(), 'int'); |
| 515 } | 509 } |
| 516 | 510 |
| 517 @override | 511 @override |
| 518 @failingTest | 512 @failingTest |
| 519 test_inferCorrectlyOnMultipleVariablesDeclaredTogether() async { | |
| 520 await super.test_inferCorrectlyOnMultipleVariablesDeclaredTogether(); | |
| 521 } | |
| 522 | |
| 523 @override | |
| 524 @failingTest | |
| 525 test_inferenceInCyclesIsDeterministic() async { | |
| 526 await super.test_inferenceInCyclesIsDeterministic(); | |
| 527 } | |
| 528 | |
| 529 @override | |
| 530 @failingTest | |
| 531 test_inferLocalFunctionReturnType() async { | 513 test_inferLocalFunctionReturnType() async { |
| 532 await super.test_inferLocalFunctionReturnType(); | 514 await super.test_inferLocalFunctionReturnType(); |
| 533 } | 515 } |
| 534 | 516 |
| 535 @override | 517 @override |
| 536 @failingTest | 518 @failingTest |
| 537 test_inferredType_blockBodiedClosure_noArguments() async { | 519 test_inferredType_blockBodiedClosure_noArguments() async { |
| 538 await super.test_inferredType_blockBodiedClosure_noArguments(); | 520 await super.test_inferredType_blockBodiedClosure_noArguments(); |
| 539 } | 521 } |
| 540 | 522 |
| 541 @override | 523 @override |
| 542 @failingTest | 524 @failingTest |
| 543 test_inferredType_blockClosure_noArgs_noReturn() async { | 525 test_inferredType_blockClosure_noArgs_noReturn() async { |
| 544 await super.test_inferredType_blockClosure_noArgs_noReturn(); | 526 await super.test_inferredType_blockClosure_noArgs_noReturn(); |
| 545 } | 527 } |
| 546 | 528 |
| 547 @override | |
| 548 @failingTest | |
| 549 test_inferredType_opAssignToProperty_prefixedIdentifier() async { | |
| 550 await super.test_inferredType_opAssignToProperty_prefixedIdentifier(); | |
| 551 } | |
| 552 | |
| 553 @override | |
| 554 @failingTest | |
| 555 test_inferredType_opAssignToProperty_prefixedIdentifier_viaInterface() async { | |
| 556 return super | |
| 557 .test_inferredType_opAssignToProperty_prefixedIdentifier_viaInterface(); | |
| 558 } | |
| 559 | |
| 560 test_invokeMethod_notGeneric_genericClass() async { | 529 test_invokeMethod_notGeneric_genericClass() async { |
| 561 var unit = await checkFileElement(r''' | 530 var unit = await checkFileElement(r''' |
| 562 class C<T> { | 531 class C<T> { |
| 563 T m(int a, {String b, T c}) => null; | 532 T m(int a, {String b, T c}) => null; |
| 564 } | 533 } |
| 565 var v = new C<double>().m(1, b: 'bbb', c: 2.0); | 534 var v = new C<double>().m(1, b: 'bbb', c: 2.0); |
| 566 '''); | 535 '''); |
| 567 expect(unit.topLevelVariables[0].type.toString(), 'double'); | 536 expect(unit.topLevelVariables[0].type.toString(), 'double'); |
| 568 } | 537 } |
| 569 | 538 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 | 893 |
| 925 @override | 894 @override |
| 926 AnalysisOptionsImpl createOptions() => | 895 AnalysisOptionsImpl createOptions() => |
| 927 super.createOptions()..strongMode = isStrongMode; | 896 super.createOptions()..strongMode = isStrongMode; |
| 928 | 897 |
| 929 @override | 898 @override |
| 930 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { | 899 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { |
| 931 return _encodeLibrary(source); | 900 return _encodeLibrary(source); |
| 932 } | 901 } |
| 933 } | 902 } |
| OLD | NEW |