| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_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/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 } else { | 1365 } else { |
| 1366 checkElementText(library, r''' | 1366 checkElementText(library, r''' |
| 1367 abstract class C { | 1367 abstract class C { |
| 1368 } | 1368 } |
| 1369 '''); | 1369 '''); |
| 1370 } | 1370 } |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 test_class_alias() async { | 1373 test_class_alias() async { |
| 1374 var library = await checkLibrary(''' | 1374 var library = await checkLibrary(''' |
| 1375 class C = D with E, F; | 1375 class C = D with E, F, G; |
| 1376 class D {} | 1376 class D {} |
| 1377 class E {} | 1377 class E {} |
| 1378 class F {} | 1378 class F {} |
| 1379 class G {} |
| 1379 '''); | 1380 '''); |
| 1380 if (isStrongMode) { | 1381 checkElementText(library, r''' |
| 1381 checkElementText(library, r''' | 1382 class alias C extends D with E, F, G { |
| 1382 class alias C extends D with E, F { | |
| 1383 synthetic C() = D; | 1383 synthetic C() = D; |
| 1384 } | 1384 } |
| 1385 class D { | 1385 class D { |
| 1386 } | 1386 } |
| 1387 class E { | 1387 class E { |
| 1388 } | 1388 } |
| 1389 class F { | 1389 class F { |
| 1390 } | 1390 } |
| 1391 '''); | 1391 class G { |
| 1392 } else { | |
| 1393 checkElementText(library, r''' | |
| 1394 class alias C extends D with E, F { | |
| 1395 synthetic C() = D; | |
| 1396 } | |
| 1397 class D { | |
| 1398 } | |
| 1399 class E { | |
| 1400 } | |
| 1401 class F { | |
| 1402 } | 1392 } |
| 1403 '''); | 1393 '''); |
| 1404 } | |
| 1405 } | 1394 } |
| 1406 | 1395 |
| 1407 test_class_alias_abstract() async { | 1396 test_class_alias_abstract() async { |
| 1408 var library = await checkLibrary(''' | 1397 var library = await checkLibrary(''' |
| 1409 abstract class C = D with E; | 1398 abstract class C = D with E; |
| 1410 class D {} | 1399 class D {} |
| 1411 class E {} | 1400 class E {} |
| 1412 '''); | 1401 '''); |
| 1413 if (isStrongMode) { | 1402 if (isStrongMode) { |
| 1414 checkElementText(library, r''' | 1403 checkElementText(library, r''' |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 synthetic C() = D; | 1454 synthetic C() = D; |
| 1466 } | 1455 } |
| 1467 class D { | 1456 class D { |
| 1468 } | 1457 } |
| 1469 class E { | 1458 class E { |
| 1470 } | 1459 } |
| 1471 '''); | 1460 '''); |
| 1472 } | 1461 } |
| 1473 } | 1462 } |
| 1474 | 1463 |
| 1464 test_class_alias_generic() async { |
| 1465 var library = await checkLibrary(''' |
| 1466 class Z = A with B<int>, C<double>; |
| 1467 class A {} |
| 1468 class B<B1> {} |
| 1469 class C<C1> {} |
| 1470 '''); |
| 1471 checkElementText(library, r''' |
| 1472 class alias Z extends A with B<int>, C<double> { |
| 1473 synthetic Z() = A; |
| 1474 } |
| 1475 class A { |
| 1476 } |
| 1477 class B<B1> { |
| 1478 } |
| 1479 class C<C1> { |
| 1480 } |
| 1481 '''); |
| 1482 } |
| 1483 |
| 1475 test_class_alias_with_forwarding_constructors() async { | 1484 test_class_alias_with_forwarding_constructors() async { |
| 1476 addLibrarySource('/a.dart', ''' | 1485 addLibrarySource('/a.dart', ''' |
| 1477 class Base { | 1486 class Base { |
| 1478 Base._priv(); | 1487 Base._priv(); |
| 1479 Base(); | 1488 Base(); |
| 1480 Base.noArgs(); | 1489 Base.noArgs(); |
| 1481 Base.requiredArg(x); | 1490 Base.requiredArg(x); |
| 1482 Base.positionalArg([x]); | 1491 Base.positionalArg([x]); |
| 1483 Base.namedArg({x}); | 1492 Base.namedArg({x}); |
| 1484 factory Base.fact() => null; | 1493 factory Base.fact() => null; |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2556 checkElementText(library, r''' | 2565 checkElementText(library, r''' |
| 2557 class C { | 2566 class C { |
| 2558 dynamic f() {} | 2567 dynamic f() {} |
| 2559 dynamic g() {} | 2568 dynamic g() {} |
| 2560 } | 2569 } |
| 2561 '''); | 2570 '''); |
| 2562 } | 2571 } |
| 2563 } | 2572 } |
| 2564 | 2573 |
| 2565 test_class_mixins() async { | 2574 test_class_mixins() async { |
| 2566 var library = await checkLibrary( | 2575 var library = await checkLibrary(''' |
| 2567 'class C extends Object with D, E {} class D {} class E {}'); | 2576 class C extends D with E, F, G {} |
| 2568 if (isStrongMode) { | 2577 class D {} |
| 2569 checkElementText(library, r''' | 2578 class E {} |
| 2570 class C extends Object with D, E { | 2579 class F {} |
| 2580 class G {} |
| 2581 '''); |
| 2582 checkElementText(library, r''' |
| 2583 class C extends D with E, F, G { |
| 2571 synthetic C(); | 2584 synthetic C(); |
| 2572 } | 2585 } |
| 2573 class D { | 2586 class D { |
| 2574 } | 2587 } |
| 2575 class E { | 2588 class E { |
| 2576 } | 2589 } |
| 2577 '''); | 2590 class F { |
| 2578 } else { | |
| 2579 checkElementText(library, r''' | |
| 2580 class C extends Object with D, E { | |
| 2581 synthetic C(); | |
| 2582 } | 2591 } |
| 2583 class D { | 2592 class G { |
| 2584 } | |
| 2585 class E { | |
| 2586 } | 2593 } |
| 2587 '''); | 2594 '''); |
| 2588 } | 2595 } |
| 2596 |
| 2597 test_class_mixins_generic() async { |
| 2598 var library = await checkLibrary(''' |
| 2599 class Z extends A with B<int>, C<double> {} |
| 2600 class A {} |
| 2601 class B<B1> {} |
| 2602 class C<C1> {} |
| 2603 '''); |
| 2604 checkElementText(library, r''' |
| 2605 class Z extends A with B<int>, C<double> { |
| 2606 synthetic Z(); |
| 2607 } |
| 2608 class A { |
| 2609 } |
| 2610 class B<B1> { |
| 2611 } |
| 2612 class C<C1> { |
| 2613 } |
| 2614 '''); |
| 2589 } | 2615 } |
| 2590 | 2616 |
| 2591 test_class_mixins_unresolved() async { | 2617 test_class_mixins_unresolved() async { |
| 2592 var library = await checkLibrary( | 2618 var library = await checkLibrary( |
| 2593 'class C extends Object with X, Y, Z; class X {} class Z {}', | 2619 'class C extends Object with X, Y, Z; class X {} class Z {}', |
| 2594 allowErrors: true); | 2620 allowErrors: true); |
| 2595 if (isStrongMode) { | 2621 if (isStrongMode) { |
| 2596 checkElementText(library, r''' | 2622 checkElementText(library, r''' |
| 2597 class C extends Object with X, Z { | 2623 class C extends Object with X, Z { |
| 2598 synthetic C(); | 2624 synthetic C(); |
| (...skipping 10571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13170 fail('Unexpectedly tried to get unlinked summary for $uri'); | 13196 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 13171 } | 13197 } |
| 13172 return serializedUnit; | 13198 return serializedUnit; |
| 13173 } | 13199 } |
| 13174 | 13200 |
| 13175 @override | 13201 @override |
| 13176 bool hasLibrarySummary(String uri) { | 13202 bool hasLibrarySummary(String uri) { |
| 13177 return true; | 13203 return true; |
| 13178 } | 13204 } |
| 13179 } | 13205 } |
| OLD | NEW |