Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_common.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 1358
1359 /** 1359 /**
1360 * Return a [SummaryResynthesizer] to resynthesize the library with the 1360 * Return a [SummaryResynthesizer] to resynthesize the library with the
1361 * given [librarySource]. 1361 * given [librarySource].
1362 */ 1362 */
1363 SummaryResynthesizer encodeDecodeLibrarySource(Source librarySource); 1363 SummaryResynthesizer encodeDecodeLibrarySource(Source librarySource);
1364 1364
1365 fail_library_hasExtUri() async { 1365 fail_library_hasExtUri() async {
1366 var library = await checkLibrary('import "dart-ext:doesNotExist.dart";'); 1366 var library = await checkLibrary('import "dart-ext:doesNotExist.dart";');
1367 if (isStrongMode) { 1367 if (isStrongMode) {
1368 checkElementText( 1368 checkElementText(library, r'''
1369 library,
1370 r'''
1371 '''); 1369 ''');
1372 } else { 1370 } else {
1373 checkElementText( 1371 checkElementText(library, r'''
1374 library,
1375 r'''
1376 '''); 1372 ''');
1377 } 1373 }
1378 } 1374 }
1379 1375
1380 test_class_abstract() async { 1376 test_class_abstract() async {
1381 var library = await checkLibrary('abstract class C {}'); 1377 var library = await checkLibrary('abstract class C {}');
1382 if (isStrongMode) { 1378 if (isStrongMode) {
1383 checkElementText( 1379 checkElementText(library, r'''
1384 library,
1385 r'''
1386 abstract class C { 1380 abstract class C {
1387 } 1381 }
1388 '''); 1382 ''');
1389 } else { 1383 } else {
1390 checkElementText( 1384 checkElementText(library, r'''
1391 library,
1392 r'''
1393 abstract class C { 1385 abstract class C {
1394 } 1386 }
1395 '''); 1387 ''');
1396 } 1388 }
1397 } 1389 }
1398 1390
1399 test_class_alias() async { 1391 test_class_alias() async {
1400 var library = await checkLibrary(''' 1392 var library = await checkLibrary('''
1401 class C = D with E, F; 1393 class C = D with E, F;
1402 class D {} 1394 class D {}
1403 class E {} 1395 class E {}
1404 class F {} 1396 class F {}
1405 '''); 1397 ''');
1406 if (isStrongMode) { 1398 if (isStrongMode) {
1407 checkElementText( 1399 checkElementText(library, r'''
1408 library,
1409 r'''
1410 class alias C extends D with E, F { 1400 class alias C extends D with E, F {
1411 synthetic C() = D; 1401 synthetic C() = D;
1412 } 1402 }
1413 class D { 1403 class D {
1414 } 1404 }
1415 class E { 1405 class E {
1416 } 1406 }
1417 class F { 1407 class F {
1418 } 1408 }
1419 '''); 1409 ''');
1420 } else { 1410 } else {
1421 checkElementText( 1411 checkElementText(library, r'''
1422 library,
1423 r'''
1424 class alias C extends D with E, F { 1412 class alias C extends D with E, F {
1425 synthetic C() = D; 1413 synthetic C() = D;
1426 } 1414 }
1427 class D { 1415 class D {
1428 } 1416 }
1429 class E { 1417 class E {
1430 } 1418 }
1431 class F { 1419 class F {
1432 } 1420 }
1433 '''); 1421 ''');
1434 } 1422 }
1435 } 1423 }
1436 1424
1437 test_class_alias_abstract() async { 1425 test_class_alias_abstract() async {
1438 var library = await checkLibrary(''' 1426 var library = await checkLibrary('''
1439 abstract class C = D with E; 1427 abstract class C = D with E;
1440 class D {} 1428 class D {}
1441 class E {} 1429 class E {}
1442 '''); 1430 ''');
1443 if (isStrongMode) { 1431 if (isStrongMode) {
1444 checkElementText( 1432 checkElementText(library, r'''
1445 library,
1446 r'''
1447 abstract class alias C extends D with E { 1433 abstract class alias C extends D with E {
1448 synthetic C() = D; 1434 synthetic C() = D;
1449 } 1435 }
1450 class D { 1436 class D {
1451 } 1437 }
1452 class E { 1438 class E {
1453 } 1439 }
1454 '''); 1440 ''');
1455 } else { 1441 } else {
1456 checkElementText( 1442 checkElementText(library, r'''
1457 library,
1458 r'''
1459 abstract class alias C extends D with E { 1443 abstract class alias C extends D with E {
1460 synthetic C() = D; 1444 synthetic C() = D;
1461 } 1445 }
1462 class D { 1446 class D {
1463 } 1447 }
1464 class E { 1448 class E {
1465 } 1449 }
1466 '''); 1450 ''');
1467 } 1451 }
1468 } 1452 }
1469 1453
1470 test_class_alias_documented() async { 1454 test_class_alias_documented() async {
1471 var library = await checkLibrary(''' 1455 var library = await checkLibrary('''
1472 // Extra comment so doc comment offset != 0 1456 // Extra comment so doc comment offset != 0
1473 /** 1457 /**
1474 * Docs 1458 * Docs
1475 */ 1459 */
1476 class C = D with E; 1460 class C = D with E;
1477 1461
1478 class D {} 1462 class D {}
1479 class E {}'''); 1463 class E {}''');
1480 if (isStrongMode) { 1464 if (isStrongMode) {
1481 checkElementText( 1465 checkElementText(library, r'''
1482 library,
1483 r'''
1484 /** 1466 /**
1485 * Docs 1467 * Docs
1486 */ 1468 */
1487 class alias C extends D with E { 1469 class alias C extends D with E {
1488 synthetic C() = D; 1470 synthetic C() = D;
1489 } 1471 }
1490 class D { 1472 class D {
1491 } 1473 }
1492 class E { 1474 class E {
1493 } 1475 }
1494 '''); 1476 ''');
1495 } else { 1477 } else {
1496 checkElementText( 1478 checkElementText(library, r'''
1497 library,
1498 r'''
1499 /** 1479 /**
1500 * Docs 1480 * Docs
1501 */ 1481 */
1502 class alias C extends D with E { 1482 class alias C extends D with E {
1503 synthetic C() = D; 1483 synthetic C() = D;
1504 } 1484 }
1505 class D { 1485 class D {
1506 } 1486 }
1507 class E { 1487 class E {
1508 } 1488 }
1509 '''); 1489 ''');
1510 } 1490 }
1511 } 1491 }
1512 1492
1513 test_class_alias_with_forwarding_constructors() async { 1493 test_class_alias_with_forwarding_constructors() async {
1514 addLibrarySource( 1494 addLibrarySource('/a.dart', '''
1515 '/a.dart',
1516 '''
1517 class Base { 1495 class Base {
1518 Base._priv(); 1496 Base._priv();
1519 Base(); 1497 Base();
1520 Base.noArgs(); 1498 Base.noArgs();
1521 Base.requiredArg(x); 1499 Base.requiredArg(x);
1522 Base.positionalArg([x]); 1500 Base.positionalArg([x]);
1523 Base.namedArg({x}); 1501 Base.namedArg({x});
1524 factory Base.fact() => null; 1502 factory Base.fact() => null;
1525 factory Base.fact2() = Base.noArgs; 1503 factory Base.fact2() = Base.noArgs;
1526 } 1504 }
1527 '''); 1505 ''');
1528 var library = await checkLibrary(''' 1506 var library = await checkLibrary('''
1529 import "a.dart"; 1507 import "a.dart";
1530 class M {} 1508 class M {}
1531 class MixinApp = Base with M; 1509 class MixinApp = Base with M;
1532 '''); 1510 ''');
1533 if (isStrongMode) { 1511 if (isStrongMode) {
1534 checkElementText( 1512 checkElementText(library, r'''
1535 library,
1536 r'''
1537 import 'a.dart'; 1513 import 'a.dart';
1538 class M { 1514 class M {
1539 } 1515 }
1540 class alias MixinApp extends Base with M { 1516 class alias MixinApp extends Base with M {
1541 synthetic MixinApp._priv() = Base._priv; 1517 synthetic MixinApp._priv() = Base._priv;
1542 synthetic MixinApp() = Base; 1518 synthetic MixinApp() = Base;
1543 synthetic MixinApp.noArgs() = Base.noArgs; 1519 synthetic MixinApp.noArgs() = Base.noArgs;
1544 synthetic MixinApp.requiredArg(dynamic x) = Base.requiredArg; 1520 synthetic MixinApp.requiredArg(dynamic x) = Base.requiredArg;
1545 synthetic MixinApp.fact() = Base.fact; 1521 synthetic MixinApp.fact() = Base.fact;
1546 synthetic MixinApp.fact2() = Base.fact2; 1522 synthetic MixinApp.fact2() = Base.fact2;
1547 } 1523 }
1548 '''); 1524 ''');
1549 } else { 1525 } else {
1550 checkElementText( 1526 checkElementText(library, r'''
1551 library,
1552 r'''
1553 import 'a.dart'; 1527 import 'a.dart';
1554 class M { 1528 class M {
1555 } 1529 }
1556 class alias MixinApp extends Base with M { 1530 class alias MixinApp extends Base with M {
1557 synthetic MixinApp._priv() = Base._priv; 1531 synthetic MixinApp._priv() = Base._priv;
1558 synthetic MixinApp() = Base; 1532 synthetic MixinApp() = Base;
1559 synthetic MixinApp.noArgs() = Base.noArgs; 1533 synthetic MixinApp.noArgs() = Base.noArgs;
1560 synthetic MixinApp.requiredArg(dynamic x) = Base.requiredArg; 1534 synthetic MixinApp.requiredArg(dynamic x) = Base.requiredArg;
1561 synthetic MixinApp.fact() = Base.fact; 1535 synthetic MixinApp.fact() = Base.fact;
1562 synthetic MixinApp.fact2() = Base.fact2; 1536 synthetic MixinApp.fact2() = Base.fact2;
1563 } 1537 }
1564 '''); 1538 ''');
1565 } 1539 }
1566 } 1540 }
1567 1541
1568 test_class_alias_with_forwarding_constructors_type_substitution() async { 1542 test_class_alias_with_forwarding_constructors_type_substitution() async {
1569 var library = await checkLibrary(''' 1543 var library = await checkLibrary('''
1570 class Base<T> { 1544 class Base<T> {
1571 Base.ctor(T t, List<T> l); 1545 Base.ctor(T t, List<T> l);
1572 } 1546 }
1573 class M {} 1547 class M {}
1574 class MixinApp = Base with M; 1548 class MixinApp = Base with M;
1575 '''); 1549 ''');
1576 if (isStrongMode) { 1550 if (isStrongMode) {
1577 checkElementText( 1551 checkElementText(library, r'''
1578 library,
1579 r'''
1580 class Base<T> { 1552 class Base<T> {
1581 Base.ctor(T t, List<T> l); 1553 Base.ctor(T t, List<T> l);
1582 } 1554 }
1583 class M { 1555 class M {
1584 } 1556 }
1585 class alias MixinApp extends Base<dynamic> with M { 1557 class alias MixinApp extends Base<dynamic> with M {
1586 synthetic MixinApp.ctor(dynamic t, List<dynamic> l) = Base<T>.ctor; 1558 synthetic MixinApp.ctor(dynamic t, List<dynamic> l) = Base<T>.ctor;
1587 } 1559 }
1588 '''); 1560 ''');
1589 } else { 1561 } else {
1590 checkElementText( 1562 checkElementText(library, r'''
1591 library,
1592 r'''
1593 class Base<T> { 1563 class Base<T> {
1594 Base.ctor(T t, List<T> l); 1564 Base.ctor(T t, List<T> l);
1595 } 1565 }
1596 class M { 1566 class M {
1597 } 1567 }
1598 class alias MixinApp extends Base<dynamic> with M { 1568 class alias MixinApp extends Base<dynamic> with M {
1599 synthetic MixinApp.ctor(dynamic t, List<dynamic> l) = Base<T>.ctor; 1569 synthetic MixinApp.ctor(dynamic t, List<dynamic> l) = Base<T>.ctor;
1600 } 1570 }
1601 '''); 1571 ''');
1602 } 1572 }
1603 } 1573 }
1604 1574
1605 test_class_alias_with_forwarding_constructors_type_substitution_complex() asyn c { 1575 test_class_alias_with_forwarding_constructors_type_substitution_complex() asyn c {
1606 var library = await checkLibrary(''' 1576 var library = await checkLibrary('''
1607 class Base<T> { 1577 class Base<T> {
1608 Base.ctor(T t, List<T> l); 1578 Base.ctor(T t, List<T> l);
1609 } 1579 }
1610 class M {} 1580 class M {}
1611 class MixinApp<U> = Base<List<U>> with M; 1581 class MixinApp<U> = Base<List<U>> with M;
1612 '''); 1582 ''');
1613 if (isStrongMode) { 1583 if (isStrongMode) {
1614 checkElementText( 1584 checkElementText(library, r'''
1615 library,
1616 r'''
1617 class Base<T> { 1585 class Base<T> {
1618 Base.ctor(T t, List<T> l); 1586 Base.ctor(T t, List<T> l);
1619 } 1587 }
1620 class M { 1588 class M {
1621 } 1589 }
1622 class alias MixinApp<U> extends Base<List<U>> with M { 1590 class alias MixinApp<U> extends Base<List<U>> with M {
1623 synthetic MixinApp.ctor(List<U> t, List<List<U>> l) = Base<T>.ctor; 1591 synthetic MixinApp.ctor(List<U> t, List<List<U>> l) = Base<T>.ctor;
1624 } 1592 }
1625 '''); 1593 ''');
1626 } else { 1594 } else {
1627 checkElementText( 1595 checkElementText(library, r'''
1628 library,
1629 r'''
1630 class Base<T> { 1596 class Base<T> {
1631 Base.ctor(T t, List<T> l); 1597 Base.ctor(T t, List<T> l);
1632 } 1598 }
1633 class M { 1599 class M {
1634 } 1600 }
1635 class alias MixinApp<U> extends Base<List<U>> with M { 1601 class alias MixinApp<U> extends Base<List<U>> with M {
1636 synthetic MixinApp.ctor(List<U> t, List<List<U>> l) = Base<T>.ctor; 1602 synthetic MixinApp.ctor(List<U> t, List<List<U>> l) = Base<T>.ctor;
1637 } 1603 }
1638 '''); 1604 ''');
1639 } 1605 }
1640 } 1606 }
1641 1607
1642 test_class_alias_with_mixin_members() async { 1608 test_class_alias_with_mixin_members() async {
1643 var library = await checkLibrary(''' 1609 var library = await checkLibrary('''
1644 class C = D with E; 1610 class C = D with E;
1645 class D {} 1611 class D {}
1646 class E { 1612 class E {
1647 int get a => null; 1613 int get a => null;
1648 void set b(int i) {} 1614 void set b(int i) {}
1649 void f() {} 1615 void f() {}
1650 int x; 1616 int x;
1651 }'''); 1617 }''');
1652 if (isStrongMode) { 1618 if (isStrongMode) {
1653 checkElementText( 1619 checkElementText(library, r'''
1654 library,
1655 r'''
1656 class alias C extends D with E { 1620 class alias C extends D with E {
1657 synthetic C() = D; 1621 synthetic C() = D;
1658 } 1622 }
1659 class D { 1623 class D {
1660 } 1624 }
1661 class E { 1625 class E {
1662 int x; 1626 int x;
1663 int get a {} 1627 int get a {}
1664 void set b(int i) {} 1628 void set b(int i) {}
1665 void f() {} 1629 void f() {}
1666 } 1630 }
1667 '''); 1631 ''');
1668 } else { 1632 } else {
1669 checkElementText( 1633 checkElementText(library, r'''
1670 library,
1671 r'''
1672 class alias C extends D with E { 1634 class alias C extends D with E {
1673 synthetic C() = D; 1635 synthetic C() = D;
1674 } 1636 }
1675 class D { 1637 class D {
1676 } 1638 }
1677 class E { 1639 class E {
1678 int x; 1640 int x;
1679 int get a {} 1641 int get a {}
1680 void set b(int i) {} 1642 void set b(int i) {}
1681 void f() {} 1643 void f() {}
1682 } 1644 }
1683 '''); 1645 ''');
1684 } 1646 }
1685 } 1647 }
1686 1648
1687 test_class_constructor_const() async { 1649 test_class_constructor_const() async {
1688 var library = await checkLibrary('class C { const C(); }'); 1650 var library = await checkLibrary('class C { const C(); }');
1689 if (isStrongMode) { 1651 if (isStrongMode) {
1690 checkElementText( 1652 checkElementText(library, r'''
1691 library,
1692 r'''
1693 class C { 1653 class C {
1694 const C(); 1654 const C();
1695 } 1655 }
1696 '''); 1656 ''');
1697 } else { 1657 } else {
1698 checkElementText( 1658 checkElementText(library, r'''
1699 library,
1700 r'''
1701 class C { 1659 class C {
1702 const C(); 1660 const C();
1703 } 1661 }
1704 '''); 1662 ''');
1705 } 1663 }
1706 } 1664 }
1707 1665
1708 test_class_constructor_const_external() async { 1666 test_class_constructor_const_external() async {
1709 var library = await checkLibrary('class C { external const C(); }'); 1667 var library = await checkLibrary('class C { external const C(); }');
1710 if (isStrongMode) { 1668 if (isStrongMode) {
1711 checkElementText( 1669 checkElementText(library, r'''
1712 library,
1713 r'''
1714 class C { 1670 class C {
1715 external const C(); 1671 external const C();
1716 } 1672 }
1717 '''); 1673 ''');
1718 } else { 1674 } else {
1719 checkElementText( 1675 checkElementText(library, r'''
1720 library,
1721 r'''
1722 class C { 1676 class C {
1723 external const C(); 1677 external const C();
1724 } 1678 }
1725 '''); 1679 ''');
1726 } 1680 }
1727 } 1681 }
1728 1682
1729 test_class_constructor_explicit_named() async { 1683 test_class_constructor_explicit_named() async {
1730 var library = await checkLibrary('class C { C.foo(); }'); 1684 var library = await checkLibrary('class C { C.foo(); }');
1731 if (isStrongMode) { 1685 if (isStrongMode) {
1732 checkElementText( 1686 checkElementText(library, r'''
1733 library,
1734 r'''
1735 class C { 1687 class C {
1736 C.foo(); 1688 C.foo();
1737 } 1689 }
1738 '''); 1690 ''');
1739 } else { 1691 } else {
1740 checkElementText( 1692 checkElementText(library, r'''
1741 library,
1742 r'''
1743 class C { 1693 class C {
1744 C.foo(); 1694 C.foo();
1745 } 1695 }
1746 '''); 1696 ''');
1747 } 1697 }
1748 } 1698 }
1749 1699
1750 test_class_constructor_explicit_type_params() async { 1700 test_class_constructor_explicit_type_params() async {
1751 var library = await checkLibrary('class C<T, U> { C(); }'); 1701 var library = await checkLibrary('class C<T, U> { C(); }');
1752 if (isStrongMode) { 1702 if (isStrongMode) {
1753 checkElementText( 1703 checkElementText(library, r'''
1754 library,
1755 r'''
1756 class C<T, U> { 1704 class C<T, U> {
1757 C(); 1705 C();
1758 } 1706 }
1759 '''); 1707 ''');
1760 } else { 1708 } else {
1761 checkElementText( 1709 checkElementText(library, r'''
1762 library,
1763 r'''
1764 class C<T, U> { 1710 class C<T, U> {
1765 C(); 1711 C();
1766 } 1712 }
1767 '''); 1713 ''');
1768 } 1714 }
1769 } 1715 }
1770 1716
1771 test_class_constructor_explicit_unnamed() async { 1717 test_class_constructor_explicit_unnamed() async {
1772 var library = await checkLibrary('class C { C(); }'); 1718 var library = await checkLibrary('class C { C(); }');
1773 if (isStrongMode) { 1719 if (isStrongMode) {
1774 checkElementText( 1720 checkElementText(library, r'''
1775 library,
1776 r'''
1777 class C { 1721 class C {
1778 C(); 1722 C();
1779 } 1723 }
1780 '''); 1724 ''');
1781 } else { 1725 } else {
1782 checkElementText( 1726 checkElementText(library, r'''
1783 library,
1784 r'''
1785 class C { 1727 class C {
1786 C(); 1728 C();
1787 } 1729 }
1788 '''); 1730 ''');
1789 } 1731 }
1790 } 1732 }
1791 1733
1792 test_class_constructor_external() async { 1734 test_class_constructor_external() async {
1793 var library = await checkLibrary('class C { external C(); }'); 1735 var library = await checkLibrary('class C { external C(); }');
1794 if (isStrongMode) { 1736 if (isStrongMode) {
1795 checkElementText( 1737 checkElementText(library, r'''
1796 library,
1797 r'''
1798 class C { 1738 class C {
1799 external C(); 1739 external C();
1800 } 1740 }
1801 '''); 1741 ''');
1802 } else { 1742 } else {
1803 checkElementText( 1743 checkElementText(library, r'''
1804 library,
1805 r'''
1806 class C { 1744 class C {
1807 external C(); 1745 external C();
1808 } 1746 }
1809 '''); 1747 ''');
1810 } 1748 }
1811 } 1749 }
1812 1750
1813 test_class_constructor_factory() async { 1751 test_class_constructor_factory() async {
1814 var library = await checkLibrary('class C { factory C() => null; }'); 1752 var library = await checkLibrary('class C { factory C() => null; }');
1815 if (isStrongMode) { 1753 if (isStrongMode) {
1816 checkElementText( 1754 checkElementText(library, r'''
1817 library,
1818 r'''
1819 class C { 1755 class C {
1820 factory C(); 1756 factory C();
1821 } 1757 }
1822 '''); 1758 ''');
1823 } else { 1759 } else {
1824 checkElementText( 1760 checkElementText(library, r'''
1825 library,
1826 r'''
1827 class C { 1761 class C {
1828 factory C(); 1762 factory C();
1829 } 1763 }
1830 '''); 1764 ''');
1831 } 1765 }
1832 } 1766 }
1833 1767
1834 test_class_constructor_field_formal_dynamic_dynamic() async { 1768 test_class_constructor_field_formal_dynamic_dynamic() async {
1835 var library = 1769 var library =
1836 await checkLibrary('class C { dynamic x; C(dynamic this.x); }'); 1770 await checkLibrary('class C { dynamic x; C(dynamic this.x); }');
1837 if (isStrongMode) { 1771 if (isStrongMode) {
1838 checkElementText( 1772 checkElementText(library, r'''
1839 library,
1840 r'''
1841 class C { 1773 class C {
1842 dynamic x; 1774 dynamic x;
1843 C(dynamic this.x); 1775 C(dynamic this.x);
1844 } 1776 }
1845 '''); 1777 ''');
1846 } else { 1778 } else {
1847 checkElementText( 1779 checkElementText(library, r'''
1848 library,
1849 r'''
1850 class C { 1780 class C {
1851 dynamic x; 1781 dynamic x;
1852 C(dynamic this.x); 1782 C(dynamic this.x);
1853 } 1783 }
1854 '''); 1784 ''');
1855 } 1785 }
1856 } 1786 }
1857 1787
1858 test_class_constructor_field_formal_dynamic_typed() async { 1788 test_class_constructor_field_formal_dynamic_typed() async {
1859 var library = await checkLibrary('class C { dynamic x; C(int this.x); }'); 1789 var library = await checkLibrary('class C { dynamic x; C(int this.x); }');
1860 if (isStrongMode) { 1790 if (isStrongMode) {
1861 checkElementText( 1791 checkElementText(library, r'''
1862 library,
1863 r'''
1864 class C { 1792 class C {
1865 dynamic x; 1793 dynamic x;
1866 C(int this.x); 1794 C(int this.x);
1867 } 1795 }
1868 '''); 1796 ''');
1869 } else { 1797 } else {
1870 checkElementText( 1798 checkElementText(library, r'''
1871 library,
1872 r'''
1873 class C { 1799 class C {
1874 dynamic x; 1800 dynamic x;
1875 C(int this.x); 1801 C(int this.x);
1876 } 1802 }
1877 '''); 1803 ''');
1878 } 1804 }
1879 } 1805 }
1880 1806
1881 test_class_constructor_field_formal_dynamic_untyped() async { 1807 test_class_constructor_field_formal_dynamic_untyped() async {
1882 var library = await checkLibrary('class C { dynamic x; C(this.x); }'); 1808 var library = await checkLibrary('class C { dynamic x; C(this.x); }');
1883 if (isStrongMode) { 1809 if (isStrongMode) {
1884 checkElementText( 1810 checkElementText(library, r'''
1885 library,
1886 r'''
1887 class C { 1811 class C {
1888 dynamic x; 1812 dynamic x;
1889 C(dynamic this.x); 1813 C(dynamic this.x);
1890 } 1814 }
1891 '''); 1815 ''');
1892 } else { 1816 } else {
1893 checkElementText( 1817 checkElementText(library, r'''
1894 library,
1895 r'''
1896 class C { 1818 class C {
1897 dynamic x; 1819 dynamic x;
1898 C(dynamic this.x); 1820 C(dynamic this.x);
1899 } 1821 }
1900 '''); 1822 ''');
1901 } 1823 }
1902 } 1824 }
1903 1825
1904 test_class_constructor_field_formal_multiple_matching_fields() async { 1826 test_class_constructor_field_formal_multiple_matching_fields() async {
1905 // This is a compile-time error but it should still analyze consistently. 1827 // This is a compile-time error but it should still analyze consistently.
1906 var library = await checkLibrary('class C { C(this.x); int x; String x; }', 1828 var library = await checkLibrary('class C { C(this.x); int x; String x; }',
1907 allowErrors: true); 1829 allowErrors: true);
1908 if (isStrongMode) { 1830 if (isStrongMode) {
1909 checkElementText( 1831 checkElementText(library, r'''
1910 library,
1911 r'''
1912 class C { 1832 class C {
1913 int x; 1833 int x;
1914 String x; 1834 String x;
1915 C(int this.x); 1835 C(int this.x);
1916 } 1836 }
1917 '''); 1837 ''');
1918 } else { 1838 } else {
1919 checkElementText( 1839 checkElementText(library, r'''
1920 library,
1921 r'''
1922 class C { 1840 class C {
1923 int x; 1841 int x;
1924 String x; 1842 String x;
1925 C(int this.x); 1843 C(int this.x);
1926 } 1844 }
1927 '''); 1845 ''');
1928 } 1846 }
1929 } 1847 }
1930 1848
1931 test_class_constructor_field_formal_no_matching_field() async { 1849 test_class_constructor_field_formal_no_matching_field() async {
1932 // This is a compile-time error but it should still analyze consistently. 1850 // This is a compile-time error but it should still analyze consistently.
1933 var library = 1851 var library =
1934 await checkLibrary('class C { C(this.x); }', allowErrors: true); 1852 await checkLibrary('class C { C(this.x); }', allowErrors: true);
1935 if (isStrongMode) { 1853 if (isStrongMode) {
1936 checkElementText( 1854 checkElementText(library, r'''
1937 library,
1938 r'''
1939 class C { 1855 class C {
1940 C(dynamic this.x); 1856 C(dynamic this.x);
1941 } 1857 }
1942 '''); 1858 ''');
1943 } else { 1859 } else {
1944 checkElementText( 1860 checkElementText(library, r'''
1945 library,
1946 r'''
1947 class C { 1861 class C {
1948 C(dynamic this.x); 1862 C(dynamic this.x);
1949 } 1863 }
1950 '''); 1864 ''');
1951 } 1865 }
1952 } 1866 }
1953 1867
1954 test_class_constructor_field_formal_typed_dynamic() async { 1868 test_class_constructor_field_formal_typed_dynamic() async {
1955 var library = await checkLibrary('class C { num x; C(dynamic this.x); }', 1869 var library = await checkLibrary('class C { num x; C(dynamic this.x); }',
1956 allowErrors: true); 1870 allowErrors: true);
1957 if (isStrongMode) { 1871 if (isStrongMode) {
1958 checkElementText( 1872 checkElementText(library, r'''
1959 library,
1960 r'''
1961 class C { 1873 class C {
1962 num x; 1874 num x;
1963 C(dynamic this.x); 1875 C(dynamic this.x);
1964 } 1876 }
1965 '''); 1877 ''');
1966 } else { 1878 } else {
1967 checkElementText( 1879 checkElementText(library, r'''
1968 library,
1969 r'''
1970 class C { 1880 class C {
1971 num x; 1881 num x;
1972 C(dynamic this.x); 1882 C(dynamic this.x);
1973 } 1883 }
1974 '''); 1884 ''');
1975 } 1885 }
1976 } 1886 }
1977 1887
1978 test_class_constructor_field_formal_typed_typed() async { 1888 test_class_constructor_field_formal_typed_typed() async {
1979 var library = await checkLibrary('class C { num x; C(int this.x); }'); 1889 var library = await checkLibrary('class C { num x; C(int this.x); }');
1980 if (isStrongMode) { 1890 if (isStrongMode) {
1981 checkElementText( 1891 checkElementText(library, r'''
1982 library,
1983 r'''
1984 class C { 1892 class C {
1985 num x; 1893 num x;
1986 C(int this.x); 1894 C(int this.x);
1987 } 1895 }
1988 '''); 1896 ''');
1989 } else { 1897 } else {
1990 checkElementText( 1898 checkElementText(library, r'''
1991 library,
1992 r'''
1993 class C { 1899 class C {
1994 num x; 1900 num x;
1995 C(int this.x); 1901 C(int this.x);
1996 } 1902 }
1997 '''); 1903 ''');
1998 } 1904 }
1999 } 1905 }
2000 1906
2001 test_class_constructor_field_formal_typed_untyped() async { 1907 test_class_constructor_field_formal_typed_untyped() async {
2002 var library = await checkLibrary('class C { num x; C(this.x); }'); 1908 var library = await checkLibrary('class C { num x; C(this.x); }');
2003 if (isStrongMode) { 1909 if (isStrongMode) {
2004 checkElementText( 1910 checkElementText(library, r'''
2005 library,
2006 r'''
2007 class C { 1911 class C {
2008 num x; 1912 num x;
2009 C(num this.x); 1913 C(num this.x);
2010 } 1914 }
2011 '''); 1915 ''');
2012 } else { 1916 } else {
2013 checkElementText( 1917 checkElementText(library, r'''
2014 library,
2015 r'''
2016 class C { 1918 class C {
2017 num x; 1919 num x;
2018 C(num this.x); 1920 C(num this.x);
2019 } 1921 }
2020 '''); 1922 ''');
2021 } 1923 }
2022 } 1924 }
2023 1925
2024 test_class_constructor_field_formal_untyped_dynamic() async { 1926 test_class_constructor_field_formal_untyped_dynamic() async {
2025 var library = await checkLibrary('class C { var x; C(dynamic this.x); }'); 1927 var library = await checkLibrary('class C { var x; C(dynamic this.x); }');
2026 if (isStrongMode) { 1928 if (isStrongMode) {
2027 checkElementText( 1929 checkElementText(library, r'''
2028 library,
2029 r'''
2030 class C { 1930 class C {
2031 dynamic x; 1931 dynamic x;
2032 C(dynamic this.x); 1932 C(dynamic this.x);
2033 } 1933 }
2034 '''); 1934 ''');
2035 } else { 1935 } else {
2036 checkElementText( 1936 checkElementText(library, r'''
2037 library,
2038 r'''
2039 class C { 1937 class C {
2040 dynamic x; 1938 dynamic x;
2041 C(dynamic this.x); 1939 C(dynamic this.x);
2042 } 1940 }
2043 '''); 1941 ''');
2044 } 1942 }
2045 } 1943 }
2046 1944
2047 test_class_constructor_field_formal_untyped_typed() async { 1945 test_class_constructor_field_formal_untyped_typed() async {
2048 var library = await checkLibrary('class C { var x; C(int this.x); }'); 1946 var library = await checkLibrary('class C { var x; C(int this.x); }');
2049 if (isStrongMode) { 1947 if (isStrongMode) {
2050 checkElementText( 1948 checkElementText(library, r'''
2051 library,
2052 r'''
2053 class C { 1949 class C {
2054 dynamic x; 1950 dynamic x;
2055 C(int this.x); 1951 C(int this.x);
2056 } 1952 }
2057 '''); 1953 ''');
2058 } else { 1954 } else {
2059 checkElementText( 1955 checkElementText(library, r'''
2060 library,
2061 r'''
2062 class C { 1956 class C {
2063 dynamic x; 1957 dynamic x;
2064 C(int this.x); 1958 C(int this.x);
2065 } 1959 }
2066 '''); 1960 ''');
2067 } 1961 }
2068 } 1962 }
2069 1963
2070 test_class_constructor_field_formal_untyped_untyped() async { 1964 test_class_constructor_field_formal_untyped_untyped() async {
2071 var library = await checkLibrary('class C { var x; C(this.x); }'); 1965 var library = await checkLibrary('class C { var x; C(this.x); }');
2072 if (isStrongMode) { 1966 if (isStrongMode) {
2073 checkElementText( 1967 checkElementText(library, r'''
2074 library,
2075 r'''
2076 class C { 1968 class C {
2077 dynamic x; 1969 dynamic x;
2078 C(dynamic this.x); 1970 C(dynamic this.x);
2079 } 1971 }
2080 '''); 1972 ''');
2081 } else { 1973 } else {
2082 checkElementText( 1974 checkElementText(library, r'''
2083 library,
2084 r'''
2085 class C { 1975 class C {
2086 dynamic x; 1976 dynamic x;
2087 C(dynamic this.x); 1977 C(dynamic this.x);
2088 } 1978 }
2089 '''); 1979 ''');
2090 } 1980 }
2091 } 1981 }
2092 1982
2093 test_class_constructor_fieldFormal_named_noDefault() async { 1983 test_class_constructor_fieldFormal_named_noDefault() async {
2094 var library = await checkLibrary('class C { int x; C({this.x}); }'); 1984 var library = await checkLibrary('class C { int x; C({this.x}); }');
2095 if (isStrongMode) { 1985 if (isStrongMode) {
2096 checkElementText( 1986 checkElementText(library, r'''
2097 library,
2098 r'''
2099 class C { 1987 class C {
2100 int x; 1988 int x;
2101 C({int this.x}); 1989 C({int this.x});
2102 } 1990 }
2103 '''); 1991 ''');
2104 } else { 1992 } else {
2105 checkElementText( 1993 checkElementText(library, r'''
2106 library,
2107 r'''
2108 class C { 1994 class C {
2109 int x; 1995 int x;
2110 C({int this.x}); 1996 C({int this.x});
2111 } 1997 }
2112 '''); 1998 ''');
2113 } 1999 }
2114 } 2000 }
2115 2001
2116 test_class_constructor_fieldFormal_named_withDefault() async { 2002 test_class_constructor_fieldFormal_named_withDefault() async {
2117 var library = await checkLibrary('class C { int x; C({this.x: 42}); }'); 2003 var library = await checkLibrary('class C { int x; C({this.x: 42}); }');
2118 if (isStrongMode) { 2004 if (isStrongMode) {
2119 checkElementText( 2005 checkElementText(library, r'''
2120 library,
2121 r'''
2122 class C { 2006 class C {
2123 int x; 2007 int x;
2124 C({int this.x}); 2008 C({int this.x});
2125 } 2009 }
2126 '''); 2010 ''');
2127 } else { 2011 } else {
2128 checkElementText( 2012 checkElementText(library, r'''
2129 library,
2130 r'''
2131 class C { 2013 class C {
2132 int x; 2014 int x;
2133 C({int this.x}); 2015 C({int this.x});
2134 } 2016 }
2135 '''); 2017 ''');
2136 } 2018 }
2137 } 2019 }
2138 2020
2139 test_class_constructor_fieldFormal_optional_noDefault() async { 2021 test_class_constructor_fieldFormal_optional_noDefault() async {
2140 var library = await checkLibrary('class C { int x; C([this.x]); }'); 2022 var library = await checkLibrary('class C { int x; C([this.x]); }');
2141 if (isStrongMode) { 2023 if (isStrongMode) {
2142 checkElementText( 2024 checkElementText(library, r'''
2143 library,
2144 r'''
2145 class C { 2025 class C {
2146 int x; 2026 int x;
2147 C([int this.x]); 2027 C([int this.x]);
2148 } 2028 }
2149 '''); 2029 ''');
2150 } else { 2030 } else {
2151 checkElementText( 2031 checkElementText(library, r'''
2152 library,
2153 r'''
2154 class C { 2032 class C {
2155 int x; 2033 int x;
2156 C([int this.x]); 2034 C([int this.x]);
2157 } 2035 }
2158 '''); 2036 ''');
2159 } 2037 }
2160 } 2038 }
2161 2039
2162 test_class_constructor_fieldFormal_optional_withDefault() async { 2040 test_class_constructor_fieldFormal_optional_withDefault() async {
2163 var library = await checkLibrary('class C { int x; C([this.x = 42]); }'); 2041 var library = await checkLibrary('class C { int x; C([this.x = 42]); }');
2164 if (isStrongMode) { 2042 if (isStrongMode) {
2165 checkElementText( 2043 checkElementText(library, r'''
2166 library,
2167 r'''
2168 class C { 2044 class C {
2169 int x; 2045 int x;
2170 C([int this.x]); 2046 C([int this.x]);
2171 } 2047 }
2172 '''); 2048 ''');
2173 } else { 2049 } else {
2174 checkElementText( 2050 checkElementText(library, r'''
2175 library,
2176 r'''
2177 class C { 2051 class C {
2178 int x; 2052 int x;
2179 C([int this.x]); 2053 C([int this.x]);
2180 } 2054 }
2181 '''); 2055 ''');
2182 } 2056 }
2183 } 2057 }
2184 2058
2185 test_class_constructor_implicit() async { 2059 test_class_constructor_implicit() async {
2186 var library = await checkLibrary('class C {}'); 2060 var library = await checkLibrary('class C {}');
2187 if (isStrongMode) { 2061 if (isStrongMode) {
2188 checkElementText( 2062 checkElementText(library, r'''
2189 library,
2190 r'''
2191 class C { 2063 class C {
2192 } 2064 }
2193 '''); 2065 ''');
2194 } else { 2066 } else {
2195 checkElementText( 2067 checkElementText(library, r'''
2196 library,
2197 r'''
2198 class C { 2068 class C {
2199 } 2069 }
2200 '''); 2070 ''');
2201 } 2071 }
2202 } 2072 }
2203 2073
2204 test_class_constructor_implicit_type_params() async { 2074 test_class_constructor_implicit_type_params() async {
2205 var library = await checkLibrary('class C<T, U> {}'); 2075 var library = await checkLibrary('class C<T, U> {}');
2206 if (isStrongMode) { 2076 if (isStrongMode) {
2207 checkElementText( 2077 checkElementText(library, r'''
2208 library,
2209 r'''
2210 class C<T, U> { 2078 class C<T, U> {
2211 } 2079 }
2212 '''); 2080 ''');
2213 } else { 2081 } else {
2214 checkElementText( 2082 checkElementText(library, r'''
2215 library,
2216 r'''
2217 class C<T, U> { 2083 class C<T, U> {
2218 } 2084 }
2219 '''); 2085 ''');
2220 } 2086 }
2221 } 2087 }
2222 2088
2223 test_class_constructor_params() async { 2089 test_class_constructor_params() async {
2224 var library = await checkLibrary('class C { C(x, int y); }'); 2090 var library = await checkLibrary('class C { C(x, int y); }');
2225 if (isStrongMode) { 2091 if (isStrongMode) {
2226 checkElementText( 2092 checkElementText(library, r'''
2227 library,
2228 r'''
2229 class C { 2093 class C {
2230 C(dynamic x, int y); 2094 C(dynamic x, int y);
2231 } 2095 }
2232 '''); 2096 ''');
2233 } else { 2097 } else {
2234 checkElementText( 2098 checkElementText(library, r'''
2235 library,
2236 r'''
2237 class C { 2099 class C {
2238 C(dynamic x, int y); 2100 C(dynamic x, int y);
2239 } 2101 }
2240 '''); 2102 ''');
2241 } 2103 }
2242 } 2104 }
2243 2105
2244 test_class_constructors() async { 2106 test_class_constructors() async {
2245 var library = await checkLibrary('class C { C.foo(); C.bar(); }'); 2107 var library = await checkLibrary('class C { C.foo(); C.bar(); }');
2246 if (isStrongMode) { 2108 if (isStrongMode) {
2247 checkElementText( 2109 checkElementText(library, r'''
2248 library,
2249 r'''
2250 class C { 2110 class C {
2251 C.foo(); 2111 C.foo();
2252 C.bar(); 2112 C.bar();
2253 } 2113 }
2254 '''); 2114 ''');
2255 } else { 2115 } else {
2256 checkElementText( 2116 checkElementText(library, r'''
2257 library,
2258 r'''
2259 class C { 2117 class C {
2260 C.foo(); 2118 C.foo();
2261 C.bar(); 2119 C.bar();
2262 } 2120 }
2263 '''); 2121 ''');
2264 } 2122 }
2265 } 2123 }
2266 2124
2267 test_class_documented() async { 2125 test_class_documented() async {
2268 var library = await checkLibrary(''' 2126 var library = await checkLibrary('''
2269 // Extra comment so doc comment offset != 0 2127 // Extra comment so doc comment offset != 0
2270 /** 2128 /**
2271 * Docs 2129 * Docs
2272 */ 2130 */
2273 class C {}'''); 2131 class C {}''');
2274 if (isStrongMode) { 2132 if (isStrongMode) {
2275 checkElementText( 2133 checkElementText(library, r'''
2276 library,
2277 r'''
2278 /** 2134 /**
2279 * Docs 2135 * Docs
2280 */ 2136 */
2281 class C { 2137 class C {
2282 } 2138 }
2283 '''); 2139 ''');
2284 } else { 2140 } else {
2285 checkElementText( 2141 checkElementText(library, r'''
2286 library,
2287 r'''
2288 /** 2142 /**
2289 * Docs 2143 * Docs
2290 */ 2144 */
2291 class C { 2145 class C {
2292 } 2146 }
2293 '''); 2147 ''');
2294 } 2148 }
2295 } 2149 }
2296 2150
2297 test_class_documented_tripleSlash() async { 2151 test_class_documented_tripleSlash() async {
2298 var library = await checkLibrary(''' 2152 var library = await checkLibrary('''
2299 /// aaa 2153 /// aaa
2300 /// bbbb 2154 /// bbbb
2301 /// cc 2155 /// cc
2302 class C {}'''); 2156 class C {}''');
2303 if (isStrongMode) { 2157 if (isStrongMode) {
2304 checkElementText( 2158 checkElementText(library, r'''
2305 library,
2306 r'''
2307 /// aaa 2159 /// aaa
2308 /// bbbb 2160 /// bbbb
2309 /// cc 2161 /// cc
2310 class C { 2162 class C {
2311 } 2163 }
2312 '''); 2164 ''');
2313 } else { 2165 } else {
2314 checkElementText( 2166 checkElementText(library, r'''
2315 library,
2316 r'''
2317 /// aaa 2167 /// aaa
2318 /// bbbb 2168 /// bbbb
2319 /// cc 2169 /// cc
2320 class C { 2170 class C {
2321 } 2171 }
2322 '''); 2172 ''');
2323 } 2173 }
2324 } 2174 }
2325 2175
2326 test_class_documented_with_references() async { 2176 test_class_documented_with_references() async {
2327 var library = await checkLibrary(''' 2177 var library = await checkLibrary('''
2328 /** 2178 /**
2329 * Docs referring to [D] and [E] 2179 * Docs referring to [D] and [E]
2330 */ 2180 */
2331 class C {} 2181 class C {}
2332 2182
2333 class D {} 2183 class D {}
2334 class E {}'''); 2184 class E {}''');
2335 if (isStrongMode) { 2185 if (isStrongMode) {
2336 checkElementText( 2186 checkElementText(library, r'''
2337 library,
2338 r'''
2339 /** 2187 /**
2340 * Docs referring to [D] and [E] 2188 * Docs referring to [D] and [E]
2341 */ 2189 */
2342 class C { 2190 class C {
2343 } 2191 }
2344 class D { 2192 class D {
2345 } 2193 }
2346 class E { 2194 class E {
2347 } 2195 }
2348 '''); 2196 ''');
2349 } else { 2197 } else {
2350 checkElementText( 2198 checkElementText(library, r'''
2351 library,
2352 r'''
2353 /** 2199 /**
2354 * Docs referring to [D] and [E] 2200 * Docs referring to [D] and [E]
2355 */ 2201 */
2356 class C { 2202 class C {
2357 } 2203 }
2358 class D { 2204 class D {
2359 } 2205 }
2360 class E { 2206 class E {
2361 } 2207 }
2362 '''); 2208 ''');
2363 } 2209 }
2364 } 2210 }
2365 2211
2366 test_class_documented_with_windows_line_endings() async { 2212 test_class_documented_with_windows_line_endings() async {
2367 var library = await checkLibrary('/**\r\n * Docs\r\n */\r\nclass C {}'); 2213 var library = await checkLibrary('/**\r\n * Docs\r\n */\r\nclass C {}');
2368 if (isStrongMode) { 2214 if (isStrongMode) {
2369 checkElementText( 2215 checkElementText(library, r'''
2370 library,
2371 r'''
2372 /** 2216 /**
2373 * Docs 2217 * Docs
2374 */ 2218 */
2375 class C { 2219 class C {
2376 } 2220 }
2377 '''); 2221 ''');
2378 } else { 2222 } else {
2379 checkElementText( 2223 checkElementText(library, r'''
2380 library,
2381 r'''
2382 /** 2224 /**
2383 * Docs 2225 * Docs
2384 */ 2226 */
2385 class C { 2227 class C {
2386 } 2228 }
2387 '''); 2229 ''');
2388 } 2230 }
2389 } 2231 }
2390 2232
2391 test_class_field_const() async { 2233 test_class_field_const() async {
2392 var library = await checkLibrary('class C { static const int i = 0; }'); 2234 var library = await checkLibrary('class C { static const int i = 0; }');
2393 if (isStrongMode) { 2235 if (isStrongMode) {
2394 checkElementText( 2236 checkElementText(library, r'''
2395 library,
2396 r'''
2397 class C { 2237 class C {
2398 static const int i = 0; 2238 static const int i = 0;
2399 } 2239 }
2400 '''); 2240 ''');
2401 } else { 2241 } else {
2402 checkElementText( 2242 checkElementText(library, r'''
2403 library,
2404 r'''
2405 class C { 2243 class C {
2406 static const int i = 0; 2244 static const int i = 0;
2407 } 2245 }
2408 '''); 2246 ''');
2409 } 2247 }
2410 } 2248 }
2411 2249
2412 test_class_field_implicit_type() async { 2250 test_class_field_implicit_type() async {
2413 var library = await checkLibrary('class C { var x; }'); 2251 var library = await checkLibrary('class C { var x; }');
2414 if (isStrongMode) { 2252 if (isStrongMode) {
2415 checkElementText( 2253 checkElementText(library, r'''
2416 library,
2417 r'''
2418 class C { 2254 class C {
2419 dynamic x; 2255 dynamic x;
2420 } 2256 }
2421 '''); 2257 ''');
2422 } else { 2258 } else {
2423 checkElementText( 2259 checkElementText(library, r'''
2424 library,
2425 r'''
2426 class C { 2260 class C {
2427 dynamic x; 2261 dynamic x;
2428 } 2262 }
2429 '''); 2263 ''');
2430 } 2264 }
2431 } 2265 }
2432 2266
2433 test_class_field_static() async { 2267 test_class_field_static() async {
2434 var library = await checkLibrary('class C { static int i; }'); 2268 var library = await checkLibrary('class C { static int i; }');
2435 if (isStrongMode) { 2269 if (isStrongMode) {
2436 checkElementText( 2270 checkElementText(library, r'''
2437 library,
2438 r'''
2439 class C { 2271 class C {
2440 static int i; 2272 static int i;
2441 } 2273 }
2442 '''); 2274 ''');
2443 } else { 2275 } else {
2444 checkElementText( 2276 checkElementText(library, r'''
2445 library,
2446 r'''
2447 class C { 2277 class C {
2448 static int i; 2278 static int i;
2449 } 2279 }
2450 '''); 2280 ''');
2451 } 2281 }
2452 } 2282 }
2453 2283
2454 test_class_fields() async { 2284 test_class_fields() async {
2455 var library = await checkLibrary('class C { int i; int j; }'); 2285 var library = await checkLibrary('class C { int i; int j; }');
2456 if (isStrongMode) { 2286 if (isStrongMode) {
2457 checkElementText( 2287 checkElementText(library, r'''
2458 library,
2459 r'''
2460 class C { 2288 class C {
2461 int i; 2289 int i;
2462 int j; 2290 int j;
2463 } 2291 }
2464 '''); 2292 ''');
2465 } else { 2293 } else {
2466 checkElementText( 2294 checkElementText(library, r'''
2467 library,
2468 r'''
2469 class C { 2295 class C {
2470 int i; 2296 int i;
2471 int j; 2297 int j;
2472 } 2298 }
2473 '''); 2299 ''');
2474 } 2300 }
2475 } 2301 }
2476 2302
2477 test_class_getter_abstract() async { 2303 test_class_getter_abstract() async {
2478 var library = await checkLibrary('abstract class C { int get x; }'); 2304 var library = await checkLibrary('abstract class C { int get x; }');
2479 if (isStrongMode) { 2305 if (isStrongMode) {
2480 checkElementText( 2306 checkElementText(library, r'''
2481 library,
2482 r'''
2483 abstract class C { 2307 abstract class C {
2484 int get x; 2308 int get x;
2485 } 2309 }
2486 '''); 2310 ''');
2487 } else { 2311 } else {
2488 checkElementText( 2312 checkElementText(library, r'''
2489 library,
2490 r'''
2491 abstract class C { 2313 abstract class C {
2492 int get x; 2314 int get x;
2493 } 2315 }
2494 '''); 2316 ''');
2495 } 2317 }
2496 } 2318 }
2497 2319
2498 test_class_getter_external() async { 2320 test_class_getter_external() async {
2499 var library = await checkLibrary('class C { external int get x; }'); 2321 var library = await checkLibrary('class C { external int get x; }');
2500 if (isStrongMode) { 2322 if (isStrongMode) {
2501 checkElementText( 2323 checkElementText(library, r'''
2502 library,
2503 r'''
2504 class C { 2324 class C {
2505 external int get x {} 2325 external int get x {}
2506 } 2326 }
2507 '''); 2327 ''');
2508 } else { 2328 } else {
2509 checkElementText( 2329 checkElementText(library, r'''
2510 library,
2511 r'''
2512 class C { 2330 class C {
2513 external int get x {} 2331 external int get x {}
2514 } 2332 }
2515 '''); 2333 ''');
2516 } 2334 }
2517 } 2335 }
2518 2336
2519 test_class_getter_implicit_return_type() async { 2337 test_class_getter_implicit_return_type() async {
2520 var library = await checkLibrary('class C { get x => null; }'); 2338 var library = await checkLibrary('class C { get x => null; }');
2521 if (isStrongMode) { 2339 if (isStrongMode) {
2522 checkElementText( 2340 checkElementText(library, r'''
2523 library,
2524 r'''
2525 class C { 2341 class C {
2526 dynamic get x {} 2342 dynamic get x {}
2527 } 2343 }
2528 '''); 2344 ''');
2529 } else { 2345 } else {
2530 checkElementText( 2346 checkElementText(library, r'''
2531 library,
2532 r'''
2533 class C { 2347 class C {
2534 dynamic get x {} 2348 dynamic get x {}
2535 } 2349 }
2536 '''); 2350 ''');
2537 } 2351 }
2538 } 2352 }
2539 2353
2540 test_class_getter_static() async { 2354 test_class_getter_static() async {
2541 var library = await checkLibrary('class C { static int get x => null; }'); 2355 var library = await checkLibrary('class C { static int get x => null; }');
2542 if (isStrongMode) { 2356 if (isStrongMode) {
2543 checkElementText( 2357 checkElementText(library, r'''
2544 library,
2545 r'''
2546 class C { 2358 class C {
2547 static int get x {} 2359 static int get x {}
2548 } 2360 }
2549 '''); 2361 ''');
2550 } else { 2362 } else {
2551 checkElementText( 2363 checkElementText(library, r'''
2552 library,
2553 r'''
2554 class C { 2364 class C {
2555 static int get x {} 2365 static int get x {}
2556 } 2366 }
2557 '''); 2367 ''');
2558 } 2368 }
2559 } 2369 }
2560 2370
2561 test_class_getters() async { 2371 test_class_getters() async {
2562 var library = 2372 var library =
2563 await checkLibrary('class C { int get x => null; get y => null; }'); 2373 await checkLibrary('class C { int get x => null; get y => null; }');
2564 if (isStrongMode) { 2374 if (isStrongMode) {
2565 checkElementText( 2375 checkElementText(library, r'''
2566 library,
2567 r'''
2568 class C { 2376 class C {
2569 int get x {} 2377 int get x {}
2570 dynamic get y {} 2378 dynamic get y {}
2571 } 2379 }
2572 '''); 2380 ''');
2573 } else { 2381 } else {
2574 checkElementText( 2382 checkElementText(library, r'''
2575 library,
2576 r'''
2577 class C { 2383 class C {
2578 int get x {} 2384 int get x {}
2579 dynamic get y {} 2385 dynamic get y {}
2580 } 2386 }
2581 '''); 2387 ''');
2582 } 2388 }
2583 } 2389 }
2584 2390
2585 test_class_implicitField_getterFirst() async { 2391 test_class_implicitField_getterFirst() async {
2586 var library = await checkLibrary(''' 2392 var library = await checkLibrary('''
2587 class C { 2393 class C {
2588 int get x => 0; 2394 int get x => 0;
2589 void set x(int value) {} 2395 void set x(int value) {}
2590 } 2396 }
2591 '''); 2397 ''');
2592 if (isStrongMode) { 2398 if (isStrongMode) {
2593 checkElementText( 2399 checkElementText(library, r'''
2594 library,
2595 r'''
2596 class C { 2400 class C {
2597 int get x {} 2401 int get x {}
2598 void set x(int value) {} 2402 void set x(int value) {}
2599 } 2403 }
2600 '''); 2404 ''');
2601 } else { 2405 } else {
2602 checkElementText( 2406 checkElementText(library, r'''
2603 library,
2604 r'''
2605 class C { 2407 class C {
2606 int get x {} 2408 int get x {}
2607 void set x(int value) {} 2409 void set x(int value) {}
2608 } 2410 }
2609 '''); 2411 ''');
2610 } 2412 }
2611 } 2413 }
2612 2414
2613 test_class_implicitField_setterFirst() async { 2415 test_class_implicitField_setterFirst() async {
2614 var library = await checkLibrary(''' 2416 var library = await checkLibrary('''
2615 class C { 2417 class C {
2616 void set x(int value) {} 2418 void set x(int value) {}
2617 int get x => 0; 2419 int get x => 0;
2618 } 2420 }
2619 '''); 2421 ''');
2620 if (isStrongMode) { 2422 if (isStrongMode) {
2621 checkElementText( 2423 checkElementText(library, r'''
2622 library,
2623 r'''
2624 class C { 2424 class C {
2625 void set x(int value) {} 2425 void set x(int value) {}
2626 int get x {} 2426 int get x {}
2627 } 2427 }
2628 '''); 2428 ''');
2629 } else { 2429 } else {
2630 checkElementText( 2430 checkElementText(library, r'''
2631 library,
2632 r'''
2633 class C { 2431 class C {
2634 void set x(int value) {} 2432 void set x(int value) {}
2635 int get x {} 2433 int get x {}
2636 } 2434 }
2637 '''); 2435 ''');
2638 } 2436 }
2639 } 2437 }
2640 2438
2641 test_class_interfaces() async { 2439 test_class_interfaces() async {
2642 var library = await checkLibrary(''' 2440 var library = await checkLibrary('''
2643 class C implements D, E {} 2441 class C implements D, E {}
2644 class D {} 2442 class D {}
2645 class E {} 2443 class E {}
2646 '''); 2444 ''');
2647 if (isStrongMode) { 2445 if (isStrongMode) {
2648 checkElementText( 2446 checkElementText(library, r'''
2649 library,
2650 r'''
2651 class C implements D, E { 2447 class C implements D, E {
2652 } 2448 }
2653 class D { 2449 class D {
2654 } 2450 }
2655 class E { 2451 class E {
2656 } 2452 }
2657 '''); 2453 ''');
2658 } else { 2454 } else {
2659 checkElementText( 2455 checkElementText(library, r'''
2660 library,
2661 r'''
2662 class C implements D, E { 2456 class C implements D, E {
2663 } 2457 }
2664 class D { 2458 class D {
2665 } 2459 }
2666 class E { 2460 class E {
2667 } 2461 }
2668 '''); 2462 ''');
2669 } 2463 }
2670 } 2464 }
2671 2465
2672 test_class_interfaces_unresolved() async { 2466 test_class_interfaces_unresolved() async {
2673 var library = await checkLibrary( 2467 var library = await checkLibrary(
2674 'class C implements X, Y, Z {} class X {} class Z {}', 2468 'class C implements X, Y, Z {} class X {} class Z {}',
2675 allowErrors: true); 2469 allowErrors: true);
2676 if (isStrongMode) { 2470 if (isStrongMode) {
2677 checkElementText( 2471 checkElementText(library, r'''
2678 library,
2679 r'''
2680 class C implements X, Z { 2472 class C implements X, Z {
2681 } 2473 }
2682 class X { 2474 class X {
2683 } 2475 }
2684 class Z { 2476 class Z {
2685 } 2477 }
2686 '''); 2478 ''');
2687 } else { 2479 } else {
2688 checkElementText( 2480 checkElementText(library, r'''
2689 library,
2690 r'''
2691 class C implements X, Z { 2481 class C implements X, Z {
2692 } 2482 }
2693 class X { 2483 class X {
2694 } 2484 }
2695 class Z { 2485 class Z {
2696 } 2486 }
2697 '''); 2487 ''');
2698 } 2488 }
2699 } 2489 }
2700 2490
2701 test_class_method_abstract() async { 2491 test_class_method_abstract() async {
2702 var library = await checkLibrary('abstract class C { f(); }'); 2492 var library = await checkLibrary('abstract class C { f(); }');
2703 if (isStrongMode) { 2493 if (isStrongMode) {
2704 checkElementText( 2494 checkElementText(library, r'''
2705 library,
2706 r'''
2707 abstract class C { 2495 abstract class C {
2708 dynamic f(); 2496 dynamic f();
2709 } 2497 }
2710 '''); 2498 ''');
2711 } else { 2499 } else {
2712 checkElementText( 2500 checkElementText(library, r'''
2713 library,
2714 r'''
2715 abstract class C { 2501 abstract class C {
2716 dynamic f(); 2502 dynamic f();
2717 } 2503 }
2718 '''); 2504 ''');
2719 } 2505 }
2720 } 2506 }
2721 2507
2722 test_class_method_external() async { 2508 test_class_method_external() async {
2723 var library = await checkLibrary('class C { external f(); }'); 2509 var library = await checkLibrary('class C { external f(); }');
2724 if (isStrongMode) { 2510 if (isStrongMode) {
2725 checkElementText( 2511 checkElementText(library, r'''
2726 library,
2727 r'''
2728 class C { 2512 class C {
2729 external dynamic f() {} 2513 external dynamic f() {}
2730 } 2514 }
2731 '''); 2515 ''');
2732 } else { 2516 } else {
2733 checkElementText( 2517 checkElementText(library, r'''
2734 library,
2735 r'''
2736 class C { 2518 class C {
2737 external dynamic f() {} 2519 external dynamic f() {}
2738 } 2520 }
2739 '''); 2521 ''');
2740 } 2522 }
2741 } 2523 }
2742 2524
2743 test_class_method_params() async { 2525 test_class_method_params() async {
2744 var library = await checkLibrary('class C { f(x, y) {} }'); 2526 var library = await checkLibrary('class C { f(x, y) {} }');
2745 if (isStrongMode) { 2527 if (isStrongMode) {
2746 checkElementText( 2528 checkElementText(library, r'''
2747 library,
2748 r'''
2749 class C { 2529 class C {
2750 dynamic f(dynamic x, dynamic y) {} 2530 dynamic f(dynamic x, dynamic y) {}
2751 } 2531 }
2752 '''); 2532 ''');
2753 } else { 2533 } else {
2754 checkElementText( 2534 checkElementText(library, r'''
2755 library,
2756 r'''
2757 class C { 2535 class C {
2758 dynamic f(dynamic x, dynamic y) {} 2536 dynamic f(dynamic x, dynamic y) {}
2759 } 2537 }
2760 '''); 2538 ''');
2761 } 2539 }
2762 } 2540 }
2763 2541
2764 test_class_method_static() async { 2542 test_class_method_static() async {
2765 var library = await checkLibrary('class C { static f() {} }'); 2543 var library = await checkLibrary('class C { static f() {} }');
2766 if (isStrongMode) { 2544 if (isStrongMode) {
2767 checkElementText( 2545 checkElementText(library, r'''
2768 library,
2769 r'''
2770 class C { 2546 class C {
2771 static dynamic f() {} 2547 static dynamic f() {}
2772 } 2548 }
2773 '''); 2549 ''');
2774 } else { 2550 } else {
2775 checkElementText( 2551 checkElementText(library, r'''
2776 library,
2777 r'''
2778 class C { 2552 class C {
2779 static dynamic f() {} 2553 static dynamic f() {}
2780 } 2554 }
2781 '''); 2555 ''');
2782 } 2556 }
2783 } 2557 }
2784 2558
2785 test_class_methods() async { 2559 test_class_methods() async {
2786 var library = await checkLibrary('class C { f() {} g() {} }'); 2560 var library = await checkLibrary('class C { f() {} g() {} }');
2787 if (isStrongMode) { 2561 if (isStrongMode) {
2788 checkElementText( 2562 checkElementText(library, r'''
2789 library,
2790 r'''
2791 class C { 2563 class C {
2792 dynamic f() {} 2564 dynamic f() {}
2793 dynamic g() {} 2565 dynamic g() {}
2794 } 2566 }
2795 '''); 2567 ''');
2796 } else { 2568 } else {
2797 checkElementText( 2569 checkElementText(library, r'''
2798 library,
2799 r'''
2800 class C { 2570 class C {
2801 dynamic f() {} 2571 dynamic f() {}
2802 dynamic g() {} 2572 dynamic g() {}
2803 } 2573 }
2804 '''); 2574 ''');
2805 } 2575 }
2806 } 2576 }
2807 2577
2808 test_class_mixins() async { 2578 test_class_mixins() async {
2809 var library = await checkLibrary( 2579 var library = await checkLibrary(
2810 'class C extends Object with D, E {} class D {} class E {}'); 2580 'class C extends Object with D, E {} class D {} class E {}');
2811 if (isStrongMode) { 2581 if (isStrongMode) {
2812 checkElementText( 2582 checkElementText(library, r'''
2813 library,
2814 r'''
2815 class C extends Object with D, E { 2583 class C extends Object with D, E {
2816 synthetic C(); 2584 synthetic C();
2817 } 2585 }
2818 class D { 2586 class D {
2819 } 2587 }
2820 class E { 2588 class E {
2821 } 2589 }
2822 '''); 2590 ''');
2823 } else { 2591 } else {
2824 checkElementText( 2592 checkElementText(library, r'''
2825 library,
2826 r'''
2827 class C extends Object with D, E { 2593 class C extends Object with D, E {
2828 synthetic C(); 2594 synthetic C();
2829 } 2595 }
2830 class D { 2596 class D {
2831 } 2597 }
2832 class E { 2598 class E {
2833 } 2599 }
2834 '''); 2600 ''');
2835 } 2601 }
2836 } 2602 }
2837 2603
2838 test_class_mixins_unresolved() async { 2604 test_class_mixins_unresolved() async {
2839 var library = await checkLibrary( 2605 var library = await checkLibrary(
2840 'class C extends Object with X, Y, Z; class X {} class Z {}', 2606 'class C extends Object with X, Y, Z; class X {} class Z {}',
2841 allowErrors: true); 2607 allowErrors: true);
2842 if (isStrongMode) { 2608 if (isStrongMode) {
2843 checkElementText( 2609 checkElementText(library, r'''
2844 library,
2845 r'''
2846 class C extends Object with X, Z { 2610 class C extends Object with X, Z {
2847 synthetic C(); 2611 synthetic C();
2848 } 2612 }
2849 class X { 2613 class X {
2850 } 2614 }
2851 class Z { 2615 class Z {
2852 } 2616 }
2853 '''); 2617 ''');
2854 } else { 2618 } else {
2855 checkElementText( 2619 checkElementText(library, r'''
2856 library,
2857 r'''
2858 class C extends Object with X, Z { 2620 class C extends Object with X, Z {
2859 synthetic C(); 2621 synthetic C();
2860 } 2622 }
2861 class X { 2623 class X {
2862 } 2624 }
2863 class Z { 2625 class Z {
2864 } 2626 }
2865 '''); 2627 ''');
2866 } 2628 }
2867 } 2629 }
2868 2630
2869 test_class_setter_abstract() async { 2631 test_class_setter_abstract() async {
2870 var library = 2632 var library =
2871 await checkLibrary('abstract class C { void set x(int value); }'); 2633 await checkLibrary('abstract class C { void set x(int value); }');
2872 if (isStrongMode) { 2634 if (isStrongMode) {
2873 checkElementText( 2635 checkElementText(library, r'''
2874 library,
2875 r'''
2876 abstract class C { 2636 abstract class C {
2877 void set x(int value); 2637 void set x(int value);
2878 } 2638 }
2879 '''); 2639 ''');
2880 } else { 2640 } else {
2881 checkElementText( 2641 checkElementText(library, r'''
2882 library,
2883 r'''
2884 abstract class C { 2642 abstract class C {
2885 void set x(int value); 2643 void set x(int value);
2886 } 2644 }
2887 '''); 2645 ''');
2888 } 2646 }
2889 } 2647 }
2890 2648
2891 test_class_setter_external() async { 2649 test_class_setter_external() async {
2892 var library = 2650 var library =
2893 await checkLibrary('class C { external void set x(int value); }'); 2651 await checkLibrary('class C { external void set x(int value); }');
2894 if (isStrongMode) { 2652 if (isStrongMode) {
2895 checkElementText( 2653 checkElementText(library, r'''
2896 library,
2897 r'''
2898 class C { 2654 class C {
2899 external void set x(int value) {} 2655 external void set x(int value) {}
2900 } 2656 }
2901 '''); 2657 ''');
2902 } else { 2658 } else {
2903 checkElementText( 2659 checkElementText(library, r'''
2904 library,
2905 r'''
2906 class C { 2660 class C {
2907 external void set x(int value) {} 2661 external void set x(int value) {}
2908 } 2662 }
2909 '''); 2663 ''');
2910 } 2664 }
2911 } 2665 }
2912 2666
2913 test_class_setter_implicit_param_type() async { 2667 test_class_setter_implicit_param_type() async {
2914 var library = await checkLibrary('class C { void set x(value) {} }'); 2668 var library = await checkLibrary('class C { void set x(value) {} }');
2915 if (isStrongMode) { 2669 if (isStrongMode) {
2916 checkElementText( 2670 checkElementText(library, r'''
2917 library,
2918 r'''
2919 class C { 2671 class C {
2920 void set x(dynamic value) {} 2672 void set x(dynamic value) {}
2921 } 2673 }
2922 '''); 2674 ''');
2923 } else { 2675 } else {
2924 checkElementText( 2676 checkElementText(library, r'''
2925 library,
2926 r'''
2927 class C { 2677 class C {
2928 void set x(dynamic value) {} 2678 void set x(dynamic value) {}
2929 } 2679 }
2930 '''); 2680 ''');
2931 } 2681 }
2932 } 2682 }
2933 2683
2934 test_class_setter_implicit_return_type() async { 2684 test_class_setter_implicit_return_type() async {
2935 var library = await checkLibrary('class C { set x(int value) {} }'); 2685 var library = await checkLibrary('class C { set x(int value) {} }');
2936 if (isStrongMode) { 2686 if (isStrongMode) {
2937 checkElementText( 2687 checkElementText(library, r'''
2938 library,
2939 r'''
2940 class C { 2688 class C {
2941 void set x(int value) {} 2689 void set x(int value) {}
2942 } 2690 }
2943 '''); 2691 ''');
2944 } else { 2692 } else {
2945 checkElementText( 2693 checkElementText(library, r'''
2946 library,
2947 r'''
2948 class C { 2694 class C {
2949 dynamic set x(int value) {} 2695 dynamic set x(int value) {}
2950 } 2696 }
2951 '''); 2697 ''');
2952 } 2698 }
2953 } 2699 }
2954 2700
2955 test_class_setter_invalid_no_parameter() async { 2701 test_class_setter_invalid_no_parameter() async {
2956 var library = await checkLibrary('class C { void set x() {} }'); 2702 var library = await checkLibrary('class C { void set x() {} }');
2957 if (isStrongMode) { 2703 if (isStrongMode) {
2958 checkElementText( 2704 checkElementText(library, r'''
2959 library,
2960 r'''
2961 class C { 2705 class C {
2962 void set x() {} 2706 void set x() {}
2963 } 2707 }
2964 '''); 2708 ''');
2965 } else { 2709 } else {
2966 checkElementText( 2710 checkElementText(library, r'''
2967 library,
2968 r'''
2969 class C { 2711 class C {
2970 void set x() {} 2712 void set x() {}
2971 } 2713 }
2972 '''); 2714 ''');
2973 } 2715 }
2974 } 2716 }
2975 2717
2976 test_class_setter_static() async { 2718 test_class_setter_static() async {
2977 var library = 2719 var library =
2978 await checkLibrary('class C { static void set x(int value) {} }'); 2720 await checkLibrary('class C { static void set x(int value) {} }');
2979 if (isStrongMode) { 2721 if (isStrongMode) {
2980 checkElementText( 2722 checkElementText(library, r'''
2981 library,
2982 r'''
2983 class C { 2723 class C {
2984 static void set x(int value) {} 2724 static void set x(int value) {}
2985 } 2725 }
2986 '''); 2726 ''');
2987 } else { 2727 } else {
2988 checkElementText( 2728 checkElementText(library, r'''
2989 library,
2990 r'''
2991 class C { 2729 class C {
2992 static void set x(int value) {} 2730 static void set x(int value) {}
2993 } 2731 }
2994 '''); 2732 ''');
2995 } 2733 }
2996 } 2734 }
2997 2735
2998 test_class_setters() async { 2736 test_class_setters() async {
2999 var library = await checkLibrary(''' 2737 var library = await checkLibrary('''
3000 class C { 2738 class C {
3001 void set x(int value) {} 2739 void set x(int value) {}
3002 set y(value) {} 2740 set y(value) {}
3003 } 2741 }
3004 '''); 2742 ''');
3005 if (isStrongMode) { 2743 if (isStrongMode) {
3006 checkElementText( 2744 checkElementText(library, r'''
3007 library,
3008 r'''
3009 class C { 2745 class C {
3010 void set x(int value) {} 2746 void set x(int value) {}
3011 void set y(dynamic value) {} 2747 void set y(dynamic value) {}
3012 } 2748 }
3013 '''); 2749 ''');
3014 } else { 2750 } else {
3015 checkElementText( 2751 checkElementText(library, r'''
3016 library,
3017 r'''
3018 class C { 2752 class C {
3019 void set x(int value) {} 2753 void set x(int value) {}
3020 dynamic set y(dynamic value) {} 2754 dynamic set y(dynamic value) {}
3021 } 2755 }
3022 '''); 2756 ''');
3023 } 2757 }
3024 } 2758 }
3025 2759
3026 test_class_supertype() async { 2760 test_class_supertype() async {
3027 var library = await checkLibrary('class C extends D {} class D {}'); 2761 var library = await checkLibrary('class C extends D {} class D {}');
3028 if (isStrongMode) { 2762 if (isStrongMode) {
3029 checkElementText( 2763 checkElementText(library, r'''
3030 library,
3031 r'''
3032 class C extends D { 2764 class C extends D {
3033 } 2765 }
3034 class D { 2766 class D {
3035 } 2767 }
3036 '''); 2768 ''');
3037 } else { 2769 } else {
3038 checkElementText( 2770 checkElementText(library, r'''
3039 library,
3040 r'''
3041 class C extends D { 2771 class C extends D {
3042 } 2772 }
3043 class D { 2773 class D {
3044 } 2774 }
3045 '''); 2775 ''');
3046 } 2776 }
3047 } 2777 }
3048 2778
3049 test_class_supertype_unresolved() async { 2779 test_class_supertype_unresolved() async {
3050 var library = await checkLibrary('class C extends D {}', allowErrors: true); 2780 var library = await checkLibrary('class C extends D {}', allowErrors: true);
3051 if (isStrongMode) { 2781 if (isStrongMode) {
3052 checkElementText( 2782 checkElementText(library, r'''
3053 library,
3054 r'''
3055 class C { 2783 class C {
3056 } 2784 }
3057 '''); 2785 ''');
3058 } else { 2786 } else {
3059 checkElementText( 2787 checkElementText(library, r'''
3060 library,
3061 r'''
3062 class C { 2788 class C {
3063 } 2789 }
3064 '''); 2790 ''');
3065 } 2791 }
3066 } 2792 }
3067 2793
3068 test_class_type_parameters() async { 2794 test_class_type_parameters() async {
3069 var library = await checkLibrary('class C<T, U> {}'); 2795 var library = await checkLibrary('class C<T, U> {}');
3070 if (isStrongMode) { 2796 if (isStrongMode) {
3071 checkElementText( 2797 checkElementText(library, r'''
3072 library,
3073 r'''
3074 class C<T, U> { 2798 class C<T, U> {
3075 } 2799 }
3076 '''); 2800 ''');
3077 } else { 2801 } else {
3078 checkElementText( 2802 checkElementText(library, r'''
3079 library,
3080 r'''
3081 class C<T, U> { 2803 class C<T, U> {
3082 } 2804 }
3083 '''); 2805 ''');
3084 } 2806 }
3085 } 2807 }
3086 2808
3087 test_class_type_parameters_bound() async { 2809 test_class_type_parameters_bound() async {
3088 var library = await checkLibrary(''' 2810 var library = await checkLibrary('''
3089 class C<T extends Object, U extends D> {} 2811 class C<T extends Object, U extends D> {}
3090 class D {} 2812 class D {}
3091 '''); 2813 ''');
3092 if (isStrongMode) { 2814 if (isStrongMode) {
3093 checkElementText( 2815 checkElementText(library, r'''
3094 library,
3095 r'''
3096 class C<T extends Object, U extends D> { 2816 class C<T extends Object, U extends D> {
3097 } 2817 }
3098 class D { 2818 class D {
3099 } 2819 }
3100 '''); 2820 ''');
3101 } else { 2821 } else {
3102 checkElementText( 2822 checkElementText(library, r'''
3103 library,
3104 r'''
3105 class C<T extends Object, U extends D> { 2823 class C<T extends Object, U extends D> {
3106 } 2824 }
3107 class D { 2825 class D {
3108 } 2826 }
3109 '''); 2827 ''');
3110 } 2828 }
3111 } 2829 }
3112 2830
3113 test_class_type_parameters_f_bound_complex() async { 2831 test_class_type_parameters_f_bound_complex() async {
3114 var library = await checkLibrary('class C<T extends List<U>, U> {}'); 2832 var library = await checkLibrary('class C<T extends List<U>, U> {}');
3115 if (isStrongMode) { 2833 if (isStrongMode) {
3116 checkElementText( 2834 checkElementText(library, r'''
3117 library,
3118 r'''
3119 class C<T extends List<U>, U> { 2835 class C<T extends List<U>, U> {
3120 } 2836 }
3121 '''); 2837 ''');
3122 } else { 2838 } else {
3123 checkElementText( 2839 checkElementText(library, r'''
3124 library,
3125 r'''
3126 class C<T extends List<U>, U> { 2840 class C<T extends List<U>, U> {
3127 } 2841 }
3128 '''); 2842 ''');
3129 } 2843 }
3130 } 2844 }
3131 2845
3132 test_class_type_parameters_f_bound_simple() async { 2846 test_class_type_parameters_f_bound_simple() async {
3133 var library = await checkLibrary('class C<T extends U, U> {}'); 2847 var library = await checkLibrary('class C<T extends U, U> {}');
3134 if (isStrongMode) { 2848 if (isStrongMode) {
3135 checkElementText( 2849 checkElementText(library, r'''
3136 library,
3137 r'''
3138 class C<T extends U, U> { 2850 class C<T extends U, U> {
3139 } 2851 }
3140 '''); 2852 ''');
3141 } else { 2853 } else {
3142 checkElementText( 2854 checkElementText(library, r'''
3143 library,
3144 r'''
3145 class C<T extends U, U> { 2855 class C<T extends U, U> {
3146 } 2856 }
3147 '''); 2857 ''');
3148 } 2858 }
3149 } 2859 }
3150 2860
3151 test_classes() async { 2861 test_classes() async {
3152 var library = await checkLibrary('class C {} class D {}'); 2862 var library = await checkLibrary('class C {} class D {}');
3153 if (isStrongMode) { 2863 if (isStrongMode) {
3154 checkElementText( 2864 checkElementText(library, r'''
3155 library,
3156 r'''
3157 class C { 2865 class C {
3158 } 2866 }
3159 class D { 2867 class D {
3160 } 2868 }
3161 '''); 2869 ''');
3162 } else { 2870 } else {
3163 checkElementText( 2871 checkElementText(library, r'''
3164 library,
3165 r'''
3166 class C { 2872 class C {
3167 } 2873 }
3168 class D { 2874 class D {
3169 } 2875 }
3170 '''); 2876 ''');
3171 } 2877 }
3172 } 2878 }
3173 2879
3174 test_closure_executable_with_return_type_from_closure() async { 2880 test_closure_executable_with_return_type_from_closure() async {
3175 var library = await checkLibrary(''' 2881 var library = await checkLibrary('''
3176 f() { 2882 f() {
3177 print(() {}); 2883 print(() {});
3178 print(() => () => 0); 2884 print(() => () => 0);
3179 } 2885 }
3180 '''); 2886 ''');
3181 if (isStrongMode) { 2887 if (isStrongMode) {
3182 checkElementText( 2888 checkElementText(library, r'''
3183 library,
3184 r'''
3185 dynamic f() {} 2889 dynamic f() {}
3186 '''); 2890 ''');
3187 } else { 2891 } else {
3188 checkElementText( 2892 checkElementText(library, r'''
3189 library,
3190 r'''
3191 dynamic f() {} 2893 dynamic f() {}
3192 '''); 2894 ''');
3193 } 2895 }
3194 } 2896 }
3195 2897
3196 test_closure_generic() async { 2898 test_closure_generic() async {
3197 var library = await checkLibrary('final f = <U, V>(U x, V y) => y;'); 2899 var library = await checkLibrary('final f = <U, V>(U x, V y) => y;');
3198 if (isStrongMode) { 2900 if (isStrongMode) {
3199 checkElementText( 2901 checkElementText(library, r'''
3200 library,
3201 r'''
3202 final <U,V>(U, V) → V f; 2902 final <U,V>(U, V) → V f;
3203 '''); 2903 ''');
3204 } else { 2904 } else {
3205 checkElementText( 2905 checkElementText(library, r'''
3206 library,
3207 r'''
3208 final dynamic f; 2906 final dynamic f;
3209 '''); 2907 ''');
3210 } 2908 }
3211 } 2909 }
3212 2910
3213 test_closure_in_variable_declaration_in_part() async { 2911 test_closure_in_variable_declaration_in_part() async {
3214 addSource('/a.dart', 'part of lib; final f = (int i) => i.toDouble();'); 2912 addSource('/a.dart', 'part of lib; final f = (int i) => i.toDouble();');
3215 var library = await checkLibrary(''' 2913 var library = await checkLibrary('''
3216 library lib; 2914 library lib;
3217 part "a.dart"; 2915 part "a.dart";
3218 '''); 2916 ''');
3219 if (isStrongMode) { 2917 if (isStrongMode) {
3220 checkElementText( 2918 checkElementText(library, r'''
3221 library,
3222 r'''
3223 library lib; 2919 library lib;
3224 part 'a.dart'; 2920 part 'a.dart';
3225 -------------------- 2921 --------------------
3226 unit: a.dart 2922 unit: a.dart
3227 2923
3228 final (int) → double f; 2924 final (int) → double f;
3229 '''); 2925 ''');
3230 } else { 2926 } else {
3231 checkElementText( 2927 checkElementText(library, r'''
3232 library,
3233 r'''
3234 library lib; 2928 library lib;
3235 part 'a.dart'; 2929 part 'a.dart';
3236 -------------------- 2930 --------------------
3237 unit: a.dart 2931 unit: a.dart
3238 2932
3239 final dynamic f; 2933 final dynamic f;
3240 '''); 2934 ''');
3241 } 2935 }
3242 } 2936 }
3243 2937
3244 test_const_invalid_field_const() async { 2938 test_const_invalid_field_const() async {
3245 variablesWithNotConstInitializers.add('f'); 2939 variablesWithNotConstInitializers.add('f');
3246 var library = await checkLibrary( 2940 var library = await checkLibrary(r'''
3247 r'''
3248 class C { 2941 class C {
3249 static const f = 1 + foo(); 2942 static const f = 1 + foo();
3250 } 2943 }
3251 int foo() => 42; 2944 int foo() => 42;
3252 ''', 2945 ''', allowErrors: true);
3253 allowErrors: true);
3254 if (isStrongMode) { 2946 if (isStrongMode) {
3255 checkElementText( 2947 checkElementText(library, r'''
3256 library,
3257 r'''
3258 class C { 2948 class C {
3259 static const int f = 2949 static const int f =
3260 $$invalidConstExpr$$/*location: null*/; 2950 $$invalidConstExpr$$/*location: null*/;
3261 } 2951 }
3262 int foo() {} 2952 int foo() {}
3263 '''); 2953 ''');
3264 } else { 2954 } else {
3265 checkElementText( 2955 checkElementText(library, r'''
3266 library,
3267 r'''
3268 class C { 2956 class C {
3269 static const dynamic f = 2957 static const dynamic f =
3270 $$invalidConstExpr$$/*location: null*/; 2958 $$invalidConstExpr$$/*location: null*/;
3271 } 2959 }
3272 int foo() {} 2960 int foo() {}
3273 '''); 2961 ''');
3274 } 2962 }
3275 } 2963 }
3276 2964
3277 test_const_invalid_field_final() async { 2965 test_const_invalid_field_final() async {
3278 variablesWithNotConstInitializers.add('f'); 2966 variablesWithNotConstInitializers.add('f');
3279 var library = await checkLibrary( 2967 var library = await checkLibrary(r'''
3280 r'''
3281 class C { 2968 class C {
3282 final f = 1 + foo(); 2969 final f = 1 + foo();
3283 } 2970 }
3284 int foo() => 42; 2971 int foo() => 42;
3285 ''', 2972 ''', allowErrors: true);
3286 allowErrors: true);
3287 if (isStrongMode) { 2973 if (isStrongMode) {
3288 checkElementText( 2974 checkElementText(library, r'''
3289 library,
3290 r'''
3291 class C { 2975 class C {
3292 final int f = 2976 final int f =
3293 $$invalidConstExpr$$/*location: null*/; 2977 $$invalidConstExpr$$/*location: null*/;
3294 } 2978 }
3295 int foo() {} 2979 int foo() {}
3296 '''); 2980 ''');
3297 } else { 2981 } else {
3298 checkElementText( 2982 checkElementText(library, r'''
3299 library,
3300 r'''
3301 class C { 2983 class C {
3302 final dynamic f = 2984 final dynamic f =
3303 $$invalidConstExpr$$/*location: null*/; 2985 $$invalidConstExpr$$/*location: null*/;
3304 } 2986 }
3305 int foo() {} 2987 int foo() {}
3306 '''); 2988 ''');
3307 } 2989 }
3308 } 2990 }
3309 2991
3310 test_const_invalid_intLiteral() async { 2992 test_const_invalid_intLiteral() async {
3311 var library = await checkLibrary( 2993 var library = await checkLibrary(r'''
3312 r'''
3313 const int x = 0x; 2994 const int x = 0x;
3314 ''', 2995 ''', allowErrors: true);
3315 allowErrors: true); 2996 checkElementText(library, r'''
3316 checkElementText(
3317 library,
3318 r'''
3319 const int x = 0; 2997 const int x = 0;
3320 '''); 2998 ''');
3321 } 2999 }
3322 3000
3323 test_const_invalid_topLevel() async { 3001 test_const_invalid_topLevel() async {
3324 variablesWithNotConstInitializers.add('v'); 3002 variablesWithNotConstInitializers.add('v');
3325 var library = await checkLibrary( 3003 var library = await checkLibrary(r'''
3326 r'''
3327 const v = 1 + foo(); 3004 const v = 1 + foo();
3328 int foo() => 42; 3005 int foo() => 42;
3329 ''', 3006 ''', allowErrors: true);
3330 allowErrors: true);
3331 if (isStrongMode) { 3007 if (isStrongMode) {
3332 checkElementText( 3008 checkElementText(library, r'''
3333 library,
3334 r'''
3335 const int v = 3009 const int v =
3336 $$invalidConstExpr$$/*location: null*/; 3010 $$invalidConstExpr$$/*location: null*/;
3337 int foo() {} 3011 int foo() {}
3338 '''); 3012 ''');
3339 } else { 3013 } else {
3340 checkElementText( 3014 checkElementText(library, r'''
3341 library,
3342 r'''
3343 const dynamic v = 3015 const dynamic v =
3344 $$invalidConstExpr$$/*location: null*/; 3016 $$invalidConstExpr$$/*location: null*/;
3345 int foo() {} 3017 int foo() {}
3346 '''); 3018 ''');
3347 } 3019 }
3348 } 3020 }
3349 3021
3350 test_const_invokeConstructor_generic_named() async { 3022 test_const_invokeConstructor_generic_named() async {
3351 var library = await checkLibrary(r''' 3023 var library = await checkLibrary(r'''
3352 class C<K, V> { 3024 class C<K, V> {
3353 const C.named(K k, V v); 3025 const C.named(K k, V v);
3354 } 3026 }
3355 const V = const C<int, String>.named(1, '222'); 3027 const V = const C<int, String>.named(1, '222');
3356 '''); 3028 ''');
3357 if (isStrongMode) { 3029 if (isStrongMode) {
3358 checkElementText( 3030 checkElementText(library, r'''
3359 library,
3360 r'''
3361 class C<K, V> { 3031 class C<K, V> {
3362 const C.named(K k, V v); 3032 const C.named(K k, V v);
3363 } 3033 }
3364 const C<int, String> V = const 3034 const C<int, String> V = const
3365 C/*location: test.dart;C*/< 3035 C/*location: test.dart;C*/<
3366 int/*location: dart:core;int*/, 3036 int/*location: dart:core;int*/,
3367 String/*location: dart:core;String*/>. 3037 String/*location: dart:core;String*/>.
3368 named/*location: test.dart;C;named*/(1, '222'); 3038 named/*location: test.dart;C;named*/(1, '222');
3369 '''); 3039 ''');
3370 } else { 3040 } else {
3371 checkElementText( 3041 checkElementText(library, r'''
3372 library,
3373 r'''
3374 class C<K, V> { 3042 class C<K, V> {
3375 const C.named(K k, V v); 3043 const C.named(K k, V v);
3376 } 3044 }
3377 const dynamic V = const 3045 const dynamic V = const
3378 C/*location: test.dart;C*/< 3046 C/*location: test.dart;C*/<
3379 int/*location: dart:core;int*/, 3047 int/*location: dart:core;int*/,
3380 String/*location: dart:core;String*/>. 3048 String/*location: dart:core;String*/>.
3381 named/*location: test.dart;C;named*/(1, '222'); 3049 named/*location: test.dart;C;named*/(1, '222');
3382 '''); 3050 ''');
3383 } 3051 }
3384 } 3052 }
3385 3053
3386 test_const_invokeConstructor_generic_named_imported() async { 3054 test_const_invokeConstructor_generic_named_imported() async {
3387 addLibrarySource( 3055 addLibrarySource('/a.dart', r'''
3388 '/a.dart',
3389 r'''
3390 class C<K, V> { 3056 class C<K, V> {
3391 const C.named(K k, V v); 3057 const C.named(K k, V v);
3392 } 3058 }
3393 '''); 3059 ''');
3394 var library = await checkLibrary(r''' 3060 var library = await checkLibrary(r'''
3395 import 'a.dart'; 3061 import 'a.dart';
3396 const V = const C<int, String>.named(1, '222'); 3062 const V = const C<int, String>.named(1, '222');
3397 '''); 3063 ''');
3398 if (isStrongMode) { 3064 if (isStrongMode) {
3399 checkElementText( 3065 checkElementText(library, r'''
3400 library,
3401 r'''
3402 import 'a.dart'; 3066 import 'a.dart';
3403 const C<int, String> V = const 3067 const C<int, String> V = const
3404 C/*location: a.dart;C*/< 3068 C/*location: a.dart;C*/<
3405 int/*location: dart:core;int*/, 3069 int/*location: dart:core;int*/,
3406 String/*location: dart:core;String*/>. 3070 String/*location: dart:core;String*/>.
3407 named/*location: a.dart;C;named*/(1, '222'); 3071 named/*location: a.dart;C;named*/(1, '222');
3408 '''); 3072 ''');
3409 } else { 3073 } else {
3410 checkElementText( 3074 checkElementText(library, r'''
3411 library,
3412 r'''
3413 import 'a.dart'; 3075 import 'a.dart';
3414 const dynamic V = const 3076 const dynamic V = const
3415 C/*location: a.dart;C*/< 3077 C/*location: a.dart;C*/<
3416 int/*location: dart:core;int*/, 3078 int/*location: dart:core;int*/,
3417 String/*location: dart:core;String*/>. 3079 String/*location: dart:core;String*/>.
3418 named/*location: a.dart;C;named*/(1, '222'); 3080 named/*location: a.dart;C;named*/(1, '222');
3419 '''); 3081 ''');
3420 } 3082 }
3421 } 3083 }
3422 3084
3423 test_const_invokeConstructor_generic_named_imported_withPrefix() async { 3085 test_const_invokeConstructor_generic_named_imported_withPrefix() async {
3424 addLibrarySource( 3086 addLibrarySource('/a.dart', r'''
3425 '/a.dart',
3426 r'''
3427 class C<K, V> { 3087 class C<K, V> {
3428 const C.named(K k, V v); 3088 const C.named(K k, V v);
3429 } 3089 }
3430 '''); 3090 ''');
3431 var library = await checkLibrary(r''' 3091 var library = await checkLibrary(r'''
3432 import 'a.dart' as p; 3092 import 'a.dart' as p;
3433 const V = const p.C<int, String>.named(1, '222'); 3093 const V = const p.C<int, String>.named(1, '222');
3434 '''); 3094 ''');
3435 if (isStrongMode) { 3095 if (isStrongMode) {
3436 checkElementText( 3096 checkElementText(library, r'''
3437 library,
3438 r'''
3439 import 'a.dart' as p; 3097 import 'a.dart' as p;
3440 const C<int, String> V = const 3098 const C<int, String> V = const
3441 C/*location: a.dart;C*/< 3099 C/*location: a.dart;C*/<
3442 int/*location: dart:core;int*/, 3100 int/*location: dart:core;int*/,
3443 String/*location: dart:core;String*/>. 3101 String/*location: dart:core;String*/>.
3444 named/*location: a.dart;C;named*/(1, '222'); 3102 named/*location: a.dart;C;named*/(1, '222');
3445 '''); 3103 ''');
3446 } else { 3104 } else {
3447 checkElementText( 3105 checkElementText(library, r'''
3448 library,
3449 r'''
3450 import 'a.dart' as p; 3106 import 'a.dart' as p;
3451 const dynamic V = const 3107 const dynamic V = const
3452 C/*location: a.dart;C*/< 3108 C/*location: a.dart;C*/<
3453 int/*location: dart:core;int*/, 3109 int/*location: dart:core;int*/,
3454 String/*location: dart:core;String*/>. 3110 String/*location: dart:core;String*/>.
3455 named/*location: a.dart;C;named*/(1, '222'); 3111 named/*location: a.dart;C;named*/(1, '222');
3456 '''); 3112 ''');
3457 } 3113 }
3458 } 3114 }
3459 3115
3460 test_const_invokeConstructor_generic_noTypeArguments() async { 3116 test_const_invokeConstructor_generic_noTypeArguments() async {
3461 var library = await checkLibrary(r''' 3117 var library = await checkLibrary(r'''
3462 class C<K, V> { 3118 class C<K, V> {
3463 const C(); 3119 const C();
3464 } 3120 }
3465 const V = const C(); 3121 const V = const C();
3466 '''); 3122 ''');
3467 if (isStrongMode) { 3123 if (isStrongMode) {
3468 checkElementText( 3124 checkElementText(library, r'''
3469 library,
3470 r'''
3471 class C<K, V> { 3125 class C<K, V> {
3472 const C(); 3126 const C();
3473 } 3127 }
3474 const C<dynamic, dynamic> V = const 3128 const C<dynamic, dynamic> V = const
3475 C/*location: test.dart;C*/(); 3129 C/*location: test.dart;C*/();
3476 '''); 3130 ''');
3477 } else { 3131 } else {
3478 checkElementText( 3132 checkElementText(library, r'''
3479 library,
3480 r'''
3481 class C<K, V> { 3133 class C<K, V> {
3482 const C(); 3134 const C();
3483 } 3135 }
3484 const dynamic V = const 3136 const dynamic V = const
3485 C/*location: test.dart;C*/(); 3137 C/*location: test.dart;C*/();
3486 '''); 3138 ''');
3487 } 3139 }
3488 } 3140 }
3489 3141
3490 test_const_invokeConstructor_generic_unnamed() async { 3142 test_const_invokeConstructor_generic_unnamed() async {
3491 var library = await checkLibrary(r''' 3143 var library = await checkLibrary(r'''
3492 class C<K, V> { 3144 class C<K, V> {
3493 const C(); 3145 const C();
3494 } 3146 }
3495 const V = const C<int, String>(); 3147 const V = const C<int, String>();
3496 '''); 3148 ''');
3497 if (isStrongMode) { 3149 if (isStrongMode) {
3498 checkElementText( 3150 checkElementText(library, r'''
3499 library,
3500 r'''
3501 class C<K, V> { 3151 class C<K, V> {
3502 const C(); 3152 const C();
3503 } 3153 }
3504 const C<int, String> V = const 3154 const C<int, String> V = const
3505 C/*location: test.dart;C*/< 3155 C/*location: test.dart;C*/<
3506 int/*location: dart:core;int*/, 3156 int/*location: dart:core;int*/,
3507 String/*location: dart:core;String*/>(); 3157 String/*location: dart:core;String*/>();
3508 '''); 3158 ''');
3509 } else { 3159 } else {
3510 checkElementText( 3160 checkElementText(library, r'''
3511 library,
3512 r'''
3513 class C<K, V> { 3161 class C<K, V> {
3514 const C(); 3162 const C();
3515 } 3163 }
3516 const dynamic V = const 3164 const dynamic V = const
3517 C/*location: test.dart;C*/< 3165 C/*location: test.dart;C*/<
3518 int/*location: dart:core;int*/, 3166 int/*location: dart:core;int*/,
3519 String/*location: dart:core;String*/>(); 3167 String/*location: dart:core;String*/>();
3520 '''); 3168 ''');
3521 } 3169 }
3522 } 3170 }
3523 3171
3524 test_const_invokeConstructor_generic_unnamed_imported() async { 3172 test_const_invokeConstructor_generic_unnamed_imported() async {
3525 addLibrarySource( 3173 addLibrarySource('/a.dart', r'''
3526 '/a.dart',
3527 r'''
3528 class C<K, V> { 3174 class C<K, V> {
3529 const C(); 3175 const C();
3530 } 3176 }
3531 '''); 3177 ''');
3532 var library = await checkLibrary(r''' 3178 var library = await checkLibrary(r'''
3533 import 'a.dart'; 3179 import 'a.dart';
3534 const V = const C<int, String>(); 3180 const V = const C<int, String>();
3535 '''); 3181 ''');
3536 if (isStrongMode) { 3182 if (isStrongMode) {
3537 checkElementText( 3183 checkElementText(library, r'''
3538 library,
3539 r'''
3540 import 'a.dart'; 3184 import 'a.dart';
3541 const C<int, String> V = const 3185 const C<int, String> V = const
3542 C/*location: a.dart;C*/< 3186 C/*location: a.dart;C*/<
3543 int/*location: dart:core;int*/, 3187 int/*location: dart:core;int*/,
3544 String/*location: dart:core;String*/>(); 3188 String/*location: dart:core;String*/>();
3545 '''); 3189 ''');
3546 } else { 3190 } else {
3547 checkElementText( 3191 checkElementText(library, r'''
3548 library,
3549 r'''
3550 import 'a.dart'; 3192 import 'a.dart';
3551 const dynamic V = const 3193 const dynamic V = const
3552 C/*location: a.dart;C*/< 3194 C/*location: a.dart;C*/<
3553 int/*location: dart:core;int*/, 3195 int/*location: dart:core;int*/,
3554 String/*location: dart:core;String*/>(); 3196 String/*location: dart:core;String*/>();
3555 '''); 3197 ''');
3556 } 3198 }
3557 } 3199 }
3558 3200
3559 test_const_invokeConstructor_generic_unnamed_imported_withPrefix() async { 3201 test_const_invokeConstructor_generic_unnamed_imported_withPrefix() async {
3560 addLibrarySource( 3202 addLibrarySource('/a.dart', r'''
3561 '/a.dart',
3562 r'''
3563 class C<K, V> { 3203 class C<K, V> {
3564 const C(); 3204 const C();
3565 } 3205 }
3566 '''); 3206 ''');
3567 var library = await checkLibrary(r''' 3207 var library = await checkLibrary(r'''
3568 import 'a.dart' as p; 3208 import 'a.dart' as p;
3569 const V = const p.C<int, String>(); 3209 const V = const p.C<int, String>();
3570 '''); 3210 ''');
3571 if (isStrongMode) { 3211 if (isStrongMode) {
3572 checkElementText( 3212 checkElementText(library, r'''
3573 library,
3574 r'''
3575 import 'a.dart' as p; 3213 import 'a.dart' as p;
3576 const C<int, String> V = const 3214 const C<int, String> V = const
3577 C/*location: a.dart;C*/< 3215 C/*location: a.dart;C*/<
3578 int/*location: dart:core;int*/, 3216 int/*location: dart:core;int*/,
3579 String/*location: dart:core;String*/>(); 3217 String/*location: dart:core;String*/>();
3580 '''); 3218 ''');
3581 } else { 3219 } else {
3582 checkElementText( 3220 checkElementText(library, r'''
3583 library,
3584 r'''
3585 import 'a.dart' as p; 3221 import 'a.dart' as p;
3586 const dynamic V = const 3222 const dynamic V = const
3587 C/*location: a.dart;C*/< 3223 C/*location: a.dart;C*/<
3588 int/*location: dart:core;int*/, 3224 int/*location: dart:core;int*/,
3589 String/*location: dart:core;String*/>(); 3225 String/*location: dart:core;String*/>();
3590 '''); 3226 ''');
3591 } 3227 }
3592 } 3228 }
3593 3229
3594 test_const_invokeConstructor_named() async { 3230 test_const_invokeConstructor_named() async {
3595 var library = await checkLibrary(r''' 3231 var library = await checkLibrary(r'''
3596 class C { 3232 class C {
3597 const C.named(bool a, int b, int c, {String d, double e}); 3233 const C.named(bool a, int b, int c, {String d, double e});
3598 } 3234 }
3599 const V = const C.named(true, 1, 2, d: 'ccc', e: 3.4); 3235 const V = const C.named(true, 1, 2, d: 'ccc', e: 3.4);
3600 '''); 3236 ''');
3601 if (isStrongMode) { 3237 if (isStrongMode) {
3602 checkElementText( 3238 checkElementText(library, r'''
3603 library,
3604 r'''
3605 class C { 3239 class C {
3606 const C.named(bool a, int b, int c, {String d}, {double e}); 3240 const C.named(bool a, int b, int c, {String d}, {double e});
3607 } 3241 }
3608 const C V = const 3242 const C V = const
3609 C/*location: test.dart;C*/. 3243 C/*location: test.dart;C*/.
3610 named/*location: test.dart;C;named*/(true, 1, 2, 3244 named/*location: test.dart;C;named*/(true, 1, 2,
3611 d/*location: null*/: 'ccc', 3245 d/*location: null*/: 'ccc',
3612 e/*location: null*/: 3.4); 3246 e/*location: null*/: 3.4);
3613 '''); 3247 ''');
3614 } else { 3248 } else {
3615 checkElementText( 3249 checkElementText(library, r'''
3616 library,
3617 r'''
3618 class C { 3250 class C {
3619 const C.named(bool a, int b, int c, {String d}, {double e}); 3251 const C.named(bool a, int b, int c, {String d}, {double e});
3620 } 3252 }
3621 const dynamic V = const 3253 const dynamic V = const
3622 C/*location: test.dart;C*/. 3254 C/*location: test.dart;C*/.
3623 named/*location: test.dart;C;named*/(true, 1, 2, 3255 named/*location: test.dart;C;named*/(true, 1, 2,
3624 d/*location: null*/: 'ccc', 3256 d/*location: null*/: 'ccc',
3625 e/*location: null*/: 3.4); 3257 e/*location: null*/: 3.4);
3626 '''); 3258 ''');
3627 } 3259 }
3628 } 3260 }
3629 3261
3630 test_const_invokeConstructor_named_imported() async { 3262 test_const_invokeConstructor_named_imported() async {
3631 addLibrarySource( 3263 addLibrarySource('/a.dart', r'''
3632 '/a.dart',
3633 r'''
3634 class C { 3264 class C {
3635 const C.named(); 3265 const C.named();
3636 } 3266 }
3637 '''); 3267 ''');
3638 var library = await checkLibrary(r''' 3268 var library = await checkLibrary(r'''
3639 import 'a.dart'; 3269 import 'a.dart';
3640 const V = const C.named(); 3270 const V = const C.named();
3641 '''); 3271 ''');
3642 if (isStrongMode) { 3272 if (isStrongMode) {
3643 checkElementText( 3273 checkElementText(library, r'''
3644 library,
3645 r'''
3646 import 'a.dart'; 3274 import 'a.dart';
3647 const C V = const 3275 const C V = const
3648 C/*location: a.dart;C*/. 3276 C/*location: a.dart;C*/.
3649 named/*location: a.dart;C;named*/(); 3277 named/*location: a.dart;C;named*/();
3650 '''); 3278 ''');
3651 } else { 3279 } else {
3652 checkElementText( 3280 checkElementText(library, r'''
3653 library,
3654 r'''
3655 import 'a.dart'; 3281 import 'a.dart';
3656 const dynamic V = const 3282 const dynamic V = const
3657 C/*location: a.dart;C*/. 3283 C/*location: a.dart;C*/.
3658 named/*location: a.dart;C;named*/(); 3284 named/*location: a.dart;C;named*/();
3659 '''); 3285 ''');
3660 } 3286 }
3661 } 3287 }
3662 3288
3663 test_const_invokeConstructor_named_imported_withPrefix() async { 3289 test_const_invokeConstructor_named_imported_withPrefix() async {
3664 addLibrarySource( 3290 addLibrarySource('/a.dart', r'''
3665 '/a.dart',
3666 r'''
3667 class C { 3291 class C {
3668 const C.named(); 3292 const C.named();
3669 } 3293 }
3670 '''); 3294 ''');
3671 var library = await checkLibrary(r''' 3295 var library = await checkLibrary(r'''
3672 import 'a.dart' as p; 3296 import 'a.dart' as p;
3673 const V = const p.C.named(); 3297 const V = const p.C.named();
3674 '''); 3298 ''');
3675 if (isStrongMode) { 3299 if (isStrongMode) {
3676 checkElementText( 3300 checkElementText(library, r'''
3677 library,
3678 r'''
3679 import 'a.dart' as p; 3301 import 'a.dart' as p;
3680 const C V = const 3302 const C V = const
3681 C/*location: a.dart;C*/. 3303 C/*location: a.dart;C*/.
3682 named/*location: a.dart;C;named*/(); 3304 named/*location: a.dart;C;named*/();
3683 '''); 3305 ''');
3684 } else { 3306 } else {
3685 checkElementText( 3307 checkElementText(library, r'''
3686 library,
3687 r'''
3688 import 'a.dart' as p; 3308 import 'a.dart' as p;
3689 const dynamic V = const 3309 const dynamic V = const
3690 C/*location: a.dart;C*/. 3310 C/*location: a.dart;C*/.
3691 named/*location: a.dart;C;named*/(); 3311 named/*location: a.dart;C;named*/();
3692 '''); 3312 ''');
3693 } 3313 }
3694 } 3314 }
3695 3315
3696 test_const_invokeConstructor_named_unresolved() async { 3316 test_const_invokeConstructor_named_unresolved() async {
3697 var library = await checkLibrary( 3317 var library = await checkLibrary(r'''
3698 r'''
3699 class C {} 3318 class C {}
3700 const V = const C.named(); 3319 const V = const C.named();
3701 ''', 3320 ''', allowErrors: true);
3702 allowErrors: true);
3703 if (isStrongMode) { 3321 if (isStrongMode) {
3704 checkElementText( 3322 checkElementText(library, r'''
3705 library,
3706 r'''
3707 class C { 3323 class C {
3708 } 3324 }
3709 const C V = const 3325 const C V = const
3710 C/*location: test.dart;C*/. 3326 C/*location: test.dart;C*/.
3711 named/*location: null*/(); 3327 named/*location: null*/();
3712 '''); 3328 ''');
3713 } else { 3329 } else {
3714 checkElementText( 3330 checkElementText(library, r'''
3715 library,
3716 r'''
3717 class C { 3331 class C {
3718 } 3332 }
3719 const dynamic V = const 3333 const dynamic V = const
3720 C/*location: test.dart;C*/. 3334 C/*location: test.dart;C*/.
3721 named/*location: null*/(); 3335 named/*location: null*/();
3722 '''); 3336 ''');
3723 } 3337 }
3724 } 3338 }
3725 3339
3726 test_const_invokeConstructor_named_unresolved2() async { 3340 test_const_invokeConstructor_named_unresolved2() async {
3727 var library = await checkLibrary( 3341 var library = await checkLibrary(r'''
3728 r'''
3729 const V = const C.named(); 3342 const V = const C.named();
3730 ''', 3343 ''', allowErrors: true);
3731 allowErrors: true);
3732 if (isStrongMode) { 3344 if (isStrongMode) {
3733 checkElementText( 3345 checkElementText(library, r'''
3734 library,
3735 r'''
3736 const dynamic V = const 3346 const dynamic V = const
3737 C/*location: null*/. 3347 C/*location: null*/.
3738 named/*location: null*/(); 3348 named/*location: null*/();
3739 '''); 3349 ''');
3740 } else { 3350 } else {
3741 checkElementText( 3351 checkElementText(library, r'''
3742 library,
3743 r'''
3744 const dynamic V = const 3352 const dynamic V = const
3745 C/*location: null*/. 3353 C/*location: null*/.
3746 named/*location: null*/(); 3354 named/*location: null*/();
3747 '''); 3355 ''');
3748 } 3356 }
3749 } 3357 }
3750 3358
3751 test_const_invokeConstructor_named_unresolved3() async { 3359 test_const_invokeConstructor_named_unresolved3() async {
3752 addLibrarySource( 3360 addLibrarySource('/a.dart', r'''
3753 '/a.dart',
3754 r'''
3755 class C { 3361 class C {
3756 } 3362 }
3757 '''); 3363 ''');
3758 var library = await checkLibrary( 3364 var library = await checkLibrary(r'''
3759 r'''
3760 import 'a.dart' as p; 3365 import 'a.dart' as p;
3761 const V = const p.C.named(); 3366 const V = const p.C.named();
3762 ''', 3367 ''', allowErrors: true);
3763 allowErrors: true);
3764 if (isStrongMode) { 3368 if (isStrongMode) {
3765 checkElementText( 3369 checkElementText(library, r'''
3766 library,
3767 r'''
3768 import 'a.dart' as p; 3370 import 'a.dart' as p;
3769 const C V = const 3371 const C V = const
3770 p/*location: test.dart;p*/. 3372 p/*location: test.dart;p*/.
3771 C/*location: a.dart;C*/. 3373 C/*location: a.dart;C*/.
3772 named/*location: null*/(); 3374 named/*location: null*/();
3773 '''); 3375 ''');
3774 } else { 3376 } else {
3775 checkElementText( 3377 checkElementText(library, r'''
3776 library,
3777 r'''
3778 import 'a.dart' as p; 3378 import 'a.dart' as p;
3779 const dynamic V = const 3379 const dynamic V = const
3780 p/*location: test.dart;p*/. 3380 p/*location: test.dart;p*/.
3781 C/*location: a.dart;C*/. 3381 C/*location: a.dart;C*/.
3782 named/*location: null*/(); 3382 named/*location: null*/();
3783 '''); 3383 ''');
3784 } 3384 }
3785 } 3385 }
3786 3386
3787 test_const_invokeConstructor_named_unresolved4() async { 3387 test_const_invokeConstructor_named_unresolved4() async {
3788 addLibrarySource('/a.dart', ''); 3388 addLibrarySource('/a.dart', '');
3789 var library = await checkLibrary( 3389 var library = await checkLibrary(r'''
3790 r'''
3791 import 'a.dart' as p; 3390 import 'a.dart' as p;
3792 const V = const p.C.named(); 3391 const V = const p.C.named();
3793 ''', 3392 ''', allowErrors: true);
3794 allowErrors: true);
3795 if (isStrongMode) { 3393 if (isStrongMode) {
3796 checkElementText( 3394 checkElementText(library, r'''
3797 library,
3798 r'''
3799 import 'a.dart' as p; 3395 import 'a.dart' as p;
3800 const dynamic V = const 3396 const dynamic V = const
3801 p/*location: test.dart;p*/. 3397 p/*location: test.dart;p*/.
3802 C/*location: null*/. 3398 C/*location: null*/.
3803 named/*location: null*/(); 3399 named/*location: null*/();
3804 '''); 3400 ''');
3805 } else { 3401 } else {
3806 checkElementText( 3402 checkElementText(library, r'''
3807 library,
3808 r'''
3809 import 'a.dart' as p; 3403 import 'a.dart' as p;
3810 const dynamic V = const 3404 const dynamic V = const
3811 p/*location: test.dart;p*/. 3405 p/*location: test.dart;p*/.
3812 C/*location: null*/. 3406 C/*location: null*/.
3813 named/*location: null*/(); 3407 named/*location: null*/();
3814 '''); 3408 ''');
3815 } 3409 }
3816 } 3410 }
3817 3411
3818 test_const_invokeConstructor_named_unresolved5() async { 3412 test_const_invokeConstructor_named_unresolved5() async {
3819 var library = await checkLibrary( 3413 var library = await checkLibrary(r'''
3820 r'''
3821 const V = const p.C.named(); 3414 const V = const p.C.named();
3822 ''', 3415 ''', allowErrors: true);
3823 allowErrors: true);
3824 if (isStrongMode) { 3416 if (isStrongMode) {
3825 checkElementText( 3417 checkElementText(library, r'''
3826 library,
3827 r'''
3828 const dynamic V = const 3418 const dynamic V = const
3829 p/*location: null*/. 3419 p/*location: null*/.
3830 C/*location: null*/. 3420 C/*location: null*/.
3831 named/*location: null*/(); 3421 named/*location: null*/();
3832 '''); 3422 ''');
3833 } else { 3423 } else {
3834 checkElementText( 3424 checkElementText(library, r'''
3835 library,
3836 r'''
3837 const dynamic V = const 3425 const dynamic V = const
3838 p/*location: null*/. 3426 p/*location: null*/.
3839 C/*location: null*/. 3427 C/*location: null*/.
3840 named/*location: null*/(); 3428 named/*location: null*/();
3841 '''); 3429 ''');
3842 } 3430 }
3843 } 3431 }
3844 3432
3845 test_const_invokeConstructor_named_unresolved6() async { 3433 test_const_invokeConstructor_named_unresolved6() async {
3846 var library = await checkLibrary( 3434 var library = await checkLibrary(r'''
3847 r'''
3848 class C<T> {} 3435 class C<T> {}
3849 const V = const C.named(); 3436 const V = const C.named();
3850 ''', 3437 ''', allowErrors: true);
3851 allowErrors: true);
3852 if (isStrongMode) { 3438 if (isStrongMode) {
3853 checkElementText( 3439 checkElementText(library, r'''
3854 library,
3855 r'''
3856 class C<T> { 3440 class C<T> {
3857 } 3441 }
3858 const C<dynamic> V = const 3442 const C<dynamic> V = const
3859 C/*location: test.dart;C*/. 3443 C/*location: test.dart;C*/.
3860 named/*location: null*/(); 3444 named/*location: null*/();
3861 '''); 3445 ''');
3862 } else { 3446 } else {
3863 checkElementText( 3447 checkElementText(library, r'''
3864 library,
3865 r'''
3866 class C<T> { 3448 class C<T> {
3867 } 3449 }
3868 const dynamic V = const 3450 const dynamic V = const
3869 C/*location: test.dart;C*/. 3451 C/*location: test.dart;C*/.
3870 named/*location: null*/(); 3452 named/*location: null*/();
3871 '''); 3453 ''');
3872 } 3454 }
3873 } 3455 }
3874 3456
3875 test_const_invokeConstructor_unnamed() async { 3457 test_const_invokeConstructor_unnamed() async {
3876 var library = await checkLibrary(r''' 3458 var library = await checkLibrary(r'''
3877 class C { 3459 class C {
3878 const C(); 3460 const C();
3879 } 3461 }
3880 const V = const C(); 3462 const V = const C();
3881 '''); 3463 ''');
3882 if (isStrongMode) { 3464 if (isStrongMode) {
3883 checkElementText( 3465 checkElementText(library, r'''
3884 library,
3885 r'''
3886 class C { 3466 class C {
3887 const C(); 3467 const C();
3888 } 3468 }
3889 const C V = const 3469 const C V = const
3890 C/*location: test.dart;C*/(); 3470 C/*location: test.dart;C*/();
3891 '''); 3471 ''');
3892 } else { 3472 } else {
3893 checkElementText( 3473 checkElementText(library, r'''
3894 library,
3895 r'''
3896 class C { 3474 class C {
3897 const C(); 3475 const C();
3898 } 3476 }
3899 const dynamic V = const 3477 const dynamic V = const
3900 C/*location: test.dart;C*/(); 3478 C/*location: test.dart;C*/();
3901 '''); 3479 ''');
3902 } 3480 }
3903 } 3481 }
3904 3482
3905 test_const_invokeConstructor_unnamed_imported() async { 3483 test_const_invokeConstructor_unnamed_imported() async {
3906 addLibrarySource( 3484 addLibrarySource('/a.dart', r'''
3907 '/a.dart',
3908 r'''
3909 class C { 3485 class C {
3910 const C(); 3486 const C();
3911 } 3487 }
3912 '''); 3488 ''');
3913 var library = await checkLibrary(r''' 3489 var library = await checkLibrary(r'''
3914 import 'a.dart'; 3490 import 'a.dart';
3915 const V = const C(); 3491 const V = const C();
3916 '''); 3492 ''');
3917 if (isStrongMode) { 3493 if (isStrongMode) {
3918 checkElementText( 3494 checkElementText(library, r'''
3919 library,
3920 r'''
3921 import 'a.dart'; 3495 import 'a.dart';
3922 const C V = const 3496 const C V = const
3923 C/*location: a.dart;C*/(); 3497 C/*location: a.dart;C*/();
3924 '''); 3498 ''');
3925 } else { 3499 } else {
3926 checkElementText( 3500 checkElementText(library, r'''
3927 library,
3928 r'''
3929 import 'a.dart'; 3501 import 'a.dart';
3930 const dynamic V = const 3502 const dynamic V = const
3931 C/*location: a.dart;C*/(); 3503 C/*location: a.dart;C*/();
3932 '''); 3504 ''');
3933 } 3505 }
3934 } 3506 }
3935 3507
3936 test_const_invokeConstructor_unnamed_imported_withPrefix() async { 3508 test_const_invokeConstructor_unnamed_imported_withPrefix() async {
3937 addLibrarySource( 3509 addLibrarySource('/a.dart', r'''
3938 '/a.dart',
3939 r'''
3940 class C { 3510 class C {
3941 const C(); 3511 const C();
3942 } 3512 }
3943 '''); 3513 ''');
3944 var library = await checkLibrary(r''' 3514 var library = await checkLibrary(r'''
3945 import 'a.dart' as p; 3515 import 'a.dart' as p;
3946 const V = const p.C(); 3516 const V = const p.C();
3947 '''); 3517 ''');
3948 if (isStrongMode) { 3518 if (isStrongMode) {
3949 checkElementText( 3519 checkElementText(library, r'''
3950 library,
3951 r'''
3952 import 'a.dart' as p; 3520 import 'a.dart' as p;
3953 const C V = const 3521 const C V = const
3954 C/*location: a.dart;C*/(); 3522 C/*location: a.dart;C*/();
3955 '''); 3523 ''');
3956 } else { 3524 } else {
3957 checkElementText( 3525 checkElementText(library, r'''
3958 library,
3959 r'''
3960 import 'a.dart' as p; 3526 import 'a.dart' as p;
3961 const dynamic V = const 3527 const dynamic V = const
3962 C/*location: a.dart;C*/(); 3528 C/*location: a.dart;C*/();
3963 '''); 3529 ''');
3964 } 3530 }
3965 } 3531 }
3966 3532
3967 test_const_invokeConstructor_unnamed_unresolved() async { 3533 test_const_invokeConstructor_unnamed_unresolved() async {
3968 var library = await checkLibrary( 3534 var library = await checkLibrary(r'''
3969 r'''
3970 const V = const C(); 3535 const V = const C();
3971 ''', 3536 ''', allowErrors: true);
3972 allowErrors: true);
3973 if (isStrongMode) { 3537 if (isStrongMode) {
3974 checkElementText( 3538 checkElementText(library, r'''
3975 library,
3976 r'''
3977 const dynamic V = const 3539 const dynamic V = const
3978 C/*location: null*/(); 3540 C/*location: null*/();
3979 '''); 3541 ''');
3980 } else { 3542 } else {
3981 checkElementText( 3543 checkElementText(library, r'''
3982 library,
3983 r'''
3984 const dynamic V = const 3544 const dynamic V = const
3985 C/*location: null*/(); 3545 C/*location: null*/();
3986 '''); 3546 ''');
3987 } 3547 }
3988 } 3548 }
3989 3549
3990 test_const_invokeConstructor_unnamed_unresolved2() async { 3550 test_const_invokeConstructor_unnamed_unresolved2() async {
3991 shouldCompareLibraryElements = false; 3551 shouldCompareLibraryElements = false;
3992 addLibrarySource('/a.dart', ''); 3552 addLibrarySource('/a.dart', '');
3993 var library = await checkLibrary( 3553 var library = await checkLibrary(r'''
3994 r'''
3995 import 'a.dart' as p; 3554 import 'a.dart' as p;
3996 const V = const p.C(); 3555 const V = const p.C();
3997 ''', 3556 ''', allowErrors: true);
3998 allowErrors: true);
3999 if (isStrongMode) { 3557 if (isStrongMode) {
4000 checkElementText( 3558 checkElementText(library, r'''
4001 library,
4002 r'''
4003 import 'a.dart' as p; 3559 import 'a.dart' as p;
4004 const dynamic V = const 3560 const dynamic V = const
4005 p/*location: test.dart;p*/. 3561 p/*location: test.dart;p*/.
4006 C/*location: null*/(); 3562 C/*location: null*/();
4007 '''); 3563 ''');
4008 } else { 3564 } else {
4009 checkElementText( 3565 checkElementText(library, r'''
4010 library,
4011 r'''
4012 import 'a.dart' as p; 3566 import 'a.dart' as p;
4013 const dynamic V = const 3567 const dynamic V = const
4014 p/*location: test.dart;p*/. 3568 p/*location: test.dart;p*/.
4015 C/*location: null*/(); 3569 C/*location: null*/();
4016 '''); 3570 ''');
4017 } 3571 }
4018 } 3572 }
4019 3573
4020 test_const_invokeConstructor_unnamed_unresolved3() async { 3574 test_const_invokeConstructor_unnamed_unresolved3() async {
4021 var library = await checkLibrary( 3575 var library = await checkLibrary(r'''
4022 r'''
4023 const V = const p.C(); 3576 const V = const p.C();
4024 ''', 3577 ''', allowErrors: true);
4025 allowErrors: true);
4026 if (isStrongMode) { 3578 if (isStrongMode) {
4027 checkElementText( 3579 checkElementText(library, r'''
4028 library,
4029 r'''
4030 const dynamic V = const 3580 const dynamic V = const
4031 p/*location: null*/. 3581 p/*location: null*/.
4032 C/*location: null*/(); 3582 C/*location: null*/();
4033 '''); 3583 ''');
4034 } else { 3584 } else {
4035 checkElementText( 3585 checkElementText(library, r'''
4036 library,
4037 r'''
4038 const dynamic V = const 3586 const dynamic V = const
4039 p/*location: null*/. 3587 p/*location: null*/.
4040 C/*location: null*/(); 3588 C/*location: null*/();
4041 '''); 3589 ''');
4042 } 3590 }
4043 } 3591 }
4044 3592
4045 test_const_length_ofClassConstField() async { 3593 test_const_length_ofClassConstField() async {
4046 var library = await checkLibrary(r''' 3594 var library = await checkLibrary(r'''
4047 class C { 3595 class C {
4048 static const String F = ''; 3596 static const String F = '';
4049 } 3597 }
4050 const int v = C.F.length; 3598 const int v = C.F.length;
4051 '''); 3599 ''');
4052 if (isStrongMode) { 3600 if (isStrongMode) {
4053 checkElementText( 3601 checkElementText(library, r'''
4054 library,
4055 r'''
4056 class C { 3602 class C {
4057 static const String F = ''; 3603 static const String F = '';
4058 } 3604 }
4059 const int v = 3605 const int v =
4060 C/*location: test.dart;C*/. 3606 C/*location: test.dart;C*/.
4061 F/*location: test.dart;C;F?*/. 3607 F/*location: test.dart;C;F?*/.
4062 length/*location: dart:core;String;length?*/; 3608 length/*location: dart:core;String;length?*/;
4063 '''); 3609 ''');
4064 } else { 3610 } else {
4065 checkElementText( 3611 checkElementText(library, r'''
4066 library,
4067 r'''
4068 class C { 3612 class C {
4069 static const String F = ''; 3613 static const String F = '';
4070 } 3614 }
4071 const int v = 3615 const int v =
4072 C/*location: test.dart;C*/. 3616 C/*location: test.dart;C*/.
4073 F/*location: test.dart;C;F?*/. 3617 F/*location: test.dart;C;F?*/.
4074 length/*location: dart:core;String;length?*/; 3618 length/*location: dart:core;String;length?*/;
4075 '''); 3619 ''');
4076 } 3620 }
4077 } 3621 }
4078 3622
4079 test_const_length_ofClassConstField_imported() async { 3623 test_const_length_ofClassConstField_imported() async {
4080 addLibrarySource( 3624 addLibrarySource('/a.dart', r'''
4081 '/a.dart',
4082 r'''
4083 class C { 3625 class C {
4084 static const String F = ''; 3626 static const String F = '';
4085 } 3627 }
4086 '''); 3628 ''');
4087 var library = await checkLibrary(r''' 3629 var library = await checkLibrary(r'''
4088 import 'a.dart'; 3630 import 'a.dart';
4089 const int v = C.F.length; 3631 const int v = C.F.length;
4090 '''); 3632 ''');
4091 if (isStrongMode) { 3633 if (isStrongMode) {
4092 checkElementText( 3634 checkElementText(library, r'''
4093 library,
4094 r'''
4095 import 'a.dart'; 3635 import 'a.dart';
4096 const int v = 3636 const int v =
4097 C/*location: a.dart;C*/. 3637 C/*location: a.dart;C*/.
4098 F/*location: a.dart;C;F?*/. 3638 F/*location: a.dart;C;F?*/.
4099 length/*location: dart:core;String;length?*/; 3639 length/*location: dart:core;String;length?*/;
4100 '''); 3640 ''');
4101 } else { 3641 } else {
4102 checkElementText( 3642 checkElementText(library, r'''
4103 library,
4104 r'''
4105 import 'a.dart'; 3643 import 'a.dart';
4106 const int v = 3644 const int v =
4107 C/*location: a.dart;C*/. 3645 C/*location: a.dart;C*/.
4108 F/*location: a.dart;C;F?*/. 3646 F/*location: a.dart;C;F?*/.
4109 length/*location: dart:core;String;length?*/; 3647 length/*location: dart:core;String;length?*/;
4110 '''); 3648 ''');
4111 } 3649 }
4112 } 3650 }
4113 3651
4114 test_const_length_ofClassConstField_imported_withPrefix() async { 3652 test_const_length_ofClassConstField_imported_withPrefix() async {
4115 addLibrarySource( 3653 addLibrarySource('/a.dart', r'''
4116 '/a.dart',
4117 r'''
4118 class C { 3654 class C {
4119 static const String F = ''; 3655 static const String F = '';
4120 } 3656 }
4121 '''); 3657 ''');
4122 var library = await checkLibrary(r''' 3658 var library = await checkLibrary(r'''
4123 import 'a.dart' as p; 3659 import 'a.dart' as p;
4124 const int v = p.C.F.length; 3660 const int v = p.C.F.length;
4125 '''); 3661 ''');
4126 if (isStrongMode) { 3662 if (isStrongMode) {
4127 checkElementText( 3663 checkElementText(library, r'''
4128 library,
4129 r'''
4130 import 'a.dart' as p; 3664 import 'a.dart' as p;
4131 const int v = 3665 const int v =
4132 p/*location: test.dart;p*/. 3666 p/*location: test.dart;p*/.
4133 C/*location: a.dart;C*/. 3667 C/*location: a.dart;C*/.
4134 F/*location: a.dart;C;F?*/. 3668 F/*location: a.dart;C;F?*/.
4135 length/*location: dart:core;String;length?*/; 3669 length/*location: dart:core;String;length?*/;
4136 '''); 3670 ''');
4137 } else { 3671 } else {
4138 checkElementText( 3672 checkElementText(library, r'''
4139 library,
4140 r'''
4141 import 'a.dart' as p; 3673 import 'a.dart' as p;
4142 const int v = 3674 const int v =
4143 p/*location: test.dart;p*/. 3675 p/*location: test.dart;p*/.
4144 C/*location: a.dart;C*/. 3676 C/*location: a.dart;C*/.
4145 F/*location: a.dart;C;F?*/. 3677 F/*location: a.dart;C;F?*/.
4146 length/*location: dart:core;String;length?*/; 3678 length/*location: dart:core;String;length?*/;
4147 '''); 3679 ''');
4148 } 3680 }
4149 } 3681 }
4150 3682
4151 test_const_length_ofStringLiteral() async { 3683 test_const_length_ofStringLiteral() async {
4152 var library = await checkLibrary(r''' 3684 var library = await checkLibrary(r'''
4153 const v = 'abc'.length; 3685 const v = 'abc'.length;
4154 '''); 3686 ''');
4155 if (isStrongMode) { 3687 if (isStrongMode) {
4156 checkElementText( 3688 checkElementText(library, r'''
4157 library,
4158 r'''
4159 const dynamic v/*error: instanceGetter*/ = 'abc'. 3689 const dynamic v/*error: instanceGetter*/ = 'abc'.
4160 length/*location: dart:core;String;length?*/; 3690 length/*location: dart:core;String;length?*/;
4161 '''); 3691 ''');
4162 } else { 3692 } else {
4163 checkElementText( 3693 checkElementText(library, r'''
4164 library,
4165 r'''
4166 const dynamic v = 'abc'. 3694 const dynamic v = 'abc'.
4167 length/*location: dart:core;String;length?*/; 3695 length/*location: dart:core;String;length?*/;
4168 '''); 3696 ''');
4169 } 3697 }
4170 } 3698 }
4171 3699
4172 test_const_length_ofTopLevelVariable() async { 3700 test_const_length_ofTopLevelVariable() async {
4173 var library = await checkLibrary(r''' 3701 var library = await checkLibrary(r'''
4174 const String S = 'abc'; 3702 const String S = 'abc';
4175 const v = S.length; 3703 const v = S.length;
4176 '''); 3704 ''');
4177 if (isStrongMode) { 3705 if (isStrongMode) {
4178 checkElementText( 3706 checkElementText(library, r'''
4179 library,
4180 r'''
4181 const String S = 'abc'; 3707 const String S = 'abc';
4182 const dynamic v/*error: instanceGetter*/ = 3708 const dynamic v/*error: instanceGetter*/ =
4183 S/*location: test.dart;S?*/. 3709 S/*location: test.dart;S?*/.
4184 length/*location: dart:core;String;length?*/; 3710 length/*location: dart:core;String;length?*/;
4185 '''); 3711 ''');
4186 } else { 3712 } else {
4187 checkElementText( 3713 checkElementText(library, r'''
4188 library,
4189 r'''
4190 const String S = 'abc'; 3714 const String S = 'abc';
4191 const dynamic v = 3715 const dynamic v =
4192 S/*location: test.dart;S?*/. 3716 S/*location: test.dart;S?*/.
4193 length/*location: dart:core;String;length?*/; 3717 length/*location: dart:core;String;length?*/;
4194 '''); 3718 ''');
4195 } 3719 }
4196 } 3720 }
4197 3721
4198 test_const_length_ofTopLevelVariable_imported() async { 3722 test_const_length_ofTopLevelVariable_imported() async {
4199 addLibrarySource( 3723 addLibrarySource('/a.dart', r'''
4200 '/a.dart',
4201 r'''
4202 const String S = 'abc'; 3724 const String S = 'abc';
4203 '''); 3725 ''');
4204 var library = await checkLibrary(r''' 3726 var library = await checkLibrary(r'''
4205 import 'a.dart'; 3727 import 'a.dart';
4206 const v = S.length; 3728 const v = S.length;
4207 '''); 3729 ''');
4208 if (isStrongMode) { 3730 if (isStrongMode) {
4209 checkElementText( 3731 checkElementText(library, r'''
4210 library,
4211 r'''
4212 import 'a.dart'; 3732 import 'a.dart';
4213 const dynamic v/*error: instanceGetter*/ = 3733 const dynamic v/*error: instanceGetter*/ =
4214 S/*location: a.dart;S?*/. 3734 S/*location: a.dart;S?*/.
4215 length/*location: dart:core;String;length?*/; 3735 length/*location: dart:core;String;length?*/;
4216 '''); 3736 ''');
4217 } else { 3737 } else {
4218 checkElementText( 3738 checkElementText(library, r'''
4219 library,
4220 r'''
4221 import 'a.dart'; 3739 import 'a.dart';
4222 const dynamic v = 3740 const dynamic v =
4223 S/*location: a.dart;S?*/. 3741 S/*location: a.dart;S?*/.
4224 length/*location: dart:core;String;length?*/; 3742 length/*location: dart:core;String;length?*/;
4225 '''); 3743 ''');
4226 } 3744 }
4227 } 3745 }
4228 3746
4229 test_const_length_ofTopLevelVariable_imported_withPrefix() async { 3747 test_const_length_ofTopLevelVariable_imported_withPrefix() async {
4230 addLibrarySource( 3748 addLibrarySource('/a.dart', r'''
4231 '/a.dart',
4232 r'''
4233 const String S = 'abc'; 3749 const String S = 'abc';
4234 '''); 3750 ''');
4235 var library = await checkLibrary(r''' 3751 var library = await checkLibrary(r'''
4236 import 'a.dart' as p; 3752 import 'a.dart' as p;
4237 const v = p.S.length; 3753 const v = p.S.length;
4238 '''); 3754 ''');
4239 if (isStrongMode) { 3755 if (isStrongMode) {
4240 checkElementText( 3756 checkElementText(library, r'''
4241 library,
4242 r'''
4243 import 'a.dart' as p; 3757 import 'a.dart' as p;
4244 const dynamic v/*error: instanceGetter*/ = 3758 const dynamic v/*error: instanceGetter*/ =
4245 p/*location: test.dart;p*/. 3759 p/*location: test.dart;p*/.
4246 S/*location: a.dart;S?*/. 3760 S/*location: a.dart;S?*/.
4247 length/*location: dart:core;String;length?*/; 3761 length/*location: dart:core;String;length?*/;
4248 '''); 3762 ''');
4249 } else { 3763 } else {
4250 checkElementText( 3764 checkElementText(library, r'''
4251 library,
4252 r'''
4253 import 'a.dart' as p; 3765 import 'a.dart' as p;
4254 const dynamic v = 3766 const dynamic v =
4255 p/*location: test.dart;p*/. 3767 p/*location: test.dart;p*/.
4256 S/*location: a.dart;S?*/. 3768 S/*location: a.dart;S?*/.
4257 length/*location: dart:core;String;length?*/; 3769 length/*location: dart:core;String;length?*/;
4258 '''); 3770 ''');
4259 } 3771 }
4260 } 3772 }
4261 3773
4262 test_const_length_staticMethod() async { 3774 test_const_length_staticMethod() async {
4263 var library = await checkLibrary(r''' 3775 var library = await checkLibrary(r'''
4264 class C { 3776 class C {
4265 static int length() => 42; 3777 static int length() => 42;
4266 } 3778 }
4267 const v = C.length; 3779 const v = C.length;
4268 '''); 3780 ''');
4269 if (isStrongMode) { 3781 if (isStrongMode) {
4270 checkElementText( 3782 checkElementText(library, r'''
4271 library,
4272 r'''
4273 class C { 3783 class C {
4274 static int length() {} 3784 static int length() {}
4275 } 3785 }
4276 const () → int v = 3786 const () → int v =
4277 C/*location: test.dart;C*/. 3787 C/*location: test.dart;C*/.
4278 length/*location: test.dart;C;length*/; 3788 length/*location: test.dart;C;length*/;
4279 '''); 3789 ''');
4280 } else { 3790 } else {
4281 checkElementText( 3791 checkElementText(library, r'''
4282 library,
4283 r'''
4284 class C { 3792 class C {
4285 static int length() {} 3793 static int length() {}
4286 } 3794 }
4287 const dynamic v = 3795 const dynamic v =
4288 C/*location: test.dart;C*/. 3796 C/*location: test.dart;C*/.
4289 length/*location: test.dart;C;length*/; 3797 length/*location: test.dart;C;length*/;
4290 '''); 3798 ''');
4291 } 3799 }
4292 } 3800 }
4293 3801
4294 test_const_parameterDefaultValue_initializingFormal_functionTyped() async { 3802 test_const_parameterDefaultValue_initializingFormal_functionTyped() async {
4295 var library = await checkLibrary(r''' 3803 var library = await checkLibrary(r'''
4296 class C { 3804 class C {
4297 final x; 3805 final x;
4298 const C({this.x: foo}); 3806 const C({this.x: foo});
4299 } 3807 }
4300 int foo() => 42; 3808 int foo() => 42;
4301 '''); 3809 ''');
4302 if (isStrongMode) { 3810 if (isStrongMode) {
4303 checkElementText( 3811 checkElementText(library, r'''
4304 library,
4305 r'''
4306 class C { 3812 class C {
4307 final dynamic x; 3813 final dynamic x;
4308 const C({dynamic this.x}); 3814 const C({dynamic this.x});
4309 } 3815 }
4310 int foo() {} 3816 int foo() {}
4311 '''); 3817 ''');
4312 } else { 3818 } else {
4313 checkElementText( 3819 checkElementText(library, r'''
4314 library,
4315 r'''
4316 class C { 3820 class C {
4317 final dynamic x; 3821 final dynamic x;
4318 const C({dynamic this.x}); 3822 const C({dynamic this.x});
4319 } 3823 }
4320 int foo() {} 3824 int foo() {}
4321 '''); 3825 ''');
4322 } 3826 }
4323 } 3827 }
4324 3828
4325 test_const_parameterDefaultValue_initializingFormal_named() async { 3829 test_const_parameterDefaultValue_initializingFormal_named() async {
4326 var library = await checkLibrary(r''' 3830 var library = await checkLibrary(r'''
4327 class C { 3831 class C {
4328 final x; 3832 final x;
4329 const C({this.x: 1 + 2}); 3833 const C({this.x: 1 + 2});
4330 } 3834 }
4331 '''); 3835 ''');
4332 if (isStrongMode) { 3836 if (isStrongMode) {
4333 checkElementText( 3837 checkElementText(library, r'''
4334 library,
4335 r'''
4336 class C { 3838 class C {
4337 final dynamic x; 3839 final dynamic x;
4338 const C({dynamic this.x}); 3840 const C({dynamic this.x});
4339 } 3841 }
4340 '''); 3842 ''');
4341 } else { 3843 } else {
4342 checkElementText( 3844 checkElementText(library, r'''
4343 library,
4344 r'''
4345 class C { 3845 class C {
4346 final dynamic x; 3846 final dynamic x;
4347 const C({dynamic this.x}); 3847 const C({dynamic this.x});
4348 } 3848 }
4349 '''); 3849 ''');
4350 } 3850 }
4351 } 3851 }
4352 3852
4353 test_const_parameterDefaultValue_initializingFormal_positional() async { 3853 test_const_parameterDefaultValue_initializingFormal_positional() async {
4354 var library = await checkLibrary(r''' 3854 var library = await checkLibrary(r'''
4355 class C { 3855 class C {
4356 final x; 3856 final x;
4357 const C([this.x = 1 + 2]); 3857 const C([this.x = 1 + 2]);
4358 } 3858 }
4359 '''); 3859 ''');
4360 if (isStrongMode) { 3860 if (isStrongMode) {
4361 checkElementText( 3861 checkElementText(library, r'''
4362 library,
4363 r'''
4364 class C { 3862 class C {
4365 final dynamic x; 3863 final dynamic x;
4366 const C([dynamic this.x]); 3864 const C([dynamic this.x]);
4367 } 3865 }
4368 '''); 3866 ''');
4369 } else { 3867 } else {
4370 checkElementText( 3868 checkElementText(library, r'''
4371 library,
4372 r'''
4373 class C { 3869 class C {
4374 final dynamic x; 3870 final dynamic x;
4375 const C([dynamic this.x]); 3871 const C([dynamic this.x]);
4376 } 3872 }
4377 '''); 3873 ''');
4378 } 3874 }
4379 } 3875 }
4380 3876
4381 test_const_parameterDefaultValue_normal() async { 3877 test_const_parameterDefaultValue_normal() async {
4382 var library = await checkLibrary(r''' 3878 var library = await checkLibrary(r'''
4383 class C { 3879 class C {
4384 const C.positional([p = 1 + 2]); 3880 const C.positional([p = 1 + 2]);
4385 const C.named({p: 1 + 2}); 3881 const C.named({p: 1 + 2});
4386 void methodPositional([p = 1 + 2]) {} 3882 void methodPositional([p = 1 + 2]) {}
4387 void methodPositionalWithoutDefault([p]) {} 3883 void methodPositionalWithoutDefault([p]) {}
4388 void methodNamed({p: 1 + 2}) {} 3884 void methodNamed({p: 1 + 2}) {}
4389 void methodNamedWithoutDefault({p}) {} 3885 void methodNamedWithoutDefault({p}) {}
4390 } 3886 }
4391 '''); 3887 ''');
4392 if (isStrongMode) { 3888 if (isStrongMode) {
4393 checkElementText( 3889 checkElementText(library, r'''
4394 library,
4395 r'''
4396 class C { 3890 class C {
4397 const C.positional([dynamic p = 1 + 2]); 3891 const C.positional([dynamic p = 1 + 2]);
4398 const C.named({dynamic p: 1 + 2}); 3892 const C.named({dynamic p: 1 + 2});
4399 void methodPositional([dynamic p = 1 + 2]) {} 3893 void methodPositional([dynamic p = 1 + 2]) {}
4400 void methodPositionalWithoutDefault([dynamic p]) {} 3894 void methodPositionalWithoutDefault([dynamic p]) {}
4401 void methodNamed({dynamic p: 1 + 2}) {} 3895 void methodNamed({dynamic p: 1 + 2}) {}
4402 void methodNamedWithoutDefault({dynamic p}) {} 3896 void methodNamedWithoutDefault({dynamic p}) {}
4403 } 3897 }
4404 '''); 3898 ''');
4405 } else { 3899 } else {
4406 checkElementText( 3900 checkElementText(library, r'''
4407 library,
4408 r'''
4409 class C { 3901 class C {
4410 const C.positional([dynamic p = 1 + 2]); 3902 const C.positional([dynamic p = 1 + 2]);
4411 const C.named({dynamic p: 1 + 2}); 3903 const C.named({dynamic p: 1 + 2});
4412 void methodPositional([dynamic p = 1 + 2]) {} 3904 void methodPositional([dynamic p = 1 + 2]) {}
4413 void methodPositionalWithoutDefault([dynamic p]) {} 3905 void methodPositionalWithoutDefault([dynamic p]) {}
4414 void methodNamed({dynamic p: 1 + 2}) {} 3906 void methodNamed({dynamic p: 1 + 2}) {}
4415 void methodNamedWithoutDefault({dynamic p}) {} 3907 void methodNamedWithoutDefault({dynamic p}) {}
4416 } 3908 }
4417 '''); 3909 ''');
4418 } 3910 }
4419 } 3911 }
4420 3912
4421 test_const_reference_staticField() async { 3913 test_const_reference_staticField() async {
4422 var library = await checkLibrary(r''' 3914 var library = await checkLibrary(r'''
4423 class C { 3915 class C {
4424 static const int F = 42; 3916 static const int F = 42;
4425 } 3917 }
4426 const V = C.F; 3918 const V = C.F;
4427 '''); 3919 ''');
4428 if (isStrongMode) { 3920 if (isStrongMode) {
4429 checkElementText( 3921 checkElementText(library, r'''
4430 library,
4431 r'''
4432 class C { 3922 class C {
4433 static const int F = 42; 3923 static const int F = 42;
4434 } 3924 }
4435 const int V = 3925 const int V =
4436 C/*location: test.dart;C*/. 3926 C/*location: test.dart;C*/.
4437 F/*location: test.dart;C;F?*/; 3927 F/*location: test.dart;C;F?*/;
4438 '''); 3928 ''');
4439 } else { 3929 } else {
4440 checkElementText( 3930 checkElementText(library, r'''
4441 library,
4442 r'''
4443 class C { 3931 class C {
4444 static const int F = 42; 3932 static const int F = 42;
4445 } 3933 }
4446 const dynamic V = 3934 const dynamic V =
4447 C/*location: test.dart;C*/. 3935 C/*location: test.dart;C*/.
4448 F/*location: test.dart;C;F?*/; 3936 F/*location: test.dart;C;F?*/;
4449 '''); 3937 ''');
4450 } 3938 }
4451 } 3939 }
4452 3940
4453 test_const_reference_staticField_imported() async { 3941 test_const_reference_staticField_imported() async {
4454 addLibrarySource( 3942 addLibrarySource('/a.dart', r'''
4455 '/a.dart',
4456 r'''
4457 class C { 3943 class C {
4458 static const int F = 42; 3944 static const int F = 42;
4459 } 3945 }
4460 '''); 3946 ''');
4461 var library = await checkLibrary(r''' 3947 var library = await checkLibrary(r'''
4462 import 'a.dart'; 3948 import 'a.dart';
4463 const V = C.F; 3949 const V = C.F;
4464 '''); 3950 ''');
4465 if (isStrongMode) { 3951 if (isStrongMode) {
4466 checkElementText( 3952 checkElementText(library, r'''
4467 library,
4468 r'''
4469 import 'a.dart'; 3953 import 'a.dart';
4470 const int V = 3954 const int V =
4471 C/*location: a.dart;C*/. 3955 C/*location: a.dart;C*/.
4472 F/*location: a.dart;C;F?*/; 3956 F/*location: a.dart;C;F?*/;
4473 '''); 3957 ''');
4474 } else { 3958 } else {
4475 checkElementText( 3959 checkElementText(library, r'''
4476 library,
4477 r'''
4478 import 'a.dart'; 3960 import 'a.dart';
4479 const dynamic V = 3961 const dynamic V =
4480 C/*location: a.dart;C*/. 3962 C/*location: a.dart;C*/.
4481 F/*location: a.dart;C;F?*/; 3963 F/*location: a.dart;C;F?*/;
4482 '''); 3964 ''');
4483 } 3965 }
4484 } 3966 }
4485 3967
4486 test_const_reference_staticField_imported_withPrefix() async { 3968 test_const_reference_staticField_imported_withPrefix() async {
4487 addLibrarySource( 3969 addLibrarySource('/a.dart', r'''
4488 '/a.dart',
4489 r'''
4490 class C { 3970 class C {
4491 static const int F = 42; 3971 static const int F = 42;
4492 } 3972 }
4493 '''); 3973 ''');
4494 var library = await checkLibrary(r''' 3974 var library = await checkLibrary(r'''
4495 import 'a.dart' as p; 3975 import 'a.dart' as p;
4496 const V = p.C.F; 3976 const V = p.C.F;
4497 '''); 3977 ''');
4498 if (isStrongMode) { 3978 if (isStrongMode) {
4499 checkElementText( 3979 checkElementText(library, r'''
4500 library,
4501 r'''
4502 import 'a.dart' as p; 3980 import 'a.dart' as p;
4503 const int V = 3981 const int V =
4504 p/*location: test.dart;p*/. 3982 p/*location: test.dart;p*/.
4505 C/*location: a.dart;C*/. 3983 C/*location: a.dart;C*/.
4506 F/*location: a.dart;C;F?*/; 3984 F/*location: a.dart;C;F?*/;
4507 '''); 3985 ''');
4508 } else { 3986 } else {
4509 checkElementText( 3987 checkElementText(library, r'''
4510 library,
4511 r'''
4512 import 'a.dart' as p; 3988 import 'a.dart' as p;
4513 const dynamic V = 3989 const dynamic V =
4514 p/*location: test.dart;p*/. 3990 p/*location: test.dart;p*/.
4515 C/*location: a.dart;C*/. 3991 C/*location: a.dart;C*/.
4516 F/*location: a.dart;C;F?*/; 3992 F/*location: a.dart;C;F?*/;
4517 '''); 3993 ''');
4518 } 3994 }
4519 } 3995 }
4520 3996
4521 test_const_reference_staticMethod() async { 3997 test_const_reference_staticMethod() async {
4522 var library = await checkLibrary(r''' 3998 var library = await checkLibrary(r'''
4523 class C { 3999 class C {
4524 static int m(int a, String b) => 42; 4000 static int m(int a, String b) => 42;
4525 } 4001 }
4526 const V = C.m; 4002 const V = C.m;
4527 '''); 4003 ''');
4528 if (isStrongMode) { 4004 if (isStrongMode) {
4529 checkElementText( 4005 checkElementText(library, r'''
4530 library,
4531 r'''
4532 class C { 4006 class C {
4533 static int m(int a, String b) {} 4007 static int m(int a, String b) {}
4534 } 4008 }
4535 const (int, String) → int V = 4009 const (int, String) → int V =
4536 C/*location: test.dart;C*/. 4010 C/*location: test.dart;C*/.
4537 m/*location: test.dart;C;m*/; 4011 m/*location: test.dart;C;m*/;
4538 '''); 4012 ''');
4539 } else { 4013 } else {
4540 checkElementText( 4014 checkElementText(library, r'''
4541 library,
4542 r'''
4543 class C { 4015 class C {
4544 static int m(int a, String b) {} 4016 static int m(int a, String b) {}
4545 } 4017 }
4546 const dynamic V = 4018 const dynamic V =
4547 C/*location: test.dart;C*/. 4019 C/*location: test.dart;C*/.
4548 m/*location: test.dart;C;m*/; 4020 m/*location: test.dart;C;m*/;
4549 '''); 4021 ''');
4550 } 4022 }
4551 } 4023 }
4552 4024
4553 test_const_reference_staticMethod_imported() async { 4025 test_const_reference_staticMethod_imported() async {
4554 addLibrarySource( 4026 addLibrarySource('/a.dart', r'''
4555 '/a.dart',
4556 r'''
4557 class C { 4027 class C {
4558 static int m(int a, String b) => 42; 4028 static int m(int a, String b) => 42;
4559 } 4029 }
4560 '''); 4030 ''');
4561 var library = await checkLibrary(r''' 4031 var library = await checkLibrary(r'''
4562 import 'a.dart'; 4032 import 'a.dart';
4563 const V = C.m; 4033 const V = C.m;
4564 '''); 4034 ''');
4565 if (isStrongMode) { 4035 if (isStrongMode) {
4566 checkElementText( 4036 checkElementText(library, r'''
4567 library,
4568 r'''
4569 import 'a.dart'; 4037 import 'a.dart';
4570 const (int, String) → int V = 4038 const (int, String) → int V =
4571 C/*location: a.dart;C*/. 4039 C/*location: a.dart;C*/.
4572 m/*location: a.dart;C;m*/; 4040 m/*location: a.dart;C;m*/;
4573 '''); 4041 ''');
4574 } else { 4042 } else {
4575 checkElementText( 4043 checkElementText(library, r'''
4576 library,
4577 r'''
4578 import 'a.dart'; 4044 import 'a.dart';
4579 const dynamic V = 4045 const dynamic V =
4580 C/*location: a.dart;C*/. 4046 C/*location: a.dart;C*/.
4581 m/*location: a.dart;C;m*/; 4047 m/*location: a.dart;C;m*/;
4582 '''); 4048 ''');
4583 } 4049 }
4584 } 4050 }
4585 4051
4586 test_const_reference_staticMethod_imported_withPrefix() async { 4052 test_const_reference_staticMethod_imported_withPrefix() async {
4587 addLibrarySource( 4053 addLibrarySource('/a.dart', r'''
4588 '/a.dart',
4589 r'''
4590 class C { 4054 class C {
4591 static int m(int a, String b) => 42; 4055 static int m(int a, String b) => 42;
4592 } 4056 }
4593 '''); 4057 ''');
4594 var library = await checkLibrary(r''' 4058 var library = await checkLibrary(r'''
4595 import 'a.dart' as p; 4059 import 'a.dart' as p;
4596 const V = p.C.m; 4060 const V = p.C.m;
4597 '''); 4061 ''');
4598 if (isStrongMode) { 4062 if (isStrongMode) {
4599 checkElementText( 4063 checkElementText(library, r'''
4600 library,
4601 r'''
4602 import 'a.dart' as p; 4064 import 'a.dart' as p;
4603 const (int, String) → int V = 4065 const (int, String) → int V =
4604 p/*location: test.dart;p*/. 4066 p/*location: test.dart;p*/.
4605 C/*location: a.dart;C*/. 4067 C/*location: a.dart;C*/.
4606 m/*location: a.dart;C;m*/; 4068 m/*location: a.dart;C;m*/;
4607 '''); 4069 ''');
4608 } else { 4070 } else {
4609 checkElementText( 4071 checkElementText(library, r'''
4610 library,
4611 r'''
4612 import 'a.dart' as p; 4072 import 'a.dart' as p;
4613 const dynamic V = 4073 const dynamic V =
4614 p/*location: test.dart;p*/. 4074 p/*location: test.dart;p*/.
4615 C/*location: a.dart;C*/. 4075 C/*location: a.dart;C*/.
4616 m/*location: a.dart;C;m*/; 4076 m/*location: a.dart;C;m*/;
4617 '''); 4077 ''');
4618 } 4078 }
4619 } 4079 }
4620 4080
4621 test_const_reference_topLevelFunction() async { 4081 test_const_reference_topLevelFunction() async {
4622 var library = await checkLibrary(r''' 4082 var library = await checkLibrary(r'''
4623 foo() {} 4083 foo() {}
4624 const V = foo; 4084 const V = foo;
4625 '''); 4085 ''');
4626 if (isStrongMode) { 4086 if (isStrongMode) {
4627 checkElementText( 4087 checkElementText(library, r'''
4628 library,
4629 r'''
4630 const () → dynamic V = 4088 const () → dynamic V =
4631 foo/*location: test.dart;foo*/; 4089 foo/*location: test.dart;foo*/;
4632 dynamic foo() {} 4090 dynamic foo() {}
4633 '''); 4091 ''');
4634 } else { 4092 } else {
4635 checkElementText( 4093 checkElementText(library, r'''
4636 library,
4637 r'''
4638 const dynamic V = 4094 const dynamic V =
4639 foo/*location: test.dart;foo*/; 4095 foo/*location: test.dart;foo*/;
4640 dynamic foo() {} 4096 dynamic foo() {}
4641 '''); 4097 ''');
4642 } 4098 }
4643 } 4099 }
4644 4100
4645 test_const_reference_topLevelFunction_imported() async { 4101 test_const_reference_topLevelFunction_imported() async {
4646 addLibrarySource( 4102 addLibrarySource('/a.dart', r'''
4647 '/a.dart',
4648 r'''
4649 foo() {} 4103 foo() {}
4650 '''); 4104 ''');
4651 var library = await checkLibrary(r''' 4105 var library = await checkLibrary(r'''
4652 import 'a.dart'; 4106 import 'a.dart';
4653 const V = foo; 4107 const V = foo;
4654 '''); 4108 ''');
4655 if (isStrongMode) { 4109 if (isStrongMode) {
4656 checkElementText( 4110 checkElementText(library, r'''
4657 library,
4658 r'''
4659 import 'a.dart'; 4111 import 'a.dart';
4660 const () → dynamic V = 4112 const () → dynamic V =
4661 foo/*location: a.dart;foo*/; 4113 foo/*location: a.dart;foo*/;
4662 '''); 4114 ''');
4663 } else { 4115 } else {
4664 checkElementText( 4116 checkElementText(library, r'''
4665 library,
4666 r'''
4667 import 'a.dart'; 4117 import 'a.dart';
4668 const dynamic V = 4118 const dynamic V =
4669 foo/*location: a.dart;foo*/; 4119 foo/*location: a.dart;foo*/;
4670 '''); 4120 ''');
4671 } 4121 }
4672 } 4122 }
4673 4123
4674 test_const_reference_topLevelFunction_imported_withPrefix() async { 4124 test_const_reference_topLevelFunction_imported_withPrefix() async {
4675 addLibrarySource( 4125 addLibrarySource('/a.dart', r'''
4676 '/a.dart',
4677 r'''
4678 foo() {} 4126 foo() {}
4679 '''); 4127 ''');
4680 var library = await checkLibrary(r''' 4128 var library = await checkLibrary(r'''
4681 import 'a.dart' as p; 4129 import 'a.dart' as p;
4682 const V = p.foo; 4130 const V = p.foo;
4683 '''); 4131 ''');
4684 if (isStrongMode) { 4132 if (isStrongMode) {
4685 checkElementText( 4133 checkElementText(library, r'''
4686 library,
4687 r'''
4688 import 'a.dart' as p; 4134 import 'a.dart' as p;
4689 const () → dynamic V = 4135 const () → dynamic V =
4690 p/*location: test.dart;p*/. 4136 p/*location: test.dart;p*/.
4691 foo/*location: a.dart;foo*/; 4137 foo/*location: a.dart;foo*/;
4692 '''); 4138 ''');
4693 } else { 4139 } else {
4694 checkElementText( 4140 checkElementText(library, r'''
4695 library,
4696 r'''
4697 import 'a.dart' as p; 4141 import 'a.dart' as p;
4698 const dynamic V = 4142 const dynamic V =
4699 p/*location: test.dart;p*/. 4143 p/*location: test.dart;p*/.
4700 foo/*location: a.dart;foo*/; 4144 foo/*location: a.dart;foo*/;
4701 '''); 4145 ''');
4702 } 4146 }
4703 } 4147 }
4704 4148
4705 test_const_reference_topLevelVariable() async { 4149 test_const_reference_topLevelVariable() async {
4706 var library = await checkLibrary(r''' 4150 var library = await checkLibrary(r'''
4707 const A = 1; 4151 const A = 1;
4708 const B = A + 2; 4152 const B = A + 2;
4709 '''); 4153 ''');
4710 if (isStrongMode) { 4154 if (isStrongMode) {
4711 checkElementText( 4155 checkElementText(library, r'''
4712 library,
4713 r'''
4714 const int A = 1; 4156 const int A = 1;
4715 const int B = 4157 const int B =
4716 A/*location: test.dart;A?*/ + 2; 4158 A/*location: test.dart;A?*/ + 2;
4717 '''); 4159 ''');
4718 } else { 4160 } else {
4719 checkElementText( 4161 checkElementText(library, r'''
4720 library,
4721 r'''
4722 const dynamic A = 1; 4162 const dynamic A = 1;
4723 const dynamic B = 4163 const dynamic B =
4724 A/*location: test.dart;A?*/ + 2; 4164 A/*location: test.dart;A?*/ + 2;
4725 '''); 4165 ''');
4726 } 4166 }
4727 } 4167 }
4728 4168
4729 test_const_reference_topLevelVariable_imported() async { 4169 test_const_reference_topLevelVariable_imported() async {
4730 addLibrarySource( 4170 addLibrarySource('/a.dart', r'''
4731 '/a.dart',
4732 r'''
4733 const A = 1; 4171 const A = 1;
4734 '''); 4172 ''');
4735 var library = await checkLibrary(r''' 4173 var library = await checkLibrary(r'''
4736 import 'a.dart'; 4174 import 'a.dart';
4737 const B = A + 2; 4175 const B = A + 2;
4738 '''); 4176 ''');
4739 if (isStrongMode) { 4177 if (isStrongMode) {
4740 checkElementText( 4178 checkElementText(library, r'''
4741 library,
4742 r'''
4743 import 'a.dart'; 4179 import 'a.dart';
4744 const int B = 4180 const int B =
4745 A/*location: a.dart;A?*/ + 2; 4181 A/*location: a.dart;A?*/ + 2;
4746 '''); 4182 ''');
4747 } else { 4183 } else {
4748 checkElementText( 4184 checkElementText(library, r'''
4749 library,
4750 r'''
4751 import 'a.dart'; 4185 import 'a.dart';
4752 const dynamic B = 4186 const dynamic B =
4753 A/*location: a.dart;A?*/ + 2; 4187 A/*location: a.dart;A?*/ + 2;
4754 '''); 4188 ''');
4755 } 4189 }
4756 } 4190 }
4757 4191
4758 test_const_reference_topLevelVariable_imported_withPrefix() async { 4192 test_const_reference_topLevelVariable_imported_withPrefix() async {
4759 addLibrarySource( 4193 addLibrarySource('/a.dart', r'''
4760 '/a.dart',
4761 r'''
4762 const A = 1; 4194 const A = 1;
4763 '''); 4195 ''');
4764 var library = await checkLibrary(r''' 4196 var library = await checkLibrary(r'''
4765 import 'a.dart' as p; 4197 import 'a.dart' as p;
4766 const B = p.A + 2; 4198 const B = p.A + 2;
4767 '''); 4199 ''');
4768 if (isStrongMode) { 4200 if (isStrongMode) {
4769 checkElementText( 4201 checkElementText(library, r'''
4770 library,
4771 r'''
4772 import 'a.dart' as p; 4202 import 'a.dart' as p;
4773 const int B = 4203 const int B =
4774 p/*location: test.dart;p*/. 4204 p/*location: test.dart;p*/.
4775 A/*location: a.dart;A?*/ + 2; 4205 A/*location: a.dart;A?*/ + 2;
4776 '''); 4206 ''');
4777 } else { 4207 } else {
4778 checkElementText( 4208 checkElementText(library, r'''
4779 library,
4780 r'''
4781 import 'a.dart' as p; 4209 import 'a.dart' as p;
4782 const dynamic B = 4210 const dynamic B =
4783 p/*location: test.dart;p*/. 4211 p/*location: test.dart;p*/.
4784 A/*location: a.dart;A?*/ + 2; 4212 A/*location: a.dart;A?*/ + 2;
4785 '''); 4213 ''');
4786 } 4214 }
4787 } 4215 }
4788 4216
4789 test_const_reference_type() async { 4217 test_const_reference_type() async {
4790 var library = await checkLibrary(r''' 4218 var library = await checkLibrary(r'''
4791 class C {} 4219 class C {}
4792 class D<T> {} 4220 class D<T> {}
4793 enum E {a, b, c} 4221 enum E {a, b, c}
4794 typedef F(int a, String b); 4222 typedef F(int a, String b);
4795 const vDynamic = dynamic; 4223 const vDynamic = dynamic;
4796 const vNull = Null; 4224 const vNull = Null;
4797 const vObject = Object; 4225 const vObject = Object;
4798 const vClass = C; 4226 const vClass = C;
4799 const vGenericClass = D; 4227 const vGenericClass = D;
4800 const vEnum = E; 4228 const vEnum = E;
4801 const vFunctionTypeAlias = F; 4229 const vFunctionTypeAlias = F;
4802 '''); 4230 ''');
4803 if (isStrongMode) { 4231 if (isStrongMode) {
4804 checkElementText( 4232 checkElementText(library, r'''
4805 library,
4806 r'''
4807 typedef dynamic F(int a, String b); 4233 typedef dynamic F(int a, String b);
4808 enum E { 4234 enum E {
4809 synthetic final int index; 4235 synthetic final int index;
4810 synthetic static const List<E> values; 4236 synthetic static const List<E> values;
4811 static const E a; 4237 static const E a;
4812 static const E b; 4238 static const E b;
4813 static const E c; 4239 static const E c;
4814 } 4240 }
4815 class C { 4241 class C {
4816 } 4242 }
4817 class D<T> { 4243 class D<T> {
4818 } 4244 }
4819 const Type vDynamic = 4245 const Type vDynamic =
4820 dynamic/*location: dynamic*/; 4246 dynamic/*location: dynamic*/;
4821 const Type vNull = 4247 const Type vNull =
4822 Null/*location: dart:core;Null*/; 4248 Null/*location: dart:core;Null*/;
4823 const Type vObject = 4249 const Type vObject =
4824 Object/*location: dart:core;Object*/; 4250 Object/*location: dart:core;Object*/;
4825 const Type vClass = 4251 const Type vClass =
4826 C/*location: test.dart;C*/; 4252 C/*location: test.dart;C*/;
4827 const Type vGenericClass = 4253 const Type vGenericClass =
4828 D/*location: test.dart;D*/; 4254 D/*location: test.dart;D*/;
4829 const Type vEnum = 4255 const Type vEnum =
4830 E/*location: test.dart;E*/; 4256 E/*location: test.dart;E*/;
4831 const Type vFunctionTypeAlias = 4257 const Type vFunctionTypeAlias =
4832 F/*location: test.dart;F*/; 4258 F/*location: test.dart;F*/;
4833 '''); 4259 ''');
4834 } else { 4260 } else {
4835 checkElementText( 4261 checkElementText(library, r'''
4836 library,
4837 r'''
4838 typedef dynamic F(int a, String b); 4262 typedef dynamic F(int a, String b);
4839 enum E { 4263 enum E {
4840 synthetic final int index; 4264 synthetic final int index;
4841 synthetic static const List<E> values; 4265 synthetic static const List<E> values;
4842 static const E a; 4266 static const E a;
4843 static const E b; 4267 static const E b;
4844 static const E c; 4268 static const E c;
4845 } 4269 }
4846 class C { 4270 class C {
4847 } 4271 }
(...skipping 18 matching lines...) Expand all
4866 } 4290 }
4867 4291
4868 test_const_reference_type_functionType() async { 4292 test_const_reference_type_functionType() async {
4869 var library = await checkLibrary(r''' 4293 var library = await checkLibrary(r'''
4870 typedef F(); 4294 typedef F();
4871 class C { 4295 class C {
4872 final f = <F>[]; 4296 final f = <F>[];
4873 } 4297 }
4874 '''); 4298 ''');
4875 if (isStrongMode) { 4299 if (isStrongMode) {
4876 checkElementText( 4300 checkElementText(library, r'''
4877 library,
4878 r'''
4879 typedef dynamic F(); 4301 typedef dynamic F();
4880 class C { 4302 class C {
4881 final List<F> f = const < 4303 final List<F> f = const <
4882 F/*location: test.dart;F*/>[]; 4304 F/*location: test.dart;F*/>[];
4883 } 4305 }
4884 '''); 4306 ''');
4885 } else { 4307 } else {
4886 checkElementText( 4308 checkElementText(library, r'''
4887 library,
4888 r'''
4889 typedef dynamic F(); 4309 typedef dynamic F();
4890 class C { 4310 class C {
4891 final dynamic f = const < 4311 final dynamic f = const <
4892 F/*location: test.dart;F*/>[]; 4312 F/*location: test.dart;F*/>[];
4893 } 4313 }
4894 '''); 4314 ''');
4895 } 4315 }
4896 } 4316 }
4897 4317
4898 test_const_reference_type_imported() async { 4318 test_const_reference_type_imported() async {
4899 addLibrarySource( 4319 addLibrarySource('/a.dart', r'''
4900 '/a.dart',
4901 r'''
4902 class C {} 4320 class C {}
4903 enum E {a, b, c} 4321 enum E {a, b, c}
4904 typedef F(int a, String b); 4322 typedef F(int a, String b);
4905 '''); 4323 ''');
4906 var library = await checkLibrary(r''' 4324 var library = await checkLibrary(r'''
4907 import 'a.dart'; 4325 import 'a.dart';
4908 const vClass = C; 4326 const vClass = C;
4909 const vEnum = E; 4327 const vEnum = E;
4910 const vFunctionTypeAlias = F; 4328 const vFunctionTypeAlias = F;
4911 '''); 4329 ''');
4912 if (isStrongMode) { 4330 if (isStrongMode) {
4913 checkElementText( 4331 checkElementText(library, r'''
4914 library,
4915 r'''
4916 import 'a.dart'; 4332 import 'a.dart';
4917 const Type vClass = 4333 const Type vClass =
4918 C/*location: a.dart;C*/; 4334 C/*location: a.dart;C*/;
4919 const Type vEnum = 4335 const Type vEnum =
4920 E/*location: a.dart;E*/; 4336 E/*location: a.dart;E*/;
4921 const Type vFunctionTypeAlias = 4337 const Type vFunctionTypeAlias =
4922 F/*location: a.dart;F*/; 4338 F/*location: a.dart;F*/;
4923 '''); 4339 ''');
4924 } else { 4340 } else {
4925 checkElementText( 4341 checkElementText(library, r'''
4926 library,
4927 r'''
4928 import 'a.dart'; 4342 import 'a.dart';
4929 const dynamic vClass = 4343 const dynamic vClass =
4930 C/*location: a.dart;C*/; 4344 C/*location: a.dart;C*/;
4931 const dynamic vEnum = 4345 const dynamic vEnum =
4932 E/*location: a.dart;E*/; 4346 E/*location: a.dart;E*/;
4933 const dynamic vFunctionTypeAlias = 4347 const dynamic vFunctionTypeAlias =
4934 F/*location: a.dart;F*/; 4348 F/*location: a.dart;F*/;
4935 '''); 4349 ''');
4936 } 4350 }
4937 } 4351 }
4938 4352
4939 test_const_reference_type_imported_withPrefix() async { 4353 test_const_reference_type_imported_withPrefix() async {
4940 addLibrarySource( 4354 addLibrarySource('/a.dart', r'''
4941 '/a.dart',
4942 r'''
4943 class C {} 4355 class C {}
4944 enum E {a, b, c} 4356 enum E {a, b, c}
4945 typedef F(int a, String b); 4357 typedef F(int a, String b);
4946 '''); 4358 ''');
4947 var library = await checkLibrary(r''' 4359 var library = await checkLibrary(r'''
4948 import 'a.dart' as p; 4360 import 'a.dart' as p;
4949 const vClass = p.C; 4361 const vClass = p.C;
4950 const vEnum = p.E; 4362 const vEnum = p.E;
4951 const vFunctionTypeAlias = p.F; 4363 const vFunctionTypeAlias = p.F;
4952 '''); 4364 ''');
4953 if (isStrongMode) { 4365 if (isStrongMode) {
4954 checkElementText( 4366 checkElementText(library, r'''
4955 library,
4956 r'''
4957 import 'a.dart' as p; 4367 import 'a.dart' as p;
4958 const Type vClass = 4368 const Type vClass =
4959 p/*location: test.dart;p*/. 4369 p/*location: test.dart;p*/.
4960 C/*location: a.dart;C*/; 4370 C/*location: a.dart;C*/;
4961 const Type vEnum = 4371 const Type vEnum =
4962 p/*location: test.dart;p*/. 4372 p/*location: test.dart;p*/.
4963 E/*location: a.dart;E*/; 4373 E/*location: a.dart;E*/;
4964 const Type vFunctionTypeAlias = 4374 const Type vFunctionTypeAlias =
4965 p/*location: test.dart;p*/. 4375 p/*location: test.dart;p*/.
4966 F/*location: a.dart;F*/; 4376 F/*location: a.dart;F*/;
4967 '''); 4377 ''');
4968 } else { 4378 } else {
4969 checkElementText( 4379 checkElementText(library, r'''
4970 library,
4971 r'''
4972 import 'a.dart' as p; 4380 import 'a.dart' as p;
4973 const dynamic vClass = 4381 const dynamic vClass =
4974 p/*location: test.dart;p*/. 4382 p/*location: test.dart;p*/.
4975 C/*location: a.dart;C*/; 4383 C/*location: a.dart;C*/;
4976 const dynamic vEnum = 4384 const dynamic vEnum =
4977 p/*location: test.dart;p*/. 4385 p/*location: test.dart;p*/.
4978 E/*location: a.dart;E*/; 4386 E/*location: a.dart;E*/;
4979 const dynamic vFunctionTypeAlias = 4387 const dynamic vFunctionTypeAlias =
4980 p/*location: test.dart;p*/. 4388 p/*location: test.dart;p*/.
4981 F/*location: a.dart;F*/; 4389 F/*location: a.dart;F*/;
4982 '''); 4390 ''');
4983 } 4391 }
4984 } 4392 }
4985 4393
4986 test_const_reference_type_typeParameter() async { 4394 test_const_reference_type_typeParameter() async {
4987 var library = await checkLibrary(r''' 4395 var library = await checkLibrary(r'''
4988 class C<T> { 4396 class C<T> {
4989 final f = <T>[]; 4397 final f = <T>[];
4990 } 4398 }
4991 '''); 4399 ''');
4992 if (isStrongMode) { 4400 if (isStrongMode) {
4993 checkElementText( 4401 checkElementText(library, r'''
4994 library,
4995 r'''
4996 class C<T> { 4402 class C<T> {
4997 final List<T> f = const < 4403 final List<T> f = const <
4998 T/*location: test.dart;C;T*/>[]; 4404 T/*location: test.dart;C;T*/>[];
4999 } 4405 }
5000 '''); 4406 ''');
5001 } else { 4407 } else {
5002 checkElementText( 4408 checkElementText(library, r'''
5003 library,
5004 r'''
5005 class C<T> { 4409 class C<T> {
5006 final dynamic f = const < 4410 final dynamic f = const <
5007 T/*location: test.dart;C;T*/>[]; 4411 T/*location: test.dart;C;T*/>[];
5008 } 4412 }
5009 '''); 4413 ''');
5010 } 4414 }
5011 } 4415 }
5012 4416
5013 test_const_reference_unresolved_prefix0() async { 4417 test_const_reference_unresolved_prefix0() async {
5014 var library = await checkLibrary( 4418 var library = await checkLibrary(r'''
5015 r'''
5016 const V = foo; 4419 const V = foo;
5017 ''', 4420 ''', allowErrors: true);
5018 allowErrors: true);
5019 if (isStrongMode) { 4421 if (isStrongMode) {
5020 checkElementText( 4422 checkElementText(library, r'''
5021 library,
5022 r'''
5023 const dynamic V = 4423 const dynamic V =
5024 foo/*location: null*/; 4424 foo/*location: null*/;
5025 '''); 4425 ''');
5026 } else { 4426 } else {
5027 checkElementText( 4427 checkElementText(library, r'''
5028 library,
5029 r'''
5030 const dynamic V = 4428 const dynamic V =
5031 foo/*location: null*/; 4429 foo/*location: null*/;
5032 '''); 4430 ''');
5033 } 4431 }
5034 } 4432 }
5035 4433
5036 test_const_reference_unresolved_prefix1() async { 4434 test_const_reference_unresolved_prefix1() async {
5037 var library = await checkLibrary( 4435 var library = await checkLibrary(r'''
5038 r'''
5039 class C {} 4436 class C {}
5040 const v = C.foo; 4437 const v = C.foo;
5041 ''', 4438 ''', allowErrors: true);
5042 allowErrors: true);
5043 if (isStrongMode) { 4439 if (isStrongMode) {
5044 checkElementText( 4440 checkElementText(library, r'''
5045 library,
5046 r'''
5047 class C { 4441 class C {
5048 } 4442 }
5049 const dynamic v = 4443 const dynamic v =
5050 C/*location: test.dart;C*/. 4444 C/*location: test.dart;C*/.
5051 foo/*location: null*/; 4445 foo/*location: null*/;
5052 '''); 4446 ''');
5053 } else { 4447 } else {
5054 checkElementText( 4448 checkElementText(library, r'''
5055 library,
5056 r'''
5057 class C { 4449 class C {
5058 } 4450 }
5059 const dynamic v = 4451 const dynamic v =
5060 C/*location: test.dart;C*/. 4452 C/*location: test.dart;C*/.
5061 foo/*location: null*/; 4453 foo/*location: null*/;
5062 '''); 4454 ''');
5063 } 4455 }
5064 } 4456 }
5065 4457
5066 test_const_reference_unresolved_prefix2() async { 4458 test_const_reference_unresolved_prefix2() async {
5067 addLibrarySource( 4459 addLibrarySource('/foo.dart', '''
5068 '/foo.dart',
5069 '''
5070 class C {} 4460 class C {}
5071 '''); 4461 ''');
5072 var library = await checkLibrary( 4462 var library = await checkLibrary(r'''
5073 r'''
5074 import 'foo.dart' as p; 4463 import 'foo.dart' as p;
5075 const v = p.C.foo; 4464 const v = p.C.foo;
5076 ''', 4465 ''', allowErrors: true);
5077 allowErrors: true);
5078 if (isStrongMode) { 4466 if (isStrongMode) {
5079 checkElementText( 4467 checkElementText(library, r'''
5080 library,
5081 r'''
5082 import 'foo.dart' as p; 4468 import 'foo.dart' as p;
5083 const dynamic v = 4469 const dynamic v =
5084 p/*location: test.dart;p*/. 4470 p/*location: test.dart;p*/.
5085 C/*location: foo.dart;C*/. 4471 C/*location: foo.dart;C*/.
5086 foo/*location: null*/; 4472 foo/*location: null*/;
5087 '''); 4473 ''');
5088 } else { 4474 } else {
5089 checkElementText( 4475 checkElementText(library, r'''
5090 library,
5091 r'''
5092 import 'foo.dart' as p; 4476 import 'foo.dart' as p;
5093 const dynamic v = 4477 const dynamic v =
5094 p/*location: test.dart;p*/. 4478 p/*location: test.dart;p*/.
5095 C/*location: foo.dart;C*/. 4479 C/*location: foo.dart;C*/.
5096 foo/*location: null*/; 4480 foo/*location: null*/;
5097 '''); 4481 ''');
5098 } 4482 }
5099 } 4483 }
5100 4484
5101 test_const_topLevel_binary() async { 4485 test_const_topLevel_binary() async {
(...skipping 11 matching lines...) Expand all
5113 const vMiltiply = 1 * 2; 4497 const vMiltiply = 1 * 2;
5114 const vDivide = 1 / 2; 4498 const vDivide = 1 / 2;
5115 const vFloorDivide = 1 ~/ 2; 4499 const vFloorDivide = 1 ~/ 2;
5116 const vModulo = 1 % 2; 4500 const vModulo = 1 % 2;
5117 const vGreater = 1 > 2; 4501 const vGreater = 1 > 2;
5118 const vGreaterEqual = 1 >= 2; 4502 const vGreaterEqual = 1 >= 2;
5119 const vLess = 1 < 2; 4503 const vLess = 1 < 2;
5120 const vLessEqual = 1 <= 2; 4504 const vLessEqual = 1 <= 2;
5121 '''); 4505 ''');
5122 if (isStrongMode) { 4506 if (isStrongMode) {
5123 checkElementText( 4507 checkElementText(library, r'''
5124 library,
5125 r'''
5126 const bool vEqual = 1 == 2; 4508 const bool vEqual = 1 == 2;
5127 const bool vAnd = true && false; 4509 const bool vAnd = true && false;
5128 const bool vOr = false || true; 4510 const bool vOr = false || true;
5129 const int vBitXor = 1 ^ 2; 4511 const int vBitXor = 1 ^ 2;
5130 const int vBitAnd = 1 & 2; 4512 const int vBitAnd = 1 & 2;
5131 const int vBitOr = 1 | 2; 4513 const int vBitOr = 1 | 2;
5132 const int vBitShiftLeft = 1 << 2; 4514 const int vBitShiftLeft = 1 << 2;
5133 const int vBitShiftRight = 1 >> 2; 4515 const int vBitShiftRight = 1 >> 2;
5134 const int vAdd = 1 + 2; 4516 const int vAdd = 1 + 2;
5135 const int vSubtract = 1 - 2; 4517 const int vSubtract = 1 - 2;
5136 const int vMiltiply = 1 * 2; 4518 const int vMiltiply = 1 * 2;
5137 const double vDivide = 1 / 2; 4519 const double vDivide = 1 / 2;
5138 const int vFloorDivide = 1 ~/ 2; 4520 const int vFloorDivide = 1 ~/ 2;
5139 const int vModulo = 1 % 2; 4521 const int vModulo = 1 % 2;
5140 const bool vGreater = 1 > 2; 4522 const bool vGreater = 1 > 2;
5141 const bool vGreaterEqual = 1 >= 2; 4523 const bool vGreaterEqual = 1 >= 2;
5142 const bool vLess = 1 < 2; 4524 const bool vLess = 1 < 2;
5143 const bool vLessEqual = 1 <= 2; 4525 const bool vLessEqual = 1 <= 2;
5144 '''); 4526 ''');
5145 } else { 4527 } else {
5146 checkElementText( 4528 checkElementText(library, r'''
5147 library,
5148 r'''
5149 const dynamic vEqual = 1 == 2; 4529 const dynamic vEqual = 1 == 2;
5150 const dynamic vAnd = true && false; 4530 const dynamic vAnd = true && false;
5151 const dynamic vOr = false || true; 4531 const dynamic vOr = false || true;
5152 const dynamic vBitXor = 1 ^ 2; 4532 const dynamic vBitXor = 1 ^ 2;
5153 const dynamic vBitAnd = 1 & 2; 4533 const dynamic vBitAnd = 1 & 2;
5154 const dynamic vBitOr = 1 | 2; 4534 const dynamic vBitOr = 1 | 2;
5155 const dynamic vBitShiftLeft = 1 << 2; 4535 const dynamic vBitShiftLeft = 1 << 2;
5156 const dynamic vBitShiftRight = 1 >> 2; 4536 const dynamic vBitShiftRight = 1 >> 2;
5157 const dynamic vAdd = 1 + 2; 4537 const dynamic vAdd = 1 + 2;
5158 const dynamic vSubtract = 1 - 2; 4538 const dynamic vSubtract = 1 - 2;
5159 const dynamic vMiltiply = 1 * 2; 4539 const dynamic vMiltiply = 1 * 2;
5160 const dynamic vDivide = 1 / 2; 4540 const dynamic vDivide = 1 / 2;
5161 const dynamic vFloorDivide = 1 ~/ 2; 4541 const dynamic vFloorDivide = 1 ~/ 2;
5162 const dynamic vModulo = 1 % 2; 4542 const dynamic vModulo = 1 % 2;
5163 const dynamic vGreater = 1 > 2; 4543 const dynamic vGreater = 1 > 2;
5164 const dynamic vGreaterEqual = 1 >= 2; 4544 const dynamic vGreaterEqual = 1 >= 2;
5165 const dynamic vLess = 1 < 2; 4545 const dynamic vLess = 1 < 2;
5166 const dynamic vLessEqual = 1 <= 2; 4546 const dynamic vLessEqual = 1 <= 2;
5167 '''); 4547 ''');
5168 } 4548 }
5169 } 4549 }
5170 4550
5171 test_const_topLevel_conditional() async { 4551 test_const_topLevel_conditional() async {
5172 var library = await checkLibrary(r''' 4552 var library = await checkLibrary(r'''
5173 const vConditional = (1 == 2) ? 11 : 22; 4553 const vConditional = (1 == 2) ? 11 : 22;
5174 '''); 4554 ''');
5175 if (isStrongMode) { 4555 if (isStrongMode) {
5176 checkElementText( 4556 checkElementText(library, r'''
5177 library,
5178 r'''
5179 const int vConditional = 1 == 2 ? 11 : 22; 4557 const int vConditional = 1 == 2 ? 11 : 22;
5180 '''); 4558 ''');
5181 } else { 4559 } else {
5182 checkElementText( 4560 checkElementText(library, r'''
5183 library,
5184 r'''
5185 const dynamic vConditional = 1 == 2 ? 11 : 22; 4561 const dynamic vConditional = 1 == 2 ? 11 : 22;
5186 '''); 4562 ''');
5187 } 4563 }
5188 } 4564 }
5189 4565
5190 test_const_topLevel_identical() async { 4566 test_const_topLevel_identical() async {
5191 var library = await checkLibrary(r''' 4567 var library = await checkLibrary(r'''
5192 const vIdentical = (1 == 2) ? 11 : 22; 4568 const vIdentical = (1 == 2) ? 11 : 22;
5193 '''); 4569 ''');
5194 if (isStrongMode) { 4570 if (isStrongMode) {
5195 checkElementText( 4571 checkElementText(library, r'''
5196 library,
5197 r'''
5198 const int vIdentical = 1 == 2 ? 11 : 22; 4572 const int vIdentical = 1 == 2 ? 11 : 22;
5199 '''); 4573 ''');
5200 } else { 4574 } else {
5201 checkElementText( 4575 checkElementText(library, r'''
5202 library,
5203 r'''
5204 const dynamic vIdentical = 1 == 2 ? 11 : 22; 4576 const dynamic vIdentical = 1 == 2 ? 11 : 22;
5205 '''); 4577 ''');
5206 } 4578 }
5207 } 4579 }
5208 4580
5209 test_const_topLevel_ifNull() async { 4581 test_const_topLevel_ifNull() async {
5210 var library = await checkLibrary(r''' 4582 var library = await checkLibrary(r'''
5211 const vIfNull = 1 ?? 2.0; 4583 const vIfNull = 1 ?? 2.0;
5212 '''); 4584 ''');
5213 if (isStrongMode) { 4585 if (isStrongMode) {
5214 checkElementText( 4586 checkElementText(library, r'''
5215 library,
5216 r'''
5217 const num vIfNull = 1 ?? 2.0; 4587 const num vIfNull = 1 ?? 2.0;
5218 '''); 4588 ''');
5219 } else { 4589 } else {
5220 checkElementText( 4590 checkElementText(library, r'''
5221 library,
5222 r'''
5223 const dynamic vIfNull = 1 ?? 2.0; 4591 const dynamic vIfNull = 1 ?? 2.0;
5224 '''); 4592 ''');
5225 } 4593 }
5226 } 4594 }
5227 4595
5228 test_const_topLevel_literal() async { 4596 test_const_topLevel_literal() async {
5229 var library = await checkLibrary(r''' 4597 var library = await checkLibrary(r'''
5230 const vNull = null; 4598 const vNull = null;
5231 const vBoolFalse = false; 4599 const vBoolFalse = false;
5232 const vBoolTrue = true; 4600 const vBoolTrue = true;
5233 const vInt = 1; 4601 const vInt = 1;
5234 const vIntLong = 0x9876543210987654321; 4602 const vIntLong = 0x9876543210987654321;
5235 const vDouble = 2.3; 4603 const vDouble = 2.3;
5236 const vString = 'abc'; 4604 const vString = 'abc';
5237 const vStringConcat = 'aaa' 'bbb'; 4605 const vStringConcat = 'aaa' 'bbb';
5238 const vStringInterpolation = 'aaa ${true} ${42} bbb'; 4606 const vStringInterpolation = 'aaa ${true} ${42} bbb';
5239 const vSymbol = #aaa.bbb.ccc; 4607 const vSymbol = #aaa.bbb.ccc;
5240 '''); 4608 ''');
5241 if (isStrongMode) { 4609 if (isStrongMode) {
5242 checkElementText( 4610 checkElementText(library, r'''
5243 library,
5244 r'''
5245 const dynamic vNull = null; 4611 const dynamic vNull = null;
5246 const bool vBoolFalse = false; 4612 const bool vBoolFalse = false;
5247 const bool vBoolTrue = true; 4613 const bool vBoolTrue = true;
5248 const int vInt = 1; 4614 const int vInt = 1;
5249 const int vIntLong = 44998905507923676709665; 4615 const int vIntLong = 44998905507923676709665;
5250 const double vDouble = 2.3; 4616 const double vDouble = 2.3;
5251 const String vString = 'abc'; 4617 const String vString = 'abc';
5252 const String vStringConcat = 'aaabbb'; 4618 const String vStringConcat = 'aaabbb';
5253 const String vStringInterpolation = 'aaa ${true} ${42} bbb'; 4619 const String vStringInterpolation = 'aaa ${true} ${42} bbb';
5254 const Symbol vSymbol = #aaa.bbb.ccc; 4620 const Symbol vSymbol = #aaa.bbb.ccc;
5255 '''); 4621 ''');
5256 } else { 4622 } else {
5257 checkElementText( 4623 checkElementText(library, r'''
5258 library,
5259 r'''
5260 const dynamic vNull = null; 4624 const dynamic vNull = null;
5261 const dynamic vBoolFalse = false; 4625 const dynamic vBoolFalse = false;
5262 const dynamic vBoolTrue = true; 4626 const dynamic vBoolTrue = true;
5263 const dynamic vInt = 1; 4627 const dynamic vInt = 1;
5264 const dynamic vIntLong = 44998905507923676709665; 4628 const dynamic vIntLong = 44998905507923676709665;
5265 const dynamic vDouble = 2.3; 4629 const dynamic vDouble = 2.3;
5266 const dynamic vString = 'abc'; 4630 const dynamic vString = 'abc';
5267 const dynamic vStringConcat = 'aaabbb'; 4631 const dynamic vStringConcat = 'aaabbb';
5268 const dynamic vStringInterpolation = 'aaa ${true} ${42} bbb'; 4632 const dynamic vStringInterpolation = 'aaa ${true} ${42} bbb';
5269 const dynamic vSymbol = #aaa.bbb.ccc; 4633 const dynamic vSymbol = #aaa.bbb.ccc;
5270 '''); 4634 ''');
5271 } 4635 }
5272 } 4636 }
5273 4637
5274 test_const_topLevel_prefix() async { 4638 test_const_topLevel_prefix() async {
5275 var library = await checkLibrary(r''' 4639 var library = await checkLibrary(r'''
5276 const vNotEqual = 1 != 2; 4640 const vNotEqual = 1 != 2;
5277 const vNot = !true; 4641 const vNot = !true;
5278 const vNegate = -1; 4642 const vNegate = -1;
5279 const vComplement = ~1; 4643 const vComplement = ~1;
5280 '''); 4644 ''');
5281 if (isStrongMode) { 4645 if (isStrongMode) {
5282 checkElementText( 4646 checkElementText(library, r'''
5283 library,
5284 r'''
5285 const bool vNotEqual = 1 != 2; 4647 const bool vNotEqual = 1 != 2;
5286 const bool vNot = !true; 4648 const bool vNot = !true;
5287 const int vNegate = -1; 4649 const int vNegate = -1;
5288 const int vComplement = ~1; 4650 const int vComplement = ~1;
5289 '''); 4651 ''');
5290 } else { 4652 } else {
5291 checkElementText( 4653 checkElementText(library, r'''
5292 library,
5293 r'''
5294 const dynamic vNotEqual = 1 != 2; 4654 const dynamic vNotEqual = 1 != 2;
5295 const dynamic vNot = !true; 4655 const dynamic vNot = !true;
5296 const dynamic vNegate = -1; 4656 const dynamic vNegate = -1;
5297 const dynamic vComplement = ~1; 4657 const dynamic vComplement = ~1;
5298 '''); 4658 ''');
5299 } 4659 }
5300 } 4660 }
5301 4661
5302 test_const_topLevel_super() async { 4662 test_const_topLevel_super() async {
5303 var library = await checkLibrary(r''' 4663 var library = await checkLibrary(r'''
5304 const vSuper = super; 4664 const vSuper = super;
5305 '''); 4665 ''');
5306 if (isStrongMode) { 4666 if (isStrongMode) {
5307 checkElementText( 4667 checkElementText(library, r'''
5308 library,
5309 r'''
5310 const dynamic vSuper = super; 4668 const dynamic vSuper = super;
5311 '''); 4669 ''');
5312 } else { 4670 } else {
5313 checkElementText( 4671 checkElementText(library, r'''
5314 library,
5315 r'''
5316 const dynamic vSuper = super; 4672 const dynamic vSuper = super;
5317 '''); 4673 ''');
5318 } 4674 }
5319 } 4675 }
5320 4676
5321 test_const_topLevel_this() async { 4677 test_const_topLevel_this() async {
5322 var library = await checkLibrary(r''' 4678 var library = await checkLibrary(r'''
5323 const vThis = this; 4679 const vThis = this;
5324 '''); 4680 ''');
5325 if (isStrongMode) { 4681 if (isStrongMode) {
5326 checkElementText( 4682 checkElementText(library, r'''
5327 library,
5328 r'''
5329 const dynamic vThis = this; 4683 const dynamic vThis = this;
5330 '''); 4684 ''');
5331 } else { 4685 } else {
5332 checkElementText( 4686 checkElementText(library, r'''
5333 library,
5334 r'''
5335 const dynamic vThis = this; 4687 const dynamic vThis = this;
5336 '''); 4688 ''');
5337 } 4689 }
5338 } 4690 }
5339 4691
5340 test_const_topLevel_typedList() async { 4692 test_const_topLevel_typedList() async {
5341 var library = await checkLibrary(r''' 4693 var library = await checkLibrary(r'''
5342 const vNull = const <Null>[]; 4694 const vNull = const <Null>[];
5343 const vDynamic = const <dynamic>[1, 2, 3]; 4695 const vDynamic = const <dynamic>[1, 2, 3];
5344 const vInterfaceNoTypeParameters = const <int>[1, 2, 3]; 4696 const vInterfaceNoTypeParameters = const <int>[1, 2, 3];
5345 const vInterfaceNoTypeArguments = const <List>[]; 4697 const vInterfaceNoTypeArguments = const <List>[];
5346 const vInterfaceWithTypeArguments = const <List<String>>[]; 4698 const vInterfaceWithTypeArguments = const <List<String>>[];
5347 const vInterfaceWithTypeArguments2 = const <Map<int, List<String>>>[]; 4699 const vInterfaceWithTypeArguments2 = const <Map<int, List<String>>>[];
5348 '''); 4700 ''');
5349 if (isStrongMode) { 4701 if (isStrongMode) {
5350 checkElementText( 4702 checkElementText(library, r'''
5351 library,
5352 r'''
5353 const List<Null> vNull = const < 4703 const List<Null> vNull = const <
5354 Null/*location: dart:core;Null*/>[]; 4704 Null/*location: dart:core;Null*/>[];
5355 const List<dynamic> vDynamic = const < 4705 const List<dynamic> vDynamic = const <
5356 dynamic/*location: dynamic*/>[1, 2, 3]; 4706 dynamic/*location: dynamic*/>[1, 2, 3];
5357 const List<int> vInterfaceNoTypeParameters = const < 4707 const List<int> vInterfaceNoTypeParameters = const <
5358 int/*location: dart:core;int*/>[1, 2, 3]; 4708 int/*location: dart:core;int*/>[1, 2, 3];
5359 const List<List<dynamic>> vInterfaceNoTypeArguments = const < 4709 const List<List<dynamic>> vInterfaceNoTypeArguments = const <
5360 List/*location: dart:core;List*/>[]; 4710 List/*location: dart:core;List*/>[];
5361 const List<List<String>> vInterfaceWithTypeArguments = const < 4711 const List<List<String>> vInterfaceWithTypeArguments = const <
5362 List/*location: dart:core;List*/< 4712 List/*location: dart:core;List*/<
5363 String/*location: dart:core;String*/>>[]; 4713 String/*location: dart:core;String*/>>[];
5364 const List<Map<int, List<String>>> vInterfaceWithTypeArguments2 = const < 4714 const List<Map<int, List<String>>> vInterfaceWithTypeArguments2 = const <
5365 Map/*location: dart:core;Map*/< 4715 Map/*location: dart:core;Map*/<
5366 int/*location: dart:core;int*/, 4716 int/*location: dart:core;int*/,
5367 List/*location: dart:core;List*/< 4717 List/*location: dart:core;List*/<
5368 String/*location: dart:core;String*/>>>[]; 4718 String/*location: dart:core;String*/>>>[];
5369 '''); 4719 ''');
5370 } else { 4720 } else {
5371 checkElementText( 4721 checkElementText(library, r'''
5372 library,
5373 r'''
5374 const dynamic vNull = const < 4722 const dynamic vNull = const <
5375 Null/*location: dart:core;Null*/>[]; 4723 Null/*location: dart:core;Null*/>[];
5376 const dynamic vDynamic = const < 4724 const dynamic vDynamic = const <
5377 dynamic/*location: dynamic*/>[1, 2, 3]; 4725 dynamic/*location: dynamic*/>[1, 2, 3];
5378 const dynamic vInterfaceNoTypeParameters = const < 4726 const dynamic vInterfaceNoTypeParameters = const <
5379 int/*location: dart:core;int*/>[1, 2, 3]; 4727 int/*location: dart:core;int*/>[1, 2, 3];
5380 const dynamic vInterfaceNoTypeArguments = const < 4728 const dynamic vInterfaceNoTypeArguments = const <
5381 List/*location: dart:core;List*/>[]; 4729 List/*location: dart:core;List*/>[];
5382 const dynamic vInterfaceWithTypeArguments = const < 4730 const dynamic vInterfaceWithTypeArguments = const <
5383 List/*location: dart:core;List*/< 4731 List/*location: dart:core;List*/<
5384 String/*location: dart:core;String*/>>[]; 4732 String/*location: dart:core;String*/>>[];
5385 const dynamic vInterfaceWithTypeArguments2 = const < 4733 const dynamic vInterfaceWithTypeArguments2 = const <
5386 Map/*location: dart:core;Map*/< 4734 Map/*location: dart:core;Map*/<
5387 int/*location: dart:core;int*/, 4735 int/*location: dart:core;int*/,
5388 List/*location: dart:core;List*/< 4736 List/*location: dart:core;List*/<
5389 String/*location: dart:core;String*/>>>[]; 4737 String/*location: dart:core;String*/>>>[];
5390 '''); 4738 ''');
5391 } 4739 }
5392 } 4740 }
5393 4741
5394 test_const_topLevel_typedList_imported() async { 4742 test_const_topLevel_typedList_imported() async {
5395 addLibrarySource('/a.dart', 'class C {}'); 4743 addLibrarySource('/a.dart', 'class C {}');
5396 var library = await checkLibrary(r''' 4744 var library = await checkLibrary(r'''
5397 import 'a.dart'; 4745 import 'a.dart';
5398 const v = const <C>[]; 4746 const v = const <C>[];
5399 '''); 4747 ''');
5400 if (isStrongMode) { 4748 if (isStrongMode) {
5401 checkElementText( 4749 checkElementText(library, r'''
5402 library,
5403 r'''
5404 import 'a.dart'; 4750 import 'a.dart';
5405 const List<C> v = const < 4751 const List<C> v = const <
5406 C/*location: a.dart;C*/>[]; 4752 C/*location: a.dart;C*/>[];
5407 '''); 4753 ''');
5408 } else { 4754 } else {
5409 checkElementText( 4755 checkElementText(library, r'''
5410 library,
5411 r'''
5412 import 'a.dart'; 4756 import 'a.dart';
5413 const dynamic v = const < 4757 const dynamic v = const <
5414 C/*location: a.dart;C*/>[]; 4758 C/*location: a.dart;C*/>[];
5415 '''); 4759 ''');
5416 } 4760 }
5417 } 4761 }
5418 4762
5419 test_const_topLevel_typedList_importedWithPrefix() async { 4763 test_const_topLevel_typedList_importedWithPrefix() async {
5420 addLibrarySource('/a.dart', 'class C {}'); 4764 addLibrarySource('/a.dart', 'class C {}');
5421 var library = await checkLibrary(r''' 4765 var library = await checkLibrary(r'''
5422 import 'a.dart' as p; 4766 import 'a.dart' as p;
5423 const v = const <p.C>[]; 4767 const v = const <p.C>[];
5424 '''); 4768 ''');
5425 if (isStrongMode) { 4769 if (isStrongMode) {
5426 checkElementText( 4770 checkElementText(library, r'''
5427 library,
5428 r'''
5429 import 'a.dart' as p; 4771 import 'a.dart' as p;
5430 const List<C> v = const < 4772 const List<C> v = const <
5431 C/*location: a.dart;C*/>[]; 4773 C/*location: a.dart;C*/>[];
5432 '''); 4774 ''');
5433 } else { 4775 } else {
5434 checkElementText( 4776 checkElementText(library, r'''
5435 library,
5436 r'''
5437 import 'a.dart' as p; 4777 import 'a.dart' as p;
5438 const dynamic v = const < 4778 const dynamic v = const <
5439 C/*location: a.dart;C*/>[]; 4779 C/*location: a.dart;C*/>[];
5440 '''); 4780 ''');
5441 } 4781 }
5442 } 4782 }
5443 4783
5444 test_const_topLevel_typedMap() async { 4784 test_const_topLevel_typedMap() async {
5445 var library = await checkLibrary(r''' 4785 var library = await checkLibrary(r'''
5446 const vDynamic1 = const <dynamic, int>{}; 4786 const vDynamic1 = const <dynamic, int>{};
5447 const vDynamic2 = const <int, dynamic>{}; 4787 const vDynamic2 = const <int, dynamic>{};
5448 const vInterface = const <int, String>{}; 4788 const vInterface = const <int, String>{};
5449 const vInterfaceWithTypeArguments = const <int, List<String>>{}; 4789 const vInterfaceWithTypeArguments = const <int, List<String>>{};
5450 '''); 4790 ''');
5451 if (isStrongMode) { 4791 if (isStrongMode) {
5452 checkElementText( 4792 checkElementText(library, r'''
5453 library,
5454 r'''
5455 const Map<dynamic, int> vDynamic1 = const < 4793 const Map<dynamic, int> vDynamic1 = const <
5456 dynamic/*location: dynamic*/, 4794 dynamic/*location: dynamic*/,
5457 int/*location: dart:core;int*/>{}; 4795 int/*location: dart:core;int*/>{};
5458 const Map<int, dynamic> vDynamic2 = const < 4796 const Map<int, dynamic> vDynamic2 = const <
5459 int/*location: dart:core;int*/, 4797 int/*location: dart:core;int*/,
5460 dynamic/*location: dynamic*/>{}; 4798 dynamic/*location: dynamic*/>{};
5461 const Map<int, String> vInterface = const < 4799 const Map<int, String> vInterface = const <
5462 int/*location: dart:core;int*/, 4800 int/*location: dart:core;int*/,
5463 String/*location: dart:core;String*/>{}; 4801 String/*location: dart:core;String*/>{};
5464 const Map<int, List<String>> vInterfaceWithTypeArguments = const < 4802 const Map<int, List<String>> vInterfaceWithTypeArguments = const <
5465 int/*location: dart:core;int*/, 4803 int/*location: dart:core;int*/,
5466 List/*location: dart:core;List*/< 4804 List/*location: dart:core;List*/<
5467 String/*location: dart:core;String*/>>{}; 4805 String/*location: dart:core;String*/>>{};
5468 '''); 4806 ''');
5469 } else { 4807 } else {
5470 checkElementText( 4808 checkElementText(library, r'''
5471 library,
5472 r'''
5473 const dynamic vDynamic1 = const < 4809 const dynamic vDynamic1 = const <
5474 dynamic/*location: dynamic*/, 4810 dynamic/*location: dynamic*/,
5475 int/*location: dart:core;int*/>{}; 4811 int/*location: dart:core;int*/>{};
5476 const dynamic vDynamic2 = const < 4812 const dynamic vDynamic2 = const <
5477 int/*location: dart:core;int*/, 4813 int/*location: dart:core;int*/,
5478 dynamic/*location: dynamic*/>{}; 4814 dynamic/*location: dynamic*/>{};
5479 const dynamic vInterface = const < 4815 const dynamic vInterface = const <
5480 int/*location: dart:core;int*/, 4816 int/*location: dart:core;int*/,
5481 String/*location: dart:core;String*/>{}; 4817 String/*location: dart:core;String*/>{};
5482 const dynamic vInterfaceWithTypeArguments = const < 4818 const dynamic vInterfaceWithTypeArguments = const <
5483 int/*location: dart:core;int*/, 4819 int/*location: dart:core;int*/,
5484 List/*location: dart:core;List*/< 4820 List/*location: dart:core;List*/<
5485 String/*location: dart:core;String*/>>{}; 4821 String/*location: dart:core;String*/>>{};
5486 '''); 4822 ''');
5487 } 4823 }
5488 } 4824 }
5489 4825
5490 test_const_topLevel_untypedList() async { 4826 test_const_topLevel_untypedList() async {
5491 var library = await checkLibrary(r''' 4827 var library = await checkLibrary(r'''
5492 const v = const [1, 2, 3]; 4828 const v = const [1, 2, 3];
5493 '''); 4829 ''');
5494 if (isStrongMode) { 4830 if (isStrongMode) {
5495 checkElementText( 4831 checkElementText(library, r'''
5496 library,
5497 r'''
5498 const List<int> v = const [1, 2, 3]; 4832 const List<int> v = const [1, 2, 3];
5499 '''); 4833 ''');
5500 } else { 4834 } else {
5501 checkElementText( 4835 checkElementText(library, r'''
5502 library,
5503 r'''
5504 const dynamic v = const [1, 2, 3]; 4836 const dynamic v = const [1, 2, 3];
5505 '''); 4837 ''');
5506 } 4838 }
5507 } 4839 }
5508 4840
5509 test_const_topLevel_untypedMap() async { 4841 test_const_topLevel_untypedMap() async {
5510 var library = await checkLibrary(r''' 4842 var library = await checkLibrary(r'''
5511 const v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'}; 4843 const v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'};
5512 '''); 4844 ''');
5513 if (isStrongMode) { 4845 if (isStrongMode) {
5514 checkElementText( 4846 checkElementText(library, r'''
5515 library,
5516 r'''
5517 const Map<int, String> v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'}; 4847 const Map<int, String> v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'};
5518 '''); 4848 ''');
5519 } else { 4849 } else {
5520 checkElementText( 4850 checkElementText(library, r'''
5521 library,
5522 r'''
5523 const dynamic v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'}; 4851 const dynamic v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'};
5524 '''); 4852 ''');
5525 } 4853 }
5526 } 4854 }
5527 4855
5528 test_constExpr_pushReference_enum_field() async { 4856 test_constExpr_pushReference_enum_field() async {
5529 var library = await checkLibrary(''' 4857 var library = await checkLibrary('''
5530 enum E {a, b, c} 4858 enum E {a, b, c}
5531 final vValue = E.a; 4859 final vValue = E.a;
5532 final vValues = E.values; 4860 final vValues = E.values;
5533 final vIndex = E.a.index; 4861 final vIndex = E.a.index;
5534 '''); 4862 ''');
5535 if (isStrongMode) { 4863 if (isStrongMode) {
5536 checkElementText( 4864 checkElementText(library, r'''
5537 library,
5538 r'''
5539 enum E { 4865 enum E {
5540 synthetic final int index; 4866 synthetic final int index;
5541 synthetic static const List<E> values; 4867 synthetic static const List<E> values;
5542 static const E a; 4868 static const E a;
5543 static const E b; 4869 static const E b;
5544 static const E c; 4870 static const E c;
5545 } 4871 }
5546 final E vValue; 4872 final E vValue;
5547 final List<E> vValues; 4873 final List<E> vValues;
5548 final dynamic vIndex/*error: instanceGetter*/; 4874 final dynamic vIndex/*error: instanceGetter*/;
5549 '''); 4875 ''');
5550 } else { 4876 } else {
5551 checkElementText( 4877 checkElementText(library, r'''
5552 library,
5553 r'''
5554 enum E { 4878 enum E {
5555 synthetic final int index; 4879 synthetic final int index;
5556 synthetic static const List<E> values; 4880 synthetic static const List<E> values;
5557 static const E a; 4881 static const E a;
5558 static const E b; 4882 static const E b;
5559 static const E c; 4883 static const E c;
5560 } 4884 }
5561 final dynamic vValue; 4885 final dynamic vValue;
5562 final dynamic vValues; 4886 final dynamic vValues;
5563 final dynamic vIndex; 4887 final dynamic vIndex;
5564 '''); 4888 ''');
5565 } 4889 }
5566 } 4890 }
5567 4891
5568 test_constExpr_pushReference_enum_method() async { 4892 test_constExpr_pushReference_enum_method() async {
5569 var library = await checkLibrary(''' 4893 var library = await checkLibrary('''
5570 enum E {a} 4894 enum E {a}
5571 final vToString = E.a.toString(); 4895 final vToString = E.a.toString();
5572 '''); 4896 ''');
5573 if (isStrongMode) { 4897 if (isStrongMode) {
5574 checkElementText( 4898 checkElementText(library, r'''
5575 library,
5576 r'''
5577 enum E { 4899 enum E {
5578 synthetic final int index; 4900 synthetic final int index;
5579 synthetic static const List<E> values; 4901 synthetic static const List<E> values;
5580 static const E a; 4902 static const E a;
5581 } 4903 }
5582 final String vToString; 4904 final String vToString;
5583 '''); 4905 ''');
5584 } else { 4906 } else {
5585 checkElementText( 4907 checkElementText(library, r'''
5586 library,
5587 r'''
5588 enum E { 4908 enum E {
5589 synthetic final int index; 4909 synthetic final int index;
5590 synthetic static const List<E> values; 4910 synthetic static const List<E> values;
5591 static const E a; 4911 static const E a;
5592 } 4912 }
5593 final dynamic vToString; 4913 final dynamic vToString;
5594 '''); 4914 ''');
5595 } 4915 }
5596 } 4916 }
5597 4917
5598 test_constExpr_pushReference_field_simpleIdentifier() async { 4918 test_constExpr_pushReference_field_simpleIdentifier() async {
5599 var library = await checkLibrary(''' 4919 var library = await checkLibrary('''
5600 class C { 4920 class C {
5601 static const a = b; 4921 static const a = b;
5602 static const b = null; 4922 static const b = null;
5603 } 4923 }
5604 '''); 4924 ''');
5605 if (isStrongMode) { 4925 if (isStrongMode) {
5606 checkElementText( 4926 checkElementText(library, r'''
5607 library,
5608 r'''
5609 class C { 4927 class C {
5610 static const dynamic a = 4928 static const dynamic a =
5611 C/*location: test.dart;C*/. 4929 C/*location: test.dart;C*/.
5612 b/*location: test.dart;C;b?*/; 4930 b/*location: test.dart;C;b?*/;
5613 static const dynamic b = null; 4931 static const dynamic b = null;
5614 } 4932 }
5615 '''); 4933 ''');
5616 } else { 4934 } else {
5617 checkElementText( 4935 checkElementText(library, r'''
5618 library,
5619 r'''
5620 class C { 4936 class C {
5621 static const dynamic a = 4937 static const dynamic a =
5622 C/*location: test.dart;C*/. 4938 C/*location: test.dart;C*/.
5623 b/*location: test.dart;C;b?*/; 4939 b/*location: test.dart;C;b?*/;
5624 static const dynamic b = null; 4940 static const dynamic b = null;
5625 } 4941 }
5626 '''); 4942 ''');
5627 } 4943 }
5628 } 4944 }
5629 4945
5630 test_constExpr_pushReference_staticMethod_simpleIdentifier() async { 4946 test_constExpr_pushReference_staticMethod_simpleIdentifier() async {
5631 var library = await checkLibrary(''' 4947 var library = await checkLibrary('''
5632 class C { 4948 class C {
5633 static const a = m; 4949 static const a = m;
5634 static m() {} 4950 static m() {}
5635 } 4951 }
5636 '''); 4952 ''');
5637 if (isStrongMode) { 4953 if (isStrongMode) {
5638 checkElementText( 4954 checkElementText(library, r'''
5639 library,
5640 r'''
5641 class C { 4955 class C {
5642 static const () → dynamic a = 4956 static const () → dynamic a =
5643 C/*location: test.dart;C*/. 4957 C/*location: test.dart;C*/.
5644 m/*location: test.dart;C;m*/; 4958 m/*location: test.dart;C;m*/;
5645 static dynamic m() {} 4959 static dynamic m() {}
5646 } 4960 }
5647 '''); 4961 ''');
5648 } else { 4962 } else {
5649 checkElementText( 4963 checkElementText(library, r'''
5650 library,
5651 r'''
5652 class C { 4964 class C {
5653 static const dynamic a = 4965 static const dynamic a =
5654 C/*location: test.dart;C*/. 4966 C/*location: test.dart;C*/.
5655 m/*location: test.dart;C;m*/; 4967 m/*location: test.dart;C;m*/;
5656 static dynamic m() {} 4968 static dynamic m() {}
5657 } 4969 }
5658 '''); 4970 ''');
5659 } 4971 }
5660 } 4972 }
5661 4973
5662 test_constructor_documented() async { 4974 test_constructor_documented() async {
5663 var library = await checkLibrary(''' 4975 var library = await checkLibrary('''
5664 class C { 4976 class C {
5665 /** 4977 /**
5666 * Docs 4978 * Docs
5667 */ 4979 */
5668 C(); 4980 C();
5669 }'''); 4981 }''');
5670 if (isStrongMode) { 4982 if (isStrongMode) {
5671 checkElementText( 4983 checkElementText(library, r'''
5672 library,
5673 r'''
5674 class C { 4984 class C {
5675 /** 4985 /**
5676 * Docs 4986 * Docs
5677 */ 4987 */
5678 C(); 4988 C();
5679 } 4989 }
5680 '''); 4990 ''');
5681 } else { 4991 } else {
5682 checkElementText( 4992 checkElementText(library, r'''
5683 library,
5684 r'''
5685 class C { 4993 class C {
5686 /** 4994 /**
5687 * Docs 4995 * Docs
5688 */ 4996 */
5689 C(); 4997 C();
5690 } 4998 }
5691 '''); 4999 ''');
5692 } 5000 }
5693 } 5001 }
5694 5002
5695 test_constructor_initializers_assertInvocation() async { 5003 test_constructor_initializers_assertInvocation() async {
5696 var library = await checkLibrary(''' 5004 var library = await checkLibrary('''
5697 class C { 5005 class C {
5698 const C(int x) : assert(x >= 42); 5006 const C(int x) : assert(x >= 42);
5699 } 5007 }
5700 '''); 5008 ''');
5701 if (isStrongMode) { 5009 if (isStrongMode) {
5702 checkElementText( 5010 checkElementText(library, r'''
5703 library,
5704 r'''
5705 class C { 5011 class C {
5706 const C(int x) : assert( 5012 const C(int x) : assert(
5707 x/*location: test.dart;C;;x*/ >= 42); 5013 x/*location: test.dart;C;;x*/ >= 42);
5708 } 5014 }
5709 '''); 5015 ''');
5710 } else { 5016 } else {
5711 checkElementText( 5017 checkElementText(library, r'''
5712 library,
5713 r'''
5714 class C { 5018 class C {
5715 const C(int x) : assert( 5019 const C(int x) : assert(
5716 x/*location: test.dart;C;;x*/ >= 42); 5020 x/*location: test.dart;C;;x*/ >= 42);
5717 } 5021 }
5718 '''); 5022 ''');
5719 } 5023 }
5720 } 5024 }
5721 5025
5722 test_constructor_initializers_assertInvocation_message() async { 5026 test_constructor_initializers_assertInvocation_message() async {
5723 var library = await checkLibrary(''' 5027 var library = await checkLibrary('''
5724 class C { 5028 class C {
5725 const C(int x) : assert(x >= 42, 'foo'); 5029 const C(int x) : assert(x >= 42, 'foo');
5726 } 5030 }
5727 '''); 5031 ''');
5728 if (isStrongMode) { 5032 if (isStrongMode) {
5729 checkElementText( 5033 checkElementText(library, r'''
5730 library,
5731 r'''
5732 class C { 5034 class C {
5733 const C(int x) : assert( 5035 const C(int x) : assert(
5734 x/*location: test.dart;C;;x*/ >= 42, 'foo'); 5036 x/*location: test.dart;C;;x*/ >= 42, 'foo');
5735 } 5037 }
5736 '''); 5038 ''');
5737 } else { 5039 } else {
5738 checkElementText( 5040 checkElementText(library, r'''
5739 library,
5740 r'''
5741 class C { 5041 class C {
5742 const C(int x) : assert( 5042 const C(int x) : assert(
5743 x/*location: test.dart;C;;x*/ >= 42, 'foo'); 5043 x/*location: test.dart;C;;x*/ >= 42, 'foo');
5744 } 5044 }
5745 '''); 5045 ''');
5746 } 5046 }
5747 } 5047 }
5748 5048
5749 test_constructor_initializers_field() async { 5049 test_constructor_initializers_field() async {
5750 var library = await checkLibrary(''' 5050 var library = await checkLibrary('''
5751 class C { 5051 class C {
5752 final x; 5052 final x;
5753 const C() : x = 42; 5053 const C() : x = 42;
5754 } 5054 }
5755 '''); 5055 ''');
5756 if (isStrongMode) { 5056 if (isStrongMode) {
5757 checkElementText( 5057 checkElementText(library, r'''
5758 library,
5759 r'''
5760 class C { 5058 class C {
5761 final dynamic x; 5059 final dynamic x;
5762 const C() : 5060 const C() :
5763 x/*location: test.dart;C;x*/ = 42; 5061 x/*location: test.dart;C;x*/ = 42;
5764 } 5062 }
5765 '''); 5063 ''');
5766 } else { 5064 } else {
5767 checkElementText( 5065 checkElementText(library, r'''
5768 library,
5769 r'''
5770 class C { 5066 class C {
5771 final dynamic x; 5067 final dynamic x;
5772 const C() : 5068 const C() :
5773 x/*location: test.dart;C;x*/ = 42; 5069 x/*location: test.dart;C;x*/ = 42;
5774 } 5070 }
5775 '''); 5071 ''');
5776 } 5072 }
5777 } 5073 }
5778 5074
5779 test_constructor_initializers_field_notConst() async { 5075 test_constructor_initializers_field_notConst() async {
5780 variablesWithNotConstInitializers.add('x'); 5076 variablesWithNotConstInitializers.add('x');
5781 var library = await checkLibrary( 5077 var library = await checkLibrary('''
5782 '''
5783 class C { 5078 class C {
5784 final x; 5079 final x;
5785 const A() : x = foo(); 5080 const A() : x = foo();
5786 } 5081 }
5787 int foo() => 42; 5082 int foo() => 42;
5788 ''', 5083 ''', allowErrors: true);
5789 allowErrors: true);
5790 if (isStrongMode) { 5084 if (isStrongMode) {
5791 checkElementText( 5085 checkElementText(library, r'''
5792 library,
5793 r'''
5794 class C { 5086 class C {
5795 final dynamic x; 5087 final dynamic x;
5796 const C() : 5088 const C() :
5797 x/*location: test.dart;C;x*/ = 5089 x/*location: test.dart;C;x*/ =
5798 $$invalidConstExpr$$/*location: null*/; 5090 $$invalidConstExpr$$/*location: null*/;
5799 } 5091 }
5800 int foo() {} 5092 int foo() {}
5801 '''); 5093 ''');
5802 } else { 5094 } else {
5803 checkElementText( 5095 checkElementText(library, r'''
5804 library,
5805 r'''
5806 class C { 5096 class C {
5807 final dynamic x; 5097 final dynamic x;
5808 const C() : 5098 const C() :
5809 x/*location: test.dart;C;x*/ = 5099 x/*location: test.dart;C;x*/ =
5810 $$invalidConstExpr$$/*location: null*/; 5100 $$invalidConstExpr$$/*location: null*/;
5811 } 5101 }
5812 int foo() {} 5102 int foo() {}
5813 '''); 5103 ''');
5814 } 5104 }
5815 } 5105 }
5816 5106
5817 test_constructor_initializers_field_withParameter() async { 5107 test_constructor_initializers_field_withParameter() async {
5818 var library = await checkLibrary(''' 5108 var library = await checkLibrary('''
5819 class C { 5109 class C {
5820 final x; 5110 final x;
5821 const C(int p) : x = 1 + p; 5111 const C(int p) : x = 1 + p;
5822 } 5112 }
5823 '''); 5113 ''');
5824 if (isStrongMode) { 5114 if (isStrongMode) {
5825 checkElementText( 5115 checkElementText(library, r'''
5826 library,
5827 r'''
5828 class C { 5116 class C {
5829 final dynamic x; 5117 final dynamic x;
5830 const C(int p) : 5118 const C(int p) :
5831 x/*location: test.dart;C;x*/ = 1 + 5119 x/*location: test.dart;C;x*/ = 1 +
5832 p/*location: test.dart;C;;p*/; 5120 p/*location: test.dart;C;;p*/;
5833 } 5121 }
5834 '''); 5122 ''');
5835 } else { 5123 } else {
5836 checkElementText( 5124 checkElementText(library, r'''
5837 library,
5838 r'''
5839 class C { 5125 class C {
5840 final dynamic x; 5126 final dynamic x;
5841 const C(int p) : 5127 const C(int p) :
5842 x/*location: test.dart;C;x*/ = 1 + 5128 x/*location: test.dart;C;x*/ = 1 +
5843 p/*location: test.dart;C;;p*/; 5129 p/*location: test.dart;C;;p*/;
5844 } 5130 }
5845 '''); 5131 ''');
5846 } 5132 }
5847 } 5133 }
5848 5134
5849 test_constructor_initializers_superInvocation_named() async { 5135 test_constructor_initializers_superInvocation_named() async {
5850 var library = await checkLibrary(''' 5136 var library = await checkLibrary('''
5851 class A { 5137 class A {
5852 const A.aaa(int p); 5138 const A.aaa(int p);
5853 } 5139 }
5854 class C extends A { 5140 class C extends A {
5855 const C() : super.aaa(42); 5141 const C() : super.aaa(42);
5856 } 5142 }
5857 '''); 5143 ''');
5858 if (isStrongMode) { 5144 if (isStrongMode) {
5859 checkElementText( 5145 checkElementText(library, r'''
5860 library,
5861 r'''
5862 class A { 5146 class A {
5863 const A.aaa(int p); 5147 const A.aaa(int p);
5864 } 5148 }
5865 class C extends A { 5149 class C extends A {
5866 const C() : super. 5150 const C() : super.
5867 aaa/*location: test.dart;A;aaa*/(42); 5151 aaa/*location: test.dart;A;aaa*/(42);
5868 } 5152 }
5869 '''); 5153 ''');
5870 } else { 5154 } else {
5871 checkElementText( 5155 checkElementText(library, r'''
5872 library,
5873 r'''
5874 class A { 5156 class A {
5875 const A.aaa(int p); 5157 const A.aaa(int p);
5876 } 5158 }
5877 class C extends A { 5159 class C extends A {
5878 const C() : super. 5160 const C() : super.
5879 aaa/*location: test.dart;A;aaa*/(42); 5161 aaa/*location: test.dart;A;aaa*/(42);
5880 } 5162 }
5881 '''); 5163 ''');
5882 } 5164 }
5883 } 5165 }
5884 5166
5885 test_constructor_initializers_superInvocation_namedExpression() async { 5167 test_constructor_initializers_superInvocation_namedExpression() async {
5886 var library = await checkLibrary(''' 5168 var library = await checkLibrary('''
5887 class A { 5169 class A {
5888 const A.aaa(a, {int b}); 5170 const A.aaa(a, {int b});
5889 } 5171 }
5890 class C extends A { 5172 class C extends A {
5891 const C() : super.aaa(1, b: 2); 5173 const C() : super.aaa(1, b: 2);
5892 } 5174 }
5893 '''); 5175 ''');
5894 if (isStrongMode) { 5176 if (isStrongMode) {
5895 checkElementText( 5177 checkElementText(library, r'''
5896 library,
5897 r'''
5898 class A { 5178 class A {
5899 const A.aaa(dynamic a, {int b}); 5179 const A.aaa(dynamic a, {int b});
5900 } 5180 }
5901 class C extends A { 5181 class C extends A {
5902 const C() : super. 5182 const C() : super.
5903 aaa/*location: test.dart;A;aaa*/(1, 5183 aaa/*location: test.dart;A;aaa*/(1,
5904 b/*location: null*/: 2); 5184 b/*location: null*/: 2);
5905 } 5185 }
5906 '''); 5186 ''');
5907 } else { 5187 } else {
5908 checkElementText( 5188 checkElementText(library, r'''
5909 library,
5910 r'''
5911 class A { 5189 class A {
5912 const A.aaa(dynamic a, {int b}); 5190 const A.aaa(dynamic a, {int b});
5913 } 5191 }
5914 class C extends A { 5192 class C extends A {
5915 const C() : super. 5193 const C() : super.
5916 aaa/*location: test.dart;A;aaa*/(1, 5194 aaa/*location: test.dart;A;aaa*/(1,
5917 b/*location: null*/: 2); 5195 b/*location: null*/: 2);
5918 } 5196 }
5919 '''); 5197 ''');
5920 } 5198 }
5921 } 5199 }
5922 5200
5923 test_constructor_initializers_superInvocation_unnamed() async { 5201 test_constructor_initializers_superInvocation_unnamed() async {
5924 var library = await checkLibrary(''' 5202 var library = await checkLibrary('''
5925 class A { 5203 class A {
5926 const A(int p); 5204 const A(int p);
5927 } 5205 }
5928 class C extends A { 5206 class C extends A {
5929 const C.ccc() : super(42); 5207 const C.ccc() : super(42);
5930 } 5208 }
5931 '''); 5209 ''');
5932 if (isStrongMode) { 5210 if (isStrongMode) {
5933 checkElementText( 5211 checkElementText(library, r'''
5934 library,
5935 r'''
5936 class A { 5212 class A {
5937 const A(int p); 5213 const A(int p);
5938 } 5214 }
5939 class C extends A { 5215 class C extends A {
5940 const C.ccc() : super(42); 5216 const C.ccc() : super(42);
5941 } 5217 }
5942 '''); 5218 ''');
5943 } else { 5219 } else {
5944 checkElementText( 5220 checkElementText(library, r'''
5945 library,
5946 r'''
5947 class A { 5221 class A {
5948 const A(int p); 5222 const A(int p);
5949 } 5223 }
5950 class C extends A { 5224 class C extends A {
5951 const C.ccc() : super(42); 5225 const C.ccc() : super(42);
5952 } 5226 }
5953 '''); 5227 ''');
5954 } 5228 }
5955 } 5229 }
5956 5230
5957 test_constructor_initializers_thisInvocation_named() async { 5231 test_constructor_initializers_thisInvocation_named() async {
5958 var library = await checkLibrary(''' 5232 var library = await checkLibrary('''
5959 class C { 5233 class C {
5960 const C() : this.named(1, 'bbb'); 5234 const C() : this.named(1, 'bbb');
5961 const C.named(int a, String b); 5235 const C.named(int a, String b);
5962 } 5236 }
5963 '''); 5237 ''');
5964 if (isStrongMode) { 5238 if (isStrongMode) {
5965 checkElementText( 5239 checkElementText(library, r'''
5966 library,
5967 r'''
5968 class C { 5240 class C {
5969 const C() = C.named : this. 5241 const C() = C.named : this.
5970 named/*location: test.dart;C;named*/(1, 'bbb'); 5242 named/*location: test.dart;C;named*/(1, 'bbb');
5971 const C.named(int a, String b); 5243 const C.named(int a, String b);
5972 } 5244 }
5973 '''); 5245 ''');
5974 } else { 5246 } else {
5975 checkElementText( 5247 checkElementText(library, r'''
5976 library,
5977 r'''
5978 class C { 5248 class C {
5979 const C() = C.named : this. 5249 const C() = C.named : this.
5980 named/*location: test.dart;C;named*/(1, 'bbb'); 5250 named/*location: test.dart;C;named*/(1, 'bbb');
5981 const C.named(int a, String b); 5251 const C.named(int a, String b);
5982 } 5252 }
5983 '''); 5253 ''');
5984 } 5254 }
5985 } 5255 }
5986 5256
5987 test_constructor_initializers_thisInvocation_namedExpression() async { 5257 test_constructor_initializers_thisInvocation_namedExpression() async {
5988 var library = await checkLibrary(''' 5258 var library = await checkLibrary('''
5989 class C { 5259 class C {
5990 const C() : this.named(1, b: 2); 5260 const C() : this.named(1, b: 2);
5991 const C.named(a, {int b}); 5261 const C.named(a, {int b});
5992 } 5262 }
5993 '''); 5263 ''');
5994 if (isStrongMode) { 5264 if (isStrongMode) {
5995 checkElementText( 5265 checkElementText(library, r'''
5996 library,
5997 r'''
5998 class C { 5266 class C {
5999 const C() = C.named : this. 5267 const C() = C.named : this.
6000 named/*location: test.dart;C;named*/(1, 5268 named/*location: test.dart;C;named*/(1,
6001 b/*location: null*/: 2); 5269 b/*location: null*/: 2);
6002 const C.named(dynamic a, {int b}); 5270 const C.named(dynamic a, {int b});
6003 } 5271 }
6004 '''); 5272 ''');
6005 } else { 5273 } else {
6006 checkElementText( 5274 checkElementText(library, r'''
6007 library,
6008 r'''
6009 class C { 5275 class C {
6010 const C() = C.named : this. 5276 const C() = C.named : this.
6011 named/*location: test.dart;C;named*/(1, 5277 named/*location: test.dart;C;named*/(1,
6012 b/*location: null*/: 2); 5278 b/*location: null*/: 2);
6013 const C.named(dynamic a, {int b}); 5279 const C.named(dynamic a, {int b});
6014 } 5280 }
6015 '''); 5281 ''');
6016 } 5282 }
6017 } 5283 }
6018 5284
6019 test_constructor_initializers_thisInvocation_unnamed() async { 5285 test_constructor_initializers_thisInvocation_unnamed() async {
6020 var library = await checkLibrary(''' 5286 var library = await checkLibrary('''
6021 class C { 5287 class C {
6022 const C.named() : this(1, 'bbb'); 5288 const C.named() : this(1, 'bbb');
6023 const C(int a, String b); 5289 const C(int a, String b);
6024 } 5290 }
6025 '''); 5291 ''');
6026 if (isStrongMode) { 5292 if (isStrongMode) {
6027 checkElementText( 5293 checkElementText(library, r'''
6028 library,
6029 r'''
6030 class C { 5294 class C {
6031 const C.named() = C : this(1, 'bbb'); 5295 const C.named() = C : this(1, 'bbb');
6032 const C(int a, String b); 5296 const C(int a, String b);
6033 } 5297 }
6034 '''); 5298 ''');
6035 } else { 5299 } else {
6036 checkElementText( 5300 checkElementText(library, r'''
6037 library,
6038 r'''
6039 class C { 5301 class C {
6040 const C.named() = C : this(1, 'bbb'); 5302 const C.named() = C : this(1, 'bbb');
6041 const C(int a, String b); 5303 const C(int a, String b);
6042 } 5304 }
6043 '''); 5305 ''');
6044 } 5306 }
6045 } 5307 }
6046 5308
6047 test_constructor_redirected_factory_named() async { 5309 test_constructor_redirected_factory_named() async {
6048 var library = await checkLibrary(''' 5310 var library = await checkLibrary('''
6049 class C { 5311 class C {
6050 factory C() = D.named; 5312 factory C() = D.named;
6051 C._(); 5313 C._();
6052 } 5314 }
6053 class D extends C { 5315 class D extends C {
6054 D.named() : super._(); 5316 D.named() : super._();
6055 } 5317 }
6056 '''); 5318 ''');
6057 if (isStrongMode) { 5319 if (isStrongMode) {
6058 checkElementText( 5320 checkElementText(library, r'''
6059 library,
6060 r'''
6061 class C { 5321 class C {
6062 factory C() = D.named; 5322 factory C() = D.named;
6063 C._(); 5323 C._();
6064 } 5324 }
6065 class D extends C { 5325 class D extends C {
6066 D.named(); 5326 D.named();
6067 } 5327 }
6068 '''); 5328 ''');
6069 } else { 5329 } else {
6070 checkElementText( 5330 checkElementText(library, r'''
6071 library,
6072 r'''
6073 class C { 5331 class C {
6074 factory C() = D.named; 5332 factory C() = D.named;
6075 C._(); 5333 C._();
6076 } 5334 }
6077 class D extends C { 5335 class D extends C {
6078 D.named(); 5336 D.named();
6079 } 5337 }
6080 '''); 5338 ''');
6081 } 5339 }
6082 } 5340 }
6083 5341
6084 test_constructor_redirected_factory_named_generic() async { 5342 test_constructor_redirected_factory_named_generic() async {
6085 var library = await checkLibrary(''' 5343 var library = await checkLibrary('''
6086 class C<T, U> { 5344 class C<T, U> {
6087 factory C() = D<U, T>.named; 5345 factory C() = D<U, T>.named;
6088 C._(); 5346 C._();
6089 } 5347 }
6090 class D<T, U> extends C<U, T> { 5348 class D<T, U> extends C<U, T> {
6091 D.named() : super._(); 5349 D.named() : super._();
6092 } 5350 }
6093 '''); 5351 ''');
6094 if (isStrongMode) { 5352 if (isStrongMode) {
6095 checkElementText( 5353 checkElementText(library, r'''
6096 library,
6097 r'''
6098 class C<T, U> { 5354 class C<T, U> {
6099 factory C() = D<U, T>.named; 5355 factory C() = D<U, T>.named;
6100 C._(); 5356 C._();
6101 } 5357 }
6102 class D<T, U> extends C<U, T> { 5358 class D<T, U> extends C<U, T> {
6103 D.named(); 5359 D.named();
6104 } 5360 }
6105 '''); 5361 ''');
6106 } else { 5362 } else {
6107 checkElementText( 5363 checkElementText(library, r'''
6108 library,
6109 r'''
6110 class C<T, U> { 5364 class C<T, U> {
6111 factory C() = D<U, T>.named; 5365 factory C() = D<U, T>.named;
6112 C._(); 5366 C._();
6113 } 5367 }
6114 class D<T, U> extends C<U, T> { 5368 class D<T, U> extends C<U, T> {
6115 D.named(); 5369 D.named();
6116 } 5370 }
6117 '''); 5371 ''');
6118 } 5372 }
6119 } 5373 }
6120 5374
6121 test_constructor_redirected_factory_named_imported() async { 5375 test_constructor_redirected_factory_named_imported() async {
6122 addLibrarySource( 5376 addLibrarySource('/foo.dart', '''
6123 '/foo.dart',
6124 '''
6125 import 'test.dart'; 5377 import 'test.dart';
6126 class D extends C { 5378 class D extends C {
6127 D.named() : super._(); 5379 D.named() : super._();
6128 } 5380 }
6129 '''); 5381 ''');
6130 var library = await checkLibrary(''' 5382 var library = await checkLibrary('''
6131 import 'foo.dart'; 5383 import 'foo.dart';
6132 class C { 5384 class C {
6133 factory C() = D.named; 5385 factory C() = D.named;
6134 C._(); 5386 C._();
6135 } 5387 }
6136 '''); 5388 ''');
6137 if (isStrongMode) { 5389 if (isStrongMode) {
6138 checkElementText( 5390 checkElementText(library, r'''
6139 library,
6140 r'''
6141 import 'foo.dart'; 5391 import 'foo.dart';
6142 class C { 5392 class C {
6143 factory C() = D.named; 5393 factory C() = D.named;
6144 C._(); 5394 C._();
6145 } 5395 }
6146 '''); 5396 ''');
6147 } else { 5397 } else {
6148 checkElementText( 5398 checkElementText(library, r'''
6149 library,
6150 r'''
6151 import 'foo.dart'; 5399 import 'foo.dart';
6152 class C { 5400 class C {
6153 factory C() = D.named; 5401 factory C() = D.named;
6154 C._(); 5402 C._();
6155 } 5403 }
6156 '''); 5404 ''');
6157 } 5405 }
6158 } 5406 }
6159 5407
6160 test_constructor_redirected_factory_named_imported_generic() async { 5408 test_constructor_redirected_factory_named_imported_generic() async {
6161 addLibrarySource( 5409 addLibrarySource('/foo.dart', '''
6162 '/foo.dart',
6163 '''
6164 import 'test.dart'; 5410 import 'test.dart';
6165 class D<T, U> extends C<U, T> { 5411 class D<T, U> extends C<U, T> {
6166 D.named() : super._(); 5412 D.named() : super._();
6167 } 5413 }
6168 '''); 5414 ''');
6169 var library = await checkLibrary(''' 5415 var library = await checkLibrary('''
6170 import 'foo.dart'; 5416 import 'foo.dart';
6171 class C<T, U> { 5417 class C<T, U> {
6172 factory C() = D<U, T>.named; 5418 factory C() = D<U, T>.named;
6173 C._(); 5419 C._();
6174 } 5420 }
6175 '''); 5421 ''');
6176 if (isStrongMode) { 5422 if (isStrongMode) {
6177 checkElementText( 5423 checkElementText(library, r'''
6178 library,
6179 r'''
6180 import 'foo.dart'; 5424 import 'foo.dart';
6181 class C<T, U> { 5425 class C<T, U> {
6182 factory C() = D<U, T>.named; 5426 factory C() = D<U, T>.named;
6183 C._(); 5427 C._();
6184 } 5428 }
6185 '''); 5429 ''');
6186 } else { 5430 } else {
6187 checkElementText( 5431 checkElementText(library, r'''
6188 library,
6189 r'''
6190 import 'foo.dart'; 5432 import 'foo.dart';
6191 class C<T, U> { 5433 class C<T, U> {
6192 factory C() = D<U, T>.named; 5434 factory C() = D<U, T>.named;
6193 C._(); 5435 C._();
6194 } 5436 }
6195 '''); 5437 ''');
6196 } 5438 }
6197 } 5439 }
6198 5440
6199 test_constructor_redirected_factory_named_prefixed() async { 5441 test_constructor_redirected_factory_named_prefixed() async {
6200 addLibrarySource( 5442 addLibrarySource('/foo.dart', '''
6201 '/foo.dart',
6202 '''
6203 import 'test.dart'; 5443 import 'test.dart';
6204 class D extends C { 5444 class D extends C {
6205 D.named() : super._(); 5445 D.named() : super._();
6206 } 5446 }
6207 '''); 5447 ''');
6208 var library = await checkLibrary(''' 5448 var library = await checkLibrary('''
6209 import 'foo.dart' as foo; 5449 import 'foo.dart' as foo;
6210 class C { 5450 class C {
6211 factory C() = foo.D.named; 5451 factory C() = foo.D.named;
6212 C._(); 5452 C._();
6213 } 5453 }
6214 '''); 5454 ''');
6215 if (isStrongMode) { 5455 if (isStrongMode) {
6216 checkElementText( 5456 checkElementText(library, r'''
6217 library,
6218 r'''
6219 import 'foo.dart' as foo; 5457 import 'foo.dart' as foo;
6220 class C { 5458 class C {
6221 factory C() = D.named; 5459 factory C() = D.named;
6222 C._(); 5460 C._();
6223 } 5461 }
6224 '''); 5462 ''');
6225 } else { 5463 } else {
6226 checkElementText( 5464 checkElementText(library, r'''
6227 library,
6228 r'''
6229 import 'foo.dart' as foo; 5465 import 'foo.dart' as foo;
6230 class C { 5466 class C {
6231 factory C() = D.named; 5467 factory C() = D.named;
6232 C._(); 5468 C._();
6233 } 5469 }
6234 '''); 5470 ''');
6235 } 5471 }
6236 } 5472 }
6237 5473
6238 test_constructor_redirected_factory_named_prefixed_generic() async { 5474 test_constructor_redirected_factory_named_prefixed_generic() async {
6239 addLibrarySource( 5475 addLibrarySource('/foo.dart', '''
6240 '/foo.dart',
6241 '''
6242 import 'test.dart'; 5476 import 'test.dart';
6243 class D<T, U> extends C<U, T> { 5477 class D<T, U> extends C<U, T> {
6244 D.named() : super._(); 5478 D.named() : super._();
6245 } 5479 }
6246 '''); 5480 ''');
6247 var library = await checkLibrary(''' 5481 var library = await checkLibrary('''
6248 import 'foo.dart' as foo; 5482 import 'foo.dart' as foo;
6249 class C<T, U> { 5483 class C<T, U> {
6250 factory C() = foo.D<U, T>.named; 5484 factory C() = foo.D<U, T>.named;
6251 C._(); 5485 C._();
6252 } 5486 }
6253 '''); 5487 ''');
6254 if (isStrongMode) { 5488 if (isStrongMode) {
6255 checkElementText( 5489 checkElementText(library, r'''
6256 library,
6257 r'''
6258 import 'foo.dart' as foo; 5490 import 'foo.dart' as foo;
6259 class C<T, U> { 5491 class C<T, U> {
6260 factory C() = D<U, T>.named; 5492 factory C() = D<U, T>.named;
6261 C._(); 5493 C._();
6262 } 5494 }
6263 '''); 5495 ''');
6264 } else { 5496 } else {
6265 checkElementText( 5497 checkElementText(library, r'''
6266 library,
6267 r'''
6268 import 'foo.dart' as foo; 5498 import 'foo.dart' as foo;
6269 class C<T, U> { 5499 class C<T, U> {
6270 factory C() = D<U, T>.named; 5500 factory C() = D<U, T>.named;
6271 C._(); 5501 C._();
6272 } 5502 }
6273 '''); 5503 ''');
6274 } 5504 }
6275 } 5505 }
6276 5506
6277 test_constructor_redirected_factory_named_unresolved_class() async { 5507 test_constructor_redirected_factory_named_unresolved_class() async {
6278 var library = await checkLibrary( 5508 var library = await checkLibrary('''
6279 '''
6280 class C<E> { 5509 class C<E> {
6281 factory C() = D.named<E>; 5510 factory C() = D.named<E>;
6282 } 5511 }
6283 ''', 5512 ''', allowErrors: true);
6284 allowErrors: true);
6285 if (isStrongMode) { 5513 if (isStrongMode) {
6286 checkElementText( 5514 checkElementText(library, r'''
6287 library,
6288 r'''
6289 class C<E> { 5515 class C<E> {
6290 factory C(); 5516 factory C();
6291 } 5517 }
6292 '''); 5518 ''');
6293 } else { 5519 } else {
6294 checkElementText( 5520 checkElementText(library, r'''
6295 library,
6296 r'''
6297 class C<E> { 5521 class C<E> {
6298 factory C(); 5522 factory C();
6299 } 5523 }
6300 '''); 5524 ''');
6301 } 5525 }
6302 } 5526 }
6303 5527
6304 test_constructor_redirected_factory_named_unresolved_constructor() async { 5528 test_constructor_redirected_factory_named_unresolved_constructor() async {
6305 var library = await checkLibrary( 5529 var library = await checkLibrary('''
6306 '''
6307 class D {} 5530 class D {}
6308 class C<E> { 5531 class C<E> {
6309 factory C() = D.named<E>; 5532 factory C() = D.named<E>;
6310 } 5533 }
6311 ''', 5534 ''', allowErrors: true);
6312 allowErrors: true);
6313 if (isStrongMode) { 5535 if (isStrongMode) {
6314 checkElementText( 5536 checkElementText(library, r'''
6315 library,
6316 r'''
6317 class D { 5537 class D {
6318 } 5538 }
6319 class C<E> { 5539 class C<E> {
6320 factory C(); 5540 factory C();
6321 } 5541 }
6322 '''); 5542 ''');
6323 } else { 5543 } else {
6324 checkElementText( 5544 checkElementText(library, r'''
6325 library,
6326 r'''
6327 class D { 5545 class D {
6328 } 5546 }
6329 class C<E> { 5547 class C<E> {
6330 factory C(); 5548 factory C();
6331 } 5549 }
6332 '''); 5550 ''');
6333 } 5551 }
6334 } 5552 }
6335 5553
6336 test_constructor_redirected_factory_unnamed() async { 5554 test_constructor_redirected_factory_unnamed() async {
6337 var library = await checkLibrary(''' 5555 var library = await checkLibrary('''
6338 class C { 5556 class C {
6339 factory C() = D; 5557 factory C() = D;
6340 C._(); 5558 C._();
6341 } 5559 }
6342 class D extends C { 5560 class D extends C {
6343 D() : super._(); 5561 D() : super._();
6344 } 5562 }
6345 '''); 5563 ''');
6346 if (isStrongMode) { 5564 if (isStrongMode) {
6347 checkElementText( 5565 checkElementText(library, r'''
6348 library,
6349 r'''
6350 class C { 5566 class C {
6351 factory C() = D; 5567 factory C() = D;
6352 C._(); 5568 C._();
6353 } 5569 }
6354 class D extends C { 5570 class D extends C {
6355 D(); 5571 D();
6356 } 5572 }
6357 '''); 5573 ''');
6358 } else { 5574 } else {
6359 checkElementText( 5575 checkElementText(library, r'''
6360 library,
6361 r'''
6362 class C { 5576 class C {
6363 factory C() = D; 5577 factory C() = D;
6364 C._(); 5578 C._();
6365 } 5579 }
6366 class D extends C { 5580 class D extends C {
6367 D(); 5581 D();
6368 } 5582 }
6369 '''); 5583 ''');
6370 } 5584 }
6371 } 5585 }
6372 5586
6373 test_constructor_redirected_factory_unnamed_generic() async { 5587 test_constructor_redirected_factory_unnamed_generic() async {
6374 var library = await checkLibrary(''' 5588 var library = await checkLibrary('''
6375 class C<T, U> { 5589 class C<T, U> {
6376 factory C() = D<U, T>; 5590 factory C() = D<U, T>;
6377 C._(); 5591 C._();
6378 } 5592 }
6379 class D<T, U> extends C<U, T> { 5593 class D<T, U> extends C<U, T> {
6380 D() : super._(); 5594 D() : super._();
6381 } 5595 }
6382 '''); 5596 ''');
6383 if (isStrongMode) { 5597 if (isStrongMode) {
6384 checkElementText( 5598 checkElementText(library, r'''
6385 library,
6386 r'''
6387 class C<T, U> { 5599 class C<T, U> {
6388 factory C() = D<U, T>; 5600 factory C() = D<U, T>;
6389 C._(); 5601 C._();
6390 } 5602 }
6391 class D<T, U> extends C<U, T> { 5603 class D<T, U> extends C<U, T> {
6392 D(); 5604 D();
6393 } 5605 }
6394 '''); 5606 ''');
6395 } else { 5607 } else {
6396 checkElementText( 5608 checkElementText(library, r'''
6397 library,
6398 r'''
6399 class C<T, U> { 5609 class C<T, U> {
6400 factory C() = D<U, T>; 5610 factory C() = D<U, T>;
6401 C._(); 5611 C._();
6402 } 5612 }
6403 class D<T, U> extends C<U, T> { 5613 class D<T, U> extends C<U, T> {
6404 D(); 5614 D();
6405 } 5615 }
6406 '''); 5616 ''');
6407 } 5617 }
6408 } 5618 }
6409 5619
6410 test_constructor_redirected_factory_unnamed_imported() async { 5620 test_constructor_redirected_factory_unnamed_imported() async {
6411 addLibrarySource( 5621 addLibrarySource('/foo.dart', '''
6412 '/foo.dart',
6413 '''
6414 import 'test.dart'; 5622 import 'test.dart';
6415 class D extends C { 5623 class D extends C {
6416 D() : super._(); 5624 D() : super._();
6417 } 5625 }
6418 '''); 5626 ''');
6419 var library = await checkLibrary(''' 5627 var library = await checkLibrary('''
6420 import 'foo.dart'; 5628 import 'foo.dart';
6421 class C { 5629 class C {
6422 factory C() = D; 5630 factory C() = D;
6423 C._(); 5631 C._();
6424 } 5632 }
6425 '''); 5633 ''');
6426 if (isStrongMode) { 5634 if (isStrongMode) {
6427 checkElementText( 5635 checkElementText(library, r'''
6428 library,
6429 r'''
6430 import 'foo.dart'; 5636 import 'foo.dart';
6431 class C { 5637 class C {
6432 factory C() = D; 5638 factory C() = D;
6433 C._(); 5639 C._();
6434 } 5640 }
6435 '''); 5641 ''');
6436 } else { 5642 } else {
6437 checkElementText( 5643 checkElementText(library, r'''
6438 library,
6439 r'''
6440 import 'foo.dart'; 5644 import 'foo.dart';
6441 class C { 5645 class C {
6442 factory C() = D; 5646 factory C() = D;
6443 C._(); 5647 C._();
6444 } 5648 }
6445 '''); 5649 ''');
6446 } 5650 }
6447 } 5651 }
6448 5652
6449 test_constructor_redirected_factory_unnamed_imported_generic() async { 5653 test_constructor_redirected_factory_unnamed_imported_generic() async {
6450 addLibrarySource( 5654 addLibrarySource('/foo.dart', '''
6451 '/foo.dart',
6452 '''
6453 import 'test.dart'; 5655 import 'test.dart';
6454 class D<T, U> extends C<U, T> { 5656 class D<T, U> extends C<U, T> {
6455 D() : super._(); 5657 D() : super._();
6456 } 5658 }
6457 '''); 5659 ''');
6458 var library = await checkLibrary(''' 5660 var library = await checkLibrary('''
6459 import 'foo.dart'; 5661 import 'foo.dart';
6460 class C<T, U> { 5662 class C<T, U> {
6461 factory C() = D<U, T>; 5663 factory C() = D<U, T>;
6462 C._(); 5664 C._();
6463 } 5665 }
6464 '''); 5666 ''');
6465 if (isStrongMode) { 5667 if (isStrongMode) {
6466 checkElementText( 5668 checkElementText(library, r'''
6467 library,
6468 r'''
6469 import 'foo.dart'; 5669 import 'foo.dart';
6470 class C<T, U> { 5670 class C<T, U> {
6471 factory C() = D<U, T>; 5671 factory C() = D<U, T>;
6472 C._(); 5672 C._();
6473 } 5673 }
6474 '''); 5674 ''');
6475 } else { 5675 } else {
6476 checkElementText( 5676 checkElementText(library, r'''
6477 library,
6478 r'''
6479 import 'foo.dart'; 5677 import 'foo.dart';
6480 class C<T, U> { 5678 class C<T, U> {
6481 factory C() = D<U, T>; 5679 factory C() = D<U, T>;
6482 C._(); 5680 C._();
6483 } 5681 }
6484 '''); 5682 ''');
6485 } 5683 }
6486 } 5684 }
6487 5685
6488 test_constructor_redirected_factory_unnamed_prefixed() async { 5686 test_constructor_redirected_factory_unnamed_prefixed() async {
6489 addLibrarySource( 5687 addLibrarySource('/foo.dart', '''
6490 '/foo.dart',
6491 '''
6492 import 'test.dart'; 5688 import 'test.dart';
6493 class D extends C { 5689 class D extends C {
6494 D() : super._(); 5690 D() : super._();
6495 } 5691 }
6496 '''); 5692 ''');
6497 var library = await checkLibrary(''' 5693 var library = await checkLibrary('''
6498 import 'foo.dart' as foo; 5694 import 'foo.dart' as foo;
6499 class C { 5695 class C {
6500 factory C() = foo.D; 5696 factory C() = foo.D;
6501 C._(); 5697 C._();
6502 } 5698 }
6503 '''); 5699 ''');
6504 if (isStrongMode) { 5700 if (isStrongMode) {
6505 checkElementText( 5701 checkElementText(library, r'''
6506 library,
6507 r'''
6508 import 'foo.dart' as foo; 5702 import 'foo.dart' as foo;
6509 class C { 5703 class C {
6510 factory C() = D; 5704 factory C() = D;
6511 C._(); 5705 C._();
6512 } 5706 }
6513 '''); 5707 ''');
6514 } else { 5708 } else {
6515 checkElementText( 5709 checkElementText(library, r'''
6516 library,
6517 r'''
6518 import 'foo.dart' as foo; 5710 import 'foo.dart' as foo;
6519 class C { 5711 class C {
6520 factory C() = D; 5712 factory C() = D;
6521 C._(); 5713 C._();
6522 } 5714 }
6523 '''); 5715 ''');
6524 } 5716 }
6525 } 5717 }
6526 5718
6527 test_constructor_redirected_factory_unnamed_prefixed_generic() async { 5719 test_constructor_redirected_factory_unnamed_prefixed_generic() async {
6528 addLibrarySource( 5720 addLibrarySource('/foo.dart', '''
6529 '/foo.dart',
6530 '''
6531 import 'test.dart'; 5721 import 'test.dart';
6532 class D<T, U> extends C<U, T> { 5722 class D<T, U> extends C<U, T> {
6533 D() : super._(); 5723 D() : super._();
6534 } 5724 }
6535 '''); 5725 ''');
6536 var library = await checkLibrary(''' 5726 var library = await checkLibrary('''
6537 import 'foo.dart' as foo; 5727 import 'foo.dart' as foo;
6538 class C<T, U> { 5728 class C<T, U> {
6539 factory C() = foo.D<U, T>; 5729 factory C() = foo.D<U, T>;
6540 C._(); 5730 C._();
6541 } 5731 }
6542 '''); 5732 ''');
6543 if (isStrongMode) { 5733 if (isStrongMode) {
6544 checkElementText( 5734 checkElementText(library, r'''
6545 library,
6546 r'''
6547 import 'foo.dart' as foo; 5735 import 'foo.dart' as foo;
6548 class C<T, U> { 5736 class C<T, U> {
6549 factory C() = D<U, T>; 5737 factory C() = D<U, T>;
6550 C._(); 5738 C._();
6551 } 5739 }
6552 '''); 5740 ''');
6553 } else { 5741 } else {
6554 checkElementText( 5742 checkElementText(library, r'''
6555 library,
6556 r'''
6557 import 'foo.dart' as foo; 5743 import 'foo.dart' as foo;
6558 class C<T, U> { 5744 class C<T, U> {
6559 factory C() = D<U, T>; 5745 factory C() = D<U, T>;
6560 C._(); 5746 C._();
6561 } 5747 }
6562 '''); 5748 ''');
6563 } 5749 }
6564 } 5750 }
6565 5751
6566 test_constructor_redirected_factory_unnamed_unresolved() async { 5752 test_constructor_redirected_factory_unnamed_unresolved() async {
6567 var library = await checkLibrary( 5753 var library = await checkLibrary('''
6568 '''
6569 class C<E> { 5754 class C<E> {
6570 factory C() = D<E>; 5755 factory C() = D<E>;
6571 } 5756 }
6572 ''', 5757 ''', allowErrors: true);
6573 allowErrors: true);
6574 if (isStrongMode) { 5758 if (isStrongMode) {
6575 checkElementText( 5759 checkElementText(library, r'''
6576 library,
6577 r'''
6578 class C<E> { 5760 class C<E> {
6579 factory C(); 5761 factory C();
6580 } 5762 }
6581 '''); 5763 ''');
6582 } else { 5764 } else {
6583 checkElementText( 5765 checkElementText(library, r'''
6584 library,
6585 r'''
6586 class C<E> { 5766 class C<E> {
6587 factory C(); 5767 factory C();
6588 } 5768 }
6589 '''); 5769 ''');
6590 } 5770 }
6591 } 5771 }
6592 5772
6593 test_constructor_redirected_thisInvocation_named() async { 5773 test_constructor_redirected_thisInvocation_named() async {
6594 var library = await checkLibrary(''' 5774 var library = await checkLibrary('''
6595 class C { 5775 class C {
6596 C.named(); 5776 C.named();
6597 C() : this.named(); 5777 C() : this.named();
6598 } 5778 }
6599 '''); 5779 ''');
6600 if (isStrongMode) { 5780 if (isStrongMode) {
6601 checkElementText( 5781 checkElementText(library, r'''
6602 library,
6603 r'''
6604 class C { 5782 class C {
6605 C.named(); 5783 C.named();
6606 C() = C.named; 5784 C() = C.named;
6607 } 5785 }
6608 '''); 5786 ''');
6609 } else { 5787 } else {
6610 checkElementText( 5788 checkElementText(library, r'''
6611 library,
6612 r'''
6613 class C { 5789 class C {
6614 C.named(); 5790 C.named();
6615 C() = C.named; 5791 C() = C.named;
6616 } 5792 }
6617 '''); 5793 ''');
6618 } 5794 }
6619 } 5795 }
6620 5796
6621 test_constructor_redirected_thisInvocation_named_generic() async { 5797 test_constructor_redirected_thisInvocation_named_generic() async {
6622 var library = await checkLibrary(''' 5798 var library = await checkLibrary('''
6623 class C<T> { 5799 class C<T> {
6624 C.named(); 5800 C.named();
6625 C() : this.named(); 5801 C() : this.named();
6626 } 5802 }
6627 '''); 5803 ''');
6628 if (isStrongMode) { 5804 if (isStrongMode) {
6629 checkElementText( 5805 checkElementText(library, r'''
6630 library,
6631 r'''
6632 class C<T> { 5806 class C<T> {
6633 C.named(); 5807 C.named();
6634 C() = C<T>.named; 5808 C() = C<T>.named;
6635 } 5809 }
6636 '''); 5810 ''');
6637 } else { 5811 } else {
6638 checkElementText( 5812 checkElementText(library, r'''
6639 library,
6640 r'''
6641 class C<T> { 5813 class C<T> {
6642 C.named(); 5814 C.named();
6643 C() = C<T>.named; 5815 C() = C<T>.named;
6644 } 5816 }
6645 '''); 5817 ''');
6646 } 5818 }
6647 } 5819 }
6648 5820
6649 test_constructor_redirected_thisInvocation_unnamed() async { 5821 test_constructor_redirected_thisInvocation_unnamed() async {
6650 var library = await checkLibrary(''' 5822 var library = await checkLibrary('''
6651 class C { 5823 class C {
6652 C(); 5824 C();
6653 C.named() : this(); 5825 C.named() : this();
6654 } 5826 }
6655 '''); 5827 ''');
6656 if (isStrongMode) { 5828 if (isStrongMode) {
6657 checkElementText( 5829 checkElementText(library, r'''
6658 library,
6659 r'''
6660 class C { 5830 class C {
6661 C(); 5831 C();
6662 C.named() = C; 5832 C.named() = C;
6663 } 5833 }
6664 '''); 5834 ''');
6665 } else { 5835 } else {
6666 checkElementText( 5836 checkElementText(library, r'''
6667 library,
6668 r'''
6669 class C { 5837 class C {
6670 C(); 5838 C();
6671 C.named() = C; 5839 C.named() = C;
6672 } 5840 }
6673 '''); 5841 ''');
6674 } 5842 }
6675 } 5843 }
6676 5844
6677 test_constructor_redirected_thisInvocation_unnamed_generic() async { 5845 test_constructor_redirected_thisInvocation_unnamed_generic() async {
6678 var library = await checkLibrary(''' 5846 var library = await checkLibrary('''
6679 class C<T> { 5847 class C<T> {
6680 C(); 5848 C();
6681 C.named() : this(); 5849 C.named() : this();
6682 } 5850 }
6683 '''); 5851 ''');
6684 if (isStrongMode) { 5852 if (isStrongMode) {
6685 checkElementText( 5853 checkElementText(library, r'''
6686 library,
6687 r'''
6688 class C<T> { 5854 class C<T> {
6689 C(); 5855 C();
6690 C.named() = C<T>; 5856 C.named() = C<T>;
6691 } 5857 }
6692 '''); 5858 ''');
6693 } else { 5859 } else {
6694 checkElementText( 5860 checkElementText(library, r'''
6695 library,
6696 r'''
6697 class C<T> { 5861 class C<T> {
6698 C(); 5862 C();
6699 C.named() = C<T>; 5863 C.named() = C<T>;
6700 } 5864 }
6701 '''); 5865 ''');
6702 } 5866 }
6703 } 5867 }
6704 5868
6705 test_constructor_withCycles_const() async { 5869 test_constructor_withCycles_const() async {
6706 var library = await checkLibrary(''' 5870 var library = await checkLibrary('''
6707 class C { 5871 class C {
6708 final x; 5872 final x;
6709 const C() : x = const D(); 5873 const C() : x = const D();
6710 } 5874 }
6711 class D { 5875 class D {
6712 final x; 5876 final x;
6713 const D() : x = const C(); 5877 const D() : x = const C();
6714 } 5878 }
6715 '''); 5879 ''');
6716 if (isStrongMode) { 5880 if (isStrongMode) {
6717 checkElementText( 5881 checkElementText(library, r'''
6718 library,
6719 r'''
6720 class C { 5882 class C {
6721 final dynamic x; 5883 final dynamic x;
6722 const C() : 5884 const C() :
6723 x/*location: test.dart;C;x*/ = const 5885 x/*location: test.dart;C;x*/ = const
6724 D/*location: test.dart;D*/(); 5886 D/*location: test.dart;D*/();
6725 } 5887 }
6726 class D { 5888 class D {
6727 final dynamic x; 5889 final dynamic x;
6728 const D() : 5890 const D() :
6729 x/*location: test.dart;D;x*/ = const 5891 x/*location: test.dart;D;x*/ = const
6730 C/*location: test.dart;C*/(); 5892 C/*location: test.dart;C*/();
6731 } 5893 }
6732 '''); 5894 ''');
6733 } else { 5895 } else {
6734 checkElementText( 5896 checkElementText(library, r'''
6735 library,
6736 r'''
6737 class C { 5897 class C {
6738 final dynamic x; 5898 final dynamic x;
6739 const C() : 5899 const C() :
6740 x/*location: test.dart;C;x*/ = const 5900 x/*location: test.dart;C;x*/ = const
6741 D/*location: test.dart;D*/(); 5901 D/*location: test.dart;D*/();
6742 } 5902 }
6743 class D { 5903 class D {
6744 final dynamic x; 5904 final dynamic x;
6745 const D() : 5905 const D() :
6746 x/*location: test.dart;D;x*/ = const 5906 x/*location: test.dart;D;x*/ = const
6747 C/*location: test.dart;C*/(); 5907 C/*location: test.dart;C*/();
6748 } 5908 }
6749 '''); 5909 ''');
6750 } 5910 }
6751 } 5911 }
6752 5912
6753 test_constructor_withCycles_nonConst() async { 5913 test_constructor_withCycles_nonConst() async {
6754 var library = await checkLibrary(''' 5914 var library = await checkLibrary('''
6755 class C { 5915 class C {
6756 final x; 5916 final x;
6757 C() : x = new D(); 5917 C() : x = new D();
6758 } 5918 }
6759 class D { 5919 class D {
6760 final x; 5920 final x;
6761 D() : x = new C(); 5921 D() : x = new C();
6762 } 5922 }
6763 '''); 5923 ''');
6764 if (isStrongMode) { 5924 if (isStrongMode) {
6765 checkElementText( 5925 checkElementText(library, r'''
6766 library,
6767 r'''
6768 class C { 5926 class C {
6769 final dynamic x; 5927 final dynamic x;
6770 C(); 5928 C();
6771 } 5929 }
6772 class D { 5930 class D {
6773 final dynamic x; 5931 final dynamic x;
6774 D(); 5932 D();
6775 } 5933 }
6776 '''); 5934 ''');
6777 } else { 5935 } else {
6778 checkElementText( 5936 checkElementText(library, r'''
6779 library,
6780 r'''
6781 class C { 5937 class C {
6782 final dynamic x; 5938 final dynamic x;
6783 C(); 5939 C();
6784 } 5940 }
6785 class D { 5941 class D {
6786 final dynamic x; 5942 final dynamic x;
6787 D(); 5943 D();
6788 } 5944 }
6789 '''); 5945 ''');
6790 } 5946 }
6791 } 5947 }
6792 5948
6793 test_defaultValue_refersToGenericClass_constructor() async { 5949 test_defaultValue_refersToGenericClass_constructor() async {
6794 var library = await checkLibrary(''' 5950 var library = await checkLibrary('''
6795 class B<T> { 5951 class B<T> {
6796 const B(); 5952 const B();
6797 } 5953 }
6798 class C<T> { 5954 class C<T> {
6799 const C([B<T> b = const B()]); 5955 const C([B<T> b = const B()]);
6800 } 5956 }
6801 '''); 5957 ''');
6802 if (isStrongMode) { 5958 if (isStrongMode) {
6803 checkElementText( 5959 checkElementText(library, r'''
6804 library,
6805 r'''
6806 class B<T> { 5960 class B<T> {
6807 const B(); 5961 const B();
6808 } 5962 }
6809 class C<T> { 5963 class C<T> {
6810 const C([B<T> b = const 5964 const C([B<T> b = const
6811 B/*location: test.dart;B*/()]); 5965 B/*location: test.dart;B*/()]);
6812 } 5966 }
6813 '''); 5967 ''');
6814 } else { 5968 } else {
6815 checkElementText( 5969 checkElementText(library, r'''
6816 library,
6817 r'''
6818 class B<T> { 5970 class B<T> {
6819 const B(); 5971 const B();
6820 } 5972 }
6821 class C<T> { 5973 class C<T> {
6822 const C([B<T> b = const 5974 const C([B<T> b = const
6823 B/*location: test.dart;B*/()]); 5975 B/*location: test.dart;B*/()]);
6824 } 5976 }
6825 '''); 5977 ''');
6826 } 5978 }
6827 } 5979 }
6828 5980
6829 test_defaultValue_refersToGenericClass_constructor2() async { 5981 test_defaultValue_refersToGenericClass_constructor2() async {
6830 var library = await checkLibrary(''' 5982 var library = await checkLibrary('''
6831 abstract class A<T> {} 5983 abstract class A<T> {}
6832 class B<T> implements A<T> { 5984 class B<T> implements A<T> {
6833 const B(); 5985 const B();
6834 } 5986 }
6835 class C<T> implements A<Iterable<T>> { 5987 class C<T> implements A<Iterable<T>> {
6836 const C([A<T> a = const B()]); 5988 const C([A<T> a = const B()]);
6837 } 5989 }
6838 '''); 5990 ''');
6839 if (isStrongMode) { 5991 if (isStrongMode) {
6840 checkElementText( 5992 checkElementText(library, r'''
6841 library,
6842 r'''
6843 abstract class A<T> { 5993 abstract class A<T> {
6844 } 5994 }
6845 class B<T> implements A<T> { 5995 class B<T> implements A<T> {
6846 const B(); 5996 const B();
6847 } 5997 }
6848 class C<T> implements A<Iterable<T>> { 5998 class C<T> implements A<Iterable<T>> {
6849 const C([A<T> a = const 5999 const C([A<T> a = const
6850 B/*location: test.dart;B*/()]); 6000 B/*location: test.dart;B*/()]);
6851 } 6001 }
6852 '''); 6002 ''');
6853 } else { 6003 } else {
6854 checkElementText( 6004 checkElementText(library, r'''
6855 library,
6856 r'''
6857 abstract class A<T> { 6005 abstract class A<T> {
6858 } 6006 }
6859 class B<T> implements A<T> { 6007 class B<T> implements A<T> {
6860 const B(); 6008 const B();
6861 } 6009 }
6862 class C<T> implements A<Iterable<T>> { 6010 class C<T> implements A<Iterable<T>> {
6863 const C([A<T> a = const 6011 const C([A<T> a = const
6864 B/*location: test.dart;B*/()]); 6012 B/*location: test.dart;B*/()]);
6865 } 6013 }
6866 '''); 6014 ''');
6867 } 6015 }
6868 } 6016 }
6869 6017
6870 test_defaultValue_refersToGenericClass_functionG() async { 6018 test_defaultValue_refersToGenericClass_functionG() async {
6871 var library = await checkLibrary(''' 6019 var library = await checkLibrary('''
6872 class B<T> { 6020 class B<T> {
6873 const B(); 6021 const B();
6874 } 6022 }
6875 void foo<T>([B<T> b = const B()]) {} 6023 void foo<T>([B<T> b = const B()]) {}
6876 '''); 6024 ''');
6877 if (isStrongMode) { 6025 if (isStrongMode) {
6878 checkElementText( 6026 checkElementText(library, r'''
6879 library,
6880 r'''
6881 class B<T> { 6027 class B<T> {
6882 const B(); 6028 const B();
6883 } 6029 }
6884 void foo<T>([B<T> b = const 6030 void foo<T>([B<T> b = const
6885 B/*location: test.dart;B*/()]) {} 6031 B/*location: test.dart;B*/()]) {}
6886 '''); 6032 ''');
6887 } else { 6033 } else {
6888 checkElementText( 6034 checkElementText(library, r'''
6889 library,
6890 r'''
6891 class B<T> { 6035 class B<T> {
6892 const B(); 6036 const B();
6893 } 6037 }
6894 void foo<T>([B<T> b = const 6038 void foo<T>([B<T> b = const
6895 B/*location: test.dart;B*/()]) {} 6039 B/*location: test.dart;B*/()]) {}
6896 '''); 6040 ''');
6897 } 6041 }
6898 } 6042 }
6899 6043
6900 test_defaultValue_refersToGenericClass_methodG() async { 6044 test_defaultValue_refersToGenericClass_methodG() async {
6901 var library = await checkLibrary(''' 6045 var library = await checkLibrary('''
6902 class B<T> { 6046 class B<T> {
6903 const B(); 6047 const B();
6904 } 6048 }
6905 class C { 6049 class C {
6906 void foo<T>([B<T> b = const B()]) {} 6050 void foo<T>([B<T> b = const B()]) {}
6907 } 6051 }
6908 '''); 6052 ''');
6909 if (isStrongMode) { 6053 if (isStrongMode) {
6910 checkElementText( 6054 checkElementText(library, r'''
6911 library,
6912 r'''
6913 class B<T> { 6055 class B<T> {
6914 const B(); 6056 const B();
6915 } 6057 }
6916 class C { 6058 class C {
6917 void foo<T>([B<T> b = const 6059 void foo<T>([B<T> b = const
6918 B/*location: test.dart;B*/()]) {} 6060 B/*location: test.dart;B*/()]) {}
6919 } 6061 }
6920 '''); 6062 ''');
6921 } else { 6063 } else {
6922 checkElementText( 6064 checkElementText(library, r'''
6923 library,
6924 r'''
6925 class B<T> { 6065 class B<T> {
6926 const B(); 6066 const B();
6927 } 6067 }
6928 class C { 6068 class C {
6929 void foo<T>([B<T> b = const 6069 void foo<T>([B<T> b = const
6930 B/*location: test.dart;B*/()]) {} 6070 B/*location: test.dart;B*/()]) {}
6931 } 6071 }
6932 '''); 6072 ''');
6933 } 6073 }
6934 } 6074 }
6935 6075
6936 test_defaultValue_refersToGenericClass_methodG_classG() async { 6076 test_defaultValue_refersToGenericClass_methodG_classG() async {
6937 var library = await checkLibrary(''' 6077 var library = await checkLibrary('''
6938 class B<T1, T2> { 6078 class B<T1, T2> {
6939 const B(); 6079 const B();
6940 } 6080 }
6941 class C<E1> { 6081 class C<E1> {
6942 void foo<E2>([B<E1, E2> b = const B()]) {} 6082 void foo<E2>([B<E1, E2> b = const B()]) {}
6943 } 6083 }
6944 '''); 6084 ''');
6945 if (isStrongMode) { 6085 if (isStrongMode) {
6946 checkElementText( 6086 checkElementText(library, r'''
6947 library,
6948 r'''
6949 class B<T1, T2> { 6087 class B<T1, T2> {
6950 const B(); 6088 const B();
6951 } 6089 }
6952 class C<E1> { 6090 class C<E1> {
6953 void foo<E2>([B<E1, E2> b = const 6091 void foo<E2>([B<E1, E2> b = const
6954 B/*location: test.dart;B*/()]) {} 6092 B/*location: test.dart;B*/()]) {}
6955 } 6093 }
6956 '''); 6094 ''');
6957 } else { 6095 } else {
6958 checkElementText( 6096 checkElementText(library, r'''
6959 library,
6960 r'''
6961 class B<T1, T2> { 6097 class B<T1, T2> {
6962 const B(); 6098 const B();
6963 } 6099 }
6964 class C<E1> { 6100 class C<E1> {
6965 void foo<E2>([B<E1, E2> b = const 6101 void foo<E2>([B<E1, E2> b = const
6966 B/*location: test.dart;B*/()]) {} 6102 B/*location: test.dart;B*/()]) {}
6967 } 6103 }
6968 '''); 6104 ''');
6969 } 6105 }
6970 } 6106 }
6971 6107
6972 test_defaultValue_refersToGenericClass_methodNG() async { 6108 test_defaultValue_refersToGenericClass_methodNG() async {
6973 var library = await checkLibrary(''' 6109 var library = await checkLibrary('''
6974 class B<T> { 6110 class B<T> {
6975 const B(); 6111 const B();
6976 } 6112 }
6977 class C<T> { 6113 class C<T> {
6978 void foo([B<T> b = const B()]) {} 6114 void foo([B<T> b = const B()]) {}
6979 } 6115 }
6980 '''); 6116 ''');
6981 if (isStrongMode) { 6117 if (isStrongMode) {
6982 checkElementText( 6118 checkElementText(library, r'''
6983 library,
6984 r'''
6985 class B<T> { 6119 class B<T> {
6986 const B(); 6120 const B();
6987 } 6121 }
6988 class C<T> { 6122 class C<T> {
6989 void foo([B<T> b = const 6123 void foo([B<T> b = const
6990 B/*location: test.dart;B*/()]) {} 6124 B/*location: test.dart;B*/()]) {}
6991 } 6125 }
6992 '''); 6126 ''');
6993 } else { 6127 } else {
6994 checkElementText( 6128 checkElementText(library, r'''
6995 library,
6996 r'''
6997 class B<T> { 6129 class B<T> {
6998 const B(); 6130 const B();
6999 } 6131 }
7000 class C<T> { 6132 class C<T> {
7001 void foo([B<T> b = const 6133 void foo([B<T> b = const
7002 B/*location: test.dart;B*/()]) {} 6134 B/*location: test.dart;B*/()]) {}
7003 } 6135 }
7004 '''); 6136 ''');
7005 } 6137 }
7006 } 6138 }
7007 6139
7008 test_enum_documented() async { 6140 test_enum_documented() async {
7009 var library = await checkLibrary(''' 6141 var library = await checkLibrary('''
7010 // Extra comment so doc comment offset != 0 6142 // Extra comment so doc comment offset != 0
7011 /** 6143 /**
7012 * Docs 6144 * Docs
7013 */ 6145 */
7014 enum E { v }'''); 6146 enum E { v }''');
7015 if (isStrongMode) { 6147 if (isStrongMode) {
7016 checkElementText( 6148 checkElementText(library, r'''
7017 library,
7018 r'''
7019 /** 6149 /**
7020 * Docs 6150 * Docs
7021 */ 6151 */
7022 enum E { 6152 enum E {
7023 synthetic final int index; 6153 synthetic final int index;
7024 synthetic static const List<E> values; 6154 synthetic static const List<E> values;
7025 static const E v; 6155 static const E v;
7026 } 6156 }
7027 '''); 6157 ''');
7028 } else { 6158 } else {
7029 checkElementText( 6159 checkElementText(library, r'''
7030 library,
7031 r'''
7032 /** 6160 /**
7033 * Docs 6161 * Docs
7034 */ 6162 */
7035 enum E { 6163 enum E {
7036 synthetic final int index; 6164 synthetic final int index;
7037 synthetic static const List<E> values; 6165 synthetic static const List<E> values;
7038 static const E v; 6166 static const E v;
7039 } 6167 }
7040 '''); 6168 ''');
7041 } 6169 }
7042 } 6170 }
7043 6171
7044 test_enum_value_documented() async { 6172 test_enum_value_documented() async {
7045 var library = await checkLibrary(''' 6173 var library = await checkLibrary('''
7046 enum E { 6174 enum E {
7047 /** 6175 /**
7048 * Docs 6176 * Docs
7049 */ 6177 */
7050 v 6178 v
7051 }'''); 6179 }''');
7052 if (isStrongMode) { 6180 if (isStrongMode) {
7053 checkElementText( 6181 checkElementText(library, r'''
7054 library,
7055 r'''
7056 enum E { 6182 enum E {
7057 synthetic final int index; 6183 synthetic final int index;
7058 synthetic static const List<E> values; 6184 synthetic static const List<E> values;
7059 /** 6185 /**
7060 * Docs 6186 * Docs
7061 */ 6187 */
7062 static const E v; 6188 static const E v;
7063 } 6189 }
7064 '''); 6190 ''');
7065 } else { 6191 } else {
7066 checkElementText( 6192 checkElementText(library, r'''
7067 library,
7068 r'''
7069 enum E { 6193 enum E {
7070 synthetic final int index; 6194 synthetic final int index;
7071 synthetic static const List<E> values; 6195 synthetic static const List<E> values;
7072 /** 6196 /**
7073 * Docs 6197 * Docs
7074 */ 6198 */
7075 static const E v; 6199 static const E v;
7076 } 6200 }
7077 '''); 6201 ''');
7078 } 6202 }
7079 } 6203 }
7080 6204
7081 test_enum_values() async { 6205 test_enum_values() async {
7082 var library = await checkLibrary('enum E { v1, v2 }'); 6206 var library = await checkLibrary('enum E { v1, v2 }');
7083 if (isStrongMode) { 6207 if (isStrongMode) {
7084 checkElementText( 6208 checkElementText(library, r'''
7085 library,
7086 r'''
7087 enum E { 6209 enum E {
7088 synthetic final int index; 6210 synthetic final int index;
7089 synthetic static const List<E> values; 6211 synthetic static const List<E> values;
7090 static const E v1; 6212 static const E v1;
7091 static const E v2; 6213 static const E v2;
7092 } 6214 }
7093 '''); 6215 ''');
7094 } else { 6216 } else {
7095 checkElementText( 6217 checkElementText(library, r'''
7096 library,
7097 r'''
7098 enum E { 6218 enum E {
7099 synthetic final int index; 6219 synthetic final int index;
7100 synthetic static const List<E> values; 6220 synthetic static const List<E> values;
7101 static const E v1; 6221 static const E v1;
7102 static const E v2; 6222 static const E v2;
7103 } 6223 }
7104 '''); 6224 ''');
7105 } 6225 }
7106 } 6226 }
7107 6227
7108 test_enums() async { 6228 test_enums() async {
7109 var library = await checkLibrary('enum E1 { v1 } enum E2 { v2 }'); 6229 var library = await checkLibrary('enum E1 { v1 } enum E2 { v2 }');
7110 if (isStrongMode) { 6230 if (isStrongMode) {
7111 checkElementText( 6231 checkElementText(library, r'''
7112 library,
7113 r'''
7114 enum E1 { 6232 enum E1 {
7115 synthetic final int index; 6233 synthetic final int index;
7116 synthetic static const List<E1> values; 6234 synthetic static const List<E1> values;
7117 static const E1 v1; 6235 static const E1 v1;
7118 } 6236 }
7119 enum E2 { 6237 enum E2 {
7120 synthetic final int index; 6238 synthetic final int index;
7121 synthetic static const List<E2> values; 6239 synthetic static const List<E2> values;
7122 static const E2 v2; 6240 static const E2 v2;
7123 } 6241 }
7124 '''); 6242 ''');
7125 } else { 6243 } else {
7126 checkElementText( 6244 checkElementText(library, r'''
7127 library,
7128 r'''
7129 enum E1 { 6245 enum E1 {
7130 synthetic final int index; 6246 synthetic final int index;
7131 synthetic static const List<E1> values; 6247 synthetic static const List<E1> values;
7132 static const E1 v1; 6248 static const E1 v1;
7133 } 6249 }
7134 enum E2 { 6250 enum E2 {
7135 synthetic final int index; 6251 synthetic final int index;
7136 synthetic static const List<E2> values; 6252 synthetic static const List<E2> values;
7137 static const E2 v2; 6253 static const E2 v2;
7138 } 6254 }
(...skipping 15 matching lines...) Expand all
7154 foo() {} 6270 foo() {}
7155 } 6271 }
7156 6272
7157 class C extends Object with E, M { 6273 class C extends Object with E, M {
7158 foo() {} 6274 foo() {}
7159 } 6275 }
7160 6276
7161 class D = Object with M, E; 6277 class D = Object with M, E;
7162 '''); 6278 ''');
7163 if (isStrongMode) { 6279 if (isStrongMode) {
7164 checkElementText( 6280 checkElementText(library, r'''
7165 library,
7166 r'''
7167 enum E { 6281 enum E {
7168 synthetic final int index; 6282 synthetic final int index;
7169 synthetic static const List<E> values; 6283 synthetic static const List<E> values;
7170 static const E a; 6284 static const E a;
7171 static const E b; 6285 static const E b;
7172 static const E c; 6286 static const E c;
7173 } 6287 }
7174 class M { 6288 class M {
7175 } 6289 }
7176 class A { 6290 class A {
7177 dynamic foo() {} 6291 dynamic foo() {}
7178 } 6292 }
7179 class B implements M { 6293 class B implements M {
7180 dynamic foo() {} 6294 dynamic foo() {}
7181 } 6295 }
7182 class C extends Object with M { 6296 class C extends Object with M {
7183 synthetic C(); 6297 synthetic C();
7184 dynamic foo() {} 6298 dynamic foo() {}
7185 } 6299 }
7186 class alias D extends Object with M { 6300 class alias D extends Object with M {
7187 synthetic D() = Object; 6301 synthetic D() = Object;
7188 } 6302 }
7189 '''); 6303 ''');
7190 } else { 6304 } else {
7191 checkElementText( 6305 checkElementText(library, r'''
7192 library,
7193 r'''
7194 enum E { 6306 enum E {
7195 synthetic final int index; 6307 synthetic final int index;
7196 synthetic static const List<E> values; 6308 synthetic static const List<E> values;
7197 static const E a; 6309 static const E a;
7198 static const E b; 6310 static const E b;
7199 static const E c; 6311 static const E c;
7200 } 6312 }
7201 class M { 6313 class M {
7202 } 6314 }
7203 class A { 6315 class A {
(...skipping 12 matching lines...) Expand all
7216 '''); 6328 ''');
7217 } 6329 }
7218 } 6330 }
7219 6331
7220 test_executable_parameter_type_typedef() async { 6332 test_executable_parameter_type_typedef() async {
7221 var library = await checkLibrary(r''' 6333 var library = await checkLibrary(r'''
7222 typedef F(int p); 6334 typedef F(int p);
7223 main(F f) {} 6335 main(F f) {}
7224 '''); 6336 ''');
7225 if (isStrongMode) { 6337 if (isStrongMode) {
7226 checkElementText( 6338 checkElementText(library, r'''
7227 library,
7228 r'''
7229 typedef dynamic F(int p); 6339 typedef dynamic F(int p);
7230 dynamic main(F f) {} 6340 dynamic main(F f) {}
7231 '''); 6341 ''');
7232 } else { 6342 } else {
7233 checkElementText( 6343 checkElementText(library, r'''
7234 library,
7235 r'''
7236 typedef dynamic F(int p); 6344 typedef dynamic F(int p);
7237 dynamic main(F f) {} 6345 dynamic main(F f) {}
7238 '''); 6346 ''');
7239 } 6347 }
7240 } 6348 }
7241 6349
7242 test_export_class() async { 6350 test_export_class() async {
7243 addLibrarySource('/a.dart', 'class C {}'); 6351 addLibrarySource('/a.dart', 'class C {}');
7244 var library = await checkLibrary('export "a.dart";'); 6352 var library = await checkLibrary('export "a.dart";');
7245 if (isStrongMode) { 6353 if (isStrongMode) {
7246 checkElementText( 6354 checkElementText(library, r'''
7247 library,
7248 r'''
7249 export 'a.dart'; 6355 export 'a.dart';
7250 '''); 6356 ''');
7251 } else { 6357 } else {
7252 checkElementText( 6358 checkElementText(library, r'''
7253 library,
7254 r'''
7255 export 'a.dart'; 6359 export 'a.dart';
7256 '''); 6360 ''');
7257 } 6361 }
7258 } 6362 }
7259 6363
7260 test_export_class_type_alias() async { 6364 test_export_class_type_alias() async {
7261 addLibrarySource( 6365 addLibrarySource(
7262 '/a.dart', 'class C {} exends _D with _E; class _D {} class _E {}'); 6366 '/a.dart', 'class C {} exends _D with _E; class _D {} class _E {}');
7263 var library = await checkLibrary('export "a.dart";'); 6367 var library = await checkLibrary('export "a.dart";');
7264 if (isStrongMode) { 6368 if (isStrongMode) {
7265 checkElementText( 6369 checkElementText(library, r'''
7266 library,
7267 r'''
7268 export 'a.dart'; 6370 export 'a.dart';
7269 '''); 6371 ''');
7270 } else { 6372 } else {
7271 checkElementText( 6373 checkElementText(library, r'''
7272 library,
7273 r'''
7274 export 'a.dart'; 6374 export 'a.dart';
7275 '''); 6375 ''');
7276 } 6376 }
7277 } 6377 }
7278 6378
7279 test_export_configurations_useDefault() async { 6379 test_export_configurations_useDefault() async {
7280 context.declaredVariables.define('dart.library.io', 'false'); 6380 context.declaredVariables.define('dart.library.io', 'false');
7281 addLibrarySource('/foo.dart', 'class A {}'); 6381 addLibrarySource('/foo.dart', 'class A {}');
7282 addLibrarySource('/foo_io.dart', 'class A {}'); 6382 addLibrarySource('/foo_io.dart', 'class A {}');
7283 addLibrarySource('/foo_html.dart', 'class A {}'); 6383 addLibrarySource('/foo_html.dart', 'class A {}');
7284 var library = await checkLibrary(r''' 6384 var library = await checkLibrary(r'''
7285 export 'foo.dart' 6385 export 'foo.dart'
7286 if (dart.library.io) 'foo_io.dart' 6386 if (dart.library.io) 'foo_io.dart'
7287 if (dart.library.html) 'foo_html.dart'; 6387 if (dart.library.html) 'foo_html.dart';
7288 '''); 6388 ''');
7289 if (isStrongMode) { 6389 if (isStrongMode) {
7290 checkElementText( 6390 checkElementText(library, r'''
7291 library,
7292 r'''
7293 export 'foo.dart'; 6391 export 'foo.dart';
7294 '''); 6392 ''');
7295 } else { 6393 } else {
7296 checkElementText( 6394 checkElementText(library, r'''
7297 library,
7298 r'''
7299 export 'foo.dart'; 6395 export 'foo.dart';
7300 '''); 6396 ''');
7301 } 6397 }
7302 expect(library.exports[0].uri, 'foo.dart'); 6398 expect(library.exports[0].uri, 'foo.dart');
7303 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart'); 6399 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart');
7304 } 6400 }
7305 6401
7306 test_export_configurations_useFirst() async { 6402 test_export_configurations_useFirst() async {
7307 context.declaredVariables.define('dart.library.io', 'true'); 6403 context.declaredVariables.define('dart.library.io', 'true');
7308 context.declaredVariables.define('dart.library.html', 'true'); 6404 context.declaredVariables.define('dart.library.html', 'true');
7309 addLibrarySource('/foo.dart', 'class A {}'); 6405 addLibrarySource('/foo.dart', 'class A {}');
7310 addLibrarySource('/foo_io.dart', 'class A {}'); 6406 addLibrarySource('/foo_io.dart', 'class A {}');
7311 addLibrarySource('/foo_html.dart', 'class A {}'); 6407 addLibrarySource('/foo_html.dart', 'class A {}');
7312 var library = await checkLibrary(r''' 6408 var library = await checkLibrary(r'''
7313 export 'foo.dart' 6409 export 'foo.dart'
7314 if (dart.library.io) 'foo_io.dart' 6410 if (dart.library.io) 'foo_io.dart'
7315 if (dart.library.html) 'foo_html.dart'; 6411 if (dart.library.html) 'foo_html.dart';
7316 '''); 6412 ''');
7317 if (isStrongMode) { 6413 if (isStrongMode) {
7318 checkElementText( 6414 checkElementText(library, r'''
7319 library,
7320 r'''
7321 export 'foo_io.dart'; 6415 export 'foo_io.dart';
7322 '''); 6416 ''');
7323 } else { 6417 } else {
7324 checkElementText( 6418 checkElementText(library, r'''
7325 library,
7326 r'''
7327 export 'foo_io.dart'; 6419 export 'foo_io.dart';
7328 '''); 6420 ''');
7329 } 6421 }
7330 expect(library.exports[0].uri, 'foo_io.dart'); 6422 expect(library.exports[0].uri, 'foo_io.dart');
7331 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart'); 6423 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart');
7332 } 6424 }
7333 6425
7334 test_export_configurations_useSecond() async { 6426 test_export_configurations_useSecond() async {
7335 context.declaredVariables.define('dart.library.io', 'false'); 6427 context.declaredVariables.define('dart.library.io', 'false');
7336 context.declaredVariables.define('dart.library.html', 'true'); 6428 context.declaredVariables.define('dart.library.html', 'true');
7337 addLibrarySource('/foo.dart', 'class A {}'); 6429 addLibrarySource('/foo.dart', 'class A {}');
7338 addLibrarySource('/foo_io.dart', 'class A {}'); 6430 addLibrarySource('/foo_io.dart', 'class A {}');
7339 addLibrarySource('/foo_html.dart', 'class A {}'); 6431 addLibrarySource('/foo_html.dart', 'class A {}');
7340 var library = await checkLibrary(r''' 6432 var library = await checkLibrary(r'''
7341 export 'foo.dart' 6433 export 'foo.dart'
7342 if (dart.library.io) 'foo_io.dart' 6434 if (dart.library.io) 'foo_io.dart'
7343 if (dart.library.html) 'foo_html.dart'; 6435 if (dart.library.html) 'foo_html.dart';
7344 '''); 6436 ''');
7345 if (isStrongMode) { 6437 if (isStrongMode) {
7346 checkElementText( 6438 checkElementText(library, r'''
7347 library,
7348 r'''
7349 export 'foo_html.dart'; 6439 export 'foo_html.dart';
7350 '''); 6440 ''');
7351 } else { 6441 } else {
7352 checkElementText( 6442 checkElementText(library, r'''
7353 library,
7354 r'''
7355 export 'foo_html.dart'; 6443 export 'foo_html.dart';
7356 '''); 6444 ''');
7357 } 6445 }
7358 ExportElement export = library.exports[0]; 6446 ExportElement export = library.exports[0];
7359 expect(export.uri, 'foo_html.dart'); 6447 expect(export.uri, 'foo_html.dart');
7360 expect(export.exportedLibrary.source.shortName, 'foo_html.dart'); 6448 expect(export.exportedLibrary.source.shortName, 'foo_html.dart');
7361 } 6449 }
7362 6450
7363 test_export_function() async { 6451 test_export_function() async {
7364 addLibrarySource('/a.dart', 'f() {}'); 6452 addLibrarySource('/a.dart', 'f() {}');
7365 var library = await checkLibrary('export "a.dart";'); 6453 var library = await checkLibrary('export "a.dart";');
7366 if (isStrongMode) { 6454 if (isStrongMode) {
7367 checkElementText( 6455 checkElementText(library, r'''
7368 library,
7369 r'''
7370 export 'a.dart'; 6456 export 'a.dart';
7371 '''); 6457 ''');
7372 } else { 6458 } else {
7373 checkElementText( 6459 checkElementText(library, r'''
7374 library,
7375 r'''
7376 export 'a.dart'; 6460 export 'a.dart';
7377 '''); 6461 ''');
7378 } 6462 }
7379 } 6463 }
7380 6464
7381 test_export_getter() async { 6465 test_export_getter() async {
7382 addLibrarySource('/a.dart', 'get f() => null;'); 6466 addLibrarySource('/a.dart', 'get f() => null;');
7383 var library = await checkLibrary('export "a.dart";'); 6467 var library = await checkLibrary('export "a.dart";');
7384 if (isStrongMode) { 6468 if (isStrongMode) {
7385 checkElementText( 6469 checkElementText(library, r'''
7386 library,
7387 r'''
7388 export 'a.dart'; 6470 export 'a.dart';
7389 '''); 6471 ''');
7390 } else { 6472 } else {
7391 checkElementText( 6473 checkElementText(library, r'''
7392 library,
7393 r'''
7394 export 'a.dart'; 6474 export 'a.dart';
7395 '''); 6475 ''');
7396 } 6476 }
7397 } 6477 }
7398 6478
7399 test_export_hide() async { 6479 test_export_hide() async {
7400 addLibrary('dart:async'); 6480 addLibrary('dart:async');
7401 var library = 6481 var library =
7402 await checkLibrary('export "dart:async" hide Stream, Future;'); 6482 await checkLibrary('export "dart:async" hide Stream, Future;');
7403 if (isStrongMode) { 6483 if (isStrongMode) {
7404 checkElementText( 6484 checkElementText(library, r'''
7405 library,
7406 r'''
7407 export 'dart:async' hide Stream, Future; 6485 export 'dart:async' hide Stream, Future;
7408 '''); 6486 ''');
7409 } else { 6487 } else {
7410 checkElementText( 6488 checkElementText(library, r'''
7411 library,
7412 r'''
7413 export 'dart:async' hide Stream, Future; 6489 export 'dart:async' hide Stream, Future;
7414 '''); 6490 ''');
7415 } 6491 }
7416 } 6492 }
7417 6493
7418 test_export_multiple_combinators() async { 6494 test_export_multiple_combinators() async {
7419 addLibrary('dart:async'); 6495 addLibrary('dart:async');
7420 var library = 6496 var library =
7421 await checkLibrary('export "dart:async" hide Stream show Future;'); 6497 await checkLibrary('export "dart:async" hide Stream show Future;');
7422 if (isStrongMode) { 6498 if (isStrongMode) {
7423 checkElementText( 6499 checkElementText(library, r'''
7424 library,
7425 r'''
7426 export 'dart:async' hide Stream show Future; 6500 export 'dart:async' hide Stream show Future;
7427 '''); 6501 ''');
7428 } else { 6502 } else {
7429 checkElementText( 6503 checkElementText(library, r'''
7430 library,
7431 r'''
7432 export 'dart:async' hide Stream show Future; 6504 export 'dart:async' hide Stream show Future;
7433 '''); 6505 ''');
7434 } 6506 }
7435 } 6507 }
7436 6508
7437 test_export_setter() async { 6509 test_export_setter() async {
7438 addLibrarySource('/a.dart', 'void set f(value) {}'); 6510 addLibrarySource('/a.dart', 'void set f(value) {}');
7439 var library = await checkLibrary('export "a.dart";'); 6511 var library = await checkLibrary('export "a.dart";');
7440 if (isStrongMode) { 6512 if (isStrongMode) {
7441 checkElementText( 6513 checkElementText(library, r'''
7442 library,
7443 r'''
7444 export 'a.dart'; 6514 export 'a.dart';
7445 '''); 6515 ''');
7446 } else { 6516 } else {
7447 checkElementText( 6517 checkElementText(library, r'''
7448 library,
7449 r'''
7450 export 'a.dart'; 6518 export 'a.dart';
7451 '''); 6519 ''');
7452 } 6520 }
7453 } 6521 }
7454 6522
7455 test_export_show() async { 6523 test_export_show() async {
7456 addLibrary('dart:async'); 6524 addLibrary('dart:async');
7457 var library = 6525 var library =
7458 await checkLibrary('export "dart:async" show Future, Stream;'); 6526 await checkLibrary('export "dart:async" show Future, Stream;');
7459 if (isStrongMode) { 6527 if (isStrongMode) {
7460 checkElementText( 6528 checkElementText(library, r'''
7461 library,
7462 r'''
7463 export 'dart:async' show Future, Stream; 6529 export 'dart:async' show Future, Stream;
7464 '''); 6530 ''');
7465 } else { 6531 } else {
7466 checkElementText( 6532 checkElementText(library, r'''
7467 library,
7468 r'''
7469 export 'dart:async' show Future, Stream; 6533 export 'dart:async' show Future, Stream;
7470 '''); 6534 ''');
7471 } 6535 }
7472 } 6536 }
7473 6537
7474 test_export_typedef() async { 6538 test_export_typedef() async {
7475 addLibrarySource('/a.dart', 'typedef F();'); 6539 addLibrarySource('/a.dart', 'typedef F();');
7476 var library = await checkLibrary('export "a.dart";'); 6540 var library = await checkLibrary('export "a.dart";');
7477 if (isStrongMode) { 6541 if (isStrongMode) {
7478 checkElementText( 6542 checkElementText(library, r'''
7479 library,
7480 r'''
7481 export 'a.dart'; 6543 export 'a.dart';
7482 '''); 6544 ''');
7483 } else { 6545 } else {
7484 checkElementText( 6546 checkElementText(library, r'''
7485 library,
7486 r'''
7487 export 'a.dart'; 6547 export 'a.dart';
7488 '''); 6548 ''');
7489 } 6549 }
7490 } 6550 }
7491 6551
7492 test_export_variable() async { 6552 test_export_variable() async {
7493 addLibrarySource('/a.dart', 'var x;'); 6553 addLibrarySource('/a.dart', 'var x;');
7494 var library = await checkLibrary('export "a.dart";'); 6554 var library = await checkLibrary('export "a.dart";');
7495 if (isStrongMode) { 6555 if (isStrongMode) {
7496 checkElementText( 6556 checkElementText(library, r'''
7497 library,
7498 r'''
7499 export 'a.dart'; 6557 export 'a.dart';
7500 '''); 6558 ''');
7501 } else { 6559 } else {
7502 checkElementText( 6560 checkElementText(library, r'''
7503 library,
7504 r'''
7505 export 'a.dart'; 6561 export 'a.dart';
7506 '''); 6562 ''');
7507 } 6563 }
7508 } 6564 }
7509 6565
7510 test_export_variable_const() async { 6566 test_export_variable_const() async {
7511 addLibrarySource('/a.dart', 'const x = 0;'); 6567 addLibrarySource('/a.dart', 'const x = 0;');
7512 var library = await checkLibrary('export "a.dart";'); 6568 var library = await checkLibrary('export "a.dart";');
7513 if (isStrongMode) { 6569 if (isStrongMode) {
7514 checkElementText( 6570 checkElementText(library, r'''
7515 library,
7516 r'''
7517 export 'a.dart'; 6571 export 'a.dart';
7518 '''); 6572 ''');
7519 } else { 6573 } else {
7520 checkElementText( 6574 checkElementText(library, r'''
7521 library,
7522 r'''
7523 export 'a.dart'; 6575 export 'a.dart';
7524 '''); 6576 ''');
7525 } 6577 }
7526 } 6578 }
7527 6579
7528 test_export_variable_final() async { 6580 test_export_variable_final() async {
7529 addLibrarySource('/a.dart', 'final x = 0;'); 6581 addLibrarySource('/a.dart', 'final x = 0;');
7530 var library = await checkLibrary('export "a.dart";'); 6582 var library = await checkLibrary('export "a.dart";');
7531 if (isStrongMode) { 6583 if (isStrongMode) {
7532 checkElementText( 6584 checkElementText(library, r'''
7533 library,
7534 r'''
7535 export 'a.dart'; 6585 export 'a.dart';
7536 '''); 6586 ''');
7537 } else { 6587 } else {
7538 checkElementText( 6588 checkElementText(library, r'''
7539 library,
7540 r'''
7541 export 'a.dart'; 6589 export 'a.dart';
7542 '''); 6590 ''');
7543 } 6591 }
7544 } 6592 }
7545 6593
7546 test_exportImport_configurations_useDefault() async { 6594 test_exportImport_configurations_useDefault() async {
7547 context.declaredVariables.define('dart.library.io', 'false'); 6595 context.declaredVariables.define('dart.library.io', 'false');
7548 addLibrarySource('/foo.dart', 'class A {}'); 6596 addLibrarySource('/foo.dart', 'class A {}');
7549 addLibrarySource('/foo_io.dart', 'class A {}'); 6597 addLibrarySource('/foo_io.dart', 'class A {}');
7550 addLibrarySource('/foo_html.dart', 'class A {}'); 6598 addLibrarySource('/foo_html.dart', 'class A {}');
7551 addLibrarySource( 6599 addLibrarySource('/bar.dart', r'''
7552 '/bar.dart',
7553 r'''
7554 export 'foo.dart' 6600 export 'foo.dart'
7555 if (dart.library.io) 'foo_io.dart' 6601 if (dart.library.io) 'foo_io.dart'
7556 if (dart.library.html) 'foo_html.dart'; 6602 if (dart.library.html) 'foo_html.dart';
7557 '''); 6603 ''');
7558 var library = await checkLibrary(r''' 6604 var library = await checkLibrary(r'''
7559 import 'bar.dart'; 6605 import 'bar.dart';
7560 class B extends A {} 6606 class B extends A {}
7561 '''); 6607 ''');
7562 if (isStrongMode) { 6608 if (isStrongMode) {
7563 checkElementText( 6609 checkElementText(library, r'''
7564 library,
7565 r'''
7566 import 'bar.dart'; 6610 import 'bar.dart';
7567 class B extends A { 6611 class B extends A {
7568 } 6612 }
7569 '''); 6613 ''');
7570 } else { 6614 } else {
7571 checkElementText( 6615 checkElementText(library, r'''
7572 library,
7573 r'''
7574 import 'bar.dart'; 6616 import 'bar.dart';
7575 class B extends A { 6617 class B extends A {
7576 } 6618 }
7577 '''); 6619 ''');
7578 } 6620 }
7579 var typeA = library.definingCompilationUnit.getType('B').supertype; 6621 var typeA = library.definingCompilationUnit.getType('B').supertype;
7580 expect(typeA.element.source.shortName, 'foo.dart'); 6622 expect(typeA.element.source.shortName, 'foo.dart');
7581 } 6623 }
7582 6624
7583 test_exportImport_configurations_useFirst() async { 6625 test_exportImport_configurations_useFirst() async {
7584 context.declaredVariables.define('dart.library.io', 'true'); 6626 context.declaredVariables.define('dart.library.io', 'true');
7585 context.declaredVariables.define('dart.library.html', 'true'); 6627 context.declaredVariables.define('dart.library.html', 'true');
7586 addLibrarySource('/foo.dart', 'class A {}'); 6628 addLibrarySource('/foo.dart', 'class A {}');
7587 addLibrarySource('/foo_io.dart', 'class A {}'); 6629 addLibrarySource('/foo_io.dart', 'class A {}');
7588 addLibrarySource('/foo_html.dart', 'class A {}'); 6630 addLibrarySource('/foo_html.dart', 'class A {}');
7589 addLibrarySource( 6631 addLibrarySource('/bar.dart', r'''
7590 '/bar.dart',
7591 r'''
7592 export 'foo.dart' 6632 export 'foo.dart'
7593 if (dart.library.io) 'foo_io.dart' 6633 if (dart.library.io) 'foo_io.dart'
7594 if (dart.library.html) 'foo_html.dart'; 6634 if (dart.library.html) 'foo_html.dart';
7595 '''); 6635 ''');
7596 var library = await checkLibrary(r''' 6636 var library = await checkLibrary(r'''
7597 import 'bar.dart'; 6637 import 'bar.dart';
7598 class B extends A {} 6638 class B extends A {}
7599 '''); 6639 ''');
7600 if (isStrongMode) { 6640 if (isStrongMode) {
7601 checkElementText( 6641 checkElementText(library, r'''
7602 library,
7603 r'''
7604 import 'bar.dart'; 6642 import 'bar.dart';
7605 class B extends A { 6643 class B extends A {
7606 } 6644 }
7607 '''); 6645 ''');
7608 } else { 6646 } else {
7609 checkElementText( 6647 checkElementText(library, r'''
7610 library,
7611 r'''
7612 import 'bar.dart'; 6648 import 'bar.dart';
7613 class B extends A { 6649 class B extends A {
7614 } 6650 }
7615 '''); 6651 ''');
7616 } 6652 }
7617 var typeA = library.definingCompilationUnit.getType('B').supertype; 6653 var typeA = library.definingCompilationUnit.getType('B').supertype;
7618 expect(typeA.element.source.shortName, 'foo_io.dart'); 6654 expect(typeA.element.source.shortName, 'foo_io.dart');
7619 } 6655 }
7620 6656
7621 test_exports() async { 6657 test_exports() async {
7622 addLibrarySource('/a.dart', 'library a;'); 6658 addLibrarySource('/a.dart', 'library a;');
7623 addLibrarySource('/b.dart', 'library b;'); 6659 addLibrarySource('/b.dart', 'library b;');
7624 var library = await checkLibrary('export "a.dart"; export "b.dart";'); 6660 var library = await checkLibrary('export "a.dart"; export "b.dart";');
7625 if (isStrongMode) { 6661 if (isStrongMode) {
7626 checkElementText( 6662 checkElementText(library, r'''
7627 library,
7628 r'''
7629 export 'a.dart'; 6663 export 'a.dart';
7630 export 'b.dart'; 6664 export 'b.dart';
7631 '''); 6665 ''');
7632 } else { 6666 } else {
7633 checkElementText( 6667 checkElementText(library, r'''
7634 library,
7635 r'''
7636 export 'a.dart'; 6668 export 'a.dart';
7637 export 'b.dart'; 6669 export 'b.dart';
7638 '''); 6670 ''');
7639 } 6671 }
7640 } 6672 }
7641 6673
7642 test_expr_invalid_typeParameter_asPrefix() async { 6674 test_expr_invalid_typeParameter_asPrefix() async {
7643 variablesWithNotConstInitializers.add('f'); 6675 variablesWithNotConstInitializers.add('f');
7644 var library = await checkLibrary(''' 6676 var library = await checkLibrary('''
7645 class C<T> { 6677 class C<T> {
7646 final f = T.k; 6678 final f = T.k;
7647 } 6679 }
7648 '''); 6680 ''');
7649 if (isStrongMode) { 6681 if (isStrongMode) {
7650 checkElementText( 6682 checkElementText(library, r'''
7651 library,
7652 r'''
7653 class C<T> { 6683 class C<T> {
7654 final dynamic f = 6684 final dynamic f =
7655 $$invalidConstExpr$$/*location: null*/; 6685 $$invalidConstExpr$$/*location: null*/;
7656 } 6686 }
7657 '''); 6687 ''');
7658 } else { 6688 } else {
7659 checkElementText( 6689 checkElementText(library, r'''
7660 library,
7661 r'''
7662 class C<T> { 6690 class C<T> {
7663 final dynamic f = 6691 final dynamic f =
7664 $$invalidConstExpr$$/*location: null*/; 6692 $$invalidConstExpr$$/*location: null*/;
7665 } 6693 }
7666 '''); 6694 ''');
7667 } 6695 }
7668 } 6696 }
7669 6697
7670 test_field_covariant() async { 6698 test_field_covariant() async {
7671 var library = await checkLibrary(''' 6699 var library = await checkLibrary('''
7672 class C { 6700 class C {
7673 covariant int x; 6701 covariant int x;
7674 }'''); 6702 }''');
7675 if (isStrongMode) { 6703 if (isStrongMode) {
7676 checkElementText( 6704 checkElementText(library, r'''
7677 library,
7678 r'''
7679 class C { 6705 class C {
7680 covariant int x; 6706 covariant int x;
7681 } 6707 }
7682 '''); 6708 ''');
7683 } else { 6709 } else {
7684 checkElementText( 6710 checkElementText(library, r'''
7685 library,
7686 r'''
7687 class C { 6711 class C {
7688 covariant int x; 6712 covariant int x;
7689 } 6713 }
7690 '''); 6714 ''');
7691 } 6715 }
7692 } 6716 }
7693 6717
7694 test_field_documented() async { 6718 test_field_documented() async {
7695 var library = await checkLibrary(''' 6719 var library = await checkLibrary('''
7696 class C { 6720 class C {
7697 /** 6721 /**
7698 * Docs 6722 * Docs
7699 */ 6723 */
7700 var x; 6724 var x;
7701 }'''); 6725 }''');
7702 if (isStrongMode) { 6726 if (isStrongMode) {
7703 checkElementText( 6727 checkElementText(library, r'''
7704 library,
7705 r'''
7706 class C { 6728 class C {
7707 /** 6729 /**
7708 * Docs 6730 * Docs
7709 */ 6731 */
7710 dynamic x; 6732 dynamic x;
7711 } 6733 }
7712 '''); 6734 ''');
7713 } else { 6735 } else {
7714 checkElementText( 6736 checkElementText(library, r'''
7715 library,
7716 r'''
7717 class C { 6737 class C {
7718 /** 6738 /**
7719 * Docs 6739 * Docs
7720 */ 6740 */
7721 dynamic x; 6741 dynamic x;
7722 } 6742 }
7723 '''); 6743 ''');
7724 } 6744 }
7725 } 6745 }
7726 6746
7727 test_field_formal_param_inferred_type_implicit() async { 6747 test_field_formal_param_inferred_type_implicit() async {
7728 var library = await checkLibrary('class C extends D { var v; C(this.v); }' 6748 var library = await checkLibrary('class C extends D { var v; C(this.v); }'
7729 ' abstract class D { int get v; }'); 6749 ' abstract class D { int get v; }');
7730 if (isStrongMode) { 6750 if (isStrongMode) {
7731 checkElementText( 6751 checkElementText(library, r'''
7732 library,
7733 r'''
7734 class C extends D { 6752 class C extends D {
7735 int v; 6753 int v;
7736 C(int this.v); 6754 C(int this.v);
7737 } 6755 }
7738 abstract class D { 6756 abstract class D {
7739 int get v; 6757 int get v;
7740 } 6758 }
7741 '''); 6759 ''');
7742 } else { 6760 } else {
7743 checkElementText( 6761 checkElementText(library, r'''
7744 library,
7745 r'''
7746 class C extends D { 6762 class C extends D {
7747 dynamic v; 6763 dynamic v;
7748 C(dynamic this.v); 6764 C(dynamic this.v);
7749 } 6765 }
7750 abstract class D { 6766 abstract class D {
7751 int get v; 6767 int get v;
7752 } 6768 }
7753 '''); 6769 ''');
7754 } 6770 }
7755 } 6771 }
7756 6772
7757 test_field_inferred_type_nonStatic_explicit_initialized() async { 6773 test_field_inferred_type_nonStatic_explicit_initialized() async {
7758 var library = await checkLibrary('class C { num v = 0; }'); 6774 var library = await checkLibrary('class C { num v = 0; }');
7759 if (isStrongMode) { 6775 if (isStrongMode) {
7760 checkElementText( 6776 checkElementText(library, r'''
7761 library,
7762 r'''
7763 class C { 6777 class C {
7764 num v; 6778 num v;
7765 } 6779 }
7766 '''); 6780 ''');
7767 } else { 6781 } else {
7768 checkElementText( 6782 checkElementText(library, r'''
7769 library,
7770 r'''
7771 class C { 6783 class C {
7772 num v; 6784 num v;
7773 } 6785 }
7774 '''); 6786 ''');
7775 } 6787 }
7776 } 6788 }
7777 6789
7778 test_field_inferred_type_nonStatic_implicit_initialized() async { 6790 test_field_inferred_type_nonStatic_implicit_initialized() async {
7779 var library = await checkLibrary('class C { var v = 0; }'); 6791 var library = await checkLibrary('class C { var v = 0; }');
7780 if (isStrongMode) { 6792 if (isStrongMode) {
7781 checkElementText( 6793 checkElementText(library, r'''
7782 library,
7783 r'''
7784 class C { 6794 class C {
7785 int v; 6795 int v;
7786 } 6796 }
7787 '''); 6797 ''');
7788 } else { 6798 } else {
7789 checkElementText( 6799 checkElementText(library, r'''
7790 library,
7791 r'''
7792 class C { 6800 class C {
7793 dynamic v; 6801 dynamic v;
7794 } 6802 }
7795 '''); 6803 ''');
7796 } 6804 }
7797 } 6805 }
7798 6806
7799 test_field_inferred_type_nonStatic_implicit_uninitialized() async { 6807 test_field_inferred_type_nonStatic_implicit_uninitialized() async {
7800 var library = await checkLibrary( 6808 var library = await checkLibrary(
7801 'class C extends D { var v; } abstract class D { int get v; }'); 6809 'class C extends D { var v; } abstract class D { int get v; }');
7802 if (isStrongMode) { 6810 if (isStrongMode) {
7803 checkElementText( 6811 checkElementText(library, r'''
7804 library,
7805 r'''
7806 class C extends D { 6812 class C extends D {
7807 int v; 6813 int v;
7808 } 6814 }
7809 abstract class D { 6815 abstract class D {
7810 int get v; 6816 int get v;
7811 } 6817 }
7812 '''); 6818 ''');
7813 } else { 6819 } else {
7814 checkElementText( 6820 checkElementText(library, r'''
7815 library,
7816 r'''
7817 class C extends D { 6821 class C extends D {
7818 dynamic v; 6822 dynamic v;
7819 } 6823 }
7820 abstract class D { 6824 abstract class D {
7821 int get v; 6825 int get v;
7822 } 6826 }
7823 '''); 6827 ''');
7824 } 6828 }
7825 } 6829 }
7826 6830
7827 test_field_inferred_type_static_implicit_initialized() async { 6831 test_field_inferred_type_static_implicit_initialized() async {
7828 var library = await checkLibrary('class C { static var v = 0; }'); 6832 var library = await checkLibrary('class C { static var v = 0; }');
7829 if (isStrongMode) { 6833 if (isStrongMode) {
7830 checkElementText( 6834 checkElementText(library, r'''
7831 library,
7832 r'''
7833 class C { 6835 class C {
7834 static int v; 6836 static int v;
7835 } 6837 }
7836 '''); 6838 ''');
7837 } else { 6839 } else {
7838 checkElementText( 6840 checkElementText(library, r'''
7839 library,
7840 r'''
7841 class C { 6841 class C {
7842 static dynamic v; 6842 static dynamic v;
7843 } 6843 }
7844 '''); 6844 ''');
7845 } 6845 }
7846 } 6846 }
7847 6847
7848 test_field_propagatedType_const_noDep() async { 6848 test_field_propagatedType_const_noDep() async {
7849 var library = await checkLibrary(''' 6849 var library = await checkLibrary('''
7850 class C { 6850 class C {
7851 static const x = 0; 6851 static const x = 0;
7852 }'''); 6852 }''');
7853 if (isStrongMode) { 6853 if (isStrongMode) {
7854 checkElementText( 6854 checkElementText(library, r'''
7855 library,
7856 r'''
7857 class C { 6855 class C {
7858 static const int x = 0; 6856 static const int x = 0;
7859 } 6857 }
7860 '''); 6858 ''');
7861 } else { 6859 } else {
7862 checkElementText( 6860 checkElementText(library, r'''
7863 library,
7864 r'''
7865 class C { 6861 class C {
7866 static const dynamic x = 0; 6862 static const dynamic x = 0;
7867 } 6863 }
7868 '''); 6864 ''');
7869 } 6865 }
7870 } 6866 }
7871 6867
7872 test_field_propagatedType_final_dep_inLib() async { 6868 test_field_propagatedType_final_dep_inLib() async {
7873 addLibrarySource('/a.dart', 'final a = 1;'); 6869 addLibrarySource('/a.dart', 'final a = 1;');
7874 var library = await checkLibrary(''' 6870 var library = await checkLibrary('''
7875 import "a.dart"; 6871 import "a.dart";
7876 class C { 6872 class C {
7877 final b = a / 2; 6873 final b = a / 2;
7878 }'''); 6874 }''');
7879 if (isStrongMode) { 6875 if (isStrongMode) {
7880 checkElementText( 6876 checkElementText(library, r'''
7881 library,
7882 r'''
7883 import 'a.dart'; 6877 import 'a.dart';
7884 class C { 6878 class C {
7885 final double b = 6879 final double b =
7886 a/*location: a.dart;a?*/ / 2; 6880 a/*location: a.dart;a?*/ / 2;
7887 } 6881 }
7888 '''); 6882 ''');
7889 } else { 6883 } else {
7890 checkElementText( 6884 checkElementText(library, r'''
7891 library,
7892 r'''
7893 import 'a.dart'; 6885 import 'a.dart';
7894 class C { 6886 class C {
7895 final dynamic b = 6887 final dynamic b =
7896 a/*location: a.dart;a?*/ / 2; 6888 a/*location: a.dart;a?*/ / 2;
7897 } 6889 }
7898 '''); 6890 ''');
7899 } 6891 }
7900 } 6892 }
7901 6893
7902 test_field_propagatedType_final_dep_inPart() async { 6894 test_field_propagatedType_final_dep_inPart() async {
7903 addSource('/a.dart', 'part of lib; final a = 1;'); 6895 addSource('/a.dart', 'part of lib; final a = 1;');
7904 var library = await checkLibrary(''' 6896 var library = await checkLibrary('''
7905 library lib; 6897 library lib;
7906 part "a.dart"; 6898 part "a.dart";
7907 class C { 6899 class C {
7908 final b = a / 2; 6900 final b = a / 2;
7909 }'''); 6901 }''');
7910 if (isStrongMode) { 6902 if (isStrongMode) {
7911 checkElementText( 6903 checkElementText(library, r'''
7912 library,
7913 r'''
7914 library lib; 6904 library lib;
7915 part 'a.dart'; 6905 part 'a.dart';
7916 class C { 6906 class C {
7917 final double b = 6907 final double b =
7918 a/*location: test.dart;a.dart;a?*/ / 2; 6908 a/*location: test.dart;a.dart;a?*/ / 2;
7919 } 6909 }
7920 -------------------- 6910 --------------------
7921 unit: a.dart 6911 unit: a.dart
7922 6912
7923 final int a; 6913 final int a;
7924 '''); 6914 ''');
7925 } else { 6915 } else {
7926 checkElementText( 6916 checkElementText(library, r'''
7927 library,
7928 r'''
7929 library lib; 6917 library lib;
7930 part 'a.dart'; 6918 part 'a.dart';
7931 class C { 6919 class C {
7932 final dynamic b = 6920 final dynamic b =
7933 a/*location: test.dart;a.dart;a?*/ / 2; 6921 a/*location: test.dart;a.dart;a?*/ / 2;
7934 } 6922 }
7935 -------------------- 6923 --------------------
7936 unit: a.dart 6924 unit: a.dart
7937 6925
7938 final dynamic a; 6926 final dynamic a;
7939 '''); 6927 ''');
7940 } 6928 }
7941 } 6929 }
7942 6930
7943 test_field_propagatedType_final_noDep_instance() async { 6931 test_field_propagatedType_final_noDep_instance() async {
7944 var library = await checkLibrary(''' 6932 var library = await checkLibrary('''
7945 class C { 6933 class C {
7946 final x = 0; 6934 final x = 0;
7947 }'''); 6935 }''');
7948 if (isStrongMode) { 6936 if (isStrongMode) {
7949 checkElementText( 6937 checkElementText(library, r'''
7950 library,
7951 r'''
7952 class C { 6938 class C {
7953 final int x = 0; 6939 final int x = 0;
7954 } 6940 }
7955 '''); 6941 ''');
7956 } else { 6942 } else {
7957 checkElementText( 6943 checkElementText(library, r'''
7958 library,
7959 r'''
7960 class C { 6944 class C {
7961 final dynamic x = 0; 6945 final dynamic x = 0;
7962 } 6946 }
7963 '''); 6947 ''');
7964 } 6948 }
7965 } 6949 }
7966 6950
7967 test_field_propagatedType_final_noDep_static() async { 6951 test_field_propagatedType_final_noDep_static() async {
7968 var library = await checkLibrary(''' 6952 var library = await checkLibrary('''
7969 class C { 6953 class C {
7970 static final x = 0; 6954 static final x = 0;
7971 }'''); 6955 }''');
7972 if (isStrongMode) { 6956 if (isStrongMode) {
7973 checkElementText( 6957 checkElementText(library, r'''
7974 library,
7975 r'''
7976 class C { 6958 class C {
7977 static final int x; 6959 static final int x;
7978 } 6960 }
7979 '''); 6961 ''');
7980 } else { 6962 } else {
7981 checkElementText( 6963 checkElementText(library, r'''
7982 library,
7983 r'''
7984 class C { 6964 class C {
7985 static final dynamic x; 6965 static final dynamic x;
7986 } 6966 }
7987 '''); 6967 ''');
7988 } 6968 }
7989 } 6969 }
7990 6970
7991 test_field_static_final_untyped() async { 6971 test_field_static_final_untyped() async {
7992 var library = await checkLibrary('class C { static final x = 0; }'); 6972 var library = await checkLibrary('class C { static final x = 0; }');
7993 if (isStrongMode) { 6973 if (isStrongMode) {
7994 checkElementText( 6974 checkElementText(library, r'''
7995 library,
7996 r'''
7997 class C { 6975 class C {
7998 static final int x; 6976 static final int x;
7999 } 6977 }
8000 '''); 6978 ''');
8001 } else { 6979 } else {
8002 checkElementText( 6980 checkElementText(library, r'''
8003 library,
8004 r'''
8005 class C { 6981 class C {
8006 static final dynamic x; 6982 static final dynamic x;
8007 } 6983 }
8008 '''); 6984 ''');
8009 } 6985 }
8010 } 6986 }
8011 6987
8012 test_field_untyped() async { 6988 test_field_untyped() async {
8013 var library = await checkLibrary('class C { var x = 0; }'); 6989 var library = await checkLibrary('class C { var x = 0; }');
8014 if (isStrongMode) { 6990 if (isStrongMode) {
8015 checkElementText( 6991 checkElementText(library, r'''
8016 library,
8017 r'''
8018 class C { 6992 class C {
8019 int x; 6993 int x;
8020 } 6994 }
8021 '''); 6995 ''');
8022 } else { 6996 } else {
8023 checkElementText( 6997 checkElementText(library, r'''
8024 library,
8025 r'''
8026 class C { 6998 class C {
8027 dynamic x; 6999 dynamic x;
8028 } 7000 }
8029 '''); 7001 ''');
8030 } 7002 }
8031 } 7003 }
8032 7004
8033 test_function_async() async { 7005 test_function_async() async {
8034 var library = await checkLibrary(r''' 7006 var library = await checkLibrary(r'''
8035 import 'dart:async'; 7007 import 'dart:async';
8036 Future f() async {} 7008 Future f() async {}
8037 '''); 7009 ''');
8038 if (isStrongMode) { 7010 if (isStrongMode) {
8039 checkElementText( 7011 checkElementText(library, r'''
8040 library,
8041 r'''
8042 import 'dart:async'; 7012 import 'dart:async';
8043 Future<dynamic> f() async {} 7013 Future<dynamic> f() async {}
8044 '''); 7014 ''');
8045 } else { 7015 } else {
8046 checkElementText( 7016 checkElementText(library, r'''
8047 library,
8048 r'''
8049 import 'dart:async'; 7017 import 'dart:async';
8050 Future<dynamic> f() async {} 7018 Future<dynamic> f() async {}
8051 '''); 7019 ''');
8052 } 7020 }
8053 } 7021 }
8054 7022
8055 test_function_asyncStar() async { 7023 test_function_asyncStar() async {
8056 var library = await checkLibrary(r''' 7024 var library = await checkLibrary(r'''
8057 import 'dart:async'; 7025 import 'dart:async';
8058 Stream f() async* {} 7026 Stream f() async* {}
8059 '''); 7027 ''');
8060 if (isStrongMode) { 7028 if (isStrongMode) {
8061 checkElementText( 7029 checkElementText(library, r'''
8062 library,
8063 r'''
8064 import 'dart:async'; 7030 import 'dart:async';
8065 Stream<dynamic> f() async* {} 7031 Stream<dynamic> f() async* {}
8066 '''); 7032 ''');
8067 } else { 7033 } else {
8068 checkElementText( 7034 checkElementText(library, r'''
8069 library,
8070 r'''
8071 import 'dart:async'; 7035 import 'dart:async';
8072 Stream<dynamic> f() async* {} 7036 Stream<dynamic> f() async* {}
8073 '''); 7037 ''');
8074 } 7038 }
8075 } 7039 }
8076 7040
8077 test_function_documented() async { 7041 test_function_documented() async {
8078 var library = await checkLibrary(''' 7042 var library = await checkLibrary('''
8079 // Extra comment so doc comment offset != 0 7043 // Extra comment so doc comment offset != 0
8080 /** 7044 /**
8081 * Docs 7045 * Docs
8082 */ 7046 */
8083 f() {}'''); 7047 f() {}''');
8084 if (isStrongMode) { 7048 if (isStrongMode) {
8085 checkElementText( 7049 checkElementText(library, r'''
8086 library,
8087 r'''
8088 dynamic f() {} 7050 dynamic f() {}
8089 '''); 7051 ''');
8090 } else { 7052 } else {
8091 checkElementText( 7053 checkElementText(library, r'''
8092 library,
8093 r'''
8094 dynamic f() {} 7054 dynamic f() {}
8095 '''); 7055 ''');
8096 } 7056 }
8097 } 7057 }
8098 7058
8099 test_function_entry_point() async { 7059 test_function_entry_point() async {
8100 var library = await checkLibrary('main() {}'); 7060 var library = await checkLibrary('main() {}');
8101 if (isStrongMode) { 7061 if (isStrongMode) {
8102 checkElementText( 7062 checkElementText(library, r'''
8103 library,
8104 r'''
8105 dynamic main() {} 7063 dynamic main() {}
8106 '''); 7064 ''');
8107 } else { 7065 } else {
8108 checkElementText( 7066 checkElementText(library, r'''
8109 library,
8110 r'''
8111 dynamic main() {} 7067 dynamic main() {}
8112 '''); 7068 ''');
8113 } 7069 }
8114 } 7070 }
8115 7071
8116 test_function_entry_point_in_export() async { 7072 test_function_entry_point_in_export() async {
8117 addLibrarySource('/a.dart', 'library a; main() {}'); 7073 addLibrarySource('/a.dart', 'library a; main() {}');
8118 var library = await checkLibrary('export "a.dart";'); 7074 var library = await checkLibrary('export "a.dart";');
8119 if (isStrongMode) { 7075 if (isStrongMode) {
8120 checkElementText( 7076 checkElementText(library, r'''
8121 library,
8122 r'''
8123 export 'a.dart'; 7077 export 'a.dart';
8124 '''); 7078 ''');
8125 } else { 7079 } else {
8126 checkElementText( 7080 checkElementText(library, r'''
8127 library,
8128 r'''
8129 export 'a.dart'; 7081 export 'a.dart';
8130 '''); 7082 ''');
8131 } 7083 }
8132 } 7084 }
8133 7085
8134 test_function_entry_point_in_export_hidden() async { 7086 test_function_entry_point_in_export_hidden() async {
8135 addLibrarySource('/a.dart', 'library a; main() {}'); 7087 addLibrarySource('/a.dart', 'library a; main() {}');
8136 var library = await checkLibrary('export "a.dart" hide main;'); 7088 var library = await checkLibrary('export "a.dart" hide main;');
8137 if (isStrongMode) { 7089 if (isStrongMode) {
8138 checkElementText( 7090 checkElementText(library, r'''
8139 library,
8140 r'''
8141 export 'a.dart' hide main; 7091 export 'a.dart' hide main;
8142 '''); 7092 ''');
8143 } else { 7093 } else {
8144 checkElementText( 7094 checkElementText(library, r'''
8145 library,
8146 r'''
8147 export 'a.dart' hide main; 7095 export 'a.dart' hide main;
8148 '''); 7096 ''');
8149 } 7097 }
8150 } 7098 }
8151 7099
8152 test_function_entry_point_in_part() async { 7100 test_function_entry_point_in_part() async {
8153 addSource('/a.dart', 'part of my.lib; main() {}'); 7101 addSource('/a.dart', 'part of my.lib; main() {}');
8154 var library = await checkLibrary('library my.lib; part "a.dart";'); 7102 var library = await checkLibrary('library my.lib; part "a.dart";');
8155 if (isStrongMode) { 7103 if (isStrongMode) {
8156 checkElementText( 7104 checkElementText(library, r'''
8157 library,
8158 r'''
8159 library my.lib; 7105 library my.lib;
8160 part 'a.dart'; 7106 part 'a.dart';
8161 -------------------- 7107 --------------------
8162 unit: a.dart 7108 unit: a.dart
8163 7109
8164 dynamic main() {} 7110 dynamic main() {}
8165 '''); 7111 ''');
8166 } else { 7112 } else {
8167 checkElementText( 7113 checkElementText(library, r'''
8168 library,
8169 r'''
8170 library my.lib; 7114 library my.lib;
8171 part 'a.dart'; 7115 part 'a.dart';
8172 -------------------- 7116 --------------------
8173 unit: a.dart 7117 unit: a.dart
8174 7118
8175 dynamic main() {} 7119 dynamic main() {}
8176 '''); 7120 ''');
8177 } 7121 }
8178 } 7122 }
8179 7123
8180 test_function_external() async { 7124 test_function_external() async {
8181 var library = await checkLibrary('external f();'); 7125 var library = await checkLibrary('external f();');
8182 if (isStrongMode) { 7126 if (isStrongMode) {
8183 checkElementText( 7127 checkElementText(library, r'''
8184 library,
8185 r'''
8186 external dynamic f() {} 7128 external dynamic f() {}
8187 '''); 7129 ''');
8188 } else { 7130 } else {
8189 checkElementText( 7131 checkElementText(library, r'''
8190 library,
8191 r'''
8192 external dynamic f() {} 7132 external dynamic f() {}
8193 '''); 7133 ''');
8194 } 7134 }
8195 } 7135 }
8196 7136
8197 test_function_parameter_final() async { 7137 test_function_parameter_final() async {
8198 var library = await checkLibrary('f(final x) {}'); 7138 var library = await checkLibrary('f(final x) {}');
8199 if (isStrongMode) { 7139 if (isStrongMode) {
8200 checkElementText( 7140 checkElementText(library, r'''
8201 library,
8202 r'''
8203 dynamic f(final dynamic x) {} 7141 dynamic f(final dynamic x) {}
8204 '''); 7142 ''');
8205 } else { 7143 } else {
8206 checkElementText( 7144 checkElementText(library, r'''
8207 library,
8208 r'''
8209 dynamic f(final dynamic x) {} 7145 dynamic f(final dynamic x) {}
8210 '''); 7146 ''');
8211 } 7147 }
8212 } 7148 }
8213 7149
8214 test_function_parameter_kind_named() async { 7150 test_function_parameter_kind_named() async {
8215 var library = await checkLibrary('f({x}) {}'); 7151 var library = await checkLibrary('f({x}) {}');
8216 if (isStrongMode) { 7152 if (isStrongMode) {
8217 checkElementText( 7153 checkElementText(library, r'''
8218 library,
8219 r'''
8220 dynamic f({dynamic x}) {} 7154 dynamic f({dynamic x}) {}
8221 '''); 7155 ''');
8222 } else { 7156 } else {
8223 checkElementText( 7157 checkElementText(library, r'''
8224 library,
8225 r'''
8226 dynamic f({dynamic x}) {} 7158 dynamic f({dynamic x}) {}
8227 '''); 7159 ''');
8228 } 7160 }
8229 } 7161 }
8230 7162
8231 test_function_parameter_kind_positional() async { 7163 test_function_parameter_kind_positional() async {
8232 var library = await checkLibrary('f([x]) {}'); 7164 var library = await checkLibrary('f([x]) {}');
8233 if (isStrongMode) { 7165 if (isStrongMode) {
8234 checkElementText( 7166 checkElementText(library, r'''
8235 library,
8236 r'''
8237 dynamic f([dynamic x]) {} 7167 dynamic f([dynamic x]) {}
8238 '''); 7168 ''');
8239 } else { 7169 } else {
8240 checkElementText( 7170 checkElementText(library, r'''
8241 library,
8242 r'''
8243 dynamic f([dynamic x]) {} 7171 dynamic f([dynamic x]) {}
8244 '''); 7172 ''');
8245 } 7173 }
8246 } 7174 }
8247 7175
8248 test_function_parameter_kind_required() async { 7176 test_function_parameter_kind_required() async {
8249 var library = await checkLibrary('f(x) {}'); 7177 var library = await checkLibrary('f(x) {}');
8250 if (isStrongMode) { 7178 if (isStrongMode) {
8251 checkElementText( 7179 checkElementText(library, r'''
8252 library,
8253 r'''
8254 dynamic f(dynamic x) {} 7180 dynamic f(dynamic x) {}
8255 '''); 7181 ''');
8256 } else { 7182 } else {
8257 checkElementText( 7183 checkElementText(library, r'''
8258 library,
8259 r'''
8260 dynamic f(dynamic x) {} 7184 dynamic f(dynamic x) {}
8261 '''); 7185 ''');
8262 } 7186 }
8263 } 7187 }
8264 7188
8265 test_function_parameter_parameters() async { 7189 test_function_parameter_parameters() async {
8266 var library = await checkLibrary('f(g(x, y)) {}'); 7190 var library = await checkLibrary('f(g(x, y)) {}');
8267 if (isStrongMode) { 7191 if (isStrongMode) {
8268 checkElementText( 7192 checkElementText(library, r'''
8269 library,
8270 r'''
8271 dynamic f((dynamic, dynamic) → dynamic g) {} 7193 dynamic f((dynamic, dynamic) → dynamic g) {}
8272 '''); 7194 ''');
8273 } else { 7195 } else {
8274 checkElementText( 7196 checkElementText(library, r'''
8275 library,
8276 r'''
8277 dynamic f((dynamic, dynamic) → dynamic g) {} 7197 dynamic f((dynamic, dynamic) → dynamic g) {}
8278 '''); 7198 ''');
8279 } 7199 }
8280 } 7200 }
8281 7201
8282 test_function_parameter_return_type() async { 7202 test_function_parameter_return_type() async {
8283 var library = await checkLibrary('f(int g()) {}'); 7203 var library = await checkLibrary('f(int g()) {}');
8284 if (isStrongMode) { 7204 if (isStrongMode) {
8285 checkElementText( 7205 checkElementText(library, r'''
8286 library,
8287 r'''
8288 dynamic f(() → int g) {} 7206 dynamic f(() → int g) {}
8289 '''); 7207 ''');
8290 } else { 7208 } else {
8291 checkElementText( 7209 checkElementText(library, r'''
8292 library,
8293 r'''
8294 dynamic f(() → int g) {} 7210 dynamic f(() → int g) {}
8295 '''); 7211 ''');
8296 } 7212 }
8297 } 7213 }
8298 7214
8299 test_function_parameter_return_type_void() async { 7215 test_function_parameter_return_type_void() async {
8300 var library = await checkLibrary('f(void g()) {}'); 7216 var library = await checkLibrary('f(void g()) {}');
8301 if (isStrongMode) { 7217 if (isStrongMode) {
8302 checkElementText( 7218 checkElementText(library, r'''
8303 library,
8304 r'''
8305 dynamic f(() → void g) {} 7219 dynamic f(() → void g) {}
8306 '''); 7220 ''');
8307 } else { 7221 } else {
8308 checkElementText( 7222 checkElementText(library, r'''
8309 library,
8310 r'''
8311 dynamic f(() → void g) {} 7223 dynamic f(() → void g) {}
8312 '''); 7224 ''');
8313 } 7225 }
8314 } 7226 }
8315 7227
8316 test_function_parameter_type() async { 7228 test_function_parameter_type() async {
8317 var library = await checkLibrary('f(int i) {}'); 7229 var library = await checkLibrary('f(int i) {}');
8318 if (isStrongMode) { 7230 if (isStrongMode) {
8319 checkElementText( 7231 checkElementText(library, r'''
8320 library,
8321 r'''
8322 dynamic f(int i) {} 7232 dynamic f(int i) {}
8323 '''); 7233 ''');
8324 } else { 7234 } else {
8325 checkElementText( 7235 checkElementText(library, r'''
8326 library,
8327 r'''
8328 dynamic f(int i) {} 7236 dynamic f(int i) {}
8329 '''); 7237 ''');
8330 } 7238 }
8331 } 7239 }
8332 7240
8333 test_function_parameters() async { 7241 test_function_parameters() async {
8334 var library = await checkLibrary('f(x, y) {}'); 7242 var library = await checkLibrary('f(x, y) {}');
8335 if (isStrongMode) { 7243 if (isStrongMode) {
8336 checkElementText( 7244 checkElementText(library, r'''
8337 library,
8338 r'''
8339 dynamic f(dynamic x, dynamic y) {} 7245 dynamic f(dynamic x, dynamic y) {}
8340 '''); 7246 ''');
8341 } else { 7247 } else {
8342 checkElementText( 7248 checkElementText(library, r'''
8343 library,
8344 r'''
8345 dynamic f(dynamic x, dynamic y) {} 7249 dynamic f(dynamic x, dynamic y) {}
8346 '''); 7250 ''');
8347 } 7251 }
8348 } 7252 }
8349 7253
8350 test_function_return_type() async { 7254 test_function_return_type() async {
8351 var library = await checkLibrary('int f() => null;'); 7255 var library = await checkLibrary('int f() => null;');
8352 if (isStrongMode) { 7256 if (isStrongMode) {
8353 checkElementText( 7257 checkElementText(library, r'''
8354 library,
8355 r'''
8356 int f() {} 7258 int f() {}
8357 '''); 7259 ''');
8358 } else { 7260 } else {
8359 checkElementText( 7261 checkElementText(library, r'''
8360 library,
8361 r'''
8362 int f() {} 7262 int f() {}
8363 '''); 7263 ''');
8364 } 7264 }
8365 } 7265 }
8366 7266
8367 test_function_return_type_implicit() async { 7267 test_function_return_type_implicit() async {
8368 var library = await checkLibrary('f() => null;'); 7268 var library = await checkLibrary('f() => null;');
8369 if (isStrongMode) { 7269 if (isStrongMode) {
8370 checkElementText( 7270 checkElementText(library, r'''
8371 library,
8372 r'''
8373 dynamic f() {} 7271 dynamic f() {}
8374 '''); 7272 ''');
8375 } else { 7273 } else {
8376 checkElementText( 7274 checkElementText(library, r'''
8377 library,
8378 r'''
8379 dynamic f() {} 7275 dynamic f() {}
8380 '''); 7276 ''');
8381 } 7277 }
8382 } 7278 }
8383 7279
8384 test_function_return_type_void() async { 7280 test_function_return_type_void() async {
8385 var library = await checkLibrary('void f() {}'); 7281 var library = await checkLibrary('void f() {}');
8386 if (isStrongMode) { 7282 if (isStrongMode) {
8387 checkElementText( 7283 checkElementText(library, r'''
8388 library,
8389 r'''
8390 void f() {} 7284 void f() {}
8391 '''); 7285 ''');
8392 } else { 7286 } else {
8393 checkElementText( 7287 checkElementText(library, r'''
8394 library,
8395 r'''
8396 void f() {} 7288 void f() {}
8397 '''); 7289 ''');
8398 } 7290 }
8399 } 7291 }
8400 7292
8401 test_function_type_parameter() async { 7293 test_function_type_parameter() async {
8402 prepareAnalysisContext(createOptions()); 7294 prepareAnalysisContext(createOptions());
8403 var library = await checkLibrary('T f<T, U>(U u) => null;'); 7295 var library = await checkLibrary('T f<T, U>(U u) => null;');
8404 if (isStrongMode) { 7296 if (isStrongMode) {
8405 checkElementText( 7297 checkElementText(library, r'''
8406 library,
8407 r'''
8408 T f<T, U>(U u) {} 7298 T f<T, U>(U u) {}
8409 '''); 7299 ''');
8410 } else { 7300 } else {
8411 checkElementText( 7301 checkElementText(library, r'''
8412 library,
8413 r'''
8414 T f<T, U>(U u) {} 7302 T f<T, U>(U u) {}
8415 '''); 7303 ''');
8416 } 7304 }
8417 } 7305 }
8418 7306
8419 test_function_type_parameter_with_function_typed_parameter() async { 7307 test_function_type_parameter_with_function_typed_parameter() async {
8420 prepareAnalysisContext(createOptions()); 7308 prepareAnalysisContext(createOptions());
8421 var library = await checkLibrary('void f<T, U>(T x(U u)) {}'); 7309 var library = await checkLibrary('void f<T, U>(T x(U u)) {}');
8422 if (isStrongMode) { 7310 if (isStrongMode) {
8423 checkElementText( 7311 checkElementText(library, r'''
8424 library,
8425 r'''
8426 void f<T, U>((U) → T x) {} 7312 void f<T, U>((U) → T x) {}
8427 '''); 7313 ''');
8428 } else { 7314 } else {
8429 checkElementText( 7315 checkElementText(library, r'''
8430 library,
8431 r'''
8432 void f<T, U>((U) → T x) {} 7316 void f<T, U>((U) → T x) {}
8433 '''); 7317 ''');
8434 } 7318 }
8435 } 7319 }
8436 7320
8437 test_function_typed_parameter_implicit() async { 7321 test_function_typed_parameter_implicit() async {
8438 var library = await checkLibrary('f(g()) => null;'); 7322 var library = await checkLibrary('f(g()) => null;');
8439 expect( 7323 expect(
8440 library 7324 library
8441 .definingCompilationUnit.functions[0].parameters[0].hasImplicitType, 7325 .definingCompilationUnit.functions[0].parameters[0].hasImplicitType,
8442 isFalse); 7326 isFalse);
8443 } 7327 }
8444 7328
8445 test_functions() async { 7329 test_functions() async {
8446 var library = await checkLibrary('f() {} g() {}'); 7330 var library = await checkLibrary('f() {} g() {}');
8447 if (isStrongMode) { 7331 if (isStrongMode) {
8448 checkElementText( 7332 checkElementText(library, r'''
8449 library,
8450 r'''
8451 dynamic f() {} 7333 dynamic f() {}
8452 dynamic g() {} 7334 dynamic g() {}
8453 '''); 7335 ''');
8454 } else { 7336 } else {
8455 checkElementText( 7337 checkElementText(library, r'''
8456 library,
8457 r'''
8458 dynamic f() {} 7338 dynamic f() {}
8459 dynamic g() {} 7339 dynamic g() {}
8460 '''); 7340 ''');
8461 } 7341 }
8462 } 7342 }
8463 7343
8464 test_futureOr() async { 7344 test_futureOr() async {
8465 var library = await checkLibrary('import "dart:async"; FutureOr<int> x;'); 7345 var library = await checkLibrary('import "dart:async"; FutureOr<int> x;');
8466 if (isStrongMode) { 7346 if (isStrongMode) {
8467 checkElementText( 7347 checkElementText(library, r'''
8468 library,
8469 r'''
8470 import 'dart:async'; 7348 import 'dart:async';
8471 FutureOr<int> x; 7349 FutureOr<int> x;
8472 '''); 7350 ''');
8473 } else { 7351 } else {
8474 checkElementText( 7352 checkElementText(library, r'''
8475 library,
8476 r'''
8477 import 'dart:async'; 7353 import 'dart:async';
8478 dynamic x; 7354 dynamic x;
8479 '''); 7355 ''');
8480 } 7356 }
8481 var variables = library.definingCompilationUnit.topLevelVariables; 7357 var variables = library.definingCompilationUnit.topLevelVariables;
8482 expect(variables, hasLength(1)); 7358 expect(variables, hasLength(1));
8483 if (createOptions().strongMode) { 7359 if (createOptions().strongMode) {
8484 expect(variables[0].type.toString(), 'FutureOr<int>'); 7360 expect(variables[0].type.toString(), 'FutureOr<int>');
8485 } else { 7361 } else {
8486 expect(variables[0].type.toString(), 'dynamic'); 7362 expect(variables[0].type.toString(), 'dynamic');
8487 } 7363 }
8488 } 7364 }
8489 7365
8490 test_futureOr_const() async { 7366 test_futureOr_const() async {
8491 var library = 7367 var library =
8492 await checkLibrary('import "dart:async"; const x = FutureOr;'); 7368 await checkLibrary('import "dart:async"; const x = FutureOr;');
8493 if (isStrongMode) { 7369 if (isStrongMode) {
8494 checkElementText( 7370 checkElementText(library, r'''
8495 library,
8496 r'''
8497 import 'dart:async'; 7371 import 'dart:async';
8498 const Type x = 7372 const Type x =
8499 FutureOr/*location: dart:async;FutureOr*/; 7373 FutureOr/*location: dart:async;FutureOr*/;
8500 '''); 7374 ''');
8501 } else { 7375 } else {
8502 checkElementText( 7376 checkElementText(library, r'''
8503 library,
8504 r'''
8505 import 'dart:async'; 7377 import 'dart:async';
8506 const dynamic x = 7378 const dynamic x =
8507 FutureOr/*location: dart:async;FutureOr*/; 7379 FutureOr/*location: dart:async;FutureOr*/;
8508 '''); 7380 ''');
8509 } 7381 }
8510 var variables = library.definingCompilationUnit.topLevelVariables; 7382 var variables = library.definingCompilationUnit.topLevelVariables;
8511 expect(variables, hasLength(1)); 7383 expect(variables, hasLength(1));
8512 var x = variables[0] as ConstTopLevelVariableElementImpl; 7384 var x = variables[0] as ConstTopLevelVariableElementImpl;
8513 if (createOptions().strongMode) { 7385 if (createOptions().strongMode) {
8514 expect(x.type.toString(), 'Type'); 7386 expect(x.type.toString(), 'Type');
8515 } else { 7387 } else {
8516 expect(x.type.toString(), 'dynamic'); 7388 expect(x.type.toString(), 'dynamic');
8517 } 7389 }
8518 expect(x.constantInitializer.toString(), 'FutureOr'); 7390 expect(x.constantInitializer.toString(), 'FutureOr');
8519 } 7391 }
8520 7392
8521 test_futureOr_inferred() async { 7393 test_futureOr_inferred() async {
8522 var library = await checkLibrary(''' 7394 var library = await checkLibrary('''
8523 import "dart:async"; 7395 import "dart:async";
8524 FutureOr<int> f() => null; 7396 FutureOr<int> f() => null;
8525 var x = f(); 7397 var x = f();
8526 var y = x.then((z) => z.asDouble()); 7398 var y = x.then((z) => z.asDouble());
8527 '''); 7399 ''');
8528 if (isStrongMode) { 7400 if (isStrongMode) {
8529 checkElementText( 7401 checkElementText(library, r'''
8530 library,
8531 r'''
8532 import 'dart:async'; 7402 import 'dart:async';
8533 FutureOr<int> x; 7403 FutureOr<int> x;
8534 dynamic y; 7404 dynamic y;
8535 FutureOr<int> f() {} 7405 FutureOr<int> f() {}
8536 '''); 7406 ''');
8537 } else { 7407 } else {
8538 checkElementText( 7408 checkElementText(library, r'''
8539 library,
8540 r'''
8541 import 'dart:async'; 7409 import 'dart:async';
8542 dynamic x; 7410 dynamic x;
8543 dynamic y; 7411 dynamic y;
8544 dynamic f() {} 7412 dynamic f() {}
8545 '''); 7413 ''');
8546 } 7414 }
8547 var variables = library.definingCompilationUnit.topLevelVariables; 7415 var variables = library.definingCompilationUnit.topLevelVariables;
8548 expect(variables, hasLength(2)); 7416 expect(variables, hasLength(2));
8549 var x = variables[0]; 7417 var x = variables[0];
8550 expect(x.name, 'x'); 7418 expect(x.name, 'x');
(...skipping 12 matching lines...) Expand all
8563 prepareAnalysisContext(createOptions()); 7431 prepareAnalysisContext(createOptions());
8564 var library = await checkLibrary(''' 7432 var library = await checkLibrary('''
8565 class C<T, U> { 7433 class C<T, U> {
8566 static void m<V, W>(V v, W w) { 7434 static void m<V, W>(V v, W w) {
8567 void f<X, Y>(V v, W w, X x, Y y) { 7435 void f<X, Y>(V v, W w, X x, Y y) {
8568 } 7436 }
8569 } 7437 }
8570 } 7438 }
8571 '''); 7439 ''');
8572 if (isStrongMode) { 7440 if (isStrongMode) {
8573 checkElementText( 7441 checkElementText(library, r'''
8574 library,
8575 r'''
8576 class C<T, U> { 7442 class C<T, U> {
8577 static void m<V, W>(V v, W w) {} 7443 static void m<V, W>(V v, W w) {}
8578 } 7444 }
8579 '''); 7445 ''');
8580 } else { 7446 } else {
8581 checkElementText( 7447 checkElementText(library, r'''
8582 library,
8583 r'''
8584 class C<T, U> { 7448 class C<T, U> {
8585 static void m<V, W>(V v, W w) {} 7449 static void m<V, W>(V v, W w) {}
8586 } 7450 }
8587 '''); 7451 ''');
8588 } 7452 }
8589 } 7453 }
8590 7454
8591 test_genericFunction_asFunctionReturnType() async { 7455 test_genericFunction_asFunctionReturnType() async {
8592 shouldCompareLibraryElements = false; 7456 shouldCompareLibraryElements = false;
8593 var library = await checkLibrary(r''' 7457 var library = await checkLibrary(r'''
8594 int Function(int a, String b) f() => null; 7458 int Function(int a, String b) f() => null;
8595 '''); 7459 ''');
8596 checkElementText( 7460 checkElementText(library, r'''
8597 library,
8598 r'''
8599 (int, String) → int f() {} 7461 (int, String) → int f() {}
8600 '''); 7462 ''');
8601 } 7463 }
8602 7464
8603 test_genericFunction_asFunctionTypedParameterReturnType() async { 7465 test_genericFunction_asFunctionTypedParameterReturnType() async {
8604 shouldCompareLibraryElements = false; 7466 shouldCompareLibraryElements = false;
8605 var library = await checkLibrary(r''' 7467 var library = await checkLibrary(r'''
8606 void f(int Function(int a, String b) p(num c)) => null; 7468 void f(int Function(int a, String b) p(num c)) => null;
8607 '''); 7469 ''');
8608 checkElementText( 7470 checkElementText(library, r'''
8609 library,
8610 r'''
8611 void f((num) → (int, String) → int p) {} 7471 void f((num) → (int, String) → int p) {}
8612 '''); 7472 ''');
8613 } 7473 }
8614 7474
8615 test_genericFunction_asGenericFunctionReturnType() async { 7475 test_genericFunction_asGenericFunctionReturnType() async {
8616 shouldCompareLibraryElements = false; 7476 shouldCompareLibraryElements = false;
8617 var library = await checkLibrary(r''' 7477 var library = await checkLibrary(r'''
8618 typedef F = void Function(String a) Function(int b); 7478 typedef F = void Function(String a) Function(int b);
8619 '''); 7479 ''');
8620 checkElementText( 7480 checkElementText(library, r'''
8621 library,
8622 r'''
8623 typedef F = (String) → void Function(int b); 7481 typedef F = (String) → void Function(int b);
8624 '''); 7482 ''');
8625 } 7483 }
8626 7484
8627 test_genericFunction_asMethodReturnType() async { 7485 test_genericFunction_asMethodReturnType() async {
8628 shouldCompareLibraryElements = false; 7486 shouldCompareLibraryElements = false;
8629 var library = await checkLibrary(r''' 7487 var library = await checkLibrary(r'''
8630 class C { 7488 class C {
8631 int Function(int a, String b) m() => null; 7489 int Function(int a, String b) m() => null;
8632 } 7490 }
8633 '''); 7491 ''');
8634 checkElementText( 7492 checkElementText(library, r'''
8635 library,
8636 r'''
8637 class C { 7493 class C {
8638 (int, String) → int m() {} 7494 (int, String) → int m() {}
8639 } 7495 }
8640 '''); 7496 ''');
8641 } 7497 }
8642 7498
8643 test_genericFunction_asParameterType() async { 7499 test_genericFunction_asParameterType() async {
8644 shouldCompareLibraryElements = false; 7500 shouldCompareLibraryElements = false;
8645 var library = await checkLibrary(r''' 7501 var library = await checkLibrary(r'''
8646 void f(int Function(int a, String b) p) => null; 7502 void f(int Function(int a, String b) p) => null;
8647 '''); 7503 ''');
8648 checkElementText( 7504 checkElementText(library, r'''
8649 library,
8650 r'''
8651 void f((int, String) → int p) {} 7505 void f((int, String) → int p) {}
8652 '''); 7506 ''');
8653 } 7507 }
8654 7508
8655 test_genericFunction_asTopLevelVariableType() async { 7509 test_genericFunction_asTopLevelVariableType() async {
8656 shouldCompareLibraryElements = false; 7510 shouldCompareLibraryElements = false;
8657 var library = await checkLibrary(r''' 7511 var library = await checkLibrary(r'''
8658 int Function(int a, String b) v; 7512 int Function(int a, String b) v;
8659 '''); 7513 ''');
8660 checkElementText( 7514 checkElementText(library, r'''
8661 library,
8662 r'''
8663 (int, String) → int v; 7515 (int, String) → int v;
8664 '''); 7516 ''');
8665 } 7517 }
8666 7518
8667 test_getElement_constructor_named() async { 7519 test_getElement_constructor_named() async {
8668 String text = 'class C { C.named(); }'; 7520 String text = 'class C { C.named(); }';
8669 Source source = addLibrarySource('/test.dart', text); 7521 Source source = addLibrarySource('/test.dart', text);
8670 ConstructorElement original = context 7522 ConstructorElement original = context
8671 .computeLibraryElement(source) 7523 .computeLibraryElement(source)
8672 .getType('C') 7524 .getType('C')
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
8747 } 7599 }
8748 7600
8749 test_getter_documented() async { 7601 test_getter_documented() async {
8750 var library = await checkLibrary(''' 7602 var library = await checkLibrary('''
8751 // Extra comment so doc comment offset != 0 7603 // Extra comment so doc comment offset != 0
8752 /** 7604 /**
8753 * Docs 7605 * Docs
8754 */ 7606 */
8755 get x => null;'''); 7607 get x => null;''');
8756 if (isStrongMode) { 7608 if (isStrongMode) {
8757 checkElementText( 7609 checkElementText(library, r'''
8758 library,
8759 r'''
8760 /** 7610 /**
8761 * Docs 7611 * Docs
8762 */ 7612 */
8763 dynamic get x {} 7613 dynamic get x {}
8764 '''); 7614 ''');
8765 } else { 7615 } else {
8766 checkElementText( 7616 checkElementText(library, r'''
8767 library,
8768 r'''
8769 /** 7617 /**
8770 * Docs 7618 * Docs
8771 */ 7619 */
8772 dynamic get x {} 7620 dynamic get x {}
8773 '''); 7621 ''');
8774 } 7622 }
8775 } 7623 }
8776 7624
8777 test_getter_external() async { 7625 test_getter_external() async {
8778 var library = await checkLibrary('external int get x;'); 7626 var library = await checkLibrary('external int get x;');
8779 if (isStrongMode) { 7627 if (isStrongMode) {
8780 checkElementText( 7628 checkElementText(library, r'''
8781 library,
8782 r'''
8783 external int get x {} 7629 external int get x {}
8784 '''); 7630 ''');
8785 } else { 7631 } else {
8786 checkElementText( 7632 checkElementText(library, r'''
8787 library,
8788 r'''
8789 external int get x {} 7633 external int get x {}
8790 '''); 7634 ''');
8791 } 7635 }
8792 } 7636 }
8793 7637
8794 test_getter_inferred_type_nonStatic_implicit_return() async { 7638 test_getter_inferred_type_nonStatic_implicit_return() async {
8795 var library = await checkLibrary( 7639 var library = await checkLibrary(
8796 'class C extends D { get f => null; } abstract class D { int get f; }'); 7640 'class C extends D { get f => null; } abstract class D { int get f; }');
8797 if (isStrongMode) { 7641 if (isStrongMode) {
8798 checkElementText( 7642 checkElementText(library, r'''
8799 library,
8800 r'''
8801 class C extends D { 7643 class C extends D {
8802 int get f {} 7644 int get f {}
8803 } 7645 }
8804 abstract class D { 7646 abstract class D {
8805 int get f; 7647 int get f;
8806 } 7648 }
8807 '''); 7649 ''');
8808 } else { 7650 } else {
8809 checkElementText( 7651 checkElementText(library, r'''
8810 library,
8811 r'''
8812 class C extends D { 7652 class C extends D {
8813 dynamic get f {} 7653 dynamic get f {}
8814 } 7654 }
8815 abstract class D { 7655 abstract class D {
8816 int get f; 7656 int get f;
8817 } 7657 }
8818 '''); 7658 ''');
8819 } 7659 }
8820 } 7660 }
8821 7661
8822 test_getters() async { 7662 test_getters() async {
8823 var library = await checkLibrary('int get x => null; get y => null;'); 7663 var library = await checkLibrary('int get x => null; get y => null;');
8824 if (isStrongMode) { 7664 if (isStrongMode) {
8825 checkElementText( 7665 checkElementText(library, r'''
8826 library,
8827 r'''
8828 int get x {} 7666 int get x {}
8829 dynamic get y {} 7667 dynamic get y {}
8830 '''); 7668 ''');
8831 } else { 7669 } else {
8832 checkElementText( 7670 checkElementText(library, r'''
8833 library,
8834 r'''
8835 int get x {} 7671 int get x {}
8836 dynamic get y {} 7672 dynamic get y {}
8837 '''); 7673 ''');
8838 } 7674 }
8839 } 7675 }
8840 7676
8841 test_implicitTopLevelVariable_getterFirst() async { 7677 test_implicitTopLevelVariable_getterFirst() async {
8842 var library = 7678 var library =
8843 await checkLibrary('int get x => 0; void set x(int value) {}'); 7679 await checkLibrary('int get x => 0; void set x(int value) {}');
8844 if (isStrongMode) { 7680 if (isStrongMode) {
8845 checkElementText( 7681 checkElementText(library, r'''
8846 library,
8847 r'''
8848 int get x {} 7682 int get x {}
8849 void set x(int value) {} 7683 void set x(int value) {}
8850 '''); 7684 ''');
8851 } else { 7685 } else {
8852 checkElementText( 7686 checkElementText(library, r'''
8853 library,
8854 r'''
8855 int get x {} 7687 int get x {}
8856 void set x(int value) {} 7688 void set x(int value) {}
8857 '''); 7689 ''');
8858 } 7690 }
8859 } 7691 }
8860 7692
8861 test_implicitTopLevelVariable_setterFirst() async { 7693 test_implicitTopLevelVariable_setterFirst() async {
8862 var library = 7694 var library =
8863 await checkLibrary('void set x(int value) {} int get x => 0;'); 7695 await checkLibrary('void set x(int value) {} int get x => 0;');
8864 if (isStrongMode) { 7696 if (isStrongMode) {
8865 checkElementText( 7697 checkElementText(library, r'''
8866 library,
8867 r'''
8868 void set x(int value) {} 7698 void set x(int value) {}
8869 int get x {} 7699 int get x {}
8870 '''); 7700 ''');
8871 } else { 7701 } else {
8872 checkElementText( 7702 checkElementText(library, r'''
8873 library,
8874 r'''
8875 void set x(int value) {} 7703 void set x(int value) {}
8876 int get x {} 7704 int get x {}
8877 '''); 7705 ''');
8878 } 7706 }
8879 } 7707 }
8880 7708
8881 test_import_configurations_useDefault() async { 7709 test_import_configurations_useDefault() async {
8882 context.declaredVariables.define('dart.library.io', 'false'); 7710 context.declaredVariables.define('dart.library.io', 'false');
8883 addLibrarySource('/foo.dart', 'class A {}'); 7711 addLibrarySource('/foo.dart', 'class A {}');
8884 addLibrarySource('/foo_io.dart', 'class A {}'); 7712 addLibrarySource('/foo_io.dart', 'class A {}');
8885 addLibrarySource('/foo_html.dart', 'class A {}'); 7713 addLibrarySource('/foo_html.dart', 'class A {}');
8886 var library = await checkLibrary(r''' 7714 var library = await checkLibrary(r'''
8887 import 'foo.dart' 7715 import 'foo.dart'
8888 if (dart.library.io) 'foo_io.dart' 7716 if (dart.library.io) 'foo_io.dart'
8889 if (dart.library.html) 'foo_html.dart'; 7717 if (dart.library.html) 'foo_html.dart';
8890 7718
8891 class B extends A {} 7719 class B extends A {}
8892 '''); 7720 ''');
8893 if (isStrongMode) { 7721 if (isStrongMode) {
8894 checkElementText( 7722 checkElementText(library, r'''
8895 library,
8896 r'''
8897 import 'foo.dart'; 7723 import 'foo.dart';
8898 class B extends A { 7724 class B extends A {
8899 } 7725 }
8900 '''); 7726 ''');
8901 } else { 7727 } else {
8902 checkElementText( 7728 checkElementText(library, r'''
8903 library,
8904 r'''
8905 import 'foo.dart'; 7729 import 'foo.dart';
8906 class B extends A { 7730 class B extends A {
8907 } 7731 }
8908 '''); 7732 ''');
8909 } 7733 }
8910 var typeA = library.definingCompilationUnit.getType('B').supertype; 7734 var typeA = library.definingCompilationUnit.getType('B').supertype;
8911 expect(typeA.element.source.shortName, 'foo.dart'); 7735 expect(typeA.element.source.shortName, 'foo.dart');
8912 } 7736 }
8913 7737
8914 test_import_configurations_useFirst() async { 7738 test_import_configurations_useFirst() async {
8915 context.declaredVariables.define('dart.library.io', 'true'); 7739 context.declaredVariables.define('dart.library.io', 'true');
8916 context.declaredVariables.define('dart.library.html', 'true'); 7740 context.declaredVariables.define('dart.library.html', 'true');
8917 addLibrarySource('/foo.dart', 'class A {}'); 7741 addLibrarySource('/foo.dart', 'class A {}');
8918 addLibrarySource('/foo_io.dart', 'class A {}'); 7742 addLibrarySource('/foo_io.dart', 'class A {}');
8919 addLibrarySource('/foo_html.dart', 'class A {}'); 7743 addLibrarySource('/foo_html.dart', 'class A {}');
8920 var library = await checkLibrary(r''' 7744 var library = await checkLibrary(r'''
8921 import 'foo.dart' 7745 import 'foo.dart'
8922 if (dart.library.io) 'foo_io.dart' 7746 if (dart.library.io) 'foo_io.dart'
8923 if (dart.library.html) 'foo_html.dart'; 7747 if (dart.library.html) 'foo_html.dart';
8924 7748
8925 class B extends A {} 7749 class B extends A {}
8926 '''); 7750 ''');
8927 if (isStrongMode) { 7751 if (isStrongMode) {
8928 checkElementText( 7752 checkElementText(library, r'''
8929 library,
8930 r'''
8931 import 'foo_io.dart'; 7753 import 'foo_io.dart';
8932 class B extends A { 7754 class B extends A {
8933 } 7755 }
8934 '''); 7756 ''');
8935 } else { 7757 } else {
8936 checkElementText( 7758 checkElementText(library, r'''
8937 library,
8938 r'''
8939 import 'foo_io.dart'; 7759 import 'foo_io.dart';
8940 class B extends A { 7760 class B extends A {
8941 } 7761 }
8942 '''); 7762 ''');
8943 } 7763 }
8944 var typeA = library.definingCompilationUnit.getType('B').supertype; 7764 var typeA = library.definingCompilationUnit.getType('B').supertype;
8945 expect(typeA.element.source.shortName, 'foo_io.dart'); 7765 expect(typeA.element.source.shortName, 'foo_io.dart');
8946 } 7766 }
8947 7767
8948 test_import_deferred() async { 7768 test_import_deferred() async {
8949 addLibrarySource('/a.dart', 'f() {}'); 7769 addLibrarySource('/a.dart', 'f() {}');
8950 var library = await checkLibrary(''' 7770 var library = await checkLibrary('''
8951 import 'a.dart' deferred as p; 7771 import 'a.dart' deferred as p;
8952 main() { 7772 main() {
8953 p.f(); 7773 p.f();
8954 } 7774 }
8955 '''); 7775 ''');
8956 if (isStrongMode) { 7776 if (isStrongMode) {
8957 checkElementText( 7777 checkElementText(library, r'''
8958 library,
8959 r'''
8960 import 'a.dart' deferred as p; 7778 import 'a.dart' deferred as p;
8961 dynamic main() {} 7779 dynamic main() {}
8962 '''); 7780 ''');
8963 } else { 7781 } else {
8964 checkElementText( 7782 checkElementText(library, r'''
8965 library,
8966 r'''
8967 import 'a.dart' deferred as p; 7783 import 'a.dart' deferred as p;
8968 dynamic main() {} 7784 dynamic main() {}
8969 '''); 7785 ''');
8970 } 7786 }
8971 } 7787 }
8972 7788
8973 test_import_hide() async { 7789 test_import_hide() async {
8974 addLibrary('dart:async'); 7790 addLibrary('dart:async');
8975 var library = await checkLibrary(''' 7791 var library = await checkLibrary('''
8976 import 'dart:async' hide Stream, Completer; Future f; 7792 import 'dart:async' hide Stream, Completer; Future f;
8977 '''); 7793 ''');
8978 if (isStrongMode) { 7794 if (isStrongMode) {
8979 checkElementText( 7795 checkElementText(library, r'''
8980 library,
8981 r'''
8982 import 'dart:async' hide Stream, Completer; 7796 import 'dart:async' hide Stream, Completer;
8983 Future<dynamic> f; 7797 Future<dynamic> f;
8984 '''); 7798 ''');
8985 } else { 7799 } else {
8986 checkElementText( 7800 checkElementText(library, r'''
8987 library,
8988 r'''
8989 import 'dart:async' hide Stream, Completer; 7801 import 'dart:async' hide Stream, Completer;
8990 Future<dynamic> f; 7802 Future<dynamic> f;
8991 '''); 7803 ''');
8992 } 7804 }
8993 } 7805 }
8994 7806
8995 test_import_invalidUri_metadata() async { 7807 test_import_invalidUri_metadata() async {
8996 allowMissingFiles = true; 7808 allowMissingFiles = true;
8997 shouldCompareLibraryElements = false; 7809 shouldCompareLibraryElements = false;
8998 var library = await checkLibrary(''' 7810 var library = await checkLibrary('''
8999 @foo 7811 @foo
9000 import ''; 7812 import '';
9001 '''); 7813 ''');
9002 if (isStrongMode) { 7814 if (isStrongMode) {
9003 checkElementText( 7815 checkElementText(library, r'''
9004 library,
9005 r'''
9006 @ 7816 @
9007 foo/*location: null*/ 7817 foo/*location: null*/
9008 import ''; 7818 import '';
9009 '''); 7819 ''');
9010 } else { 7820 } else {
9011 checkElementText( 7821 checkElementText(library, r'''
9012 library,
9013 r'''
9014 @ 7822 @
9015 foo/*location: null*/ 7823 foo/*location: null*/
9016 import ''; 7824 import '';
9017 '''); 7825 ''');
9018 } 7826 }
9019 } 7827 }
9020 7828
9021 test_import_multiple_combinators() async { 7829 test_import_multiple_combinators() async {
9022 addLibrary('dart:async'); 7830 addLibrary('dart:async');
9023 var library = await checkLibrary(''' 7831 var library = await checkLibrary('''
9024 import "dart:async" hide Stream show Future; 7832 import "dart:async" hide Stream show Future;
9025 Future f; 7833 Future f;
9026 '''); 7834 ''');
9027 if (isStrongMode) { 7835 if (isStrongMode) {
9028 checkElementText( 7836 checkElementText(library, r'''
9029 library,
9030 r'''
9031 import 'dart:async' hide Stream show Future; 7837 import 'dart:async' hide Stream show Future;
9032 Future<dynamic> f; 7838 Future<dynamic> f;
9033 '''); 7839 ''');
9034 } else { 7840 } else {
9035 checkElementText( 7841 checkElementText(library, r'''
9036 library,
9037 r'''
9038 import 'dart:async' hide Stream show Future; 7842 import 'dart:async' hide Stream show Future;
9039 Future<dynamic> f; 7843 Future<dynamic> f;
9040 '''); 7844 ''');
9041 } 7845 }
9042 } 7846 }
9043 7847
9044 test_import_prefixed() async { 7848 test_import_prefixed() async {
9045 addLibrarySource('/a.dart', 'library a; class C {}'); 7849 addLibrarySource('/a.dart', 'library a; class C {}');
9046 var library = await checkLibrary('import "a.dart" as a; a.C c;'); 7850 var library = await checkLibrary('import "a.dart" as a; a.C c;');
9047 if (isStrongMode) { 7851 if (isStrongMode) {
9048 checkElementText( 7852 checkElementText(library, r'''
9049 library,
9050 r'''
9051 import 'a.dart' as a; 7853 import 'a.dart' as a;
9052 C c; 7854 C c;
9053 '''); 7855 ''');
9054 } else { 7856 } else {
9055 checkElementText( 7857 checkElementText(library, r'''
9056 library,
9057 r'''
9058 import 'a.dart' as a; 7858 import 'a.dart' as a;
9059 C c; 7859 C c;
9060 '''); 7860 ''');
9061 } 7861 }
9062 } 7862 }
9063 7863
9064 test_import_self() async { 7864 test_import_self() async {
9065 var library = await checkLibrary(''' 7865 var library = await checkLibrary('''
9066 import 'test.dart' as p; 7866 import 'test.dart' as p;
9067 class C {} 7867 class C {}
9068 class D extends p.C {} // Prevent "unused import" warning 7868 class D extends p.C {} // Prevent "unused import" warning
9069 '''); 7869 ''');
9070 expect(library.imports, hasLength(2)); 7870 expect(library.imports, hasLength(2));
9071 expect(library.imports[0].importedLibrary.location, library.location); 7871 expect(library.imports[0].importedLibrary.location, library.location);
9072 expect(library.imports[1].importedLibrary.isDartCore, true); 7872 expect(library.imports[1].importedLibrary.isDartCore, true);
9073 if (isStrongMode) { 7873 if (isStrongMode) {
9074 checkElementText( 7874 checkElementText(library, r'''
9075 library,
9076 r'''
9077 import 'test.dart' as p; 7875 import 'test.dart' as p;
9078 class C { 7876 class C {
9079 } 7877 }
9080 class D extends C { 7878 class D extends C {
9081 } 7879 }
9082 '''); 7880 ''');
9083 } else { 7881 } else {
9084 checkElementText( 7882 checkElementText(library, r'''
9085 library,
9086 r'''
9087 import 'test.dart' as p; 7883 import 'test.dart' as p;
9088 class C { 7884 class C {
9089 } 7885 }
9090 class D extends C { 7886 class D extends C {
9091 } 7887 }
9092 '''); 7888 ''');
9093 } 7889 }
9094 } 7890 }
9095 7891
9096 test_import_short_absolute() async { 7892 test_import_short_absolute() async {
9097 testFile = '/my/project/bin/test.dart'; 7893 testFile = '/my/project/bin/test.dart';
9098 // Note: "/a.dart" resolves differently on Windows vs. Posix. 7894 // Note: "/a.dart" resolves differently on Windows vs. Posix.
9099 var destinationPath = 7895 var destinationPath =
9100 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); 7896 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart'));
9101 addLibrarySource(destinationPath, 'class C {}'); 7897 addLibrarySource(destinationPath, 'class C {}');
9102 var library = await checkLibrary('import "/a.dart"; C c;'); 7898 var library = await checkLibrary('import "/a.dart"; C c;');
9103 if (isStrongMode) { 7899 if (isStrongMode) {
9104 checkElementText( 7900 checkElementText(library, r'''
9105 library,
9106 r'''
9107 import '/a.dart'; 7901 import '/a.dart';
9108 C c; 7902 C c;
9109 '''); 7903 ''');
9110 } else { 7904 } else {
9111 checkElementText( 7905 checkElementText(library, r'''
9112 library,
9113 r'''
9114 import '/a.dart'; 7906 import '/a.dart';
9115 C c; 7907 C c;
9116 '''); 7908 ''');
9117 } 7909 }
9118 } 7910 }
9119 7911
9120 test_import_show() async { 7912 test_import_show() async {
9121 addLibrary('dart:async'); 7913 addLibrary('dart:async');
9122 var library = await checkLibrary(''' 7914 var library = await checkLibrary('''
9123 import "dart:async" show Future, Stream; 7915 import "dart:async" show Future, Stream;
9124 Future f; 7916 Future f;
9125 Stream s; 7917 Stream s;
9126 '''); 7918 ''');
9127 if (isStrongMode) { 7919 if (isStrongMode) {
9128 checkElementText( 7920 checkElementText(library, r'''
9129 library,
9130 r'''
9131 import 'dart:async' show Future, Stream; 7921 import 'dart:async' show Future, Stream;
9132 Future<dynamic> f; 7922 Future<dynamic> f;
9133 Stream<dynamic> s; 7923 Stream<dynamic> s;
9134 '''); 7924 ''');
9135 } else { 7925 } else {
9136 checkElementText( 7926 checkElementText(library, r'''
9137 library,
9138 r'''
9139 import 'dart:async' show Future, Stream; 7927 import 'dart:async' show Future, Stream;
9140 Future<dynamic> f; 7928 Future<dynamic> f;
9141 Stream<dynamic> s; 7929 Stream<dynamic> s;
9142 '''); 7930 ''');
9143 } 7931 }
9144 } 7932 }
9145 7933
9146 test_imports() async { 7934 test_imports() async {
9147 addLibrarySource('/a.dart', 'library a; class C {}'); 7935 addLibrarySource('/a.dart', 'library a; class C {}');
9148 addLibrarySource('/b.dart', 'library b; class D {}'); 7936 addLibrarySource('/b.dart', 'library b; class D {}');
9149 var library = 7937 var library =
9150 await checkLibrary('import "a.dart"; import "b.dart"; C c; D d;'); 7938 await checkLibrary('import "a.dart"; import "b.dart"; C c; D d;');
9151 if (isStrongMode) { 7939 if (isStrongMode) {
9152 checkElementText( 7940 checkElementText(library, r'''
9153 library,
9154 r'''
9155 import 'a.dart'; 7941 import 'a.dart';
9156 import 'b.dart'; 7942 import 'b.dart';
9157 C c; 7943 C c;
9158 D d; 7944 D d;
9159 '''); 7945 ''');
9160 } else { 7946 } else {
9161 checkElementText( 7947 checkElementText(library, r'''
9162 library,
9163 r'''
9164 import 'a.dart'; 7948 import 'a.dart';
9165 import 'b.dart'; 7949 import 'b.dart';
9166 C c; 7950 C c;
9167 D d; 7951 D d;
9168 '''); 7952 ''');
9169 } 7953 }
9170 } 7954 }
9171 7955
9172 test_inferred_function_type_for_variable_in_generic_function() async { 7956 test_inferred_function_type_for_variable_in_generic_function() async {
9173 // In the code below, `x` has an inferred type of `() => int`, with 2 7957 // In the code below, `x` has an inferred type of `() => int`, with 2
9174 // (unused) type parameters from the enclosing top level function. 7958 // (unused) type parameters from the enclosing top level function.
9175 var library = await checkLibrary(''' 7959 var library = await checkLibrary('''
9176 f<U, V>() { 7960 f<U, V>() {
9177 var x = () => 0; 7961 var x = () => 0;
9178 } 7962 }
9179 '''); 7963 ''');
9180 if (isStrongMode) { 7964 if (isStrongMode) {
9181 checkElementText( 7965 checkElementText(library, r'''
9182 library,
9183 r'''
9184 dynamic f<U, V>() {} 7966 dynamic f<U, V>() {}
9185 '''); 7967 ''');
9186 } else { 7968 } else {
9187 checkElementText( 7969 checkElementText(library, r'''
9188 library,
9189 r'''
9190 dynamic f<U, V>() {} 7970 dynamic f<U, V>() {}
9191 '''); 7971 ''');
9192 } 7972 }
9193 } 7973 }
9194 7974
9195 test_inferred_function_type_in_generic_class_constructor() async { 7975 test_inferred_function_type_in_generic_class_constructor() async {
9196 // In the code below, `() => () => 0` has an inferred return type of 7976 // In the code below, `() => () => 0` has an inferred return type of
9197 // `() => int`, with 2 (unused) type parameters from the enclosing class. 7977 // `() => int`, with 2 (unused) type parameters from the enclosing class.
9198 var library = await checkLibrary(''' 7978 var library = await checkLibrary('''
9199 class C<U, V> { 7979 class C<U, V> {
9200 final x; 7980 final x;
9201 C() : x = (() => () => 0); 7981 C() : x = (() => () => 0);
9202 } 7982 }
9203 '''); 7983 ''');
9204 if (isStrongMode) { 7984 if (isStrongMode) {
9205 checkElementText( 7985 checkElementText(library, r'''
9206 library,
9207 r'''
9208 class C<U, V> { 7986 class C<U, V> {
9209 final dynamic x; 7987 final dynamic x;
9210 C(); 7988 C();
9211 } 7989 }
9212 '''); 7990 ''');
9213 } else { 7991 } else {
9214 checkElementText( 7992 checkElementText(library, r'''
9215 library,
9216 r'''
9217 class C<U, V> { 7993 class C<U, V> {
9218 final dynamic x; 7994 final dynamic x;
9219 C(); 7995 C();
9220 } 7996 }
9221 '''); 7997 ''');
9222 } 7998 }
9223 } 7999 }
9224 8000
9225 test_inferred_function_type_in_generic_class_getter() async { 8001 test_inferred_function_type_in_generic_class_getter() async {
9226 // In the code below, `() => () => 0` has an inferred return type of 8002 // In the code below, `() => () => 0` has an inferred return type of
9227 // `() => int`, with 2 (unused) type parameters from the enclosing class. 8003 // `() => int`, with 2 (unused) type parameters from the enclosing class.
9228 var library = await checkLibrary(''' 8004 var library = await checkLibrary('''
9229 class C<U, V> { 8005 class C<U, V> {
9230 get x => () => () => 0; 8006 get x => () => () => 0;
9231 } 8007 }
9232 '''); 8008 ''');
9233 if (isStrongMode) { 8009 if (isStrongMode) {
9234 checkElementText( 8010 checkElementText(library, r'''
9235 library,
9236 r'''
9237 class C<U, V> { 8011 class C<U, V> {
9238 dynamic get x {} 8012 dynamic get x {}
9239 } 8013 }
9240 '''); 8014 ''');
9241 } else { 8015 } else {
9242 checkElementText( 8016 checkElementText(library, r'''
9243 library,
9244 r'''
9245 class C<U, V> { 8017 class C<U, V> {
9246 dynamic get x {} 8018 dynamic get x {}
9247 } 8019 }
9248 '''); 8020 ''');
9249 } 8021 }
9250 } 8022 }
9251 8023
9252 test_inferred_function_type_in_generic_class_in_generic_method() async { 8024 test_inferred_function_type_in_generic_class_in_generic_method() async {
9253 // In the code below, `() => () => 0` has an inferred return type of 8025 // In the code below, `() => () => 0` has an inferred return type of
9254 // `() => int`, with 3 (unused) type parameters from the enclosing class 8026 // `() => int`, with 3 (unused) type parameters from the enclosing class
9255 // and method. 8027 // and method.
9256 var library = await checkLibrary(''' 8028 var library = await checkLibrary('''
9257 class C<T> { 8029 class C<T> {
9258 f<U, V>() { 8030 f<U, V>() {
9259 print(() => () => 0); 8031 print(() => () => 0);
9260 } 8032 }
9261 } 8033 }
9262 '''); 8034 ''');
9263 if (isStrongMode) { 8035 if (isStrongMode) {
9264 checkElementText( 8036 checkElementText(library, r'''
9265 library,
9266 r'''
9267 class C<T> { 8037 class C<T> {
9268 dynamic f<U, V>() {} 8038 dynamic f<U, V>() {}
9269 } 8039 }
9270 '''); 8040 ''');
9271 } else { 8041 } else {
9272 checkElementText( 8042 checkElementText(library, r'''
9273 library,
9274 r'''
9275 class C<T> { 8043 class C<T> {
9276 dynamic f<U, V>() {} 8044 dynamic f<U, V>() {}
9277 } 8045 }
9278 '''); 8046 ''');
9279 } 8047 }
9280 } 8048 }
9281 8049
9282 test_inferred_function_type_in_generic_class_setter() async { 8050 test_inferred_function_type_in_generic_class_setter() async {
9283 // In the code below, `() => () => 0` has an inferred return type of 8051 // In the code below, `() => () => 0` has an inferred return type of
9284 // `() => int`, with 2 (unused) type parameters from the enclosing class. 8052 // `() => int`, with 2 (unused) type parameters from the enclosing class.
9285 var library = await checkLibrary(''' 8053 var library = await checkLibrary('''
9286 class C<U, V> { 8054 class C<U, V> {
9287 void set x(value) { 8055 void set x(value) {
9288 print(() => () => 0); 8056 print(() => () => 0);
9289 } 8057 }
9290 } 8058 }
9291 '''); 8059 ''');
9292 if (isStrongMode) { 8060 if (isStrongMode) {
9293 checkElementText( 8061 checkElementText(library, r'''
9294 library,
9295 r'''
9296 class C<U, V> { 8062 class C<U, V> {
9297 void set x(dynamic value) {} 8063 void set x(dynamic value) {}
9298 } 8064 }
9299 '''); 8065 ''');
9300 } else { 8066 } else {
9301 checkElementText( 8067 checkElementText(library, r'''
9302 library,
9303 r'''
9304 class C<U, V> { 8068 class C<U, V> {
9305 void set x(dynamic value) {} 8069 void set x(dynamic value) {}
9306 } 8070 }
9307 '''); 8071 ''');
9308 } 8072 }
9309 } 8073 }
9310 8074
9311 test_inferred_function_type_in_generic_closure() async { 8075 test_inferred_function_type_in_generic_closure() async {
9312 if (!createOptions().strongMode) { 8076 if (!createOptions().strongMode) {
9313 // The test below uses generic comment syntax because proper generic 8077 // The test below uses generic comment syntax because proper generic
9314 // method syntax doesn't support generic closures. So it can only run in 8078 // method syntax doesn't support generic closures. So it can only run in
9315 // strong mode. 8079 // strong mode.
9316 // TODO(paulberry): once proper generic method syntax supports generic 8080 // TODO(paulberry): once proper generic method syntax supports generic
9317 // closures, rewrite the test below without using generic comment syntax, 8081 // closures, rewrite the test below without using generic comment syntax,
9318 // and remove this hack. See dartbug.com/25819 8082 // and remove this hack. See dartbug.com/25819
9319 return; 8083 return;
9320 } 8084 }
9321 // In the code below, `<U, V>() => () => 0` has an inferred return type of 8085 // In the code below, `<U, V>() => () => 0` has an inferred return type of
9322 // `() => int`, with 3 (unused) type parameters. 8086 // `() => int`, with 3 (unused) type parameters.
9323 var library = await checkLibrary(''' 8087 var library = await checkLibrary('''
9324 f<T>() { 8088 f<T>() {
9325 print(/*<U, V>*/() => () => 0); 8089 print(/*<U, V>*/() => () => 0);
9326 } 8090 }
9327 '''); 8091 ''');
9328 if (isStrongMode) { 8092 if (isStrongMode) {
9329 checkElementText( 8093 checkElementText(library, r'''
9330 library,
9331 r'''
9332 dynamic f<T>() {} 8094 dynamic f<T>() {}
9333 '''); 8095 ''');
9334 } else { 8096 } else {
9335 checkElementText( 8097 checkElementText(library, r'''
9336 library,
9337 r'''
9338 '''); 8098 ''');
9339 } 8099 }
9340 } 8100 }
9341 8101
9342 test_inferred_generic_function_type_in_generic_closure() async { 8102 test_inferred_generic_function_type_in_generic_closure() async {
9343 if (!createOptions().strongMode) { 8103 if (!createOptions().strongMode) {
9344 // The test below uses generic comment syntax because proper generic 8104 // The test below uses generic comment syntax because proper generic
9345 // method syntax doesn't support generic closures. So it can only run in 8105 // method syntax doesn't support generic closures. So it can only run in
9346 // strong mode. 8106 // strong mode.
9347 // TODO(paulberry): once proper generic method syntax supports generic 8107 // TODO(paulberry): once proper generic method syntax supports generic
9348 // closures, rewrite the test below without using generic comment syntax, 8108 // closures, rewrite the test below without using generic comment syntax,
9349 // and remove this hack. See dartbug.com/25819 8109 // and remove this hack. See dartbug.com/25819
9350 return; 8110 return;
9351 } 8111 }
9352 // In the code below, `<U, V>() => <W, X, Y, Z>() => 0` has an inferred 8112 // In the code below, `<U, V>() => <W, X, Y, Z>() => 0` has an inferred
9353 // return type of `() => int`, with 7 (unused) type parameters. 8113 // return type of `() => int`, with 7 (unused) type parameters.
9354 var library = await checkLibrary(''' 8114 var library = await checkLibrary('''
9355 f<T>() { 8115 f<T>() {
9356 print(/*<U, V>*/() => /*<W, X, Y, Z>*/() => 0); 8116 print(/*<U, V>*/() => /*<W, X, Y, Z>*/() => 0);
9357 } 8117 }
9358 '''); 8118 ''');
9359 if (isStrongMode) { 8119 if (isStrongMode) {
9360 checkElementText( 8120 checkElementText(library, r'''
9361 library,
9362 r'''
9363 dynamic f<T>() {} 8121 dynamic f<T>() {}
9364 '''); 8122 ''');
9365 } else { 8123 } else {
9366 checkElementText( 8124 checkElementText(library, r'''
9367 library,
9368 r'''
9369 '''); 8125 ''');
9370 } 8126 }
9371 } 8127 }
9372 8128
9373 test_inferred_type_is_typedef() async { 8129 test_inferred_type_is_typedef() async {
9374 var library = await checkLibrary('typedef int F(String s);' 8130 var library = await checkLibrary('typedef int F(String s);'
9375 ' class C extends D { var v; }' 8131 ' class C extends D { var v; }'
9376 ' abstract class D { F get v; }'); 8132 ' abstract class D { F get v; }');
9377 if (isStrongMode) { 8133 if (isStrongMode) {
9378 checkElementText( 8134 checkElementText(library, r'''
9379 library,
9380 r'''
9381 typedef int F(String s); 8135 typedef int F(String s);
9382 class C extends D { 8136 class C extends D {
9383 F v; 8137 F v;
9384 } 8138 }
9385 abstract class D { 8139 abstract class D {
9386 F get v; 8140 F get v;
9387 } 8141 }
9388 '''); 8142 ''');
9389 } else { 8143 } else {
9390 checkElementText( 8144 checkElementText(library, r'''
9391 library,
9392 r'''
9393 typedef int F(String s); 8145 typedef int F(String s);
9394 class C extends D { 8146 class C extends D {
9395 dynamic v; 8147 dynamic v;
9396 } 8148 }
9397 abstract class D { 8149 abstract class D {
9398 F get v; 8150 F get v;
9399 } 8151 }
9400 '''); 8152 ''');
9401 } 8153 }
9402 } 8154 }
9403 8155
9404 test_inferred_type_refers_to_bound_type_param() async { 8156 test_inferred_type_refers_to_bound_type_param() async {
9405 var library = await checkLibrary(''' 8157 var library = await checkLibrary('''
9406 class C<T> extends D<int, T> { 8158 class C<T> extends D<int, T> {
9407 var v; 8159 var v;
9408 } 8160 }
9409 abstract class D<U, V> { 8161 abstract class D<U, V> {
9410 Map<V, U> get v; 8162 Map<V, U> get v;
9411 } 8163 }
9412 '''); 8164 ''');
9413 if (isStrongMode) { 8165 if (isStrongMode) {
9414 checkElementText( 8166 checkElementText(library, r'''
9415 library,
9416 r'''
9417 class C<T> extends D<int, T> { 8167 class C<T> extends D<int, T> {
9418 Map<T, int> v; 8168 Map<T, int> v;
9419 } 8169 }
9420 abstract class D<U, V> { 8170 abstract class D<U, V> {
9421 Map<V, U> get v; 8171 Map<V, U> get v;
9422 } 8172 }
9423 '''); 8173 ''');
9424 } else { 8174 } else {
9425 checkElementText( 8175 checkElementText(library, r'''
9426 library,
9427 r'''
9428 class C<T> extends D<int, T> { 8176 class C<T> extends D<int, T> {
9429 dynamic v; 8177 dynamic v;
9430 } 8178 }
9431 abstract class D<U, V> { 8179 abstract class D<U, V> {
9432 Map<V, U> get v; 8180 Map<V, U> get v;
9433 } 8181 }
9434 '''); 8182 ''');
9435 } 8183 }
9436 } 8184 }
9437 8185
9438 test_inferred_type_refers_to_function_typed_param_of_typedef() async { 8186 test_inferred_type_refers_to_function_typed_param_of_typedef() async {
9439 var library = await checkLibrary(''' 8187 var library = await checkLibrary('''
9440 typedef void F(int g(String s)); 8188 typedef void F(int g(String s));
9441 h(F f) => null; 8189 h(F f) => null;
9442 var v = h(/*info:INFERRED_TYPE_CLOSURE*/(y) {}); 8190 var v = h(/*info:INFERRED_TYPE_CLOSURE*/(y) {});
9443 '''); 8191 ''');
9444 if (isStrongMode) { 8192 if (isStrongMode) {
9445 checkElementText( 8193 checkElementText(library, r'''
9446 library,
9447 r'''
9448 typedef void F((String) → int g); 8194 typedef void F((String) → int g);
9449 dynamic v; 8195 dynamic v;
9450 dynamic h(F f) {} 8196 dynamic h(F f) {}
9451 '''); 8197 ''');
9452 } else { 8198 } else {
9453 checkElementText( 8199 checkElementText(library, r'''
9454 library,
9455 r'''
9456 typedef void F((String) → int g); 8200 typedef void F((String) → int g);
9457 dynamic v; 8201 dynamic v;
9458 dynamic h(F f) {} 8202 dynamic h(F f) {}
9459 '''); 8203 ''');
9460 } 8204 }
9461 } 8205 }
9462 8206
9463 test_inferred_type_refers_to_function_typed_parameter_type_generic_class() asy nc { 8207 test_inferred_type_refers_to_function_typed_parameter_type_generic_class() asy nc {
9464 var library = await checkLibrary(''' 8208 var library = await checkLibrary('''
9465 class C<T, U> extends D<U, int> { 8209 class C<T, U> extends D<U, int> {
9466 void f(int x, g) {} 8210 void f(int x, g) {}
9467 } 8211 }
9468 abstract class D<V, W> { 8212 abstract class D<V, W> {
9469 void f(int x, W g(V s)); 8213 void f(int x, W g(V s));
9470 }'''); 8214 }''');
9471 if (isStrongMode) { 8215 if (isStrongMode) {
9472 checkElementText( 8216 checkElementText(library, r'''
9473 library,
9474 r'''
9475 class C<T, U> extends D<U, int> { 8217 class C<T, U> extends D<U, int> {
9476 void f(int x, (U) → int g) {} 8218 void f(int x, (U) → int g) {}
9477 } 8219 }
9478 abstract class D<V, W> { 8220 abstract class D<V, W> {
9479 void f(int x, (V) → W g); 8221 void f(int x, (V) → W g);
9480 } 8222 }
9481 '''); 8223 ''');
9482 } else { 8224 } else {
9483 checkElementText( 8225 checkElementText(library, r'''
9484 library,
9485 r'''
9486 class C<T, U> extends D<U, int> { 8226 class C<T, U> extends D<U, int> {
9487 void f(int x, dynamic g) {} 8227 void f(int x, dynamic g) {}
9488 } 8228 }
9489 abstract class D<V, W> { 8229 abstract class D<V, W> {
9490 void f(int x, (V) → W g); 8230 void f(int x, (V) → W g);
9491 } 8231 }
9492 '''); 8232 ''');
9493 } 8233 }
9494 } 8234 }
9495 8235
9496 test_inferred_type_refers_to_function_typed_parameter_type_other_lib() async { 8236 test_inferred_type_refers_to_function_typed_parameter_type_other_lib() async {
9497 addLibrarySource( 8237 addLibrarySource('/a.dart', '''
9498 '/a.dart',
9499 '''
9500 import 'b.dart'; 8238 import 'b.dart';
9501 abstract class D extends E {} 8239 abstract class D extends E {}
9502 '''); 8240 ''');
9503 addLibrarySource( 8241 addLibrarySource('/b.dart', '''
9504 '/b.dart',
9505 '''
9506 abstract class E { 8242 abstract class E {
9507 void f(int x, int g(String s)); 8243 void f(int x, int g(String s));
9508 } 8244 }
9509 '''); 8245 ''');
9510 var library = await checkLibrary(''' 8246 var library = await checkLibrary('''
9511 import 'a.dart'; 8247 import 'a.dart';
9512 class C extends D { 8248 class C extends D {
9513 void f(int x, g) {} 8249 void f(int x, g) {}
9514 } 8250 }
9515 '''); 8251 ''');
9516 if (isStrongMode) { 8252 if (isStrongMode) {
9517 checkElementText( 8253 checkElementText(library, r'''
9518 library,
9519 r'''
9520 import 'a.dart'; 8254 import 'a.dart';
9521 class C extends D { 8255 class C extends D {
9522 void f(int x, (String) → int g) {} 8256 void f(int x, (String) → int g) {}
9523 } 8257 }
9524 '''); 8258 ''');
9525 } else { 8259 } else {
9526 checkElementText( 8260 checkElementText(library, r'''
9527 library,
9528 r'''
9529 import 'a.dart'; 8261 import 'a.dart';
9530 class C extends D { 8262 class C extends D {
9531 void f(int x, dynamic g) {} 8263 void f(int x, dynamic g) {}
9532 } 8264 }
9533 '''); 8265 ''');
9534 } 8266 }
9535 } 8267 }
9536 8268
9537 test_inferred_type_refers_to_method_function_typed_parameter_type() async { 8269 test_inferred_type_refers_to_method_function_typed_parameter_type() async {
9538 var library = await checkLibrary('class C extends D { void f(int x, g) {} }' 8270 var library = await checkLibrary('class C extends D { void f(int x, g) {} }'
9539 ' abstract class D { void f(int x, int g(String s)); }'); 8271 ' abstract class D { void f(int x, int g(String s)); }');
9540 if (isStrongMode) { 8272 if (isStrongMode) {
9541 checkElementText( 8273 checkElementText(library, r'''
9542 library,
9543 r'''
9544 class C extends D { 8274 class C extends D {
9545 void f(int x, (String) → int g) {} 8275 void f(int x, (String) → int g) {}
9546 } 8276 }
9547 abstract class D { 8277 abstract class D {
9548 void f(int x, (String) → int g); 8278 void f(int x, (String) → int g);
9549 } 8279 }
9550 '''); 8280 ''');
9551 } else { 8281 } else {
9552 checkElementText( 8282 checkElementText(library, r'''
9553 library,
9554 r'''
9555 class C extends D { 8283 class C extends D {
9556 void f(int x, dynamic g) {} 8284 void f(int x, dynamic g) {}
9557 } 8285 }
9558 abstract class D { 8286 abstract class D {
9559 void f(int x, (String) → int g); 8287 void f(int x, (String) → int g);
9560 } 8288 }
9561 '''); 8289 ''');
9562 } 8290 }
9563 } 8291 }
9564 8292
9565 test_inferred_type_refers_to_nested_function_typed_param() async { 8293 test_inferred_type_refers_to_nested_function_typed_param() async {
9566 var library = await checkLibrary(''' 8294 var library = await checkLibrary('''
9567 f(void g(int x, void h())) => null; 8295 f(void g(int x, void h())) => null;
9568 var v = f((x, y) {}); 8296 var v = f((x, y) {});
9569 '''); 8297 ''');
9570 if (isStrongMode) { 8298 if (isStrongMode) {
9571 checkElementText( 8299 checkElementText(library, r'''
9572 library,
9573 r'''
9574 dynamic v; 8300 dynamic v;
9575 dynamic f((int, () → void) → void g) {} 8301 dynamic f((int, () → void) → void g) {}
9576 '''); 8302 ''');
9577 } else { 8303 } else {
9578 checkElementText( 8304 checkElementText(library, r'''
9579 library,
9580 r'''
9581 dynamic v; 8305 dynamic v;
9582 dynamic f((int, () → void) → void g) {} 8306 dynamic f((int, () → void) → void g) {}
9583 '''); 8307 ''');
9584 } 8308 }
9585 } 8309 }
9586 8310
9587 test_inferred_type_refers_to_nested_function_typed_param_named() async { 8311 test_inferred_type_refers_to_nested_function_typed_param_named() async {
9588 var library = await checkLibrary(''' 8312 var library = await checkLibrary('''
9589 f({void g(int x, void h())}) => null; 8313 f({void g(int x, void h())}) => null;
9590 var v = f(g: (x, y) {}); 8314 var v = f(g: (x, y) {});
9591 '''); 8315 ''');
9592 if (isStrongMode) { 8316 if (isStrongMode) {
9593 checkElementText( 8317 checkElementText(library, r'''
9594 library,
9595 r'''
9596 dynamic v; 8318 dynamic v;
9597 dynamic f({(int, () → void) → void g}) {} 8319 dynamic f({(int, () → void) → void g}) {}
9598 '''); 8320 ''');
9599 } else { 8321 } else {
9600 checkElementText( 8322 checkElementText(library, r'''
9601 library,
9602 r'''
9603 dynamic v; 8323 dynamic v;
9604 dynamic f({(int, () → void) → void g}) {} 8324 dynamic f({(int, () → void) → void g}) {}
9605 '''); 8325 ''');
9606 } 8326 }
9607 } 8327 }
9608 8328
9609 test_inferred_type_refers_to_setter_function_typed_parameter_type() async { 8329 test_inferred_type_refers_to_setter_function_typed_parameter_type() async {
9610 var library = await checkLibrary('class C extends D { void set f(g) {} }' 8330 var library = await checkLibrary('class C extends D { void set f(g) {} }'
9611 ' abstract class D { void set f(int g(String s)); }'); 8331 ' abstract class D { void set f(int g(String s)); }');
9612 if (isStrongMode) { 8332 if (isStrongMode) {
9613 checkElementText( 8333 checkElementText(library, r'''
9614 library,
9615 r'''
9616 class C extends D { 8334 class C extends D {
9617 void set f((String) → int g) {} 8335 void set f((String) → int g) {}
9618 } 8336 }
9619 abstract class D { 8337 abstract class D {
9620 void set f((String) → int g); 8338 void set f((String) → int g);
9621 } 8339 }
9622 '''); 8340 ''');
9623 } else { 8341 } else {
9624 checkElementText( 8342 checkElementText(library, r'''
9625 library,
9626 r'''
9627 class C extends D { 8343 class C extends D {
9628 void set f(dynamic g) {} 8344 void set f(dynamic g) {}
9629 } 8345 }
9630 abstract class D { 8346 abstract class D {
9631 void set f((String) → int g); 8347 void set f((String) → int g);
9632 } 8348 }
9633 '''); 8349 ''');
9634 } 8350 }
9635 } 8351 }
9636 8352
9637 test_inferredType_definedInSdkLibraryPart() async { 8353 test_inferredType_definedInSdkLibraryPart() async {
9638 addSource( 8354 addSource('/a.dart', r'''
9639 '/a.dart',
9640 r'''
9641 import 'dart:async'; 8355 import 'dart:async';
9642 class A { 8356 class A {
9643 m(Stream p) {} 8357 m(Stream p) {}
9644 } 8358 }
9645 '''); 8359 ''');
9646 LibraryElement library = await checkLibrary(r''' 8360 LibraryElement library = await checkLibrary(r'''
9647 import 'a.dart'; 8361 import 'a.dart';
9648 class B extends A { 8362 class B extends A {
9649 m(p) {} 8363 m(p) {}
9650 } 8364 }
9651 '''); 8365 ''');
9652 if (isStrongMode) { 8366 if (isStrongMode) {
9653 checkElementText( 8367 checkElementText(library, r'''
9654 library,
9655 r'''
9656 import 'a.dart'; 8368 import 'a.dart';
9657 class B extends A { 8369 class B extends A {
9658 dynamic m(Stream<dynamic> p) {} 8370 dynamic m(Stream<dynamic> p) {}
9659 } 8371 }
9660 '''); 8372 ''');
9661 } else { 8373 } else {
9662 checkElementText( 8374 checkElementText(library, r'''
9663 library,
9664 r'''
9665 import 'a.dart'; 8375 import 'a.dart';
9666 class B extends A { 8376 class B extends A {
9667 dynamic m(dynamic p) {} 8377 dynamic m(dynamic p) {}
9668 } 8378 }
9669 '''); 8379 ''');
9670 } 8380 }
9671 ClassElement b = library.definingCompilationUnit.types[0]; 8381 ClassElement b = library.definingCompilationUnit.types[0];
9672 ParameterElement p = b.methods[0].parameters[0]; 8382 ParameterElement p = b.methods[0].parameters[0];
9673 // This test should verify that we correctly record inferred types, 8383 // This test should verify that we correctly record inferred types,
9674 // when the type is defined in a part of an SDK library. So, test that 8384 // when the type is defined in a part of an SDK library. So, test that
9675 // the type is actually in a part. 8385 // the type is actually in a part.
9676 Element streamElement = p.type.element; 8386 Element streamElement = p.type.element;
9677 if (streamElement is ClassElement) { 8387 if (streamElement is ClassElement) {
9678 expect(streamElement.source, isNot(streamElement.library.source)); 8388 expect(streamElement.source, isNot(streamElement.library.source));
9679 } 8389 }
9680 } 8390 }
9681 8391
9682 test_inferredType_usesSyntheticFunctionType_functionTypedParam() async { 8392 test_inferredType_usesSyntheticFunctionType_functionTypedParam() async {
9683 // AnalysisContext does not set the enclosing element for the synthetic 8393 // AnalysisContext does not set the enclosing element for the synthetic
9684 // FunctionElement created for the [f, g] type argument. 8394 // FunctionElement created for the [f, g] type argument.
9685 shouldCompareLibraryElements = false; 8395 shouldCompareLibraryElements = false;
9686 var library = await checkLibrary(''' 8396 var library = await checkLibrary('''
9687 int f(int x(String y)) => null; 8397 int f(int x(String y)) => null;
9688 String g(int x(String y)) => null; 8398 String g(int x(String y)) => null;
9689 var v = [f, g]; 8399 var v = [f, g];
9690 '''); 8400 ''');
9691 if (isStrongMode) { 8401 if (isStrongMode) {
9692 checkElementText( 8402 checkElementText(library, r'''
9693 library,
9694 r'''
9695 List<((String) → int) → Object> v; 8403 List<((String) → int) → Object> v;
9696 int f((String) → int x) {} 8404 int f((String) → int x) {}
9697 String g((String) → int x) {} 8405 String g((String) → int x) {}
9698 '''); 8406 ''');
9699 } else { 8407 } else {
9700 checkElementText( 8408 checkElementText(library, r'''
9701 library,
9702 r'''
9703 dynamic v; 8409 dynamic v;
9704 int f((String) → int x) {} 8410 int f((String) → int x) {}
9705 String g((String) → int x) {} 8411 String g((String) → int x) {}
9706 '''); 8412 ''');
9707 } 8413 }
9708 } 8414 }
9709 8415
9710 test_inheritance_errors() async { 8416 test_inheritance_errors() async {
9711 var library = await checkLibrary(''' 8417 var library = await checkLibrary('''
9712 abstract class A { 8418 abstract class A {
9713 int m(); 8419 int m();
9714 } 8420 }
9715 8421
9716 abstract class B { 8422 abstract class B {
9717 String m(); 8423 String m();
9718 } 8424 }
9719 8425
9720 abstract class C implements A, B {} 8426 abstract class C implements A, B {}
9721 8427
9722 abstract class D extends C { 8428 abstract class D extends C {
9723 var f; 8429 var f;
9724 } 8430 }
9725 '''); 8431 ''');
9726 if (isStrongMode) { 8432 if (isStrongMode) {
9727 checkElementText( 8433 checkElementText(library, r'''
9728 library,
9729 r'''
9730 abstract class A { 8434 abstract class A {
9731 int m(); 8435 int m();
9732 } 8436 }
9733 abstract class B { 8437 abstract class B {
9734 String m(); 8438 String m();
9735 } 8439 }
9736 abstract class C implements A, B { 8440 abstract class C implements A, B {
9737 } 8441 }
9738 abstract class D extends C { 8442 abstract class D extends C {
9739 dynamic f; 8443 dynamic f;
9740 } 8444 }
9741 '''); 8445 ''');
9742 } else { 8446 } else {
9743 checkElementText( 8447 checkElementText(library, r'''
9744 library,
9745 r'''
9746 abstract class A { 8448 abstract class A {
9747 int m(); 8449 int m();
9748 } 8450 }
9749 abstract class B { 8451 abstract class B {
9750 String m(); 8452 String m();
9751 } 8453 }
9752 abstract class C implements A, B { 8454 abstract class C implements A, B {
9753 } 8455 }
9754 abstract class D extends C { 8456 abstract class D extends C {
9755 dynamic f; 8457 dynamic f;
9756 } 8458 }
9757 '''); 8459 ''');
9758 } 8460 }
9759 } 8461 }
9760 8462
9761 test_initializer_executable_with_return_type_from_closure() async { 8463 test_initializer_executable_with_return_type_from_closure() async {
9762 var library = await checkLibrary('var v = () => 0;'); 8464 var library = await checkLibrary('var v = () => 0;');
9763 if (isStrongMode) { 8465 if (isStrongMode) {
9764 checkElementText( 8466 checkElementText(library, r'''
9765 library,
9766 r'''
9767 () → int v; 8467 () → int v;
9768 '''); 8468 ''');
9769 } else { 8469 } else {
9770 checkElementText( 8470 checkElementText(library, r'''
9771 library,
9772 r'''
9773 dynamic v; 8471 dynamic v;
9774 '''); 8472 ''');
9775 } 8473 }
9776 } 8474 }
9777 8475
9778 test_initializer_executable_with_return_type_from_closure_await_dynamic() asyn c { 8476 test_initializer_executable_with_return_type_from_closure_await_dynamic() asyn c {
9779 var library = await checkLibrary('var v = (f) async => await f;'); 8477 var library = await checkLibrary('var v = (f) async => await f;');
9780 if (isStrongMode) { 8478 if (isStrongMode) {
9781 checkElementText( 8479 checkElementText(library, r'''
9782 library,
9783 r'''
9784 (dynamic) → Future<dynamic> v; 8480 (dynamic) → Future<dynamic> v;
9785 '''); 8481 ''');
9786 } else { 8482 } else {
9787 checkElementText( 8483 checkElementText(library, r'''
9788 library,
9789 r'''
9790 dynamic v; 8484 dynamic v;
9791 '''); 8485 ''');
9792 } 8486 }
9793 } 8487 }
9794 8488
9795 test_initializer_executable_with_return_type_from_closure_await_future3_int() async { 8489 test_initializer_executable_with_return_type_from_closure_await_future3_int() async {
9796 var library = await checkLibrary(r''' 8490 var library = await checkLibrary(r'''
9797 import 'dart:async'; 8491 import 'dart:async';
9798 var v = (Future<Future<Future<int>>> f) async => await f; 8492 var v = (Future<Future<Future<int>>> f) async => await f;
9799 '''); 8493 ''');
9800 if (isStrongMode) { 8494 if (isStrongMode) {
9801 checkElementText( 8495 checkElementText(library, r'''
9802 library,
9803 r'''
9804 import 'dart:async'; 8496 import 'dart:async';
9805 (Future<Future<Future<int>>>) → Future<int> v; 8497 (Future<Future<Future<int>>>) → Future<int> v;
9806 '''); 8498 ''');
9807 } else { 8499 } else {
9808 checkElementText( 8500 checkElementText(library, r'''
9809 library,
9810 r'''
9811 import 'dart:async'; 8501 import 'dart:async';
9812 dynamic v; 8502 dynamic v;
9813 '''); 8503 ''');
9814 } 8504 }
9815 } 8505 }
9816 8506
9817 test_initializer_executable_with_return_type_from_closure_await_future_int() a sync { 8507 test_initializer_executable_with_return_type_from_closure_await_future_int() a sync {
9818 var library = await checkLibrary(r''' 8508 var library = await checkLibrary(r'''
9819 import 'dart:async'; 8509 import 'dart:async';
9820 var v = (Future<int> f) async => await f; 8510 var v = (Future<int> f) async => await f;
9821 '''); 8511 ''');
9822 if (isStrongMode) { 8512 if (isStrongMode) {
9823 checkElementText( 8513 checkElementText(library, r'''
9824 library,
9825 r'''
9826 import 'dart:async'; 8514 import 'dart:async';
9827 (Future<int>) → Future<int> v; 8515 (Future<int>) → Future<int> v;
9828 '''); 8516 ''');
9829 } else { 8517 } else {
9830 checkElementText( 8518 checkElementText(library, r'''
9831 library,
9832 r'''
9833 import 'dart:async'; 8519 import 'dart:async';
9834 dynamic v; 8520 dynamic v;
9835 '''); 8521 ''');
9836 } 8522 }
9837 } 8523 }
9838 8524
9839 test_initializer_executable_with_return_type_from_closure_await_future_noArg() async { 8525 test_initializer_executable_with_return_type_from_closure_await_future_noArg() async {
9840 var library = await checkLibrary(r''' 8526 var library = await checkLibrary(r'''
9841 import 'dart:async'; 8527 import 'dart:async';
9842 var v = (Future f) async => await f; 8528 var v = (Future f) async => await f;
9843 '''); 8529 ''');
9844 if (isStrongMode) { 8530 if (isStrongMode) {
9845 checkElementText( 8531 checkElementText(library, r'''
9846 library,
9847 r'''
9848 import 'dart:async'; 8532 import 'dart:async';
9849 (Future<dynamic>) → Future<dynamic> v; 8533 (Future<dynamic>) → Future<dynamic> v;
9850 '''); 8534 ''');
9851 } else { 8535 } else {
9852 checkElementText( 8536 checkElementText(library, r'''
9853 library,
9854 r'''
9855 import 'dart:async'; 8537 import 'dart:async';
9856 dynamic v; 8538 dynamic v;
9857 '''); 8539 ''');
9858 } 8540 }
9859 } 8541 }
9860 8542
9861 test_initializer_executable_with_return_type_from_closure_field() async { 8543 test_initializer_executable_with_return_type_from_closure_field() async {
9862 var library = await checkLibrary(''' 8544 var library = await checkLibrary('''
9863 class C { 8545 class C {
9864 var v = () => 0; 8546 var v = () => 0;
9865 } 8547 }
9866 '''); 8548 ''');
9867 if (isStrongMode) { 8549 if (isStrongMode) {
9868 checkElementText( 8550 checkElementText(library, r'''
9869 library,
9870 r'''
9871 class C { 8551 class C {
9872 () → int v; 8552 () → int v;
9873 } 8553 }
9874 '''); 8554 ''');
9875 } else { 8555 } else {
9876 checkElementText( 8556 checkElementText(library, r'''
9877 library,
9878 r'''
9879 class C { 8557 class C {
9880 dynamic v; 8558 dynamic v;
9881 } 8559 }
9882 '''); 8560 ''');
9883 } 8561 }
9884 } 8562 }
9885 8563
9886 test_initializer_executable_with_return_type_from_closure_local() async { 8564 test_initializer_executable_with_return_type_from_closure_local() async {
9887 var library = await checkLibrary(''' 8565 var library = await checkLibrary('''
9888 void f() { 8566 void f() {
9889 int u = 0; 8567 int u = 0;
9890 var v = () => 0; 8568 var v = () => 0;
9891 } 8569 }
9892 '''); 8570 ''');
9893 if (isStrongMode) { 8571 if (isStrongMode) {
9894 checkElementText( 8572 checkElementText(library, r'''
9895 library,
9896 r'''
9897 void f() {} 8573 void f() {}
9898 '''); 8574 ''');
9899 } else { 8575 } else {
9900 checkElementText( 8576 checkElementText(library, r'''
9901 library,
9902 r'''
9903 void f() {} 8577 void f() {}
9904 '''); 8578 ''');
9905 } 8579 }
9906 } 8580 }
9907 8581
9908 test_instantiateToBounds_boundRefersToEarlierTypeArgument() async { 8582 test_instantiateToBounds_boundRefersToEarlierTypeArgument() async {
9909 var library = await checkLibrary(''' 8583 var library = await checkLibrary('''
9910 class C<S extends num, T extends C<S, T>> {} 8584 class C<S extends num, T extends C<S, T>> {}
9911 C c; 8585 C c;
9912 '''); 8586 ''');
9913 if (isStrongMode) { 8587 if (isStrongMode) {
9914 checkElementText( 8588 checkElementText(library, r'''
9915 library,
9916 r'''
9917 class C<S extends num, T extends C<S, T>> { 8589 class C<S extends num, T extends C<S, T>> {
9918 } 8590 }
9919 C<num, C<num, dynamic>> c; 8591 C<num, C<num, dynamic>> c;
9920 '''); 8592 ''');
9921 } else { 8593 } else {
9922 checkElementText( 8594 checkElementText(library, r'''
9923 library,
9924 r'''
9925 class C<S extends num, T extends C<S, T>> { 8595 class C<S extends num, T extends C<S, T>> {
9926 } 8596 }
9927 C<dynamic, dynamic> c; 8597 C<dynamic, dynamic> c;
9928 '''); 8598 ''');
9929 } 8599 }
9930 } 8600 }
9931 8601
9932 test_instantiateToBounds_boundRefersToItself() async { 8602 test_instantiateToBounds_boundRefersToItself() async {
9933 var library = await checkLibrary(''' 8603 var library = await checkLibrary('''
9934 class C<T extends C<T>> {} 8604 class C<T extends C<T>> {}
9935 C c; 8605 C c;
9936 var c2 = new C(); 8606 var c2 = new C();
9937 class B { 8607 class B {
9938 var c3 = new C(); 8608 var c3 = new C();
9939 } 8609 }
9940 '''); 8610 ''');
9941 if (isStrongMode) { 8611 if (isStrongMode) {
9942 checkElementText( 8612 checkElementText(library, r'''
9943 library,
9944 r'''
9945 class C<T extends C<T>> { 8613 class C<T extends C<T>> {
9946 } 8614 }
9947 class B { 8615 class B {
9948 C<C<dynamic>> c3; 8616 C<C<dynamic>> c3;
9949 } 8617 }
9950 C<C<dynamic>> c; 8618 C<C<dynamic>> c;
9951 C<C<dynamic>> c2; 8619 C<C<dynamic>> c2;
9952 '''); 8620 ''');
9953 } else { 8621 } else {
9954 checkElementText( 8622 checkElementText(library, r'''
9955 library,
9956 r'''
9957 class C<T extends C<T>> { 8623 class C<T extends C<T>> {
9958 } 8624 }
9959 class B { 8625 class B {
9960 dynamic c3; 8626 dynamic c3;
9961 } 8627 }
9962 C<dynamic> c; 8628 C<dynamic> c;
9963 dynamic c2; 8629 dynamic c2;
9964 '''); 8630 ''');
9965 } 8631 }
9966 } 8632 }
9967 8633
9968 test_instantiateToBounds_boundRefersToLaterTypeArgument() async { 8634 test_instantiateToBounds_boundRefersToLaterTypeArgument() async {
9969 var library = await checkLibrary(''' 8635 var library = await checkLibrary('''
9970 class C<T extends C<T, U>, U extends num> {} 8636 class C<T extends C<T, U>, U extends num> {}
9971 C c; 8637 C c;
9972 '''); 8638 ''');
9973 if (isStrongMode) { 8639 if (isStrongMode) {
9974 checkElementText( 8640 checkElementText(library, r'''
9975 library,
9976 r'''
9977 class C<T extends C<T, U>, U extends num> { 8641 class C<T extends C<T, U>, U extends num> {
9978 } 8642 }
9979 C<C<dynamic, num>, num> c; 8643 C<C<dynamic, num>, num> c;
9980 '''); 8644 ''');
9981 } else { 8645 } else {
9982 checkElementText( 8646 checkElementText(library, r'''
9983 library,
9984 r'''
9985 class C<T extends C<T, U>, U extends num> { 8647 class C<T extends C<T, U>, U extends num> {
9986 } 8648 }
9987 C<dynamic, dynamic> c; 8649 C<dynamic, dynamic> c;
9988 '''); 8650 ''');
9989 } 8651 }
9990 } 8652 }
9991 8653
9992 test_instantiateToBounds_functionTypeAlias_simple() async { 8654 test_instantiateToBounds_functionTypeAlias_simple() async {
9993 var library = await checkLibrary(''' 8655 var library = await checkLibrary('''
9994 typedef F<T extends num>(T p); 8656 typedef F<T extends num>(T p);
9995 F f; 8657 F f;
9996 '''); 8658 ''');
9997 if (isStrongMode) { 8659 if (isStrongMode) {
9998 checkElementText( 8660 checkElementText(library, r'''
9999 library,
10000 r'''
10001 typedef dynamic F<T extends num>(T p); 8661 typedef dynamic F<T extends num>(T p);
10002 F<num> f; 8662 F<num> f;
10003 '''); 8663 ''');
10004 } else { 8664 } else {
10005 checkElementText( 8665 checkElementText(library, r'''
10006 library,
10007 r'''
10008 typedef dynamic F<T extends num>(T p); 8666 typedef dynamic F<T extends num>(T p);
10009 F f; 8667 F f;
10010 '''); 8668 ''');
10011 } 8669 }
10012 } 8670 }
10013 8671
10014 test_instantiateToBounds_simple() async { 8672 test_instantiateToBounds_simple() async {
10015 var library = await checkLibrary(''' 8673 var library = await checkLibrary('''
10016 class C<T extends num> {} 8674 class C<T extends num> {}
10017 C c; 8675 C c;
10018 '''); 8676 ''');
10019 if (isStrongMode) { 8677 if (isStrongMode) {
10020 checkElementText( 8678 checkElementText(library, r'''
10021 library,
10022 r'''
10023 class C<T extends num> { 8679 class C<T extends num> {
10024 } 8680 }
10025 C<num> c; 8681 C<num> c;
10026 '''); 8682 ''');
10027 } else { 8683 } else {
10028 checkElementText( 8684 checkElementText(library, r'''
10029 library,
10030 r'''
10031 class C<T extends num> { 8685 class C<T extends num> {
10032 } 8686 }
10033 C<dynamic> c; 8687 C<dynamic> c;
10034 '''); 8688 ''');
10035 } 8689 }
10036 } 8690 }
10037 8691
10038 test_invalid_annotation_prefixed_constructor() async { 8692 test_invalid_annotation_prefixed_constructor() async {
10039 addLibrarySource( 8693 addLibrarySource('/a.dart', r'''
10040 '/a.dart',
10041 r'''
10042 class C { 8694 class C {
10043 const C.named(); 8695 const C.named();
10044 } 8696 }
10045 '''); 8697 ''');
10046 var library = await checkLibrary(''' 8698 var library = await checkLibrary('''
10047 import "a.dart" as a; 8699 import "a.dart" as a;
10048 @a.C.named 8700 @a.C.named
10049 class D {} 8701 class D {}
10050 '''); 8702 ''');
10051 if (isStrongMode) { 8703 if (isStrongMode) {
10052 checkElementText( 8704 checkElementText(library, r'''
10053 library,
10054 r'''
10055 import 'a.dart' as a; 8705 import 'a.dart' as a;
10056 @ 8706 @
10057 a/*location: test.dart;a*/. 8707 a/*location: test.dart;a*/.
10058 C/*location: a.dart;C*/. 8708 C/*location: a.dart;C*/.
10059 named/*location: a.dart;C;named*/ 8709 named/*location: a.dart;C;named*/
10060 class D { 8710 class D {
10061 } 8711 }
10062 '''); 8712 ''');
10063 } else { 8713 } else {
10064 checkElementText( 8714 checkElementText(library, r'''
10065 library,
10066 r'''
10067 import 'a.dart' as a; 8715 import 'a.dart' as a;
10068 @ 8716 @
10069 a/*location: test.dart;a*/. 8717 a/*location: test.dart;a*/.
10070 C/*location: a.dart;C*/. 8718 C/*location: a.dart;C*/.
10071 named/*location: a.dart;C;named*/ 8719 named/*location: a.dart;C;named*/
10072 class D { 8720 class D {
10073 } 8721 }
10074 '''); 8722 ''');
10075 } 8723 }
10076 } 8724 }
10077 8725
10078 test_invalid_annotation_unprefixed_constructor() async { 8726 test_invalid_annotation_unprefixed_constructor() async {
10079 addLibrarySource( 8727 addLibrarySource('/a.dart', r'''
10080 '/a.dart',
10081 r'''
10082 class C { 8728 class C {
10083 const C.named(); 8729 const C.named();
10084 } 8730 }
10085 '''); 8731 ''');
10086 var library = await checkLibrary(''' 8732 var library = await checkLibrary('''
10087 import "a.dart"; 8733 import "a.dart";
10088 @C.named 8734 @C.named
10089 class D {} 8735 class D {}
10090 '''); 8736 ''');
10091 if (isStrongMode) { 8737 if (isStrongMode) {
10092 checkElementText( 8738 checkElementText(library, r'''
10093 library,
10094 r'''
10095 import 'a.dart'; 8739 import 'a.dart';
10096 @ 8740 @
10097 C/*location: a.dart;C*/. 8741 C/*location: a.dart;C*/.
10098 named/*location: a.dart;C;named*/ 8742 named/*location: a.dart;C;named*/
10099 class D { 8743 class D {
10100 } 8744 }
10101 '''); 8745 ''');
10102 } else { 8746 } else {
10103 checkElementText( 8747 checkElementText(library, r'''
10104 library,
10105 r'''
10106 import 'a.dart'; 8748 import 'a.dart';
10107 @ 8749 @
10108 C/*location: a.dart;C*/. 8750 C/*location: a.dart;C*/.
10109 named/*location: a.dart;C;named*/ 8751 named/*location: a.dart;C;named*/
10110 class D { 8752 class D {
10111 } 8753 }
10112 '''); 8754 ''');
10113 } 8755 }
10114 } 8756 }
10115 8757
10116 test_invalid_importPrefix_asTypeArgument() async { 8758 test_invalid_importPrefix_asTypeArgument() async {
10117 var library = await checkLibrary(''' 8759 var library = await checkLibrary('''
10118 import 'dart:async' as ppp; 8760 import 'dart:async' as ppp;
10119 class C { 8761 class C {
10120 List<ppp> v; 8762 List<ppp> v;
10121 } 8763 }
10122 '''); 8764 ''');
10123 if (isStrongMode) { 8765 if (isStrongMode) {
10124 checkElementText( 8766 checkElementText(library, r'''
10125 library,
10126 r'''
10127 import 'dart:async' as ppp; 8767 import 'dart:async' as ppp;
10128 class C { 8768 class C {
10129 List<dynamic> v; 8769 List<dynamic> v;
10130 } 8770 }
10131 '''); 8771 ''');
10132 } else { 8772 } else {
10133 checkElementText( 8773 checkElementText(library, r'''
10134 library,
10135 r'''
10136 import 'dart:async' as ppp; 8774 import 'dart:async' as ppp;
10137 class C { 8775 class C {
10138 List<dynamic> v; 8776 List<dynamic> v;
10139 } 8777 }
10140 '''); 8778 ''');
10141 } 8779 }
10142 } 8780 }
10143 8781
10144 test_invalid_nameConflict_imported() async { 8782 test_invalid_nameConflict_imported() async {
10145 namesThatCannotBeResolved.add('V'); 8783 namesThatCannotBeResolved.add('V');
10146 addLibrarySource('/a.dart', 'V() {}'); 8784 addLibrarySource('/a.dart', 'V() {}');
10147 addLibrarySource('/b.dart', 'V() {}'); 8785 addLibrarySource('/b.dart', 'V() {}');
10148 var library = await checkLibrary(''' 8786 var library = await checkLibrary('''
10149 import 'a.dart'; 8787 import 'a.dart';
10150 import 'b.dart'; 8788 import 'b.dart';
10151 foo([p = V]) {} 8789 foo([p = V]) {}
10152 '''); 8790 ''');
10153 if (isStrongMode) { 8791 if (isStrongMode) {
10154 checkElementText( 8792 checkElementText(library, r'''
10155 library,
10156 r'''
10157 import 'a.dart'; 8793 import 'a.dart';
10158 import 'b.dart'; 8794 import 'b.dart';
10159 dynamic foo([dynamic p = 8795 dynamic foo([dynamic p =
10160 V/*location: null*/]) {} 8796 V/*location: null*/]) {}
10161 '''); 8797 ''');
10162 } else { 8798 } else {
10163 checkElementText( 8799 checkElementText(library, r'''
10164 library,
10165 r'''
10166 import 'a.dart'; 8800 import 'a.dart';
10167 import 'b.dart'; 8801 import 'b.dart';
10168 dynamic foo([dynamic p = 8802 dynamic foo([dynamic p =
10169 V/*location: null*/]) {} 8803 V/*location: null*/]) {}
10170 '''); 8804 ''');
10171 } 8805 }
10172 } 8806 }
10173 8807
10174 test_invalid_nameConflict_imported_exported() async { 8808 test_invalid_nameConflict_imported_exported() async {
10175 namesThatCannotBeResolved.add('V'); 8809 namesThatCannotBeResolved.add('V');
10176 addLibrarySource('/a.dart', 'V() {}'); 8810 addLibrarySource('/a.dart', 'V() {}');
10177 addLibrarySource('/b.dart', 'V() {}'); 8811 addLibrarySource('/b.dart', 'V() {}');
10178 addLibrarySource( 8812 addLibrarySource('/c.dart', r'''
10179 '/c.dart',
10180 r'''
10181 export 'a.dart'; 8813 export 'a.dart';
10182 export 'b.dart'; 8814 export 'b.dart';
10183 '''); 8815 ''');
10184 var library = await checkLibrary(''' 8816 var library = await checkLibrary('''
10185 import 'c.dart'; 8817 import 'c.dart';
10186 foo([p = V]) {} 8818 foo([p = V]) {}
10187 '''); 8819 ''');
10188 if (isStrongMode) { 8820 if (isStrongMode) {
10189 checkElementText( 8821 checkElementText(library, r'''
10190 library,
10191 r'''
10192 import 'c.dart'; 8822 import 'c.dart';
10193 dynamic foo([dynamic p = 8823 dynamic foo([dynamic p =
10194 V/*location: null*/]) {} 8824 V/*location: null*/]) {}
10195 '''); 8825 ''');
10196 } else { 8826 } else {
10197 checkElementText( 8827 checkElementText(library, r'''
10198 library,
10199 r'''
10200 import 'c.dart'; 8828 import 'c.dart';
10201 dynamic foo([dynamic p = 8829 dynamic foo([dynamic p =
10202 V/*location: null*/]) {} 8830 V/*location: null*/]) {}
10203 '''); 8831 ''');
10204 } 8832 }
10205 } 8833 }
10206 8834
10207 test_invalid_nameConflict_local() async { 8835 test_invalid_nameConflict_local() async {
10208 namesThatCannotBeResolved.add('V'); 8836 namesThatCannotBeResolved.add('V');
10209 var library = await checkLibrary(''' 8837 var library = await checkLibrary('''
10210 foo([p = V]) {} 8838 foo([p = V]) {}
10211 V() {} 8839 V() {}
10212 var V; 8840 var V;
10213 '''); 8841 ''');
10214 if (isStrongMode) { 8842 if (isStrongMode) {
10215 checkElementText( 8843 checkElementText(library, r'''
10216 library,
10217 r'''
10218 dynamic V; 8844 dynamic V;
10219 dynamic foo([dynamic p = 8845 dynamic foo([dynamic p =
10220 V/*location: null*/]) {} 8846 V/*location: null*/]) {}
10221 dynamic V() {} 8847 dynamic V() {}
10222 '''); 8848 ''');
10223 } else { 8849 } else {
10224 checkElementText( 8850 checkElementText(library, r'''
10225 library,
10226 r'''
10227 dynamic V; 8851 dynamic V;
10228 dynamic foo([dynamic p = 8852 dynamic foo([dynamic p =
10229 V/*location: null*/]) {} 8853 V/*location: null*/]) {}
10230 dynamic V() {} 8854 dynamic V() {}
10231 '''); 8855 ''');
10232 } 8856 }
10233 } 8857 }
10234 8858
10235 test_invalid_setterParameter_fieldFormalParameter() async { 8859 test_invalid_setterParameter_fieldFormalParameter() async {
10236 var library = await checkLibrary(''' 8860 var library = await checkLibrary('''
10237 class C { 8861 class C {
10238 int foo; 8862 int foo;
10239 void set bar(this.foo) {} 8863 void set bar(this.foo) {}
10240 } 8864 }
10241 '''); 8865 ''');
10242 if (isStrongMode) { 8866 if (isStrongMode) {
10243 checkElementText( 8867 checkElementText(library, r'''
10244 library,
10245 r'''
10246 class C { 8868 class C {
10247 int foo; 8869 int foo;
10248 void set bar(dynamic this.foo) {} 8870 void set bar(dynamic this.foo) {}
10249 } 8871 }
10250 '''); 8872 ''');
10251 } else { 8873 } else {
10252 checkElementText( 8874 checkElementText(library, r'''
10253 library,
10254 r'''
10255 class C { 8875 class C {
10256 int foo; 8876 int foo;
10257 void set bar(dynamic this.foo) {} 8877 void set bar(dynamic this.foo) {}
10258 } 8878 }
10259 '''); 8879 ''');
10260 } 8880 }
10261 } 8881 }
10262 8882
10263 test_invalid_setterParameter_fieldFormalParameter_self() async { 8883 test_invalid_setterParameter_fieldFormalParameter_self() async {
10264 var library = await checkLibrary(''' 8884 var library = await checkLibrary('''
10265 class C { 8885 class C {
10266 set x(this.x) {} 8886 set x(this.x) {}
10267 } 8887 }
10268 '''); 8888 ''');
10269 if (isStrongMode) { 8889 if (isStrongMode) {
10270 checkElementText( 8890 checkElementText(library, r'''
10271 library,
10272 r'''
10273 class C { 8891 class C {
10274 void set x(dynamic this.x) {} 8892 void set x(dynamic this.x) {}
10275 } 8893 }
10276 '''); 8894 ''');
10277 } else { 8895 } else {
10278 checkElementText( 8896 checkElementText(library, r'''
10279 library,
10280 r'''
10281 class C { 8897 class C {
10282 dynamic set x(dynamic this.x) {} 8898 dynamic set x(dynamic this.x) {}
10283 } 8899 }
10284 '''); 8900 ''');
10285 } 8901 }
10286 } 8902 }
10287 8903
10288 test_invalidUri_part_emptyUri() async { 8904 test_invalidUri_part_emptyUri() async {
10289 allowMissingFiles = true; 8905 allowMissingFiles = true;
10290 shouldCompareLibraryElements = false; 8906 shouldCompareLibraryElements = false;
10291 var library = await checkLibrary(r''' 8907 var library = await checkLibrary(r'''
10292 part ''; 8908 part '';
10293 class B extends A {} 8909 class B extends A {}
10294 '''); 8910 ''');
10295 if (isStrongMode) { 8911 if (isStrongMode) {
10296 checkElementText( 8912 checkElementText(library, r'''
10297 library,
10298 r'''
10299 part ''; 8913 part '';
10300 class B { 8914 class B {
10301 } 8915 }
10302 -------------------- 8916 --------------------
10303 unit: null 8917 unit: null
10304 8918
10305 '''); 8919 ''');
10306 } else { 8920 } else {
10307 checkElementText( 8921 checkElementText(library, r'''
10308 library,
10309 r'''
10310 part ''; 8922 part '';
10311 class B { 8923 class B {
10312 } 8924 }
10313 -------------------- 8925 --------------------
10314 unit: null 8926 unit: null
10315 8927
10316 '''); 8928 ''');
10317 } 8929 }
10318 } 8930 }
10319 8931
(...skipping 11 matching lines...) Expand all
10331 export '[invalid uri]:foo.dart'; 8943 export '[invalid uri]:foo.dart';
10332 export 'a2.dart'; 8944 export 'a2.dart';
10333 export '[invalid uri]'; 8945 export '[invalid uri]';
10334 export '[invalid uri]:foo.dart'; 8946 export '[invalid uri]:foo.dart';
10335 8947
10336 part '[invalid uri]'; 8948 part '[invalid uri]';
10337 part 'a3.dart'; 8949 part 'a3.dart';
10338 part '[invalid uri]'; 8950 part '[invalid uri]';
10339 '''); 8951 ''');
10340 if (isStrongMode) { 8952 if (isStrongMode) {
10341 checkElementText( 8953 checkElementText(library, r'''
10342 library,
10343 r'''
10344 import '[invalid uri]'; 8954 import '[invalid uri]';
10345 import '[invalid uri]:foo.dart'; 8955 import '[invalid uri]:foo.dart';
10346 import 'a1.dart'; 8956 import 'a1.dart';
10347 import '[invalid uri]'; 8957 import '[invalid uri]';
10348 import '[invalid uri]:foo.dart'; 8958 import '[invalid uri]:foo.dart';
10349 export '[invalid uri]'; 8959 export '[invalid uri]';
10350 export '[invalid uri]:foo.dart'; 8960 export '[invalid uri]:foo.dart';
10351 export 'a2.dart'; 8961 export 'a2.dart';
10352 export '[invalid uri]'; 8962 export '[invalid uri]';
10353 export '[invalid uri]:foo.dart'; 8963 export '[invalid uri]:foo.dart';
10354 part '[invalid uri]'; 8964 part '[invalid uri]';
10355 part 'a3.dart'; 8965 part 'a3.dart';
10356 part '[invalid uri]'; 8966 part '[invalid uri]';
10357 -------------------- 8967 --------------------
10358 unit: null 8968 unit: null
10359 8969
10360 -------------------- 8970 --------------------
10361 unit: a3.dart 8971 unit: a3.dart
10362 8972
10363 -------------------- 8973 --------------------
10364 unit: null 8974 unit: null
10365 8975
10366 '''); 8976 ''');
10367 } else { 8977 } else {
10368 checkElementText( 8978 checkElementText(library, r'''
10369 library,
10370 r'''
10371 import '[invalid uri]'; 8979 import '[invalid uri]';
10372 import '[invalid uri]:foo.dart'; 8980 import '[invalid uri]:foo.dart';
10373 import 'a1.dart'; 8981 import 'a1.dart';
10374 import '[invalid uri]'; 8982 import '[invalid uri]';
10375 import '[invalid uri]:foo.dart'; 8983 import '[invalid uri]:foo.dart';
10376 export '[invalid uri]'; 8984 export '[invalid uri]';
10377 export '[invalid uri]:foo.dart'; 8985 export '[invalid uri]:foo.dart';
10378 export 'a2.dart'; 8986 export 'a2.dart';
10379 export '[invalid uri]'; 8987 export '[invalid uri]';
10380 export '[invalid uri]:foo.dart'; 8988 export '[invalid uri]:foo.dart';
10381 part '[invalid uri]'; 8989 part '[invalid uri]';
10382 part 'a3.dart'; 8990 part 'a3.dart';
10383 part '[invalid uri]'; 8991 part '[invalid uri]';
10384 -------------------- 8992 --------------------
10385 unit: null 8993 unit: null
10386 8994
10387 -------------------- 8995 --------------------
10388 unit: a3.dart 8996 unit: a3.dart
10389 8997
10390 -------------------- 8998 --------------------
10391 unit: null 8999 unit: null
10392 9000
10393 '''); 9001 ''');
10394 } 9002 }
10395 } 9003 }
10396 9004
10397 test_library() async { 9005 test_library() async {
10398 var library = await checkLibrary(''); 9006 var library = await checkLibrary('');
10399 if (isStrongMode) { 9007 if (isStrongMode) {
10400 checkElementText( 9008 checkElementText(library, r'''
10401 library,
10402 r'''
10403 '''); 9009 ''');
10404 } else { 9010 } else {
10405 checkElementText( 9011 checkElementText(library, r'''
10406 library,
10407 r'''
10408 '''); 9012 ''');
10409 } 9013 }
10410 } 9014 }
10411 9015
10412 test_library_documented() async { 9016 test_library_documented() async {
10413 var library = await checkLibrary(''' 9017 var library = await checkLibrary('''
10414 // Extra comment so doc comment offset != 0 9018 // Extra comment so doc comment offset != 0
10415 /** 9019 /**
10416 * Docs 9020 * Docs
10417 */ 9021 */
10418 library foo;'''); 9022 library foo;''');
10419 if (isStrongMode) { 9023 if (isStrongMode) {
10420 checkElementText( 9024 checkElementText(library, r'''
10421 library,
10422 r'''
10423 library foo; 9025 library foo;
10424 '''); 9026 ''');
10425 } else { 9027 } else {
10426 checkElementText( 9028 checkElementText(library, r'''
10427 library,
10428 r'''
10429 library foo; 9029 library foo;
10430 '''); 9030 ''');
10431 } 9031 }
10432 } 9032 }
10433 9033
10434 test_library_name_with_spaces() async { 9034 test_library_name_with_spaces() async {
10435 var library = await checkLibrary('library foo . bar ;'); 9035 var library = await checkLibrary('library foo . bar ;');
10436 if (isStrongMode) { 9036 if (isStrongMode) {
10437 checkElementText( 9037 checkElementText(library, r'''
10438 library,
10439 r'''
10440 library foo.bar; 9038 library foo.bar;
10441 '''); 9039 ''');
10442 } else { 9040 } else {
10443 checkElementText( 9041 checkElementText(library, r'''
10444 library,
10445 r'''
10446 library foo.bar; 9042 library foo.bar;
10447 '''); 9043 ''');
10448 } 9044 }
10449 } 9045 }
10450 9046
10451 test_library_named() async { 9047 test_library_named() async {
10452 var library = await checkLibrary('library foo.bar;'); 9048 var library = await checkLibrary('library foo.bar;');
10453 if (isStrongMode) { 9049 if (isStrongMode) {
10454 checkElementText( 9050 checkElementText(library, r'''
10455 library,
10456 r'''
10457 library foo.bar; 9051 library foo.bar;
10458 '''); 9052 ''');
10459 } else { 9053 } else {
10460 checkElementText( 9054 checkElementText(library, r'''
10461 library,
10462 r'''
10463 library foo.bar; 9055 library foo.bar;
10464 '''); 9056 ''');
10465 } 9057 }
10466 } 9058 }
10467 9059
10468 test_localFunctions() async { 9060 test_localFunctions() async {
10469 var library = await checkLibrary(r''' 9061 var library = await checkLibrary(r'''
10470 f() { 9062 f() {
10471 f1() {} 9063 f1() {}
10472 { 9064 {
10473 f2() {} 9065 f2() {}
10474 } 9066 }
10475 } 9067 }
10476 '''); 9068 ''');
10477 if (isStrongMode) { 9069 if (isStrongMode) {
10478 checkElementText( 9070 checkElementText(library, r'''
10479 library,
10480 r'''
10481 dynamic f() {} 9071 dynamic f() {}
10482 '''); 9072 ''');
10483 } else { 9073 } else {
10484 checkElementText( 9074 checkElementText(library, r'''
10485 library,
10486 r'''
10487 dynamic f() {} 9075 dynamic f() {}
10488 '''); 9076 ''');
10489 } 9077 }
10490 } 9078 }
10491 9079
10492 test_localFunctions_inConstructor() async { 9080 test_localFunctions_inConstructor() async {
10493 var library = await checkLibrary(r''' 9081 var library = await checkLibrary(r'''
10494 class C { 9082 class C {
10495 C() { 9083 C() {
10496 f() {} 9084 f() {}
10497 } 9085 }
10498 } 9086 }
10499 '''); 9087 ''');
10500 if (isStrongMode) { 9088 if (isStrongMode) {
10501 checkElementText( 9089 checkElementText(library, r'''
10502 library,
10503 r'''
10504 class C { 9090 class C {
10505 C(); 9091 C();
10506 } 9092 }
10507 '''); 9093 ''');
10508 } else { 9094 } else {
10509 checkElementText( 9095 checkElementText(library, r'''
10510 library,
10511 r'''
10512 class C { 9096 class C {
10513 C(); 9097 C();
10514 } 9098 }
10515 '''); 9099 ''');
10516 } 9100 }
10517 } 9101 }
10518 9102
10519 test_localFunctions_inMethod() async { 9103 test_localFunctions_inMethod() async {
10520 var library = await checkLibrary(r''' 9104 var library = await checkLibrary(r'''
10521 class C { 9105 class C {
10522 m() { 9106 m() {
10523 f() {} 9107 f() {}
10524 } 9108 }
10525 } 9109 }
10526 '''); 9110 ''');
10527 if (isStrongMode) { 9111 if (isStrongMode) {
10528 checkElementText( 9112 checkElementText(library, r'''
10529 library,
10530 r'''
10531 class C { 9113 class C {
10532 dynamic m() {} 9114 dynamic m() {}
10533 } 9115 }
10534 '''); 9116 ''');
10535 } else { 9117 } else {
10536 checkElementText( 9118 checkElementText(library, r'''
10537 library,
10538 r'''
10539 class C { 9119 class C {
10540 dynamic m() {} 9120 dynamic m() {}
10541 } 9121 }
10542 '''); 9122 ''');
10543 } 9123 }
10544 } 9124 }
10545 9125
10546 test_localFunctions_inTopLevelGetter() async { 9126 test_localFunctions_inTopLevelGetter() async {
10547 var library = await checkLibrary(r''' 9127 var library = await checkLibrary(r'''
10548 get g { 9128 get g {
10549 f() {} 9129 f() {}
10550 } 9130 }
10551 '''); 9131 ''');
10552 if (isStrongMode) { 9132 if (isStrongMode) {
10553 checkElementText( 9133 checkElementText(library, r'''
10554 library,
10555 r'''
10556 dynamic get g {} 9134 dynamic get g {}
10557 '''); 9135 ''');
10558 } else { 9136 } else {
10559 checkElementText( 9137 checkElementText(library, r'''
10560 library,
10561 r'''
10562 dynamic get g {} 9138 dynamic get g {}
10563 '''); 9139 ''');
10564 } 9140 }
10565 } 9141 }
10566 9142
10567 test_localLabels_inConstructor() async { 9143 test_localLabels_inConstructor() async {
10568 var library = await checkLibrary( 9144 var library = await checkLibrary(r'''
10569 r'''
10570 class C { 9145 class C {
10571 C() { 9146 C() {
10572 aaa: while (true) {} 9147 aaa: while (true) {}
10573 bbb: switch (42) { 9148 bbb: switch (42) {
10574 ccc: case 0: 9149 ccc: case 0:
10575 break; 9150 break;
10576 } 9151 }
10577 } 9152 }
10578 } 9153 }
10579 ''', 9154 ''', allowErrors: true);
10580 allowErrors: true);
10581 if (isStrongMode) { 9155 if (isStrongMode) {
10582 checkElementText( 9156 checkElementText(library, r'''
10583 library,
10584 r'''
10585 class C { 9157 class C {
10586 C(); 9158 C();
10587 } 9159 }
10588 '''); 9160 ''');
10589 } else { 9161 } else {
10590 checkElementText( 9162 checkElementText(library, r'''
10591 library,
10592 r'''
10593 class C { 9163 class C {
10594 C(); 9164 C();
10595 } 9165 }
10596 '''); 9166 ''');
10597 } 9167 }
10598 } 9168 }
10599 9169
10600 test_localLabels_inMethod() async { 9170 test_localLabels_inMethod() async {
10601 var library = await checkLibrary( 9171 var library = await checkLibrary(r'''
10602 r'''
10603 class C { 9172 class C {
10604 m() { 9173 m() {
10605 aaa: while (true) {} 9174 aaa: while (true) {}
10606 bbb: switch (42) { 9175 bbb: switch (42) {
10607 ccc: case 0: 9176 ccc: case 0:
10608 break; 9177 break;
10609 } 9178 }
10610 } 9179 }
10611 } 9180 }
10612 ''', 9181 ''', allowErrors: true);
10613 allowErrors: true);
10614 if (isStrongMode) { 9182 if (isStrongMode) {
10615 checkElementText( 9183 checkElementText(library, r'''
10616 library,
10617 r'''
10618 class C { 9184 class C {
10619 dynamic m() {} 9185 dynamic m() {}
10620 } 9186 }
10621 '''); 9187 ''');
10622 } else { 9188 } else {
10623 checkElementText( 9189 checkElementText(library, r'''
10624 library,
10625 r'''
10626 class C { 9190 class C {
10627 dynamic m() {} 9191 dynamic m() {}
10628 } 9192 }
10629 '''); 9193 ''');
10630 } 9194 }
10631 } 9195 }
10632 9196
10633 test_localLabels_inTopLevelFunction() async { 9197 test_localLabels_inTopLevelFunction() async {
10634 var library = await checkLibrary( 9198 var library = await checkLibrary(r'''
10635 r'''
10636 main() { 9199 main() {
10637 aaa: while (true) {} 9200 aaa: while (true) {}
10638 bbb: switch (42) { 9201 bbb: switch (42) {
10639 ccc: case 0: 9202 ccc: case 0:
10640 break; 9203 break;
10641 } 9204 }
10642 } 9205 }
10643 ''', 9206 ''', allowErrors: true);
10644 allowErrors: true);
10645 if (isStrongMode) { 9207 if (isStrongMode) {
10646 checkElementText( 9208 checkElementText(library, r'''
10647 library,
10648 r'''
10649 dynamic main() {} 9209 dynamic main() {}
10650 '''); 9210 ''');
10651 } else { 9211 } else {
10652 checkElementText( 9212 checkElementText(library, r'''
10653 library,
10654 r'''
10655 dynamic main() {} 9213 dynamic main() {}
10656 '''); 9214 ''');
10657 } 9215 }
10658 } 9216 }
10659 9217
10660 test_main_class() async { 9218 test_main_class() async {
10661 var library = await checkLibrary('class main {}'); 9219 var library = await checkLibrary('class main {}');
10662 if (isStrongMode) { 9220 if (isStrongMode) {
10663 checkElementText( 9221 checkElementText(library, r'''
10664 library,
10665 r'''
10666 class main { 9222 class main {
10667 } 9223 }
10668 '''); 9224 ''');
10669 } else { 9225 } else {
10670 checkElementText( 9226 checkElementText(library, r'''
10671 library,
10672 r'''
10673 class main { 9227 class main {
10674 } 9228 }
10675 '''); 9229 ''');
10676 } 9230 }
10677 } 9231 }
10678 9232
10679 test_main_class_alias() async { 9233 test_main_class_alias() async {
10680 var library = 9234 var library =
10681 await checkLibrary('class main = C with D; class C {} class D {}'); 9235 await checkLibrary('class main = C with D; class C {} class D {}');
10682 if (isStrongMode) { 9236 if (isStrongMode) {
10683 checkElementText( 9237 checkElementText(library, r'''
10684 library,
10685 r'''
10686 class alias main extends C with D { 9238 class alias main extends C with D {
10687 synthetic main() = C; 9239 synthetic main() = C;
10688 } 9240 }
10689 class C { 9241 class C {
10690 } 9242 }
10691 class D { 9243 class D {
10692 } 9244 }
10693 '''); 9245 ''');
10694 } else { 9246 } else {
10695 checkElementText( 9247 checkElementText(library, r'''
10696 library,
10697 r'''
10698 class alias main extends C with D { 9248 class alias main extends C with D {
10699 synthetic main() = C; 9249 synthetic main() = C;
10700 } 9250 }
10701 class C { 9251 class C {
10702 } 9252 }
10703 class D { 9253 class D {
10704 } 9254 }
10705 '''); 9255 ''');
10706 } 9256 }
10707 } 9257 }
10708 9258
10709 test_main_class_alias_via_export() async { 9259 test_main_class_alias_via_export() async {
10710 addLibrarySource('/a.dart', 'class main = C with D; class C {} class D {}'); 9260 addLibrarySource('/a.dart', 'class main = C with D; class C {} class D {}');
10711 var library = await checkLibrary('export "a.dart";'); 9261 var library = await checkLibrary('export "a.dart";');
10712 if (isStrongMode) { 9262 if (isStrongMode) {
10713 checkElementText( 9263 checkElementText(library, r'''
10714 library,
10715 r'''
10716 export 'a.dart'; 9264 export 'a.dart';
10717 '''); 9265 ''');
10718 } else { 9266 } else {
10719 checkElementText( 9267 checkElementText(library, r'''
10720 library,
10721 r'''
10722 export 'a.dart'; 9268 export 'a.dart';
10723 '''); 9269 ''');
10724 } 9270 }
10725 } 9271 }
10726 9272
10727 test_main_class_via_export() async { 9273 test_main_class_via_export() async {
10728 addLibrarySource('/a.dart', 'class main {}'); 9274 addLibrarySource('/a.dart', 'class main {}');
10729 var library = await checkLibrary('export "a.dart";'); 9275 var library = await checkLibrary('export "a.dart";');
10730 if (isStrongMode) { 9276 if (isStrongMode) {
10731 checkElementText( 9277 checkElementText(library, r'''
10732 library,
10733 r'''
10734 export 'a.dart'; 9278 export 'a.dart';
10735 '''); 9279 ''');
10736 } else { 9280 } else {
10737 checkElementText( 9281 checkElementText(library, r'''
10738 library,
10739 r'''
10740 export 'a.dart'; 9282 export 'a.dart';
10741 '''); 9283 ''');
10742 } 9284 }
10743 } 9285 }
10744 9286
10745 test_main_getter() async { 9287 test_main_getter() async {
10746 var library = await checkLibrary('get main => null;'); 9288 var library = await checkLibrary('get main => null;');
10747 if (isStrongMode) { 9289 if (isStrongMode) {
10748 checkElementText( 9290 checkElementText(library, r'''
10749 library,
10750 r'''
10751 dynamic get main {} 9291 dynamic get main {}
10752 '''); 9292 ''');
10753 } else { 9293 } else {
10754 checkElementText( 9294 checkElementText(library, r'''
10755 library,
10756 r'''
10757 dynamic get main {} 9295 dynamic get main {}
10758 '''); 9296 ''');
10759 } 9297 }
10760 } 9298 }
10761 9299
10762 test_main_getter_via_export() async { 9300 test_main_getter_via_export() async {
10763 addLibrarySource('/a.dart', 'get main => null;'); 9301 addLibrarySource('/a.dart', 'get main => null;');
10764 var library = await checkLibrary('export "a.dart";'); 9302 var library = await checkLibrary('export "a.dart";');
10765 if (isStrongMode) { 9303 if (isStrongMode) {
10766 checkElementText( 9304 checkElementText(library, r'''
10767 library,
10768 r'''
10769 export 'a.dart'; 9305 export 'a.dart';
10770 '''); 9306 ''');
10771 } else { 9307 } else {
10772 checkElementText( 9308 checkElementText(library, r'''
10773 library,
10774 r'''
10775 export 'a.dart'; 9309 export 'a.dart';
10776 '''); 9310 ''');
10777 } 9311 }
10778 } 9312 }
10779 9313
10780 test_main_typedef() async { 9314 test_main_typedef() async {
10781 var library = await checkLibrary('typedef main();'); 9315 var library = await checkLibrary('typedef main();');
10782 if (isStrongMode) { 9316 if (isStrongMode) {
10783 checkElementText( 9317 checkElementText(library, r'''
10784 library,
10785 r'''
10786 typedef dynamic main(); 9318 typedef dynamic main();
10787 '''); 9319 ''');
10788 } else { 9320 } else {
10789 checkElementText( 9321 checkElementText(library, r'''
10790 library,
10791 r'''
10792 typedef dynamic main(); 9322 typedef dynamic main();
10793 '''); 9323 ''');
10794 } 9324 }
10795 } 9325 }
10796 9326
10797 test_main_typedef_via_export() async { 9327 test_main_typedef_via_export() async {
10798 addLibrarySource('/a.dart', 'typedef main();'); 9328 addLibrarySource('/a.dart', 'typedef main();');
10799 var library = await checkLibrary('export "a.dart";'); 9329 var library = await checkLibrary('export "a.dart";');
10800 if (isStrongMode) { 9330 if (isStrongMode) {
10801 checkElementText( 9331 checkElementText(library, r'''
10802 library,
10803 r'''
10804 export 'a.dart'; 9332 export 'a.dart';
10805 '''); 9333 ''');
10806 } else { 9334 } else {
10807 checkElementText( 9335 checkElementText(library, r'''
10808 library,
10809 r'''
10810 export 'a.dart'; 9336 export 'a.dart';
10811 '''); 9337 ''');
10812 } 9338 }
10813 } 9339 }
10814 9340
10815 test_main_variable() async { 9341 test_main_variable() async {
10816 var library = await checkLibrary('var main;'); 9342 var library = await checkLibrary('var main;');
10817 if (isStrongMode) { 9343 if (isStrongMode) {
10818 checkElementText( 9344 checkElementText(library, r'''
10819 library,
10820 r'''
10821 dynamic main; 9345 dynamic main;
10822 '''); 9346 ''');
10823 } else { 9347 } else {
10824 checkElementText( 9348 checkElementText(library, r'''
10825 library,
10826 r'''
10827 dynamic main; 9349 dynamic main;
10828 '''); 9350 ''');
10829 } 9351 }
10830 } 9352 }
10831 9353
10832 test_main_variable_via_export() async { 9354 test_main_variable_via_export() async {
10833 addLibrarySource('/a.dart', 'var main;'); 9355 addLibrarySource('/a.dart', 'var main;');
10834 var library = await checkLibrary('export "a.dart";'); 9356 var library = await checkLibrary('export "a.dart";');
10835 if (isStrongMode) { 9357 if (isStrongMode) {
10836 checkElementText( 9358 checkElementText(library, r'''
10837 library,
10838 r'''
10839 export 'a.dart'; 9359 export 'a.dart';
10840 '''); 9360 ''');
10841 } else { 9361 } else {
10842 checkElementText( 9362 checkElementText(library, r'''
10843 library,
10844 r'''
10845 export 'a.dart'; 9363 export 'a.dart';
10846 '''); 9364 ''');
10847 } 9365 }
10848 } 9366 }
10849 9367
10850 test_member_function_async() async { 9368 test_member_function_async() async {
10851 var library = await checkLibrary(r''' 9369 var library = await checkLibrary(r'''
10852 import 'dart:async'; 9370 import 'dart:async';
10853 class C { 9371 class C {
10854 Future f() async {} 9372 Future f() async {}
10855 } 9373 }
10856 '''); 9374 ''');
10857 if (isStrongMode) { 9375 if (isStrongMode) {
10858 checkElementText( 9376 checkElementText(library, r'''
10859 library,
10860 r'''
10861 import 'dart:async'; 9377 import 'dart:async';
10862 class C { 9378 class C {
10863 Future<dynamic> f() async {} 9379 Future<dynamic> f() async {}
10864 } 9380 }
10865 '''); 9381 ''');
10866 } else { 9382 } else {
10867 checkElementText( 9383 checkElementText(library, r'''
10868 library,
10869 r'''
10870 import 'dart:async'; 9384 import 'dart:async';
10871 class C { 9385 class C {
10872 Future<dynamic> f() async {} 9386 Future<dynamic> f() async {}
10873 } 9387 }
10874 '''); 9388 ''');
10875 } 9389 }
10876 } 9390 }
10877 9391
10878 test_member_function_asyncStar() async { 9392 test_member_function_asyncStar() async {
10879 var library = await checkLibrary(r''' 9393 var library = await checkLibrary(r'''
10880 import 'dart:async'; 9394 import 'dart:async';
10881 class C { 9395 class C {
10882 Stream f() async* {} 9396 Stream f() async* {}
10883 } 9397 }
10884 '''); 9398 ''');
10885 if (isStrongMode) { 9399 if (isStrongMode) {
10886 checkElementText( 9400 checkElementText(library, r'''
10887 library,
10888 r'''
10889 import 'dart:async'; 9401 import 'dart:async';
10890 class C { 9402 class C {
10891 Stream<dynamic> f() async* {} 9403 Stream<dynamic> f() async* {}
10892 } 9404 }
10893 '''); 9405 ''');
10894 } else { 9406 } else {
10895 checkElementText( 9407 checkElementText(library, r'''
10896 library,
10897 r'''
10898 import 'dart:async'; 9408 import 'dart:async';
10899 class C { 9409 class C {
10900 Stream<dynamic> f() async* {} 9410 Stream<dynamic> f() async* {}
10901 } 9411 }
10902 '''); 9412 ''');
10903 } 9413 }
10904 } 9414 }
10905 9415
10906 test_metadata_classDeclaration() async { 9416 test_metadata_classDeclaration() async {
10907 var library = await checkLibrary(r''' 9417 var library = await checkLibrary(r'''
10908 const a = null; 9418 const a = null;
10909 const b = null; 9419 const b = null;
10910 @a 9420 @a
10911 @b 9421 @b
10912 class C {}'''); 9422 class C {}''');
10913 if (isStrongMode) { 9423 if (isStrongMode) {
10914 checkElementText( 9424 checkElementText(library, r'''
10915 library,
10916 r'''
10917 @ 9425 @
10918 a/*location: test.dart;a?*/ 9426 a/*location: test.dart;a?*/
10919 @ 9427 @
10920 b/*location: test.dart;b?*/ 9428 b/*location: test.dart;b?*/
10921 class C { 9429 class C {
10922 } 9430 }
10923 const dynamic a = null; 9431 const dynamic a = null;
10924 const dynamic b = null; 9432 const dynamic b = null;
10925 '''); 9433 ''');
10926 } else { 9434 } else {
10927 checkElementText( 9435 checkElementText(library, r'''
10928 library,
10929 r'''
10930 @ 9436 @
10931 a/*location: test.dart;a?*/ 9437 a/*location: test.dart;a?*/
10932 @ 9438 @
10933 b/*location: test.dart;b?*/ 9439 b/*location: test.dart;b?*/
10934 class C { 9440 class C {
10935 } 9441 }
10936 const dynamic a = null; 9442 const dynamic a = null;
10937 const dynamic b = null; 9443 const dynamic b = null;
10938 '''); 9444 ''');
10939 } 9445 }
10940 } 9446 }
10941 9447
10942 test_metadata_classTypeAlias() async { 9448 test_metadata_classTypeAlias() async {
10943 var library = await checkLibrary( 9449 var library = await checkLibrary(
10944 'const a = null; @a class C = D with E; class D {} class E {}'); 9450 'const a = null; @a class C = D with E; class D {} class E {}');
10945 if (isStrongMode) { 9451 if (isStrongMode) {
10946 checkElementText( 9452 checkElementText(library, r'''
10947 library,
10948 r'''
10949 @ 9453 @
10950 a/*location: test.dart;a?*/ 9454 a/*location: test.dart;a?*/
10951 class alias C extends D with E { 9455 class alias C extends D with E {
10952 synthetic C() = D; 9456 synthetic C() = D;
10953 } 9457 }
10954 class D { 9458 class D {
10955 } 9459 }
10956 class E { 9460 class E {
10957 } 9461 }
10958 const dynamic a = null; 9462 const dynamic a = null;
10959 '''); 9463 ''');
10960 } else { 9464 } else {
10961 checkElementText( 9465 checkElementText(library, r'''
10962 library,
10963 r'''
10964 @ 9466 @
10965 a/*location: test.dart;a?*/ 9467 a/*location: test.dart;a?*/
10966 class alias C extends D with E { 9468 class alias C extends D with E {
10967 synthetic C() = D; 9469 synthetic C() = D;
10968 } 9470 }
10969 class D { 9471 class D {
10970 } 9472 }
10971 class E { 9473 class E {
10972 } 9474 }
10973 const dynamic a = null; 9475 const dynamic a = null;
10974 '''); 9476 ''');
10975 } 9477 }
10976 } 9478 }
10977 9479
10978 test_metadata_constructor_call_named() async { 9480 test_metadata_constructor_call_named() async {
10979 var library = await checkLibrary(''' 9481 var library = await checkLibrary('''
10980 class A { 9482 class A {
10981 const A.named(); 9483 const A.named();
10982 } 9484 }
10983 @A.named() 9485 @A.named()
10984 class C {} 9486 class C {}
10985 '''); 9487 ''');
10986 if (isStrongMode) { 9488 if (isStrongMode) {
10987 checkElementText( 9489 checkElementText(library, r'''
10988 library,
10989 r'''
10990 class A { 9490 class A {
10991 const A.named(); 9491 const A.named();
10992 } 9492 }
10993 @ 9493 @
10994 A/*location: test.dart;A*/. 9494 A/*location: test.dart;A*/.
10995 named/*location: test.dart;A;named*/() 9495 named/*location: test.dart;A;named*/()
10996 class C { 9496 class C {
10997 } 9497 }
10998 '''); 9498 ''');
10999 } else { 9499 } else {
11000 checkElementText( 9500 checkElementText(library, r'''
11001 library,
11002 r'''
11003 class A { 9501 class A {
11004 const A.named(); 9502 const A.named();
11005 } 9503 }
11006 @ 9504 @
11007 A/*location: test.dart;A*/. 9505 A/*location: test.dart;A*/.
11008 named/*location: test.dart;A;named*/() 9506 named/*location: test.dart;A;named*/()
11009 class C { 9507 class C {
11010 } 9508 }
11011 '''); 9509 ''');
11012 } 9510 }
11013 } 9511 }
11014 9512
11015 test_metadata_constructor_call_named_prefixed() async { 9513 test_metadata_constructor_call_named_prefixed() async {
11016 addLibrarySource('/foo.dart', 'class A { const A.named(); }'); 9514 addLibrarySource('/foo.dart', 'class A { const A.named(); }');
11017 var library = await checkLibrary(''' 9515 var library = await checkLibrary('''
11018 import 'foo.dart' as foo; 9516 import 'foo.dart' as foo;
11019 @foo.A.named() 9517 @foo.A.named()
11020 class C {} 9518 class C {}
11021 '''); 9519 ''');
11022 if (isStrongMode) { 9520 if (isStrongMode) {
11023 checkElementText( 9521 checkElementText(library, r'''
11024 library,
11025 r'''
11026 import 'foo.dart' as foo; 9522 import 'foo.dart' as foo;
11027 @ 9523 @
11028 A/*location: foo.dart;A*/. 9524 A/*location: foo.dart;A*/.
11029 named/*location: foo.dart;A;named*/() 9525 named/*location: foo.dart;A;named*/()
11030 class C { 9526 class C {
11031 } 9527 }
11032 '''); 9528 ''');
11033 } else { 9529 } else {
11034 checkElementText( 9530 checkElementText(library, r'''
11035 library,
11036 r'''
11037 import 'foo.dart' as foo; 9531 import 'foo.dart' as foo;
11038 @ 9532 @
11039 A/*location: foo.dart;A*/. 9533 A/*location: foo.dart;A*/.
11040 named/*location: foo.dart;A;named*/() 9534 named/*location: foo.dart;A;named*/()
11041 class C { 9535 class C {
11042 } 9536 }
11043 '''); 9537 ''');
11044 } 9538 }
11045 } 9539 }
11046 9540
11047 test_metadata_constructor_call_unnamed() async { 9541 test_metadata_constructor_call_unnamed() async {
11048 var library = await checkLibrary('class A { const A(); } @A() class C {}'); 9542 var library = await checkLibrary('class A { const A(); } @A() class C {}');
11049 if (isStrongMode) { 9543 if (isStrongMode) {
11050 checkElementText( 9544 checkElementText(library, r'''
11051 library,
11052 r'''
11053 class A { 9545 class A {
11054 const A(); 9546 const A();
11055 } 9547 }
11056 @ 9548 @
11057 A/*location: test.dart;A*/() 9549 A/*location: test.dart;A*/()
11058 class C { 9550 class C {
11059 } 9551 }
11060 '''); 9552 ''');
11061 } else { 9553 } else {
11062 checkElementText( 9554 checkElementText(library, r'''
11063 library,
11064 r'''
11065 class A { 9555 class A {
11066 const A(); 9556 const A();
11067 } 9557 }
11068 @ 9558 @
11069 A/*location: test.dart;A*/() 9559 A/*location: test.dart;A*/()
11070 class C { 9560 class C {
11071 } 9561 }
11072 '''); 9562 ''');
11073 } 9563 }
11074 } 9564 }
11075 9565
11076 test_metadata_constructor_call_unnamed_prefixed() async { 9566 test_metadata_constructor_call_unnamed_prefixed() async {
11077 addLibrarySource('/foo.dart', 'class A { const A(); }'); 9567 addLibrarySource('/foo.dart', 'class A { const A(); }');
11078 var library = 9568 var library =
11079 await checkLibrary('import "foo.dart" as foo; @foo.A() class C {}'); 9569 await checkLibrary('import "foo.dart" as foo; @foo.A() class C {}');
11080 if (isStrongMode) { 9570 if (isStrongMode) {
11081 checkElementText( 9571 checkElementText(library, r'''
11082 library,
11083 r'''
11084 import 'foo.dart' as foo; 9572 import 'foo.dart' as foo;
11085 @ 9573 @
11086 A/*location: foo.dart;A*/() 9574 A/*location: foo.dart;A*/()
11087 class C { 9575 class C {
11088 } 9576 }
11089 '''); 9577 ''');
11090 } else { 9578 } else {
11091 checkElementText( 9579 checkElementText(library, r'''
11092 library,
11093 r'''
11094 import 'foo.dart' as foo; 9580 import 'foo.dart' as foo;
11095 @ 9581 @
11096 A/*location: foo.dart;A*/() 9582 A/*location: foo.dart;A*/()
11097 class C { 9583 class C {
11098 } 9584 }
11099 '''); 9585 ''');
11100 } 9586 }
11101 } 9587 }
11102 9588
11103 test_metadata_constructor_call_with_args() async { 9589 test_metadata_constructor_call_with_args() async {
11104 var library = 9590 var library =
11105 await checkLibrary('class A { const A(x); } @A(null) class C {}'); 9591 await checkLibrary('class A { const A(x); } @A(null) class C {}');
11106 if (isStrongMode) { 9592 if (isStrongMode) {
11107 checkElementText( 9593 checkElementText(library, r'''
11108 library,
11109 r'''
11110 class A { 9594 class A {
11111 const A(dynamic x); 9595 const A(dynamic x);
11112 } 9596 }
11113 @ 9597 @
11114 A/*location: test.dart;A*/(null) 9598 A/*location: test.dart;A*/(null)
11115 class C { 9599 class C {
11116 } 9600 }
11117 '''); 9601 ''');
11118 } else { 9602 } else {
11119 checkElementText( 9603 checkElementText(library, r'''
11120 library,
11121 r'''
11122 class A { 9604 class A {
11123 const A(dynamic x); 9605 const A(dynamic x);
11124 } 9606 }
11125 @ 9607 @
11126 A/*location: test.dart;A*/(null) 9608 A/*location: test.dart;A*/(null)
11127 class C { 9609 class C {
11128 } 9610 }
11129 '''); 9611 ''');
11130 } 9612 }
11131 } 9613 }
11132 9614
11133 test_metadata_constructorDeclaration_named() async { 9615 test_metadata_constructorDeclaration_named() async {
11134 var library = 9616 var library =
11135 await checkLibrary('const a = null; class C { @a C.named(); }'); 9617 await checkLibrary('const a = null; class C { @a C.named(); }');
11136 if (isStrongMode) { 9618 if (isStrongMode) {
11137 checkElementText( 9619 checkElementText(library, r'''
11138 library,
11139 r'''
11140 class C { 9620 class C {
11141 @ 9621 @
11142 a/*location: test.dart;a?*/ 9622 a/*location: test.dart;a?*/
11143 C.named(); 9623 C.named();
11144 } 9624 }
11145 const dynamic a = null; 9625 const dynamic a = null;
11146 '''); 9626 ''');
11147 } else { 9627 } else {
11148 checkElementText( 9628 checkElementText(library, r'''
11149 library,
11150 r'''
11151 class C { 9629 class C {
11152 @ 9630 @
11153 a/*location: test.dart;a?*/ 9631 a/*location: test.dart;a?*/
11154 C.named(); 9632 C.named();
11155 } 9633 }
11156 const dynamic a = null; 9634 const dynamic a = null;
11157 '''); 9635 ''');
11158 } 9636 }
11159 } 9637 }
11160 9638
11161 test_metadata_constructorDeclaration_unnamed() async { 9639 test_metadata_constructorDeclaration_unnamed() async {
11162 var library = await checkLibrary('const a = null; class C { @a C(); }'); 9640 var library = await checkLibrary('const a = null; class C { @a C(); }');
11163 if (isStrongMode) { 9641 if (isStrongMode) {
11164 checkElementText( 9642 checkElementText(library, r'''
11165 library,
11166 r'''
11167 class C { 9643 class C {
11168 @ 9644 @
11169 a/*location: test.dart;a?*/ 9645 a/*location: test.dart;a?*/
11170 C(); 9646 C();
11171 } 9647 }
11172 const dynamic a = null; 9648 const dynamic a = null;
11173 '''); 9649 ''');
11174 } else { 9650 } else {
11175 checkElementText( 9651 checkElementText(library, r'''
11176 library,
11177 r'''
11178 class C { 9652 class C {
11179 @ 9653 @
11180 a/*location: test.dart;a?*/ 9654 a/*location: test.dart;a?*/
11181 C(); 9655 C();
11182 } 9656 }
11183 const dynamic a = null; 9657 const dynamic a = null;
11184 '''); 9658 ''');
11185 } 9659 }
11186 } 9660 }
11187 9661
11188 test_metadata_enumDeclaration() async { 9662 test_metadata_enumDeclaration() async {
11189 var library = await checkLibrary('const a = null; @a enum E { v }'); 9663 var library = await checkLibrary('const a = null; @a enum E { v }');
11190 if (isStrongMode) { 9664 if (isStrongMode) {
11191 checkElementText( 9665 checkElementText(library, r'''
11192 library,
11193 r'''
11194 @ 9666 @
11195 a/*location: test.dart;a?*/ 9667 a/*location: test.dart;a?*/
11196 enum E { 9668 enum E {
11197 synthetic final int index; 9669 synthetic final int index;
11198 synthetic static const List<E> values; 9670 synthetic static const List<E> values;
11199 static const E v; 9671 static const E v;
11200 } 9672 }
11201 const dynamic a = null; 9673 const dynamic a = null;
11202 '''); 9674 ''');
11203 } else { 9675 } else {
11204 checkElementText( 9676 checkElementText(library, r'''
11205 library,
11206 r'''
11207 @ 9677 @
11208 a/*location: test.dart;a?*/ 9678 a/*location: test.dart;a?*/
11209 enum E { 9679 enum E {
11210 synthetic final int index; 9680 synthetic final int index;
11211 synthetic static const List<E> values; 9681 synthetic static const List<E> values;
11212 static const E v; 9682 static const E v;
11213 } 9683 }
11214 const dynamic a = null; 9684 const dynamic a = null;
11215 '''); 9685 ''');
11216 } 9686 }
11217 } 9687 }
11218 9688
11219 test_metadata_exportDirective() async { 9689 test_metadata_exportDirective() async {
11220 addLibrarySource('/foo.dart', ''); 9690 addLibrarySource('/foo.dart', '');
11221 var library = await checkLibrary('@a export "foo.dart"; const a = null;'); 9691 var library = await checkLibrary('@a export "foo.dart"; const a = null;');
11222 if (isStrongMode) { 9692 if (isStrongMode) {
11223 checkElementText( 9693 checkElementText(library, r'''
11224 library,
11225 r'''
11226 @ 9694 @
11227 a/*location: test.dart;a?*/ 9695 a/*location: test.dart;a?*/
11228 export 'foo.dart'; 9696 export 'foo.dart';
11229 const dynamic a = null; 9697 const dynamic a = null;
11230 '''); 9698 ''');
11231 } else { 9699 } else {
11232 checkElementText( 9700 checkElementText(library, r'''
11233 library,
11234 r'''
11235 @ 9701 @
11236 a/*location: test.dart;a?*/ 9702 a/*location: test.dart;a?*/
11237 export 'foo.dart'; 9703 export 'foo.dart';
11238 const dynamic a = null; 9704 const dynamic a = null;
11239 '''); 9705 ''');
11240 } 9706 }
11241 } 9707 }
11242 9708
11243 test_metadata_fieldDeclaration() async { 9709 test_metadata_fieldDeclaration() async {
11244 var library = await checkLibrary('const a = null; class C { @a int x; }'); 9710 var library = await checkLibrary('const a = null; class C { @a int x; }');
11245 if (isStrongMode) { 9711 if (isStrongMode) {
11246 checkElementText( 9712 checkElementText(library, r'''
11247 library,
11248 r'''
11249 class C { 9713 class C {
11250 @ 9714 @
11251 a/*location: test.dart;a?*/ 9715 a/*location: test.dart;a?*/
11252 int x; 9716 int x;
11253 } 9717 }
11254 const dynamic a = null; 9718 const dynamic a = null;
11255 '''); 9719 ''');
11256 } else { 9720 } else {
11257 checkElementText( 9721 checkElementText(library, r'''
11258 library,
11259 r'''
11260 class C { 9722 class C {
11261 @ 9723 @
11262 a/*location: test.dart;a?*/ 9724 a/*location: test.dart;a?*/
11263 int x; 9725 int x;
11264 } 9726 }
11265 const dynamic a = null; 9727 const dynamic a = null;
11266 '''); 9728 ''');
11267 } 9729 }
11268 } 9730 }
11269 9731
11270 test_metadata_fieldFormalParameter() async { 9732 test_metadata_fieldFormalParameter() async {
11271 var library = await checkLibrary(''' 9733 var library = await checkLibrary('''
11272 const a = null; 9734 const a = null;
11273 class C { 9735 class C {
11274 var x; 9736 var x;
11275 C(@a this.x); 9737 C(@a this.x);
11276 } 9738 }
11277 '''); 9739 ''');
11278 if (isStrongMode) { 9740 if (isStrongMode) {
11279 checkElementText( 9741 checkElementText(library, r'''
11280 library,
11281 r'''
11282 class C { 9742 class C {
11283 dynamic x; 9743 dynamic x;
11284 C(@ 9744 C(@
11285 a/*location: test.dart;a?*/ dynamic this.x); 9745 a/*location: test.dart;a?*/ dynamic this.x);
11286 } 9746 }
11287 const dynamic a = null; 9747 const dynamic a = null;
11288 '''); 9748 ''');
11289 } else { 9749 } else {
11290 checkElementText( 9750 checkElementText(library, r'''
11291 library,
11292 r'''
11293 class C { 9751 class C {
11294 dynamic x; 9752 dynamic x;
11295 C(@ 9753 C(@
11296 a/*location: test.dart;a?*/ dynamic this.x); 9754 a/*location: test.dart;a?*/ dynamic this.x);
11297 } 9755 }
11298 const dynamic a = null; 9756 const dynamic a = null;
11299 '''); 9757 ''');
11300 } 9758 }
11301 } 9759 }
11302 9760
11303 test_metadata_fieldFormalParameter_withDefault() async { 9761 test_metadata_fieldFormalParameter_withDefault() async {
11304 var library = await checkLibrary( 9762 var library = await checkLibrary(
11305 'const a = null; class C { var x; C([@a this.x = null]); }'); 9763 'const a = null; class C { var x; C([@a this.x = null]); }');
11306 if (isStrongMode) { 9764 if (isStrongMode) {
11307 checkElementText( 9765 checkElementText(library, r'''
11308 library,
11309 r'''
11310 class C { 9766 class C {
11311 dynamic x; 9767 dynamic x;
11312 C([@ 9768 C([@
11313 a/*location: test.dart;a?*/ dynamic this.x]); 9769 a/*location: test.dart;a?*/ dynamic this.x]);
11314 } 9770 }
11315 const dynamic a = null; 9771 const dynamic a = null;
11316 '''); 9772 ''');
11317 } else { 9773 } else {
11318 checkElementText( 9774 checkElementText(library, r'''
11319 library,
11320 r'''
11321 class C { 9775 class C {
11322 dynamic x; 9776 dynamic x;
11323 C([@ 9777 C([@
11324 a/*location: test.dart;a?*/ dynamic this.x]); 9778 a/*location: test.dart;a?*/ dynamic this.x]);
11325 } 9779 }
11326 const dynamic a = null; 9780 const dynamic a = null;
11327 '''); 9781 ''');
11328 } 9782 }
11329 } 9783 }
11330 9784
11331 test_metadata_functionDeclaration_function() async { 9785 test_metadata_functionDeclaration_function() async {
11332 var library = await checkLibrary('const a = null; @a f() {}'); 9786 var library = await checkLibrary('const a = null; @a f() {}');
11333 if (isStrongMode) { 9787 if (isStrongMode) {
11334 checkElementText( 9788 checkElementText(library, r'''
11335 library,
11336 r'''
11337 const dynamic a = null; 9789 const dynamic a = null;
11338 dynamic f() {} 9790 dynamic f() {}
11339 '''); 9791 ''');
11340 } else { 9792 } else {
11341 checkElementText( 9793 checkElementText(library, r'''
11342 library,
11343 r'''
11344 const dynamic a = null; 9794 const dynamic a = null;
11345 dynamic f() {} 9795 dynamic f() {}
11346 '''); 9796 ''');
11347 } 9797 }
11348 } 9798 }
11349 9799
11350 test_metadata_functionDeclaration_getter() async { 9800 test_metadata_functionDeclaration_getter() async {
11351 var library = await checkLibrary('const a = null; @a get f => null;'); 9801 var library = await checkLibrary('const a = null; @a get f => null;');
11352 if (isStrongMode) { 9802 if (isStrongMode) {
11353 checkElementText( 9803 checkElementText(library, r'''
11354 library,
11355 r'''
11356 const dynamic a = null; 9804 const dynamic a = null;
11357 @ 9805 @
11358 a/*location: test.dart;a?*/ 9806 a/*location: test.dart;a?*/
11359 dynamic get f {} 9807 dynamic get f {}
11360 '''); 9808 ''');
11361 } else { 9809 } else {
11362 checkElementText( 9810 checkElementText(library, r'''
11363 library,
11364 r'''
11365 const dynamic a = null; 9811 const dynamic a = null;
11366 @ 9812 @
11367 a/*location: test.dart;a?*/ 9813 a/*location: test.dart;a?*/
11368 dynamic get f {} 9814 dynamic get f {}
11369 '''); 9815 ''');
11370 } 9816 }
11371 } 9817 }
11372 9818
11373 test_metadata_functionDeclaration_setter() async { 9819 test_metadata_functionDeclaration_setter() async {
11374 var library = await checkLibrary('const a = null; @a set f(value) {}'); 9820 var library = await checkLibrary('const a = null; @a set f(value) {}');
11375 if (isStrongMode) { 9821 if (isStrongMode) {
11376 checkElementText( 9822 checkElementText(library, r'''
11377 library,
11378 r'''
11379 const dynamic a = null; 9823 const dynamic a = null;
11380 @ 9824 @
11381 a/*location: test.dart;a?*/ 9825 a/*location: test.dart;a?*/
11382 void set f(dynamic value) {} 9826 void set f(dynamic value) {}
11383 '''); 9827 ''');
11384 } else { 9828 } else {
11385 checkElementText( 9829 checkElementText(library, r'''
11386 library,
11387 r'''
11388 const dynamic a = null; 9830 const dynamic a = null;
11389 @ 9831 @
11390 a/*location: test.dart;a?*/ 9832 a/*location: test.dart;a?*/
11391 dynamic set f(dynamic value) {} 9833 dynamic set f(dynamic value) {}
11392 '''); 9834 ''');
11393 } 9835 }
11394 } 9836 }
11395 9837
11396 test_metadata_functionTypeAlias() async { 9838 test_metadata_functionTypeAlias() async {
11397 var library = await checkLibrary('const a = null; @a typedef F();'); 9839 var library = await checkLibrary('const a = null; @a typedef F();');
11398 if (isStrongMode) { 9840 if (isStrongMode) {
11399 checkElementText( 9841 checkElementText(library, r'''
11400 library,
11401 r'''
11402 @ 9842 @
11403 a/*location: test.dart;a?*/ 9843 a/*location: test.dart;a?*/
11404 typedef dynamic F(); 9844 typedef dynamic F();
11405 const dynamic a = null; 9845 const dynamic a = null;
11406 '''); 9846 ''');
11407 } else { 9847 } else {
11408 checkElementText( 9848 checkElementText(library, r'''
11409 library,
11410 r'''
11411 @ 9849 @
11412 a/*location: test.dart;a?*/ 9850 a/*location: test.dart;a?*/
11413 typedef dynamic F(); 9851 typedef dynamic F();
11414 const dynamic a = null; 9852 const dynamic a = null;
11415 '''); 9853 ''');
11416 } 9854 }
11417 } 9855 }
11418 9856
11419 test_metadata_functionTypedFormalParameter() async { 9857 test_metadata_functionTypedFormalParameter() async {
11420 var library = await checkLibrary('const a = null; f(@a g()) {}'); 9858 var library = await checkLibrary('const a = null; f(@a g()) {}');
11421 if (isStrongMode) { 9859 if (isStrongMode) {
11422 checkElementText( 9860 checkElementText(library, r'''
11423 library,
11424 r'''
11425 const dynamic a = null; 9861 const dynamic a = null;
11426 dynamic f(@ 9862 dynamic f(@
11427 a/*location: test.dart;a?*/ () → dynamic g) {} 9863 a/*location: test.dart;a?*/ () → dynamic g) {}
11428 '''); 9864 ''');
11429 } else { 9865 } else {
11430 checkElementText( 9866 checkElementText(library, r'''
11431 library,
11432 r'''
11433 const dynamic a = null; 9867 const dynamic a = null;
11434 dynamic f(@ 9868 dynamic f(@
11435 a/*location: test.dart;a?*/ () → dynamic g) {} 9869 a/*location: test.dart;a?*/ () → dynamic g) {}
11436 '''); 9870 ''');
11437 } 9871 }
11438 } 9872 }
11439 9873
11440 test_metadata_functionTypedFormalParameter_withDefault() async { 9874 test_metadata_functionTypedFormalParameter_withDefault() async {
11441 var library = await checkLibrary('const a = null; f([@a g() = null]) {}'); 9875 var library = await checkLibrary('const a = null; f([@a g() = null]) {}');
11442 if (isStrongMode) { 9876 if (isStrongMode) {
11443 checkElementText( 9877 checkElementText(library, r'''
11444 library,
11445 r'''
11446 const dynamic a = null; 9878 const dynamic a = null;
11447 dynamic f([@ 9879 dynamic f([@
11448 a/*location: test.dart;a?*/ () → dynamic g = null]) {} 9880 a/*location: test.dart;a?*/ () → dynamic g = null]) {}
11449 '''); 9881 ''');
11450 } else { 9882 } else {
11451 checkElementText( 9883 checkElementText(library, r'''
11452 library,
11453 r'''
11454 const dynamic a = null; 9884 const dynamic a = null;
11455 dynamic f([@ 9885 dynamic f([@
11456 a/*location: test.dart;a?*/ () → dynamic g = null]) {} 9886 a/*location: test.dart;a?*/ () → dynamic g = null]) {}
11457 '''); 9887 ''');
11458 } 9888 }
11459 } 9889 }
11460 9890
11461 test_metadata_importDirective() async { 9891 test_metadata_importDirective() async {
11462 addLibrarySource('/foo.dart', 'const b = null;'); 9892 addLibrarySource('/foo.dart', 'const b = null;');
11463 var library = await checkLibrary('@a import "foo.dart"; const a = b;'); 9893 var library = await checkLibrary('@a import "foo.dart"; const a = b;');
11464 if (isStrongMode) { 9894 if (isStrongMode) {
11465 checkElementText( 9895 checkElementText(library, r'''
11466 library,
11467 r'''
11468 @ 9896 @
11469 a/*location: test.dart;a?*/ 9897 a/*location: test.dart;a?*/
11470 import 'foo.dart'; 9898 import 'foo.dart';
11471 const dynamic a = 9899 const dynamic a =
11472 b/*location: foo.dart;b?*/; 9900 b/*location: foo.dart;b?*/;
11473 '''); 9901 ''');
11474 } else { 9902 } else {
11475 checkElementText( 9903 checkElementText(library, r'''
11476 library,
11477 r'''
11478 @ 9904 @
11479 a/*location: test.dart;a?*/ 9905 a/*location: test.dart;a?*/
11480 import 'foo.dart'; 9906 import 'foo.dart';
11481 const dynamic a = 9907 const dynamic a =
11482 b/*location: foo.dart;b?*/; 9908 b/*location: foo.dart;b?*/;
11483 '''); 9909 ''');
11484 } 9910 }
11485 } 9911 }
11486 9912
11487 test_metadata_invalid_classDeclaration() async { 9913 test_metadata_invalid_classDeclaration() async {
11488 var library = await checkLibrary('f(_) {} @f(42) class C {}'); 9914 var library = await checkLibrary('f(_) {} @f(42) class C {}');
11489 if (isStrongMode) { 9915 if (isStrongMode) {
11490 checkElementText( 9916 checkElementText(library, r'''
11491 library,
11492 r'''
11493 @ 9917 @
11494 f/*location: test.dart;f*/(42) 9918 f/*location: test.dart;f*/(42)
11495 class C { 9919 class C {
11496 } 9920 }
11497 dynamic f(dynamic _) {} 9921 dynamic f(dynamic _) {}
11498 '''); 9922 ''');
11499 } else { 9923 } else {
11500 checkElementText( 9924 checkElementText(library, r'''
11501 library,
11502 r'''
11503 @ 9925 @
11504 f/*location: test.dart;f*/(42) 9926 f/*location: test.dart;f*/(42)
11505 class C { 9927 class C {
11506 } 9928 }
11507 dynamic f(dynamic _) {} 9929 dynamic f(dynamic _) {}
11508 '''); 9930 ''');
11509 } 9931 }
11510 } 9932 }
11511 9933
11512 test_metadata_libraryDirective() async { 9934 test_metadata_libraryDirective() async {
11513 var library = await checkLibrary('@a library L; const a = null;'); 9935 var library = await checkLibrary('@a library L; const a = null;');
11514 if (isStrongMode) { 9936 if (isStrongMode) {
11515 checkElementText( 9937 checkElementText(library, r'''
11516 library,
11517 r'''
11518 @ 9938 @
11519 a/*location: test.dart;a?*/ 9939 a/*location: test.dart;a?*/
11520 library L; 9940 library L;
11521 const dynamic a = null; 9941 const dynamic a = null;
11522 '''); 9942 ''');
11523 } else { 9943 } else {
11524 checkElementText( 9944 checkElementText(library, r'''
11525 library,
11526 r'''
11527 @ 9945 @
11528 a/*location: test.dart;a?*/ 9946 a/*location: test.dart;a?*/
11529 library L; 9947 library L;
11530 const dynamic a = null; 9948 const dynamic a = null;
11531 '''); 9949 ''');
11532 } 9950 }
11533 } 9951 }
11534 9952
11535 test_metadata_methodDeclaration_getter() async { 9953 test_metadata_methodDeclaration_getter() async {
11536 var library = 9954 var library =
11537 await checkLibrary('const a = null; class C { @a get m => null; }'); 9955 await checkLibrary('const a = null; class C { @a get m => null; }');
11538 if (isStrongMode) { 9956 if (isStrongMode) {
11539 checkElementText( 9957 checkElementText(library, r'''
11540 library,
11541 r'''
11542 class C { 9958 class C {
11543 @ 9959 @
11544 a/*location: test.dart;a?*/ 9960 a/*location: test.dart;a?*/
11545 dynamic get m {} 9961 dynamic get m {}
11546 } 9962 }
11547 const dynamic a = null; 9963 const dynamic a = null;
11548 '''); 9964 ''');
11549 } else { 9965 } else {
11550 checkElementText( 9966 checkElementText(library, r'''
11551 library,
11552 r'''
11553 class C { 9967 class C {
11554 @ 9968 @
11555 a/*location: test.dart;a?*/ 9969 a/*location: test.dart;a?*/
11556 dynamic get m {} 9970 dynamic get m {}
11557 } 9971 }
11558 const dynamic a = null; 9972 const dynamic a = null;
11559 '''); 9973 ''');
11560 } 9974 }
11561 } 9975 }
11562 9976
11563 test_metadata_methodDeclaration_method() async { 9977 test_metadata_methodDeclaration_method() async {
11564 var library = await checkLibrary(r''' 9978 var library = await checkLibrary(r'''
11565 const a = null; 9979 const a = null;
11566 const b = null; 9980 const b = null;
11567 class C { 9981 class C {
11568 @a 9982 @a
11569 @b 9983 @b
11570 m() {} 9984 m() {}
11571 } 9985 }
11572 '''); 9986 ''');
11573 if (isStrongMode) { 9987 if (isStrongMode) {
11574 checkElementText( 9988 checkElementText(library, r'''
11575 library,
11576 r'''
11577 class C { 9989 class C {
11578 @ 9990 @
11579 a/*location: test.dart;a?*/ 9991 a/*location: test.dart;a?*/
11580 @ 9992 @
11581 b/*location: test.dart;b?*/ 9993 b/*location: test.dart;b?*/
11582 dynamic m() {} 9994 dynamic m() {}
11583 } 9995 }
11584 const dynamic a = null; 9996 const dynamic a = null;
11585 const dynamic b = null; 9997 const dynamic b = null;
11586 '''); 9998 ''');
11587 } else { 9999 } else {
11588 checkElementText( 10000 checkElementText(library, r'''
11589 library,
11590 r'''
11591 class C { 10001 class C {
11592 @ 10002 @
11593 a/*location: test.dart;a?*/ 10003 a/*location: test.dart;a?*/
11594 @ 10004 @
11595 b/*location: test.dart;b?*/ 10005 b/*location: test.dart;b?*/
11596 dynamic m() {} 10006 dynamic m() {}
11597 } 10007 }
11598 const dynamic a = null; 10008 const dynamic a = null;
11599 const dynamic b = null; 10009 const dynamic b = null;
11600 '''); 10010 ''');
11601 } 10011 }
11602 } 10012 }
11603 10013
11604 test_metadata_methodDeclaration_setter() async { 10014 test_metadata_methodDeclaration_setter() async {
11605 var library = await checkLibrary(''' 10015 var library = await checkLibrary('''
11606 const a = null; 10016 const a = null;
11607 class C { 10017 class C {
11608 @a 10018 @a
11609 set m(value) {} 10019 set m(value) {}
11610 } 10020 }
11611 '''); 10021 ''');
11612 if (isStrongMode) { 10022 if (isStrongMode) {
11613 checkElementText( 10023 checkElementText(library, r'''
11614 library,
11615 r'''
11616 class C { 10024 class C {
11617 @ 10025 @
11618 a/*location: test.dart;a?*/ 10026 a/*location: test.dart;a?*/
11619 void set m(dynamic value) {} 10027 void set m(dynamic value) {}
11620 } 10028 }
11621 const dynamic a = null; 10029 const dynamic a = null;
11622 '''); 10030 ''');
11623 } else { 10031 } else {
11624 checkElementText( 10032 checkElementText(library, r'''
11625 library,
11626 r'''
11627 class C { 10033 class C {
11628 @ 10034 @
11629 a/*location: test.dart;a?*/ 10035 a/*location: test.dart;a?*/
11630 dynamic set m(dynamic value) {} 10036 dynamic set m(dynamic value) {}
11631 } 10037 }
11632 const dynamic a = null; 10038 const dynamic a = null;
11633 '''); 10039 ''');
11634 } 10040 }
11635 } 10041 }
11636 10042
11637 test_metadata_partDirective() async { 10043 test_metadata_partDirective() async {
11638 addSource('/foo.dart', 'part of L;'); 10044 addSource('/foo.dart', 'part of L;');
11639 var library = await checkLibrary(''' 10045 var library = await checkLibrary('''
11640 library L; 10046 library L;
11641 @a 10047 @a
11642 part 'foo.dart'; 10048 part 'foo.dart';
11643 const a = null;'''); 10049 const a = null;''');
11644 if (isStrongMode) { 10050 if (isStrongMode) {
11645 checkElementText( 10051 checkElementText(library, r'''
11646 library,
11647 r'''
11648 library L; 10052 library L;
11649 @ 10053 @
11650 a/*location: test.dart;a?*/ 10054 a/*location: test.dart;a?*/
11651 part 'foo.dart'; 10055 part 'foo.dart';
11652 const dynamic a = null; 10056 const dynamic a = null;
11653 -------------------- 10057 --------------------
11654 unit: foo.dart 10058 unit: foo.dart
11655 10059
11656 '''); 10060 ''');
11657 } else { 10061 } else {
11658 checkElementText( 10062 checkElementText(library, r'''
11659 library,
11660 r'''
11661 library L; 10063 library L;
11662 @ 10064 @
11663 a/*location: test.dart;a?*/ 10065 a/*location: test.dart;a?*/
11664 part 'foo.dart'; 10066 part 'foo.dart';
11665 const dynamic a = null; 10067 const dynamic a = null;
11666 -------------------- 10068 --------------------
11667 unit: foo.dart 10069 unit: foo.dart
11668 10070
11669 '''); 10071 ''');
11670 } 10072 }
11671 } 10073 }
11672 10074
11673 test_metadata_prefixed_variable() async { 10075 test_metadata_prefixed_variable() async {
11674 addLibrarySource('/a.dart', 'const b = null;'); 10076 addLibrarySource('/a.dart', 'const b = null;');
11675 var library = await checkLibrary('import "a.dart" as a; @a.b class C {}'); 10077 var library = await checkLibrary('import "a.dart" as a; @a.b class C {}');
11676 if (isStrongMode) { 10078 if (isStrongMode) {
11677 checkElementText( 10079 checkElementText(library, r'''
11678 library,
11679 r'''
11680 import 'a.dart' as a; 10080 import 'a.dart' as a;
11681 @ 10081 @
11682 a/*location: test.dart;a*/. 10082 a/*location: test.dart;a*/.
11683 b/*location: a.dart;b?*/ 10083 b/*location: a.dart;b?*/
11684 class C { 10084 class C {
11685 } 10085 }
11686 '''); 10086 ''');
11687 } else { 10087 } else {
11688 checkElementText( 10088 checkElementText(library, r'''
11689 library,
11690 r'''
11691 import 'a.dart' as a; 10089 import 'a.dart' as a;
11692 @ 10090 @
11693 a/*location: test.dart;a*/. 10091 a/*location: test.dart;a*/.
11694 b/*location: a.dart;b?*/ 10092 b/*location: a.dart;b?*/
11695 class C { 10093 class C {
11696 } 10094 }
11697 '''); 10095 ''');
11698 } 10096 }
11699 } 10097 }
11700 10098
11701 test_metadata_simpleFormalParameter() async { 10099 test_metadata_simpleFormalParameter() async {
11702 var library = await checkLibrary('const a = null; f(@a x) {}'); 10100 var library = await checkLibrary('const a = null; f(@a x) {}');
11703 if (isStrongMode) { 10101 if (isStrongMode) {
11704 checkElementText( 10102 checkElementText(library, r'''
11705 library,
11706 r'''
11707 const dynamic a = null; 10103 const dynamic a = null;
11708 dynamic f(@ 10104 dynamic f(@
11709 a/*location: test.dart;a?*/ dynamic x) {} 10105 a/*location: test.dart;a?*/ dynamic x) {}
11710 '''); 10106 ''');
11711 } else { 10107 } else {
11712 checkElementText( 10108 checkElementText(library, r'''
11713 library,
11714 r'''
11715 const dynamic a = null; 10109 const dynamic a = null;
11716 dynamic f(@ 10110 dynamic f(@
11717 a/*location: test.dart;a?*/ dynamic x) {} 10111 a/*location: test.dart;a?*/ dynamic x) {}
11718 '''); 10112 ''');
11719 } 10113 }
11720 } 10114 }
11721 10115
11722 test_metadata_simpleFormalParameter_withDefault() async { 10116 test_metadata_simpleFormalParameter_withDefault() async {
11723 var library = await checkLibrary('const a = null; f([@a x = null]) {}'); 10117 var library = await checkLibrary('const a = null; f([@a x = null]) {}');
11724 if (isStrongMode) { 10118 if (isStrongMode) {
11725 checkElementText( 10119 checkElementText(library, r'''
11726 library,
11727 r'''
11728 const dynamic a = null; 10120 const dynamic a = null;
11729 dynamic f([@ 10121 dynamic f([@
11730 a/*location: test.dart;a?*/ dynamic x = null]) {} 10122 a/*location: test.dart;a?*/ dynamic x = null]) {}
11731 '''); 10123 ''');
11732 } else { 10124 } else {
11733 checkElementText( 10125 checkElementText(library, r'''
11734 library,
11735 r'''
11736 const dynamic a = null; 10126 const dynamic a = null;
11737 dynamic f([@ 10127 dynamic f([@
11738 a/*location: test.dart;a?*/ dynamic x = null]) {} 10128 a/*location: test.dart;a?*/ dynamic x = null]) {}
11739 '''); 10129 ''');
11740 } 10130 }
11741 } 10131 }
11742 10132
11743 test_metadata_topLevelVariableDeclaration() async { 10133 test_metadata_topLevelVariableDeclaration() async {
11744 var library = await checkLibrary('const a = null; @a int v;'); 10134 var library = await checkLibrary('const a = null; @a int v;');
11745 if (isStrongMode) { 10135 if (isStrongMode) {
11746 checkElementText( 10136 checkElementText(library, r'''
11747 library,
11748 r'''
11749 const dynamic a = null; 10137 const dynamic a = null;
11750 @ 10138 @
11751 a/*location: test.dart;a?*/ 10139 a/*location: test.dart;a?*/
11752 int v; 10140 int v;
11753 '''); 10141 ''');
11754 } else { 10142 } else {
11755 checkElementText( 10143 checkElementText(library, r'''
11756 library,
11757 r'''
11758 const dynamic a = null; 10144 const dynamic a = null;
11759 @ 10145 @
11760 a/*location: test.dart;a?*/ 10146 a/*location: test.dart;a?*/
11761 int v; 10147 int v;
11762 '''); 10148 ''');
11763 } 10149 }
11764 } 10150 }
11765 10151
11766 test_metadata_typeParameter_ofClass() async { 10152 test_metadata_typeParameter_ofClass() async {
11767 var library = await checkLibrary('const a = null; class C<@a T> {}'); 10153 var library = await checkLibrary('const a = null; class C<@a T> {}');
11768 if (isStrongMode) { 10154 if (isStrongMode) {
11769 checkElementText( 10155 checkElementText(library, r'''
11770 library,
11771 r'''
11772 class C<T> { 10156 class C<T> {
11773 } 10157 }
11774 const dynamic a = null; 10158 const dynamic a = null;
11775 '''); 10159 ''');
11776 } else { 10160 } else {
11777 checkElementText( 10161 checkElementText(library, r'''
11778 library,
11779 r'''
11780 class C<T> { 10162 class C<T> {
11781 } 10163 }
11782 const dynamic a = null; 10164 const dynamic a = null;
11783 '''); 10165 ''');
11784 } 10166 }
11785 } 10167 }
11786 10168
11787 test_metadata_typeParameter_ofClassTypeAlias() async { 10169 test_metadata_typeParameter_ofClassTypeAlias() async {
11788 var library = await checkLibrary(''' 10170 var library = await checkLibrary('''
11789 const a = null; 10171 const a = null;
11790 class C<@a T> = D with E; 10172 class C<@a T> = D with E;
11791 class D {} 10173 class D {}
11792 class E {}'''); 10174 class E {}''');
11793 if (isStrongMode) { 10175 if (isStrongMode) {
11794 checkElementText( 10176 checkElementText(library, r'''
11795 library,
11796 r'''
11797 class alias C<T> extends D with E { 10177 class alias C<T> extends D with E {
11798 synthetic C() = D; 10178 synthetic C() = D;
11799 } 10179 }
11800 class D { 10180 class D {
11801 } 10181 }
11802 class E { 10182 class E {
11803 } 10183 }
11804 const dynamic a = null; 10184 const dynamic a = null;
11805 '''); 10185 ''');
11806 } else { 10186 } else {
11807 checkElementText( 10187 checkElementText(library, r'''
11808 library,
11809 r'''
11810 class alias C<T> extends D with E { 10188 class alias C<T> extends D with E {
11811 synthetic C() = D; 10189 synthetic C() = D;
11812 } 10190 }
11813 class D { 10191 class D {
11814 } 10192 }
11815 class E { 10193 class E {
11816 } 10194 }
11817 const dynamic a = null; 10195 const dynamic a = null;
11818 '''); 10196 ''');
11819 } 10197 }
11820 } 10198 }
11821 10199
11822 test_metadata_typeParameter_ofFunction() async { 10200 test_metadata_typeParameter_ofFunction() async {
11823 var library = await checkLibrary('const a = null; f<@a T>() {}'); 10201 var library = await checkLibrary('const a = null; f<@a T>() {}');
11824 if (isStrongMode) { 10202 if (isStrongMode) {
11825 checkElementText( 10203 checkElementText(library, r'''
11826 library,
11827 r'''
11828 const dynamic a = null; 10204 const dynamic a = null;
11829 dynamic f<T>() {} 10205 dynamic f<T>() {}
11830 '''); 10206 ''');
11831 } else { 10207 } else {
11832 checkElementText( 10208 checkElementText(library, r'''
11833 library,
11834 r'''
11835 const dynamic a = null; 10209 const dynamic a = null;
11836 dynamic f<T>() {} 10210 dynamic f<T>() {}
11837 '''); 10211 ''');
11838 } 10212 }
11839 } 10213 }
11840 10214
11841 test_metadata_typeParameter_ofTypedef() async { 10215 test_metadata_typeParameter_ofTypedef() async {
11842 var library = await checkLibrary('const a = null; typedef F<@a T>();'); 10216 var library = await checkLibrary('const a = null; typedef F<@a T>();');
11843 if (isStrongMode) { 10217 if (isStrongMode) {
11844 checkElementText( 10218 checkElementText(library, r'''
11845 library,
11846 r'''
11847 typedef dynamic F<T>(); 10219 typedef dynamic F<T>();
11848 const dynamic a = null; 10220 const dynamic a = null;
11849 '''); 10221 ''');
11850 } else { 10222 } else {
11851 checkElementText( 10223 checkElementText(library, r'''
11852 library,
11853 r'''
11854 typedef dynamic F<T>(); 10224 typedef dynamic F<T>();
11855 const dynamic a = null; 10225 const dynamic a = null;
11856 '''); 10226 ''');
11857 } 10227 }
11858 } 10228 }
11859 10229
11860 test_method_documented() async { 10230 test_method_documented() async {
11861 var library = await checkLibrary(''' 10231 var library = await checkLibrary('''
11862 class C { 10232 class C {
11863 /** 10233 /**
11864 * Docs 10234 * Docs
11865 */ 10235 */
11866 f() {} 10236 f() {}
11867 }'''); 10237 }''');
11868 if (isStrongMode) { 10238 if (isStrongMode) {
11869 checkElementText( 10239 checkElementText(library, r'''
11870 library,
11871 r'''
11872 class C { 10240 class C {
11873 /** 10241 /**
11874 * Docs 10242 * Docs
11875 */ 10243 */
11876 dynamic f() {} 10244 dynamic f() {}
11877 } 10245 }
11878 '''); 10246 ''');
11879 } else { 10247 } else {
11880 checkElementText( 10248 checkElementText(library, r'''
11881 library,
11882 r'''
11883 class C { 10249 class C {
11884 /** 10250 /**
11885 * Docs 10251 * Docs
11886 */ 10252 */
11887 dynamic f() {} 10253 dynamic f() {}
11888 } 10254 }
11889 '''); 10255 ''');
11890 } 10256 }
11891 } 10257 }
11892 10258
11893 test_method_inferred_type_nonStatic_implicit_param() async { 10259 test_method_inferred_type_nonStatic_implicit_param() async {
11894 var library = await checkLibrary('class C extends D { void f(value) {} }' 10260 var library = await checkLibrary('class C extends D { void f(value) {} }'
11895 ' abstract class D { void f(int value); }'); 10261 ' abstract class D { void f(int value); }');
11896 if (isStrongMode) { 10262 if (isStrongMode) {
11897 checkElementText( 10263 checkElementText(library, r'''
11898 library,
11899 r'''
11900 class C extends D { 10264 class C extends D {
11901 void f(int value) {} 10265 void f(int value) {}
11902 } 10266 }
11903 abstract class D { 10267 abstract class D {
11904 void f(int value); 10268 void f(int value);
11905 } 10269 }
11906 '''); 10270 ''');
11907 } else { 10271 } else {
11908 checkElementText( 10272 checkElementText(library, r'''
11909 library,
11910 r'''
11911 class C extends D { 10273 class C extends D {
11912 void f(dynamic value) {} 10274 void f(dynamic value) {}
11913 } 10275 }
11914 abstract class D { 10276 abstract class D {
11915 void f(int value); 10277 void f(int value);
11916 } 10278 }
11917 '''); 10279 ''');
11918 } 10280 }
11919 } 10281 }
11920 10282
11921 test_method_inferred_type_nonStatic_implicit_return() async { 10283 test_method_inferred_type_nonStatic_implicit_return() async {
11922 var library = await checkLibrary( 10284 var library = await checkLibrary(
11923 'class C extends D { f() => null; } abstract class D { int f(); }'); 10285 'class C extends D { f() => null; } abstract class D { int f(); }');
11924 if (isStrongMode) { 10286 if (isStrongMode) {
11925 checkElementText( 10287 checkElementText(library, r'''
11926 library,
11927 r'''
11928 class C extends D { 10288 class C extends D {
11929 int f() {} 10289 int f() {}
11930 } 10290 }
11931 abstract class D { 10291 abstract class D {
11932 int f(); 10292 int f();
11933 } 10293 }
11934 '''); 10294 ''');
11935 } else { 10295 } else {
11936 checkElementText( 10296 checkElementText(library, r'''
11937 library,
11938 r'''
11939 class C extends D { 10297 class C extends D {
11940 dynamic f() {} 10298 dynamic f() {}
11941 } 10299 }
11942 abstract class D { 10300 abstract class D {
11943 int f(); 10301 int f();
11944 } 10302 }
11945 '''); 10303 ''');
11946 } 10304 }
11947 } 10305 }
11948 10306
11949 test_method_type_parameter() async { 10307 test_method_type_parameter() async {
11950 prepareAnalysisContext(createOptions()); 10308 prepareAnalysisContext(createOptions());
11951 var library = await checkLibrary('class C { T f<T, U>(U u) => null; }'); 10309 var library = await checkLibrary('class C { T f<T, U>(U u) => null; }');
11952 if (isStrongMode) { 10310 if (isStrongMode) {
11953 checkElementText( 10311 checkElementText(library, r'''
11954 library,
11955 r'''
11956 class C { 10312 class C {
11957 T f<T, U>(U u) {} 10313 T f<T, U>(U u) {}
11958 } 10314 }
11959 '''); 10315 ''');
11960 } else { 10316 } else {
11961 checkElementText( 10317 checkElementText(library, r'''
11962 library,
11963 r'''
11964 class C { 10318 class C {
11965 T f<T, U>(U u) {} 10319 T f<T, U>(U u) {}
11966 } 10320 }
11967 '''); 10321 ''');
11968 } 10322 }
11969 } 10323 }
11970 10324
11971 test_method_type_parameter_in_generic_class() async { 10325 test_method_type_parameter_in_generic_class() async {
11972 prepareAnalysisContext(createOptions()); 10326 prepareAnalysisContext(createOptions());
11973 var library = await checkLibrary(''' 10327 var library = await checkLibrary('''
11974 class C<T, U> { 10328 class C<T, U> {
11975 V f<V, W>(T t, U u, W w) => null; 10329 V f<V, W>(T t, U u, W w) => null;
11976 } 10330 }
11977 '''); 10331 ''');
11978 if (isStrongMode) { 10332 if (isStrongMode) {
11979 checkElementText( 10333 checkElementText(library, r'''
11980 library,
11981 r'''
11982 class C<T, U> { 10334 class C<T, U> {
11983 V f<V, W>(T t, U u, W w) {} 10335 V f<V, W>(T t, U u, W w) {}
11984 } 10336 }
11985 '''); 10337 ''');
11986 } else { 10338 } else {
11987 checkElementText( 10339 checkElementText(library, r'''
11988 library,
11989 r'''
11990 class C<T, U> { 10340 class C<T, U> {
11991 V f<V, W>(T t, U u, W w) {} 10341 V f<V, W>(T t, U u, W w) {}
11992 } 10342 }
11993 '''); 10343 ''');
11994 } 10344 }
11995 } 10345 }
11996 10346
11997 test_method_type_parameter_with_function_typed_parameter() async { 10347 test_method_type_parameter_with_function_typed_parameter() async {
11998 prepareAnalysisContext(createOptions()); 10348 prepareAnalysisContext(createOptions());
11999 var library = await checkLibrary('class C { void f<T, U>(T x(U u)) {} }'); 10349 var library = await checkLibrary('class C { void f<T, U>(T x(U u)) {} }');
12000 if (isStrongMode) { 10350 if (isStrongMode) {
12001 checkElementText( 10351 checkElementText(library, r'''
12002 library,
12003 r'''
12004 class C { 10352 class C {
12005 void f<T, U>((U) → T x) {} 10353 void f<T, U>((U) → T x) {}
12006 } 10354 }
12007 '''); 10355 ''');
12008 } else { 10356 } else {
12009 checkElementText( 10357 checkElementText(library, r'''
12010 library,
12011 r'''
12012 class C { 10358 class C {
12013 void f<T, U>((U) → T x) {} 10359 void f<T, U>((U) → T x) {}
12014 } 10360 }
12015 '''); 10361 ''');
12016 } 10362 }
12017 } 10363 }
12018 10364
12019 test_nameConflict_exportedAndLocal() async { 10365 test_nameConflict_exportedAndLocal() async {
12020 namesThatCannotBeResolved.add('V'); 10366 namesThatCannotBeResolved.add('V');
12021 addLibrarySource('/a.dart', 'class C {}'); 10367 addLibrarySource('/a.dart', 'class C {}');
12022 addLibrarySource( 10368 addLibrarySource('/c.dart', '''
12023 '/c.dart',
12024 '''
12025 export 'a.dart'; 10369 export 'a.dart';
12026 class C {} 10370 class C {}
12027 '''); 10371 ''');
12028 var library = await checkLibrary(''' 10372 var library = await checkLibrary('''
12029 import 'c.dart'; 10373 import 'c.dart';
12030 C v = null; 10374 C v = null;
12031 '''); 10375 ''');
12032 if (isStrongMode) { 10376 if (isStrongMode) {
12033 checkElementText( 10377 checkElementText(library, r'''
12034 library,
12035 r'''
12036 import 'c.dart'; 10378 import 'c.dart';
12037 C v; 10379 C v;
12038 '''); 10380 ''');
12039 } else { 10381 } else {
12040 checkElementText( 10382 checkElementText(library, r'''
12041 library,
12042 r'''
12043 import 'c.dart'; 10383 import 'c.dart';
12044 C v; 10384 C v;
12045 '''); 10385 ''');
12046 } 10386 }
12047 } 10387 }
12048 10388
12049 test_nameConflict_exportedAndLocal_exported() async { 10389 test_nameConflict_exportedAndLocal_exported() async {
12050 namesThatCannotBeResolved.add('V'); 10390 namesThatCannotBeResolved.add('V');
12051 addLibrarySource('/a.dart', 'class C {}'); 10391 addLibrarySource('/a.dart', 'class C {}');
12052 addLibrarySource( 10392 addLibrarySource('/c.dart', '''
12053 '/c.dart',
12054 '''
12055 export 'a.dart'; 10393 export 'a.dart';
12056 class C {} 10394 class C {}
12057 '''); 10395 ''');
12058 addLibrarySource('/d.dart', 'export "c.dart";'); 10396 addLibrarySource('/d.dart', 'export "c.dart";');
12059 var library = await checkLibrary(''' 10397 var library = await checkLibrary('''
12060 import 'd.dart'; 10398 import 'd.dart';
12061 C v = null; 10399 C v = null;
12062 '''); 10400 ''');
12063 if (isStrongMode) { 10401 if (isStrongMode) {
12064 checkElementText( 10402 checkElementText(library, r'''
12065 library,
12066 r'''
12067 import 'd.dart'; 10403 import 'd.dart';
12068 C v; 10404 C v;
12069 '''); 10405 ''');
12070 } else { 10406 } else {
12071 checkElementText( 10407 checkElementText(library, r'''
12072 library,
12073 r'''
12074 import 'd.dart'; 10408 import 'd.dart';
12075 C v; 10409 C v;
12076 '''); 10410 ''');
12077 } 10411 }
12078 } 10412 }
12079 10413
12080 test_nameConflict_exportedAndParted() async { 10414 test_nameConflict_exportedAndParted() async {
12081 namesThatCannotBeResolved.add('V'); 10415 namesThatCannotBeResolved.add('V');
12082 addLibrarySource('/a.dart', 'class C {}'); 10416 addLibrarySource('/a.dart', 'class C {}');
12083 addLibrarySource( 10417 addLibrarySource('/b.dart', '''
12084 '/b.dart',
12085 '''
12086 part of lib; 10418 part of lib;
12087 class C {} 10419 class C {}
12088 '''); 10420 ''');
12089 addLibrarySource( 10421 addLibrarySource('/c.dart', '''
12090 '/c.dart',
12091 '''
12092 library lib; 10422 library lib;
12093 export 'a.dart'; 10423 export 'a.dart';
12094 part 'b.dart'; 10424 part 'b.dart';
12095 '''); 10425 ''');
12096 var library = await checkLibrary(''' 10426 var library = await checkLibrary('''
12097 import 'c.dart'; 10427 import 'c.dart';
12098 C v = null; 10428 C v = null;
12099 '''); 10429 ''');
12100 if (isStrongMode) { 10430 if (isStrongMode) {
12101 checkElementText( 10431 checkElementText(library, r'''
12102 library,
12103 r'''
12104 import 'c.dart'; 10432 import 'c.dart';
12105 C v; 10433 C v;
12106 '''); 10434 ''');
12107 } else { 10435 } else {
12108 checkElementText( 10436 checkElementText(library, r'''
12109 library,
12110 r'''
12111 import 'c.dart'; 10437 import 'c.dart';
12112 C v; 10438 C v;
12113 '''); 10439 ''');
12114 } 10440 }
12115 } 10441 }
12116 10442
12117 test_nameConflict_importWithRelativeUri_exportWithAbsolute() async { 10443 test_nameConflict_importWithRelativeUri_exportWithAbsolute() async {
12118 if (resourceProvider.pathContext.separator != '/') { 10444 if (resourceProvider.pathContext.separator != '/') {
12119 return; 10445 return;
12120 } 10446 }
12121 10447
12122 addLibrarySource('/a.dart', 'class A {}'); 10448 addLibrarySource('/a.dart', 'class A {}');
12123 addLibrarySource('/b.dart', 'export "/a.dart";'); 10449 addLibrarySource('/b.dart', 'export "/a.dart";');
12124 var library = await checkLibrary(''' 10450 var library = await checkLibrary('''
12125 import 'a.dart'; 10451 import 'a.dart';
12126 import 'b.dart'; 10452 import 'b.dart';
12127 A v = null; 10453 A v = null;
12128 '''); 10454 ''');
12129 if (isStrongMode) { 10455 if (isStrongMode) {
12130 checkElementText( 10456 checkElementText(library, r'''
12131 library,
12132 r'''
12133 import 'a.dart'; 10457 import 'a.dart';
12134 import 'b.dart'; 10458 import 'b.dart';
12135 A v; 10459 A v;
12136 '''); 10460 ''');
12137 } else { 10461 } else {
12138 checkElementText( 10462 checkElementText(library, r'''
12139 library,
12140 r'''
12141 import 'a.dart'; 10463 import 'a.dart';
12142 import 'b.dart'; 10464 import 'b.dart';
12143 A v; 10465 A v;
12144 '''); 10466 ''');
12145 } 10467 }
12146 } 10468 }
12147 10469
12148 test_nested_generic_functions_in_generic_class_with_function_typed_params() as ync { 10470 test_nested_generic_functions_in_generic_class_with_function_typed_params() as ync {
12149 var library = await checkLibrary(''' 10471 var library = await checkLibrary('''
12150 class C<T, U> { 10472 class C<T, U> {
12151 void g<V, W>() { 10473 void g<V, W>() {
12152 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) { 10474 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) {
12153 } 10475 }
12154 } 10476 }
12155 } 10477 }
12156 '''); 10478 ''');
12157 if (isStrongMode) { 10479 if (isStrongMode) {
12158 checkElementText( 10480 checkElementText(library, r'''
12159 library,
12160 r'''
12161 class C<T, U> { 10481 class C<T, U> {
12162 void g<V, W>() {} 10482 void g<V, W>() {}
12163 } 10483 }
12164 '''); 10484 ''');
12165 } else { 10485 } else {
12166 checkElementText( 10486 checkElementText(library, r'''
12167 library,
12168 r'''
12169 class C<T, U> { 10487 class C<T, U> {
12170 void g<V, W>() {} 10488 void g<V, W>() {}
12171 } 10489 }
12172 '''); 10490 ''');
12173 } 10491 }
12174 } 10492 }
12175 10493
12176 test_nested_generic_functions_in_generic_class_with_local_variables() async { 10494 test_nested_generic_functions_in_generic_class_with_local_variables() async {
12177 var library = await checkLibrary(''' 10495 var library = await checkLibrary('''
12178 class C<T, U> { 10496 class C<T, U> {
12179 void g<V, W>() { 10497 void g<V, W>() {
12180 void h<X, Y>() { 10498 void h<X, Y>() {
12181 T t; 10499 T t;
12182 U u; 10500 U u;
12183 V v; 10501 V v;
12184 W w; 10502 W w;
12185 X x; 10503 X x;
12186 Y y; 10504 Y y;
12187 } 10505 }
12188 } 10506 }
12189 } 10507 }
12190 '''); 10508 ''');
12191 if (isStrongMode) { 10509 if (isStrongMode) {
12192 checkElementText( 10510 checkElementText(library, r'''
12193 library,
12194 r'''
12195 class C<T, U> { 10511 class C<T, U> {
12196 void g<V, W>() {} 10512 void g<V, W>() {}
12197 } 10513 }
12198 '''); 10514 ''');
12199 } else { 10515 } else {
12200 checkElementText( 10516 checkElementText(library, r'''
12201 library,
12202 r'''
12203 class C<T, U> { 10517 class C<T, U> {
12204 void g<V, W>() {} 10518 void g<V, W>() {}
12205 } 10519 }
12206 '''); 10520 ''');
12207 } 10521 }
12208 } 10522 }
12209 10523
12210 test_nested_generic_functions_with_function_typed_param() async { 10524 test_nested_generic_functions_with_function_typed_param() async {
12211 var library = await checkLibrary(''' 10525 var library = await checkLibrary('''
12212 void f<T, U>() { 10526 void f<T, U>() {
12213 void g<V, W>() { 10527 void g<V, W>() {
12214 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) { 10528 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) {
12215 } 10529 }
12216 } 10530 }
12217 } 10531 }
12218 '''); 10532 ''');
12219 if (isStrongMode) { 10533 if (isStrongMode) {
12220 checkElementText( 10534 checkElementText(library, r'''
12221 library,
12222 r'''
12223 void f<T, U>() {} 10535 void f<T, U>() {}
12224 '''); 10536 ''');
12225 } else { 10537 } else {
12226 checkElementText( 10538 checkElementText(library, r'''
12227 library,
12228 r'''
12229 void f<T, U>() {} 10539 void f<T, U>() {}
12230 '''); 10540 ''');
12231 } 10541 }
12232 } 10542 }
12233 10543
12234 test_nested_generic_functions_with_local_variables() async { 10544 test_nested_generic_functions_with_local_variables() async {
12235 var library = await checkLibrary(''' 10545 var library = await checkLibrary('''
12236 void f<T, U>() { 10546 void f<T, U>() {
12237 void g<V, W>() { 10547 void g<V, W>() {
12238 void h<X, Y>() { 10548 void h<X, Y>() {
12239 T t; 10549 T t;
12240 U u; 10550 U u;
12241 V v; 10551 V v;
12242 W w; 10552 W w;
12243 X x; 10553 X x;
12244 Y y; 10554 Y y;
12245 } 10555 }
12246 } 10556 }
12247 } 10557 }
12248 '''); 10558 ''');
12249 if (isStrongMode) { 10559 if (isStrongMode) {
12250 checkElementText( 10560 checkElementText(library, r'''
12251 library,
12252 r'''
12253 void f<T, U>() {} 10561 void f<T, U>() {}
12254 '''); 10562 ''');
12255 } else { 10563 } else {
12256 checkElementText( 10564 checkElementText(library, r'''
12257 library,
12258 r'''
12259 void f<T, U>() {} 10565 void f<T, U>() {}
12260 '''); 10566 ''');
12261 } 10567 }
12262 } 10568 }
12263 10569
12264 test_operator() async { 10570 test_operator() async {
12265 var library = 10571 var library =
12266 await checkLibrary('class C { C operator+(C other) => null; }'); 10572 await checkLibrary('class C { C operator+(C other) => null; }');
12267 if (isStrongMode) { 10573 if (isStrongMode) {
12268 checkElementText( 10574 checkElementText(library, r'''
12269 library,
12270 r'''
12271 class C { 10575 class C {
12272 C +(C other) {} 10576 C +(C other) {}
12273 } 10577 }
12274 '''); 10578 ''');
12275 } else { 10579 } else {
12276 checkElementText( 10580 checkElementText(library, r'''
12277 library,
12278 r'''
12279 class C { 10581 class C {
12280 C +(C other) {} 10582 C +(C other) {}
12281 } 10583 }
12282 '''); 10584 ''');
12283 } 10585 }
12284 } 10586 }
12285 10587
12286 test_operator_equal() async { 10588 test_operator_equal() async {
12287 var library = await checkLibrary(''' 10589 var library = await checkLibrary('''
12288 class C { 10590 class C {
12289 bool operator==(Object other) => false; 10591 bool operator==(Object other) => false;
12290 } 10592 }
12291 '''); 10593 ''');
12292 if (isStrongMode) { 10594 if (isStrongMode) {
12293 checkElementText( 10595 checkElementText(library, r'''
12294 library,
12295 r'''
12296 class C { 10596 class C {
12297 bool ==(Object other) {} 10597 bool ==(Object other) {}
12298 } 10598 }
12299 '''); 10599 ''');
12300 } else { 10600 } else {
12301 checkElementText( 10601 checkElementText(library, r'''
12302 library,
12303 r'''
12304 class C { 10602 class C {
12305 bool ==(Object other) {} 10603 bool ==(Object other) {}
12306 } 10604 }
12307 '''); 10605 ''');
12308 } 10606 }
12309 } 10607 }
12310 10608
12311 test_operator_external() async { 10609 test_operator_external() async {
12312 var library = 10610 var library =
12313 await checkLibrary('class C { external C operator+(C other); }'); 10611 await checkLibrary('class C { external C operator+(C other); }');
12314 if (isStrongMode) { 10612 if (isStrongMode) {
12315 checkElementText( 10613 checkElementText(library, r'''
12316 library,
12317 r'''
12318 class C { 10614 class C {
12319 external C +(C other) {} 10615 external C +(C other) {}
12320 } 10616 }
12321 '''); 10617 ''');
12322 } else { 10618 } else {
12323 checkElementText( 10619 checkElementText(library, r'''
12324 library,
12325 r'''
12326 class C { 10620 class C {
12327 external C +(C other) {} 10621 external C +(C other) {}
12328 } 10622 }
12329 '''); 10623 ''');
12330 } 10624 }
12331 } 10625 }
12332 10626
12333 test_operator_greater_equal() async { 10627 test_operator_greater_equal() async {
12334 var library = await checkLibrary(''' 10628 var library = await checkLibrary('''
12335 class C { 10629 class C {
12336 bool operator>=(C other) => false; 10630 bool operator>=(C other) => false;
12337 } 10631 }
12338 '''); 10632 ''');
12339 if (isStrongMode) { 10633 if (isStrongMode) {
12340 checkElementText( 10634 checkElementText(library, r'''
12341 library,
12342 r'''
12343 class C { 10635 class C {
12344 bool >=(C other) {} 10636 bool >=(C other) {}
12345 } 10637 }
12346 '''); 10638 ''');
12347 } else { 10639 } else {
12348 checkElementText( 10640 checkElementText(library, r'''
12349 library,
12350 r'''
12351 class C { 10641 class C {
12352 bool >=(C other) {} 10642 bool >=(C other) {}
12353 } 10643 }
12354 '''); 10644 ''');
12355 } 10645 }
12356 } 10646 }
12357 10647
12358 test_operator_index() async { 10648 test_operator_index() async {
12359 var library = 10649 var library =
12360 await checkLibrary('class C { bool operator[](int i) => null; }'); 10650 await checkLibrary('class C { bool operator[](int i) => null; }');
12361 if (isStrongMode) { 10651 if (isStrongMode) {
12362 checkElementText( 10652 checkElementText(library, r'''
12363 library,
12364 r'''
12365 class C { 10653 class C {
12366 bool [](int i) {} 10654 bool [](int i) {}
12367 } 10655 }
12368 '''); 10656 ''');
12369 } else { 10657 } else {
12370 checkElementText( 10658 checkElementText(library, r'''
12371 library,
12372 r'''
12373 class C { 10659 class C {
12374 bool [](int i) {} 10660 bool [](int i) {}
12375 } 10661 }
12376 '''); 10662 ''');
12377 } 10663 }
12378 } 10664 }
12379 10665
12380 test_operator_index_set() async { 10666 test_operator_index_set() async {
12381 var library = await checkLibrary(''' 10667 var library = await checkLibrary('''
12382 class C { 10668 class C {
12383 void operator[]=(int i, bool v) {} 10669 void operator[]=(int i, bool v) {}
12384 } 10670 }
12385 '''); 10671 ''');
12386 if (isStrongMode) { 10672 if (isStrongMode) {
12387 checkElementText( 10673 checkElementText(library, r'''
12388 library,
12389 r'''
12390 class C { 10674 class C {
12391 void []=(int i, bool v) {} 10675 void []=(int i, bool v) {}
12392 } 10676 }
12393 '''); 10677 ''');
12394 } else { 10678 } else {
12395 checkElementText( 10679 checkElementText(library, r'''
12396 library,
12397 r'''
12398 class C { 10680 class C {
12399 void []=(int i, bool v) {} 10681 void []=(int i, bool v) {}
12400 } 10682 }
12401 '''); 10683 ''');
12402 } 10684 }
12403 } 10685 }
12404 10686
12405 test_operator_less_equal() async { 10687 test_operator_less_equal() async {
12406 var library = await checkLibrary(''' 10688 var library = await checkLibrary('''
12407 class C { 10689 class C {
12408 bool operator<=(C other) => false; 10690 bool operator<=(C other) => false;
12409 } 10691 }
12410 '''); 10692 ''');
12411 if (isStrongMode) { 10693 if (isStrongMode) {
12412 checkElementText( 10694 checkElementText(library, r'''
12413 library,
12414 r'''
12415 class C { 10695 class C {
12416 bool <=(C other) {} 10696 bool <=(C other) {}
12417 } 10697 }
12418 '''); 10698 ''');
12419 } else { 10699 } else {
12420 checkElementText( 10700 checkElementText(library, r'''
12421 library,
12422 r'''
12423 class C { 10701 class C {
12424 bool <=(C other) {} 10702 bool <=(C other) {}
12425 } 10703 }
12426 '''); 10704 ''');
12427 } 10705 }
12428 } 10706 }
12429 10707
12430 test_parameter_checked() async { 10708 test_parameter_checked() async {
12431 // Note: due to dartbug.com/27393, the keyword "checked" is identified by 10709 // Note: due to dartbug.com/27393, the keyword "checked" is identified by
12432 // its presence in a library called "meta". If that bug is fixed, this test 10710 // its presence in a library called "meta". If that bug is fixed, this test
12433 // my need to be changed. 10711 // my need to be changed.
12434 var library = await checkLibrary(r''' 10712 var library = await checkLibrary(r'''
12435 library meta; 10713 library meta;
12436 const checked = null; 10714 const checked = null;
12437 class A<T> { 10715 class A<T> {
12438 void f(@checked T t) {} 10716 void f(@checked T t) {}
12439 } 10717 }
12440 '''); 10718 ''');
12441 if (isStrongMode) { 10719 if (isStrongMode) {
12442 checkElementText( 10720 checkElementText(library, r'''
12443 library,
12444 r'''
12445 library meta; 10721 library meta;
12446 class A<T> { 10722 class A<T> {
12447 void f(@ 10723 void f(@
12448 checked/*location: test.dart;checked?*/ covariant T t) {} 10724 checked/*location: test.dart;checked?*/ covariant T t) {}
12449 } 10725 }
12450 const dynamic checked = null; 10726 const dynamic checked = null;
12451 '''); 10727 ''');
12452 } else { 10728 } else {
12453 checkElementText( 10729 checkElementText(library, r'''
12454 library,
12455 r'''
12456 library meta; 10730 library meta;
12457 class A<T> { 10731 class A<T> {
12458 void f(@ 10732 void f(@
12459 checked/*location: test.dart;checked?*/ covariant T t) {} 10733 checked/*location: test.dart;checked?*/ covariant T t) {}
12460 } 10734 }
12461 const dynamic checked = null; 10735 const dynamic checked = null;
12462 '''); 10736 ''');
12463 } 10737 }
12464 } 10738 }
12465 10739
12466 test_parameter_checked_inherited() async { 10740 test_parameter_checked_inherited() async {
12467 // Note: due to dartbug.com/27393, the keyword "checked" is identified by 10741 // Note: due to dartbug.com/27393, the keyword "checked" is identified by
12468 // its presence in a library called "meta". If that bug is fixed, this test 10742 // its presence in a library called "meta". If that bug is fixed, this test
12469 // my need to be changed. 10743 // my need to be changed.
12470 var library = await checkLibrary(r''' 10744 var library = await checkLibrary(r'''
12471 library meta; 10745 library meta;
12472 const checked = null; 10746 const checked = null;
12473 class A<T> { 10747 class A<T> {
12474 void f(@checked T t) {} 10748 void f(@checked T t) {}
12475 } 10749 }
12476 class B<T> extends A<T> { 10750 class B<T> extends A<T> {
12477 void f(T t) {} 10751 void f(T t) {}
12478 } 10752 }
12479 '''); 10753 ''');
12480 if (isStrongMode) { 10754 if (isStrongMode) {
12481 checkElementText( 10755 checkElementText(library, r'''
12482 library,
12483 r'''
12484 library meta; 10756 library meta;
12485 class A<T> { 10757 class A<T> {
12486 void f(@ 10758 void f(@
12487 checked/*location: test.dart;checked?*/ covariant T t) {} 10759 checked/*location: test.dart;checked?*/ covariant T t) {}
12488 } 10760 }
12489 class B<T> extends A<T> { 10761 class B<T> extends A<T> {
12490 void f(covariant T t) {} 10762 void f(covariant T t) {}
12491 } 10763 }
12492 const dynamic checked = null; 10764 const dynamic checked = null;
12493 '''); 10765 ''');
12494 } else { 10766 } else {
12495 checkElementText( 10767 checkElementText(library, r'''
12496 library,
12497 r'''
12498 library meta; 10768 library meta;
12499 class A<T> { 10769 class A<T> {
12500 void f(@ 10770 void f(@
12501 checked/*location: test.dart;checked?*/ covariant T t) {} 10771 checked/*location: test.dart;checked?*/ covariant T t) {}
12502 } 10772 }
12503 class B<T> extends A<T> { 10773 class B<T> extends A<T> {
12504 void f(T t) {} 10774 void f(T t) {}
12505 } 10775 }
12506 const dynamic checked = null; 10776 const dynamic checked = null;
12507 '''); 10777 ''');
12508 } 10778 }
12509 } 10779 }
12510 10780
12511 test_parameter_covariant() async { 10781 test_parameter_covariant() async {
12512 prepareAnalysisContext(createOptions()); 10782 prepareAnalysisContext(createOptions());
12513 var library = await checkLibrary('class C { void m(covariant C c) {} }'); 10783 var library = await checkLibrary('class C { void m(covariant C c) {} }');
12514 if (isStrongMode) { 10784 if (isStrongMode) {
12515 checkElementText( 10785 checkElementText(library, r'''
12516 library,
12517 r'''
12518 class C { 10786 class C {
12519 void m(covariant C c) {} 10787 void m(covariant C c) {}
12520 } 10788 }
12521 '''); 10789 ''');
12522 } else { 10790 } else {
12523 checkElementText( 10791 checkElementText(library, r'''
12524 library,
12525 r'''
12526 class C { 10792 class C {
12527 void m(covariant C c) {} 10793 void m(covariant C c) {}
12528 } 10794 }
12529 '''); 10795 ''');
12530 } 10796 }
12531 } 10797 }
12532 10798
12533 test_parameter_covariant_inherited() async { 10799 test_parameter_covariant_inherited() async {
12534 var library = await checkLibrary(r''' 10800 var library = await checkLibrary(r'''
12535 class A<T> { 10801 class A<T> {
12536 void f(covariant T t) {} 10802 void f(covariant T t) {}
12537 } 10803 }
12538 class B<T> extends A<T> { 10804 class B<T> extends A<T> {
12539 void f(T t) {} 10805 void f(T t) {}
12540 } 10806 }
12541 '''); 10807 ''');
12542 if (isStrongMode) { 10808 if (isStrongMode) {
12543 checkElementText( 10809 checkElementText(library, r'''
12544 library,
12545 r'''
12546 class A<T> { 10810 class A<T> {
12547 void f(covariant T t) {} 10811 void f(covariant T t) {}
12548 } 10812 }
12549 class B<T> extends A<T> { 10813 class B<T> extends A<T> {
12550 void f(covariant T t) {} 10814 void f(covariant T t) {}
12551 } 10815 }
12552 '''); 10816 ''');
12553 } else { 10817 } else {
12554 checkElementText( 10818 checkElementText(library, r'''
12555 library,
12556 r'''
12557 class A<T> { 10819 class A<T> {
12558 void f(covariant T t) {} 10820 void f(covariant T t) {}
12559 } 10821 }
12560 class B<T> extends A<T> { 10822 class B<T> extends A<T> {
12561 void f(T t) {} 10823 void f(T t) {}
12562 } 10824 }
12563 '''); 10825 ''');
12564 } 10826 }
12565 } 10827 }
12566 10828
12567 test_parameter_parameters() async { 10829 test_parameter_parameters() async {
12568 var library = await checkLibrary('class C { f(g(x, y)) {} }'); 10830 var library = await checkLibrary('class C { f(g(x, y)) {} }');
12569 if (isStrongMode) { 10831 if (isStrongMode) {
12570 checkElementText( 10832 checkElementText(library, r'''
12571 library,
12572 r'''
12573 class C { 10833 class C {
12574 dynamic f((dynamic, dynamic) → dynamic g) {} 10834 dynamic f((dynamic, dynamic) → dynamic g) {}
12575 } 10835 }
12576 '''); 10836 ''');
12577 } else { 10837 } else {
12578 checkElementText( 10838 checkElementText(library, r'''
12579 library,
12580 r'''
12581 class C { 10839 class C {
12582 dynamic f((dynamic, dynamic) → dynamic g) {} 10840 dynamic f((dynamic, dynamic) → dynamic g) {}
12583 } 10841 }
12584 '''); 10842 ''');
12585 } 10843 }
12586 } 10844 }
12587 10845
12588 test_parameter_parameters_in_generic_class() async { 10846 test_parameter_parameters_in_generic_class() async {
12589 var library = await checkLibrary('class C<A, B> { f(A g(B x)) {} }'); 10847 var library = await checkLibrary('class C<A, B> { f(A g(B x)) {} }');
12590 if (isStrongMode) { 10848 if (isStrongMode) {
12591 checkElementText( 10849 checkElementText(library, r'''
12592 library,
12593 r'''
12594 class C<A, B> { 10850 class C<A, B> {
12595 dynamic f((B) → A g) {} 10851 dynamic f((B) → A g) {}
12596 } 10852 }
12597 '''); 10853 ''');
12598 } else { 10854 } else {
12599 checkElementText( 10855 checkElementText(library, r'''
12600 library,
12601 r'''
12602 class C<A, B> { 10856 class C<A, B> {
12603 dynamic f((B) → A g) {} 10857 dynamic f((B) → A g) {}
12604 } 10858 }
12605 '''); 10859 ''');
12606 } 10860 }
12607 } 10861 }
12608 10862
12609 test_parameter_return_type() async { 10863 test_parameter_return_type() async {
12610 var library = await checkLibrary('class C { f(int g()) {} }'); 10864 var library = await checkLibrary('class C { f(int g()) {} }');
12611 if (isStrongMode) { 10865 if (isStrongMode) {
12612 checkElementText( 10866 checkElementText(library, r'''
12613 library,
12614 r'''
12615 class C { 10867 class C {
12616 dynamic f(() → int g) {} 10868 dynamic f(() → int g) {}
12617 } 10869 }
12618 '''); 10870 ''');
12619 } else { 10871 } else {
12620 checkElementText( 10872 checkElementText(library, r'''
12621 library,
12622 r'''
12623 class C { 10873 class C {
12624 dynamic f(() → int g) {} 10874 dynamic f(() → int g) {}
12625 } 10875 }
12626 '''); 10876 ''');
12627 } 10877 }
12628 } 10878 }
12629 10879
12630 test_parameter_return_type_void() async { 10880 test_parameter_return_type_void() async {
12631 var library = await checkLibrary('class C { f(void g()) {} }'); 10881 var library = await checkLibrary('class C { f(void g()) {} }');
12632 if (isStrongMode) { 10882 if (isStrongMode) {
12633 checkElementText( 10883 checkElementText(library, r'''
12634 library,
12635 r'''
12636 class C { 10884 class C {
12637 dynamic f(() → void g) {} 10885 dynamic f(() → void g) {}
12638 } 10886 }
12639 '''); 10887 ''');
12640 } else { 10888 } else {
12641 checkElementText( 10889 checkElementText(library, r'''
12642 library,
12643 r'''
12644 class C { 10890 class C {
12645 dynamic f(() → void g) {} 10891 dynamic f(() → void g) {}
12646 } 10892 }
12647 '''); 10893 ''');
12648 } 10894 }
12649 } 10895 }
12650 10896
12651 test_parameterTypeNotInferred_constructor() async { 10897 test_parameterTypeNotInferred_constructor() async {
12652 // Strong mode doesn't do type inference on constructor parameters, so it's 10898 // Strong mode doesn't do type inference on constructor parameters, so it's
12653 // ok that we don't store inferred type info for them in summaries. 10899 // ok that we don't store inferred type info for them in summaries.
12654 var library = await checkLibrary(''' 10900 var library = await checkLibrary('''
12655 class C { 10901 class C {
12656 C.positional([x = 1]); 10902 C.positional([x = 1]);
12657 C.named({x: 1}); 10903 C.named({x: 1});
12658 } 10904 }
12659 '''); 10905 ''');
12660 if (isStrongMode) { 10906 if (isStrongMode) {
12661 checkElementText( 10907 checkElementText(library, r'''
12662 library,
12663 r'''
12664 class C { 10908 class C {
12665 C.positional([dynamic x = 1]); 10909 C.positional([dynamic x = 1]);
12666 C.named({dynamic x: 1}); 10910 C.named({dynamic x: 1});
12667 } 10911 }
12668 '''); 10912 ''');
12669 } else { 10913 } else {
12670 checkElementText( 10914 checkElementText(library, r'''
12671 library,
12672 r'''
12673 class C { 10915 class C {
12674 C.positional([dynamic x = 1]); 10916 C.positional([dynamic x = 1]);
12675 C.named({dynamic x: 1}); 10917 C.named({dynamic x: 1});
12676 } 10918 }
12677 '''); 10919 ''');
12678 } 10920 }
12679 } 10921 }
12680 10922
12681 test_parameterTypeNotInferred_initializingFormal() async { 10923 test_parameterTypeNotInferred_initializingFormal() async {
12682 // Strong mode doesn't do type inference on initializing formals, so it's 10924 // Strong mode doesn't do type inference on initializing formals, so it's
12683 // ok that we don't store inferred type info for them in summaries. 10925 // ok that we don't store inferred type info for them in summaries.
12684 var library = await checkLibrary(''' 10926 var library = await checkLibrary('''
12685 class C { 10927 class C {
12686 var x; 10928 var x;
12687 C.positional([this.x = 1]); 10929 C.positional([this.x = 1]);
12688 C.named({this.x: 1}); 10930 C.named({this.x: 1});
12689 } 10931 }
12690 '''); 10932 ''');
12691 if (isStrongMode) { 10933 if (isStrongMode) {
12692 checkElementText( 10934 checkElementText(library, r'''
12693 library,
12694 r'''
12695 class C { 10935 class C {
12696 dynamic x; 10936 dynamic x;
12697 C.positional([dynamic this.x]); 10937 C.positional([dynamic this.x]);
12698 C.named({dynamic this.x}); 10938 C.named({dynamic this.x});
12699 } 10939 }
12700 '''); 10940 ''');
12701 } else { 10941 } else {
12702 checkElementText( 10942 checkElementText(library, r'''
12703 library,
12704 r'''
12705 class C { 10943 class C {
12706 dynamic x; 10944 dynamic x;
12707 C.positional([dynamic this.x]); 10945 C.positional([dynamic this.x]);
12708 C.named({dynamic this.x}); 10946 C.named({dynamic this.x});
12709 } 10947 }
12710 '''); 10948 ''');
12711 } 10949 }
12712 } 10950 }
12713 10951
12714 test_parameterTypeNotInferred_staticMethod() async { 10952 test_parameterTypeNotInferred_staticMethod() async {
12715 // Strong mode doesn't do type inference on parameters of static methods, 10953 // Strong mode doesn't do type inference on parameters of static methods,
12716 // so it's ok that we don't store inferred type info for them in summaries. 10954 // so it's ok that we don't store inferred type info for them in summaries.
12717 var library = await checkLibrary(''' 10955 var library = await checkLibrary('''
12718 class C { 10956 class C {
12719 static void positional([x = 1]) {} 10957 static void positional([x = 1]) {}
12720 static void named({x: 1}) {} 10958 static void named({x: 1}) {}
12721 } 10959 }
12722 '''); 10960 ''');
12723 if (isStrongMode) { 10961 if (isStrongMode) {
12724 checkElementText( 10962 checkElementText(library, r'''
12725 library,
12726 r'''
12727 class C { 10963 class C {
12728 static void positional([dynamic x = 1]) {} 10964 static void positional([dynamic x = 1]) {}
12729 static void named({dynamic x: 1}) {} 10965 static void named({dynamic x: 1}) {}
12730 } 10966 }
12731 '''); 10967 ''');
12732 } else { 10968 } else {
12733 checkElementText( 10969 checkElementText(library, r'''
12734 library,
12735 r'''
12736 class C { 10970 class C {
12737 static void positional([dynamic x = 1]) {} 10971 static void positional([dynamic x = 1]) {}
12738 static void named({dynamic x: 1}) {} 10972 static void named({dynamic x: 1}) {}
12739 } 10973 }
12740 '''); 10974 ''');
12741 } 10975 }
12742 } 10976 }
12743 10977
12744 test_parameterTypeNotInferred_topLevelFunction() async { 10978 test_parameterTypeNotInferred_topLevelFunction() async {
12745 // Strong mode doesn't do type inference on parameters of top level 10979 // Strong mode doesn't do type inference on parameters of top level
12746 // functions, so it's ok that we don't store inferred type info for them in 10980 // functions, so it's ok that we don't store inferred type info for them in
12747 // summaries. 10981 // summaries.
12748 var library = await checkLibrary(''' 10982 var library = await checkLibrary('''
12749 void positional([x = 1]) {} 10983 void positional([x = 1]) {}
12750 void named({x: 1}) {} 10984 void named({x: 1}) {}
12751 '''); 10985 ''');
12752 if (isStrongMode) { 10986 if (isStrongMode) {
12753 checkElementText( 10987 checkElementText(library, r'''
12754 library,
12755 r'''
12756 void positional([dynamic x = 1]) {} 10988 void positional([dynamic x = 1]) {}
12757 void named({dynamic x: 1}) {} 10989 void named({dynamic x: 1}) {}
12758 '''); 10990 ''');
12759 } else { 10991 } else {
12760 checkElementText( 10992 checkElementText(library, r'''
12761 library,
12762 r'''
12763 void positional([dynamic x = 1]) {} 10993 void positional([dynamic x = 1]) {}
12764 void named({dynamic x: 1}) {} 10994 void named({dynamic x: 1}) {}
12765 '''); 10995 ''');
12766 } 10996 }
12767 } 10997 }
12768 10998
12769 test_parts() async { 10999 test_parts() async {
12770 addSource('/a.dart', 'part of my.lib;'); 11000 addSource('/a.dart', 'part of my.lib;');
12771 addSource('/b.dart', 'part of my.lib;'); 11001 addSource('/b.dart', 'part of my.lib;');
12772 var library = 11002 var library =
12773 await checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); 11003 await checkLibrary('library my.lib; part "a.dart"; part "b.dart";');
12774 if (isStrongMode) { 11004 if (isStrongMode) {
12775 checkElementText( 11005 checkElementText(library, r'''
12776 library,
12777 r'''
12778 library my.lib; 11006 library my.lib;
12779 part 'a.dart'; 11007 part 'a.dart';
12780 part 'b.dart'; 11008 part 'b.dart';
12781 -------------------- 11009 --------------------
12782 unit: a.dart 11010 unit: a.dart
12783 11011
12784 -------------------- 11012 --------------------
12785 unit: b.dart 11013 unit: b.dart
12786 11014
12787 '''); 11015 ''');
12788 } else { 11016 } else {
12789 checkElementText( 11017 checkElementText(library, r'''
12790 library,
12791 r'''
12792 library my.lib; 11018 library my.lib;
12793 part 'a.dart'; 11019 part 'a.dart';
12794 part 'b.dart'; 11020 part 'b.dart';
12795 -------------------- 11021 --------------------
12796 unit: a.dart 11022 unit: a.dart
12797 11023
12798 -------------------- 11024 --------------------
12799 unit: b.dart 11025 unit: b.dart
12800 11026
12801 '''); 11027 ''');
12802 } 11028 }
12803 } 11029 }
12804 11030
12805 test_parts_invalidUri() async { 11031 test_parts_invalidUri() async {
12806 allowMissingFiles = true; 11032 allowMissingFiles = true;
12807 shouldCompareLibraryElements = false; 11033 shouldCompareLibraryElements = false;
12808 addSource('/foo/bar.dart', 'part of my.lib;'); 11034 addSource('/foo/bar.dart', 'part of my.lib;');
12809 var library = await checkLibrary('library my.lib; part "foo/";'); 11035 var library = await checkLibrary('library my.lib; part "foo/";');
12810 if (isStrongMode) { 11036 if (isStrongMode) {
12811 checkElementText( 11037 checkElementText(library, r'''
12812 library,
12813 r'''
12814 library my.lib; 11038 library my.lib;
12815 part 'foo/'; 11039 part 'foo/';
12816 -------------------- 11040 --------------------
12817 unit: null 11041 unit: null
12818 11042
12819 '''); 11043 ''');
12820 } else { 11044 } else {
12821 checkElementText( 11045 checkElementText(library, r'''
12822 library,
12823 r'''
12824 library my.lib; 11046 library my.lib;
12825 part 'foo/'; 11047 part 'foo/';
12826 -------------------- 11048 --------------------
12827 unit: null 11049 unit: null
12828 11050
12829 '''); 11051 ''');
12830 } 11052 }
12831 } 11053 }
12832 11054
12833 test_parts_invalidUri_nullStringValue() async { 11055 test_parts_invalidUri_nullStringValue() async {
12834 allowMissingFiles = true; 11056 allowMissingFiles = true;
12835 shouldCompareLibraryElements = false; 11057 shouldCompareLibraryElements = false;
12836 addSource('/foo/bar.dart', 'part of my.lib;'); 11058 addSource('/foo/bar.dart', 'part of my.lib;');
12837 var library = await checkLibrary(r''' 11059 var library = await checkLibrary(r'''
12838 library my.lib; 11060 library my.lib;
12839 part "${foo}/bar.dart"; 11061 part "${foo}/bar.dart";
12840 '''); 11062 ''');
12841 if (isStrongMode) { 11063 if (isStrongMode) {
12842 checkElementText( 11064 checkElementText(library, r'''
12843 library,
12844 r'''
12845 library my.lib; 11065 library my.lib;
12846 part ''; 11066 part '';
12847 -------------------- 11067 --------------------
12848 unit: null 11068 unit: null
12849 11069
12850 '''); 11070 ''');
12851 } else { 11071 } else {
12852 checkElementText( 11072 checkElementText(library, r'''
12853 library,
12854 r'''
12855 library my.lib; 11073 library my.lib;
12856 part ''; 11074 part '';
12857 -------------------- 11075 --------------------
12858 unit: null 11076 unit: null
12859 11077
12860 '''); 11078 ''');
12861 } 11079 }
12862 } 11080 }
12863 11081
12864 test_propagated_type_refers_to_closure() async { 11082 test_propagated_type_refers_to_closure() async {
12865 var library = await checkLibrary(''' 11083 var library = await checkLibrary('''
12866 void f() { 11084 void f() {
12867 var x = () => 0; 11085 var x = () => 0;
12868 var y = x; 11086 var y = x;
12869 } 11087 }
12870 '''); 11088 ''');
12871 if (isStrongMode) { 11089 if (isStrongMode) {
12872 checkElementText( 11090 checkElementText(library, r'''
12873 library,
12874 r'''
12875 void f() {} 11091 void f() {}
12876 '''); 11092 ''');
12877 } else { 11093 } else {
12878 checkElementText( 11094 checkElementText(library, r'''
12879 library,
12880 r'''
12881 void f() {} 11095 void f() {}
12882 '''); 11096 ''');
12883 } 11097 }
12884 } 11098 }
12885 11099
12886 test_setter_covariant() async { 11100 test_setter_covariant() async {
12887 var library = 11101 var library =
12888 await checkLibrary('class C { void set x(covariant int value); }'); 11102 await checkLibrary('class C { void set x(covariant int value); }');
12889 if (isStrongMode) { 11103 if (isStrongMode) {
12890 checkElementText( 11104 checkElementText(library, r'''
12891 library,
12892 r'''
12893 class C { 11105 class C {
12894 void set x(covariant int value); 11106 void set x(covariant int value);
12895 } 11107 }
12896 '''); 11108 ''');
12897 } else { 11109 } else {
12898 checkElementText( 11110 checkElementText(library, r'''
12899 library,
12900 r'''
12901 class C { 11111 class C {
12902 void set x(covariant int value); 11112 void set x(covariant int value);
12903 } 11113 }
12904 '''); 11114 ''');
12905 } 11115 }
12906 } 11116 }
12907 11117
12908 test_setter_documented() async { 11118 test_setter_documented() async {
12909 var library = await checkLibrary(''' 11119 var library = await checkLibrary('''
12910 // Extra comment so doc comment offset != 0 11120 // Extra comment so doc comment offset != 0
12911 /** 11121 /**
12912 * Docs 11122 * Docs
12913 */ 11123 */
12914 void set x(value) {}'''); 11124 void set x(value) {}''');
12915 if (isStrongMode) { 11125 if (isStrongMode) {
12916 checkElementText( 11126 checkElementText(library, r'''
12917 library,
12918 r'''
12919 /** 11127 /**
12920 * Docs 11128 * Docs
12921 */ 11129 */
12922 void set x(dynamic value) {} 11130 void set x(dynamic value) {}
12923 '''); 11131 ''');
12924 } else { 11132 } else {
12925 checkElementText( 11133 checkElementText(library, r'''
12926 library,
12927 r'''
12928 /** 11134 /**
12929 * Docs 11135 * Docs
12930 */ 11136 */
12931 void set x(dynamic value) {} 11137 void set x(dynamic value) {}
12932 '''); 11138 ''');
12933 } 11139 }
12934 } 11140 }
12935 11141
12936 test_setter_external() async { 11142 test_setter_external() async {
12937 var library = await checkLibrary('external void set x(int value);'); 11143 var library = await checkLibrary('external void set x(int value);');
12938 if (isStrongMode) { 11144 if (isStrongMode) {
12939 checkElementText( 11145 checkElementText(library, r'''
12940 library,
12941 r'''
12942 external void set x(int value) {} 11146 external void set x(int value) {}
12943 '''); 11147 ''');
12944 } else { 11148 } else {
12945 checkElementText( 11149 checkElementText(library, r'''
12946 library,
12947 r'''
12948 external void set x(int value) {} 11150 external void set x(int value) {}
12949 '''); 11151 ''');
12950 } 11152 }
12951 } 11153 }
12952 11154
12953 test_setter_inferred_type_nonStatic_implicit_param() async { 11155 test_setter_inferred_type_nonStatic_implicit_param() async {
12954 var library = 11156 var library =
12955 await checkLibrary('class C extends D { void set f(value) {} }' 11157 await checkLibrary('class C extends D { void set f(value) {} }'
12956 ' abstract class D { void set f(int value); }'); 11158 ' abstract class D { void set f(int value); }');
12957 if (isStrongMode) { 11159 if (isStrongMode) {
12958 checkElementText( 11160 checkElementText(library, r'''
12959 library,
12960 r'''
12961 class C extends D { 11161 class C extends D {
12962 void set f(int value) {} 11162 void set f(int value) {}
12963 } 11163 }
12964 abstract class D { 11164 abstract class D {
12965 void set f(int value); 11165 void set f(int value);
12966 } 11166 }
12967 '''); 11167 ''');
12968 } else { 11168 } else {
12969 checkElementText( 11169 checkElementText(library, r'''
12970 library,
12971 r'''
12972 class C extends D { 11170 class C extends D {
12973 void set f(dynamic value) {} 11171 void set f(dynamic value) {}
12974 } 11172 }
12975 abstract class D { 11173 abstract class D {
12976 void set f(int value); 11174 void set f(int value);
12977 } 11175 }
12978 '''); 11176 ''');
12979 } 11177 }
12980 } 11178 }
12981 11179
12982 test_setter_inferred_type_static_implicit_return() async { 11180 test_setter_inferred_type_static_implicit_return() async {
12983 var library = await checkLibrary('class C { static set f(int value) {} }'); 11181 var library = await checkLibrary('class C { static set f(int value) {} }');
12984 if (isStrongMode) { 11182 if (isStrongMode) {
12985 checkElementText( 11183 checkElementText(library, r'''
12986 library,
12987 r'''
12988 class C { 11184 class C {
12989 static void set f(int value) {} 11185 static void set f(int value) {}
12990 } 11186 }
12991 '''); 11187 ''');
12992 } else { 11188 } else {
12993 checkElementText( 11189 checkElementText(library, r'''
12994 library,
12995 r'''
12996 class C { 11190 class C {
12997 static dynamic set f(int value) {} 11191 static dynamic set f(int value) {}
12998 } 11192 }
12999 '''); 11193 ''');
13000 } 11194 }
13001 } 11195 }
13002 11196
13003 test_setter_inferred_type_top_level_implicit_return() async { 11197 test_setter_inferred_type_top_level_implicit_return() async {
13004 var library = await checkLibrary('set f(int value) {}'); 11198 var library = await checkLibrary('set f(int value) {}');
13005 if (isStrongMode) { 11199 if (isStrongMode) {
13006 checkElementText( 11200 checkElementText(library, r'''
13007 library,
13008 r'''
13009 void set f(int value) {} 11201 void set f(int value) {}
13010 '''); 11202 ''');
13011 } else { 11203 } else {
13012 checkElementText( 11204 checkElementText(library, r'''
13013 library,
13014 r'''
13015 dynamic set f(int value) {} 11205 dynamic set f(int value) {}
13016 '''); 11206 ''');
13017 } 11207 }
13018 } 11208 }
13019 11209
13020 test_setters() async { 11210 test_setters() async {
13021 var library = 11211 var library =
13022 await checkLibrary('void set x(int value) {} set y(value) {}'); 11212 await checkLibrary('void set x(int value) {} set y(value) {}');
13023 if (isStrongMode) { 11213 if (isStrongMode) {
13024 checkElementText( 11214 checkElementText(library, r'''
13025 library,
13026 r'''
13027 void set x(int value) {} 11215 void set x(int value) {}
13028 void set y(dynamic value) {} 11216 void set y(dynamic value) {}
13029 '''); 11217 ''');
13030 } else { 11218 } else {
13031 checkElementText( 11219 checkElementText(library, r'''
13032 library,
13033 r'''
13034 void set x(int value) {} 11220 void set x(int value) {}
13035 dynamic set y(dynamic value) {} 11221 dynamic set y(dynamic value) {}
13036 '''); 11222 ''');
13037 } 11223 }
13038 } 11224 }
13039 11225
13040 test_syntheticFunctionType_genericClosure() async { 11226 test_syntheticFunctionType_genericClosure() async {
13041 if (!createOptions().strongMode) { 11227 if (!createOptions().strongMode) {
13042 // The test below uses generic comment syntax because proper generic 11228 // The test below uses generic comment syntax because proper generic
13043 // method syntax doesn't support generic closures. So it can only run in 11229 // method syntax doesn't support generic closures. So it can only run in
13044 // strong mode. 11230 // strong mode.
13045 // TODO(paulberry): once proper generic method syntax supports generic 11231 // TODO(paulberry): once proper generic method syntax supports generic
13046 // closures, rewrite the test below without using generic comment syntax, 11232 // closures, rewrite the test below without using generic comment syntax,
13047 // and remove this hack. See dartbug.com/25819 11233 // and remove this hack. See dartbug.com/25819
13048 return; 11234 return;
13049 } 11235 }
13050 var library = await checkLibrary(''' 11236 var library = await checkLibrary('''
13051 final v = f() ? /*<T>*/(T t) => 0 : /*<T>*/(T t) => 1; 11237 final v = f() ? /*<T>*/(T t) => 0 : /*<T>*/(T t) => 1;
13052 bool f() => true; 11238 bool f() => true;
13053 '''); 11239 ''');
13054 if (isStrongMode) { 11240 if (isStrongMode) {
13055 checkElementText( 11241 checkElementText(library, r'''
13056 library,
13057 r'''
13058 '''); 11242 ''');
13059 } else { 11243 } else {
13060 checkElementText( 11244 checkElementText(library, r'''
13061 library,
13062 r'''
13063 '''); 11245 ''');
13064 } 11246 }
13065 } 11247 }
13066 11248
13067 test_syntheticFunctionType_genericClosure_inGenericFunction() async { 11249 test_syntheticFunctionType_genericClosure_inGenericFunction() async {
13068 if (!createOptions().strongMode) { 11250 if (!createOptions().strongMode) {
13069 // The test below uses generic comment syntax because proper generic 11251 // The test below uses generic comment syntax because proper generic
13070 // method syntax doesn't support generic closures. So it can only run in 11252 // method syntax doesn't support generic closures. So it can only run in
13071 // strong mode. 11253 // strong mode.
13072 // TODO(paulberry): once proper generic method syntax supports generic 11254 // TODO(paulberry): once proper generic method syntax supports generic
13073 // closures, rewrite the test below without using generic comment syntax, 11255 // closures, rewrite the test below without using generic comment syntax,
13074 // and remove this hack. See dartbug.com/25819 11256 // and remove this hack. See dartbug.com/25819
13075 return; 11257 return;
13076 } 11258 }
13077 var library = await checkLibrary(''' 11259 var library = await checkLibrary('''
13078 void f<T, U>(bool b) { 11260 void f<T, U>(bool b) {
13079 final v = b ? /*<V>*/(T t, U u, V v) => 0 : /*<V>*/(T t, U u, V v) => 1; 11261 final v = b ? /*<V>*/(T t, U u, V v) => 0 : /*<V>*/(T t, U u, V v) => 1;
13080 } 11262 }
13081 '''); 11263 ''');
13082 if (isStrongMode) { 11264 if (isStrongMode) {
13083 checkElementText( 11265 checkElementText(library, r'''
13084 library,
13085 r'''
13086 void f<T, U>(bool b) {} 11266 void f<T, U>(bool b) {}
13087 '''); 11267 ''');
13088 } else { 11268 } else {
13089 checkElementText( 11269 checkElementText(library, r'''
13090 library,
13091 r'''
13092 '''); 11270 ''');
13093 } 11271 }
13094 } 11272 }
13095 11273
13096 test_syntheticFunctionType_inGenericClass() async { 11274 test_syntheticFunctionType_inGenericClass() async {
13097 var library = await checkLibrary(''' 11275 var library = await checkLibrary('''
13098 class C<T, U> { 11276 class C<T, U> {
13099 var v = f() ? (T t, U u) => 0 : (T t, U u) => 1; 11277 var v = f() ? (T t, U u) => 0 : (T t, U u) => 1;
13100 } 11278 }
13101 bool f() => false; 11279 bool f() => false;
13102 '''); 11280 ''');
13103 if (isStrongMode) { 11281 if (isStrongMode) {
13104 checkElementText( 11282 checkElementText(library, r'''
13105 library,
13106 r'''
13107 class C { 11283 class C {
13108 synthetic C(); 11284 synthetic C();
13109 } 11285 }
13110 '''); 11286 ''');
13111 } else { 11287 } else {
13112 checkElementText( 11288 checkElementText(library, r'''
13113 library,
13114 r'''
13115 class C<T, U> { 11289 class C<T, U> {
13116 dynamic v; 11290 dynamic v;
13117 } 11291 }
13118 bool f() {} 11292 bool f() {}
13119 '''); 11293 ''');
13120 } 11294 }
13121 } 11295 }
13122 11296
13123 test_syntheticFunctionType_inGenericFunction() async { 11297 test_syntheticFunctionType_inGenericFunction() async {
13124 var library = await checkLibrary(''' 11298 var library = await checkLibrary('''
13125 void f<T, U>(bool b) { 11299 void f<T, U>(bool b) {
13126 var v = b ? (T t, U u) => 0 : (T t, U u) => 1; 11300 var v = b ? (T t, U u) => 0 : (T t, U u) => 1;
13127 } 11301 }
13128 '''); 11302 ''');
13129 if (isStrongMode) { 11303 if (isStrongMode) {
13130 checkElementText( 11304 checkElementText(library, r'''
13131 library,
13132 r'''
13133 void f<T, U>(bool b) {} 11305 void f<T, U>(bool b) {}
13134 '''); 11306 ''');
13135 } else { 11307 } else {
13136 checkElementText( 11308 checkElementText(library, r'''
13137 library,
13138 r'''
13139 void f<T, U>(bool b) {} 11309 void f<T, U>(bool b) {}
13140 '''); 11310 ''');
13141 } 11311 }
13142 } 11312 }
13143 11313
13144 test_syntheticFunctionType_noArguments() async { 11314 test_syntheticFunctionType_noArguments() async {
13145 var library = await checkLibrary(''' 11315 var library = await checkLibrary('''
13146 final v = f() ? () => 0 : () => 1; 11316 final v = f() ? () => 0 : () => 1;
13147 bool f() => true; 11317 bool f() => true;
13148 '''); 11318 ''');
13149 if (isStrongMode) { 11319 if (isStrongMode) {
13150 checkElementText( 11320 checkElementText(library, r'''
13151 library,
13152 r'''
13153 '''); 11321 ''');
13154 } else { 11322 } else {
13155 checkElementText( 11323 checkElementText(library, r'''
13156 library,
13157 r'''
13158 final dynamic v; 11324 final dynamic v;
13159 bool f() {} 11325 bool f() {}
13160 '''); 11326 ''');
13161 } 11327 }
13162 } 11328 }
13163 11329
13164 test_syntheticFunctionType_withArguments() async { 11330 test_syntheticFunctionType_withArguments() async {
13165 var library = await checkLibrary(''' 11331 var library = await checkLibrary('''
13166 final v = f() ? (int x, String y) => 0 : (int x, String y) => 1; 11332 final v = f() ? (int x, String y) => 0 : (int x, String y) => 1;
13167 bool f() => true; 11333 bool f() => true;
13168 '''); 11334 ''');
13169 if (isStrongMode) { 11335 if (isStrongMode) {
13170 checkElementText( 11336 checkElementText(library, r'''
13171 library,
13172 r'''
13173 '''); 11337 ''');
13174 } else { 11338 } else {
13175 checkElementText( 11339 checkElementText(library, r'''
13176 library,
13177 r'''
13178 final dynamic v; 11340 final dynamic v;
13179 bool f() {} 11341 bool f() {}
13180 '''); 11342 ''');
13181 } 11343 }
13182 } 11344 }
13183 11345
13184 test_type_arguments_explicit_dynamic_dynamic() async { 11346 test_type_arguments_explicit_dynamic_dynamic() async {
13185 var library = await checkLibrary('Map<dynamic, dynamic> m;'); 11347 var library = await checkLibrary('Map<dynamic, dynamic> m;');
13186 if (isStrongMode) { 11348 if (isStrongMode) {
13187 checkElementText( 11349 checkElementText(library, r'''
13188 library,
13189 r'''
13190 Map<dynamic, dynamic> m; 11350 Map<dynamic, dynamic> m;
13191 '''); 11351 ''');
13192 } else { 11352 } else {
13193 checkElementText( 11353 checkElementText(library, r'''
13194 library,
13195 r'''
13196 Map<dynamic, dynamic> m; 11354 Map<dynamic, dynamic> m;
13197 '''); 11355 ''');
13198 } 11356 }
13199 } 11357 }
13200 11358
13201 test_type_arguments_explicit_dynamic_int() async { 11359 test_type_arguments_explicit_dynamic_int() async {
13202 var library = await checkLibrary('Map<dynamic, int> m;'); 11360 var library = await checkLibrary('Map<dynamic, int> m;');
13203 if (isStrongMode) { 11361 if (isStrongMode) {
13204 checkElementText( 11362 checkElementText(library, r'''
13205 library,
13206 r'''
13207 Map<dynamic, int> m; 11363 Map<dynamic, int> m;
13208 '''); 11364 ''');
13209 } else { 11365 } else {
13210 checkElementText( 11366 checkElementText(library, r'''
13211 library,
13212 r'''
13213 Map<dynamic, int> m; 11367 Map<dynamic, int> m;
13214 '''); 11368 ''');
13215 } 11369 }
13216 } 11370 }
13217 11371
13218 test_type_arguments_explicit_String_dynamic() async { 11372 test_type_arguments_explicit_String_dynamic() async {
13219 var library = await checkLibrary('Map<String, dynamic> m;'); 11373 var library = await checkLibrary('Map<String, dynamic> m;');
13220 if (isStrongMode) { 11374 if (isStrongMode) {
13221 checkElementText( 11375 checkElementText(library, r'''
13222 library,
13223 r'''
13224 Map<String, dynamic> m; 11376 Map<String, dynamic> m;
13225 '''); 11377 ''');
13226 } else { 11378 } else {
13227 checkElementText( 11379 checkElementText(library, r'''
13228 library,
13229 r'''
13230 Map<String, dynamic> m; 11380 Map<String, dynamic> m;
13231 '''); 11381 ''');
13232 } 11382 }
13233 } 11383 }
13234 11384
13235 test_type_arguments_explicit_String_int() async { 11385 test_type_arguments_explicit_String_int() async {
13236 var library = await checkLibrary('Map<String, int> m;'); 11386 var library = await checkLibrary('Map<String, int> m;');
13237 if (isStrongMode) { 11387 if (isStrongMode) {
13238 checkElementText( 11388 checkElementText(library, r'''
13239 library,
13240 r'''
13241 Map<String, int> m; 11389 Map<String, int> m;
13242 '''); 11390 ''');
13243 } else { 11391 } else {
13244 checkElementText( 11392 checkElementText(library, r'''
13245 library,
13246 r'''
13247 Map<String, int> m; 11393 Map<String, int> m;
13248 '''); 11394 ''');
13249 } 11395 }
13250 } 11396 }
13251 11397
13252 test_type_arguments_implicit() async { 11398 test_type_arguments_implicit() async {
13253 var library = await checkLibrary('Map m;'); 11399 var library = await checkLibrary('Map m;');
13254 if (isStrongMode) { 11400 if (isStrongMode) {
13255 checkElementText( 11401 checkElementText(library, r'''
13256 library,
13257 r'''
13258 Map<dynamic, dynamic> m; 11402 Map<dynamic, dynamic> m;
13259 '''); 11403 ''');
13260 } else { 11404 } else {
13261 checkElementText( 11405 checkElementText(library, r'''
13262 library,
13263 r'''
13264 Map<dynamic, dynamic> m; 11406 Map<dynamic, dynamic> m;
13265 '''); 11407 ''');
13266 } 11408 }
13267 } 11409 }
13268 11410
13269 test_type_dynamic() async { 11411 test_type_dynamic() async {
13270 var library = await checkLibrary('dynamic d;'); 11412 var library = await checkLibrary('dynamic d;');
13271 if (isStrongMode) { 11413 if (isStrongMode) {
13272 checkElementText( 11414 checkElementText(library, r'''
13273 library,
13274 r'''
13275 dynamic d; 11415 dynamic d;
13276 '''); 11416 ''');
13277 } else { 11417 } else {
13278 checkElementText( 11418 checkElementText(library, r'''
13279 library,
13280 r'''
13281 dynamic d; 11419 dynamic d;
13282 '''); 11420 ''');
13283 } 11421 }
13284 } 11422 }
13285 11423
13286 test_type_invalid_topLevelVariableElement_asType() async { 11424 test_type_invalid_topLevelVariableElement_asType() async {
13287 var library = await checkLibrary( 11425 var library = await checkLibrary('''
13288 '''
13289 class C<T extends V> {} 11426 class C<T extends V> {}
13290 typedef V F(V p); 11427 typedef V F(V p);
13291 V f(V p) {} 11428 V f(V p) {}
13292 V V2 = null; 11429 V V2 = null;
13293 int V = 0; 11430 int V = 0;
13294 ''', 11431 ''', allowErrors: true);
13295 allowErrors: true);
13296 if (isStrongMode) { 11432 if (isStrongMode) {
13297 checkElementText( 11433 checkElementText(library, r'''
13298 library,
13299 r'''
13300 typedef dynamic F(dynamic p); 11434 typedef dynamic F(dynamic p);
13301 class C<T extends dynamic> { 11435 class C<T extends dynamic> {
13302 } 11436 }
13303 dynamic V2; 11437 dynamic V2;
13304 int V; 11438 int V;
13305 dynamic f(dynamic p) {} 11439 dynamic f(dynamic p) {}
13306 '''); 11440 ''');
13307 } else { 11441 } else {
13308 checkElementText( 11442 checkElementText(library, r'''
13309 library,
13310 r'''
13311 typedef dynamic F(dynamic p); 11443 typedef dynamic F(dynamic p);
13312 class C<T extends dynamic> { 11444 class C<T extends dynamic> {
13313 } 11445 }
13314 dynamic V2; 11446 dynamic V2;
13315 int V; 11447 int V;
13316 dynamic f(dynamic p) {} 11448 dynamic f(dynamic p) {}
13317 '''); 11449 ''');
13318 } 11450 }
13319 } 11451 }
13320 11452
13321 test_type_invalid_topLevelVariableElement_asTypeArgument() async { 11453 test_type_invalid_topLevelVariableElement_asTypeArgument() async {
13322 var library = await checkLibrary( 11454 var library = await checkLibrary('''
13323 '''
13324 var V; 11455 var V;
13325 static List<V> V2; 11456 static List<V> V2;
13326 ''', 11457 ''', allowErrors: true);
13327 allowErrors: true);
13328 if (isStrongMode) { 11458 if (isStrongMode) {
13329 checkElementText( 11459 checkElementText(library, r'''
13330 library,
13331 r'''
13332 dynamic V; 11460 dynamic V;
13333 List<dynamic> V2; 11461 List<dynamic> V2;
13334 '''); 11462 ''');
13335 } else { 11463 } else {
13336 checkElementText( 11464 checkElementText(library, r'''
13337 library,
13338 r'''
13339 dynamic V; 11465 dynamic V;
13340 List<dynamic> V2; 11466 List<dynamic> V2;
13341 '''); 11467 ''');
13342 } 11468 }
13343 } 11469 }
13344 11470
13345 test_type_invalid_typeParameter_asPrefix() async { 11471 test_type_invalid_typeParameter_asPrefix() async {
13346 var library = await checkLibrary( 11472 var library = await checkLibrary('''
13347 '''
13348 class C<T> { 11473 class C<T> {
13349 m(T.K p) {} 11474 m(T.K p) {}
13350 } 11475 }
13351 ''', 11476 ''', allowErrors: true);
13352 allowErrors: true);
13353 if (isStrongMode) { 11477 if (isStrongMode) {
13354 checkElementText( 11478 checkElementText(library, r'''
13355 library,
13356 r'''
13357 class C<T> { 11479 class C<T> {
13358 dynamic m(dynamic p) {} 11480 dynamic m(dynamic p) {}
13359 } 11481 }
13360 '''); 11482 ''');
13361 } else { 11483 } else {
13362 checkElementText( 11484 checkElementText(library, r'''
13363 library,
13364 r'''
13365 class C<T> { 11485 class C<T> {
13366 dynamic m(dynamic p) {} 11486 dynamic m(dynamic p) {}
13367 } 11487 }
13368 '''); 11488 ''');
13369 } 11489 }
13370 } 11490 }
13371 11491
13372 test_type_reference_lib_to_lib() async { 11492 test_type_reference_lib_to_lib() async {
13373 var library = await checkLibrary(''' 11493 var library = await checkLibrary('''
13374 class C {} 11494 class C {}
13375 enum E { v } 11495 enum E { v }
13376 typedef F(); 11496 typedef F();
13377 C c; 11497 C c;
13378 E e; 11498 E e;
13379 F f;'''); 11499 F f;''');
13380 if (isStrongMode) { 11500 if (isStrongMode) {
13381 checkElementText( 11501 checkElementText(library, r'''
13382 library,
13383 r'''
13384 typedef dynamic F(); 11502 typedef dynamic F();
13385 enum E { 11503 enum E {
13386 synthetic final int index; 11504 synthetic final int index;
13387 synthetic static const List<E> values; 11505 synthetic static const List<E> values;
13388 static const E v; 11506 static const E v;
13389 } 11507 }
13390 class C { 11508 class C {
13391 } 11509 }
13392 C c; 11510 C c;
13393 E e; 11511 E e;
13394 F f; 11512 F f;
13395 '''); 11513 ''');
13396 } else { 11514 } else {
13397 checkElementText( 11515 checkElementText(library, r'''
13398 library,
13399 r'''
13400 typedef dynamic F(); 11516 typedef dynamic F();
13401 enum E { 11517 enum E {
13402 synthetic final int index; 11518 synthetic final int index;
13403 synthetic static const List<E> values; 11519 synthetic static const List<E> values;
13404 static const E v; 11520 static const E v;
13405 } 11521 }
13406 class C { 11522 class C {
13407 } 11523 }
13408 C c; 11524 C c;
13409 E e; 11525 E e;
13410 F f; 11526 F f;
13411 '''); 11527 ''');
13412 } 11528 }
13413 } 11529 }
13414 11530
13415 test_type_reference_lib_to_part() async { 11531 test_type_reference_lib_to_part() async {
13416 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); 11532 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();');
13417 var library = 11533 var library =
13418 await checkLibrary('library l; part "a.dart"; C c; E e; F f;'); 11534 await checkLibrary('library l; part "a.dart"; C c; E e; F f;');
13419 if (isStrongMode) { 11535 if (isStrongMode) {
13420 checkElementText( 11536 checkElementText(library, r'''
13421 library,
13422 r'''
13423 library l; 11537 library l;
13424 part 'a.dart'; 11538 part 'a.dart';
13425 C c; 11539 C c;
13426 E e; 11540 E e;
13427 F f; 11541 F f;
13428 -------------------- 11542 --------------------
13429 unit: a.dart 11543 unit: a.dart
13430 11544
13431 typedef dynamic F(); 11545 typedef dynamic F();
13432 enum E { 11546 enum E {
13433 synthetic final int index; 11547 synthetic final int index;
13434 synthetic static const List<E> values; 11548 synthetic static const List<E> values;
13435 static const E v; 11549 static const E v;
13436 } 11550 }
13437 class C { 11551 class C {
13438 } 11552 }
13439 '''); 11553 ''');
13440 } else { 11554 } else {
13441 checkElementText( 11555 checkElementText(library, r'''
13442 library,
13443 r'''
13444 library l; 11556 library l;
13445 part 'a.dart'; 11557 part 'a.dart';
13446 C c; 11558 C c;
13447 E e; 11559 E e;
13448 F f; 11560 F f;
13449 -------------------- 11561 --------------------
13450 unit: a.dart 11562 unit: a.dart
13451 11563
13452 typedef dynamic F(); 11564 typedef dynamic F();
13453 enum E { 11565 enum E {
13454 synthetic final int index; 11566 synthetic final int index;
13455 synthetic static const List<E> values; 11567 synthetic static const List<E> values;
13456 static const E v; 11568 static const E v;
13457 } 11569 }
13458 class C { 11570 class C {
13459 } 11571 }
13460 '''); 11572 ''');
13461 } 11573 }
13462 } 11574 }
13463 11575
13464 test_type_reference_part_to_lib() async { 11576 test_type_reference_part_to_lib() async {
13465 addSource('/a.dart', 'part of l; C c; E e; F f;'); 11577 addSource('/a.dart', 'part of l; C c; E e; F f;');
13466 var library = await checkLibrary( 11578 var library = await checkLibrary(
13467 'library l; part "a.dart"; class C {} enum E { v } typedef F();'); 11579 'library l; part "a.dart"; class C {} enum E { v } typedef F();');
13468 if (isStrongMode) { 11580 if (isStrongMode) {
13469 checkElementText( 11581 checkElementText(library, r'''
13470 library,
13471 r'''
13472 library l; 11582 library l;
13473 part 'a.dart'; 11583 part 'a.dart';
13474 typedef dynamic F(); 11584 typedef dynamic F();
13475 enum E { 11585 enum E {
13476 synthetic final int index; 11586 synthetic final int index;
13477 synthetic static const List<E> values; 11587 synthetic static const List<E> values;
13478 static const E v; 11588 static const E v;
13479 } 11589 }
13480 class C { 11590 class C {
13481 } 11591 }
13482 -------------------- 11592 --------------------
13483 unit: a.dart 11593 unit: a.dart
13484 11594
13485 C c; 11595 C c;
13486 E e; 11596 E e;
13487 F f; 11597 F f;
13488 '''); 11598 ''');
13489 } else { 11599 } else {
13490 checkElementText( 11600 checkElementText(library, r'''
13491 library,
13492 r'''
13493 library l; 11601 library l;
13494 part 'a.dart'; 11602 part 'a.dart';
13495 typedef dynamic F(); 11603 typedef dynamic F();
13496 enum E { 11604 enum E {
13497 synthetic final int index; 11605 synthetic final int index;
13498 synthetic static const List<E> values; 11606 synthetic static const List<E> values;
13499 static const E v; 11607 static const E v;
13500 } 11608 }
13501 class C { 11609 class C {
13502 } 11610 }
13503 -------------------- 11611 --------------------
13504 unit: a.dart 11612 unit: a.dart
13505 11613
13506 C c; 11614 C c;
13507 E e; 11615 E e;
13508 F f; 11616 F f;
13509 '''); 11617 ''');
13510 } 11618 }
13511 } 11619 }
13512 11620
13513 test_type_reference_part_to_other_part() async { 11621 test_type_reference_part_to_other_part() async {
13514 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); 11622 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();');
13515 addSource('/b.dart', 'part of l; C c; E e; F f;'); 11623 addSource('/b.dart', 'part of l; C c; E e; F f;');
13516 var library = 11624 var library =
13517 await checkLibrary('library l; part "a.dart"; part "b.dart";'); 11625 await checkLibrary('library l; part "a.dart"; part "b.dart";');
13518 if (isStrongMode) { 11626 if (isStrongMode) {
13519 checkElementText( 11627 checkElementText(library, r'''
13520 library,
13521 r'''
13522 library l; 11628 library l;
13523 part 'a.dart'; 11629 part 'a.dart';
13524 part 'b.dart'; 11630 part 'b.dart';
13525 -------------------- 11631 --------------------
13526 unit: a.dart 11632 unit: a.dart
13527 11633
13528 typedef dynamic F(); 11634 typedef dynamic F();
13529 enum E { 11635 enum E {
13530 synthetic final int index; 11636 synthetic final int index;
13531 synthetic static const List<E> values; 11637 synthetic static const List<E> values;
13532 static const E v; 11638 static const E v;
13533 } 11639 }
13534 class C { 11640 class C {
13535 } 11641 }
13536 -------------------- 11642 --------------------
13537 unit: b.dart 11643 unit: b.dart
13538 11644
13539 C c; 11645 C c;
13540 E e; 11646 E e;
13541 F f; 11647 F f;
13542 '''); 11648 ''');
13543 } else { 11649 } else {
13544 checkElementText( 11650 checkElementText(library, r'''
13545 library,
13546 r'''
13547 library l; 11651 library l;
13548 part 'a.dart'; 11652 part 'a.dart';
13549 part 'b.dart'; 11653 part 'b.dart';
13550 -------------------- 11654 --------------------
13551 unit: a.dart 11655 unit: a.dart
13552 11656
13553 typedef dynamic F(); 11657 typedef dynamic F();
13554 enum E { 11658 enum E {
13555 synthetic final int index; 11659 synthetic final int index;
13556 synthetic static const List<E> values; 11660 synthetic static const List<E> values;
13557 static const E v; 11661 static const E v;
13558 } 11662 }
13559 class C { 11663 class C {
13560 } 11664 }
13561 -------------------- 11665 --------------------
13562 unit: b.dart 11666 unit: b.dart
13563 11667
13564 C c; 11668 C c;
13565 E e; 11669 E e;
13566 F f; 11670 F f;
13567 '''); 11671 ''');
13568 } 11672 }
13569 } 11673 }
13570 11674
13571 test_type_reference_part_to_part() async { 11675 test_type_reference_part_to_part() async {
13572 addSource('/a.dart', 11676 addSource('/a.dart',
13573 'part of l; class C {} enum E { v } typedef F(); C c; E e; F f;'); 11677 'part of l; class C {} enum E { v } typedef F(); C c; E e; F f;');
13574 var library = await checkLibrary('library l; part "a.dart";'); 11678 var library = await checkLibrary('library l; part "a.dart";');
13575 if (isStrongMode) { 11679 if (isStrongMode) {
13576 checkElementText( 11680 checkElementText(library, r'''
13577 library,
13578 r'''
13579 library l; 11681 library l;
13580 part 'a.dart'; 11682 part 'a.dart';
13581 -------------------- 11683 --------------------
13582 unit: a.dart 11684 unit: a.dart
13583 11685
13584 typedef dynamic F(); 11686 typedef dynamic F();
13585 enum E { 11687 enum E {
13586 synthetic final int index; 11688 synthetic final int index;
13587 synthetic static const List<E> values; 11689 synthetic static const List<E> values;
13588 static const E v; 11690 static const E v;
13589 } 11691 }
13590 class C { 11692 class C {
13591 } 11693 }
13592 C c; 11694 C c;
13593 E e; 11695 E e;
13594 F f; 11696 F f;
13595 '''); 11697 ''');
13596 } else { 11698 } else {
13597 checkElementText( 11699 checkElementText(library, r'''
13598 library,
13599 r'''
13600 library l; 11700 library l;
13601 part 'a.dart'; 11701 part 'a.dart';
13602 -------------------- 11702 --------------------
13603 unit: a.dart 11703 unit: a.dart
13604 11704
13605 typedef dynamic F(); 11705 typedef dynamic F();
13606 enum E { 11706 enum E {
13607 synthetic final int index; 11707 synthetic final int index;
13608 synthetic static const List<E> values; 11708 synthetic static const List<E> values;
13609 static const E v; 11709 static const E v;
13610 } 11710 }
13611 class C { 11711 class C {
13612 } 11712 }
13613 C c; 11713 C c;
13614 E e; 11714 E e;
13615 F f; 11715 F f;
13616 '''); 11716 ''');
13617 } 11717 }
13618 } 11718 }
13619 11719
13620 test_type_reference_to_class() async { 11720 test_type_reference_to_class() async {
13621 var library = await checkLibrary('class C {} C c;'); 11721 var library = await checkLibrary('class C {} C c;');
13622 if (isStrongMode) { 11722 if (isStrongMode) {
13623 checkElementText( 11723 checkElementText(library, r'''
13624 library,
13625 r'''
13626 class C { 11724 class C {
13627 } 11725 }
13628 C c; 11726 C c;
13629 '''); 11727 ''');
13630 } else { 11728 } else {
13631 checkElementText( 11729 checkElementText(library, r'''
13632 library,
13633 r'''
13634 class C { 11730 class C {
13635 } 11731 }
13636 C c; 11732 C c;
13637 '''); 11733 ''');
13638 } 11734 }
13639 } 11735 }
13640 11736
13641 test_type_reference_to_class_with_type_arguments() async { 11737 test_type_reference_to_class_with_type_arguments() async {
13642 var library = await checkLibrary('class C<T, U> {} C<int, String> c;'); 11738 var library = await checkLibrary('class C<T, U> {} C<int, String> c;');
13643 if (isStrongMode) { 11739 if (isStrongMode) {
13644 checkElementText( 11740 checkElementText(library, r'''
13645 library,
13646 r'''
13647 class C<T, U> { 11741 class C<T, U> {
13648 } 11742 }
13649 C<int, String> c; 11743 C<int, String> c;
13650 '''); 11744 ''');
13651 } else { 11745 } else {
13652 checkElementText( 11746 checkElementText(library, r'''
13653 library,
13654 r'''
13655 class C<T, U> { 11747 class C<T, U> {
13656 } 11748 }
13657 C<int, String> c; 11749 C<int, String> c;
13658 '''); 11750 ''');
13659 } 11751 }
13660 } 11752 }
13661 11753
13662 test_type_reference_to_class_with_type_arguments_implicit() async { 11754 test_type_reference_to_class_with_type_arguments_implicit() async {
13663 var library = await checkLibrary('class C<T, U> {} C c;'); 11755 var library = await checkLibrary('class C<T, U> {} C c;');
13664 if (isStrongMode) { 11756 if (isStrongMode) {
13665 checkElementText( 11757 checkElementText(library, r'''
13666 library,
13667 r'''
13668 class C<T, U> { 11758 class C<T, U> {
13669 } 11759 }
13670 C<dynamic, dynamic> c; 11760 C<dynamic, dynamic> c;
13671 '''); 11761 ''');
13672 } else { 11762 } else {
13673 checkElementText( 11763 checkElementText(library, r'''
13674 library,
13675 r'''
13676 class C<T, U> { 11764 class C<T, U> {
13677 } 11765 }
13678 C<dynamic, dynamic> c; 11766 C<dynamic, dynamic> c;
13679 '''); 11767 ''');
13680 } 11768 }
13681 } 11769 }
13682 11770
13683 test_type_reference_to_enum() async { 11771 test_type_reference_to_enum() async {
13684 var library = await checkLibrary('enum E { v } E e;'); 11772 var library = await checkLibrary('enum E { v } E e;');
13685 if (isStrongMode) { 11773 if (isStrongMode) {
13686 checkElementText( 11774 checkElementText(library, r'''
13687 library,
13688 r'''
13689 enum E { 11775 enum E {
13690 synthetic final int index; 11776 synthetic final int index;
13691 synthetic static const List<E> values; 11777 synthetic static const List<E> values;
13692 static const E v; 11778 static const E v;
13693 } 11779 }
13694 E e; 11780 E e;
13695 '''); 11781 ''');
13696 } else { 11782 } else {
13697 checkElementText( 11783 checkElementText(library, r'''
13698 library,
13699 r'''
13700 enum E { 11784 enum E {
13701 synthetic final int index; 11785 synthetic final int index;
13702 synthetic static const List<E> values; 11786 synthetic static const List<E> values;
13703 static const E v; 11787 static const E v;
13704 } 11788 }
13705 E e; 11789 E e;
13706 '''); 11790 ''');
13707 } 11791 }
13708 } 11792 }
13709 11793
13710 test_type_reference_to_import() async { 11794 test_type_reference_to_import() async {
13711 addLibrarySource('/a.dart', 'class C {} enum E { v }; typedef F();'); 11795 addLibrarySource('/a.dart', 'class C {} enum E { v }; typedef F();');
13712 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); 11796 var library = await checkLibrary('import "a.dart"; C c; E e; F f;');
13713 if (isStrongMode) { 11797 if (isStrongMode) {
13714 checkElementText( 11798 checkElementText(library, r'''
13715 library,
13716 r'''
13717 import 'a.dart'; 11799 import 'a.dart';
13718 C c; 11800 C c;
13719 E e; 11801 E e;
13720 F f; 11802 F f;
13721 '''); 11803 ''');
13722 } else { 11804 } else {
13723 checkElementText( 11805 checkElementText(library, r'''
13724 library,
13725 r'''
13726 import 'a.dart'; 11806 import 'a.dart';
13727 C c; 11807 C c;
13728 E e; 11808 E e;
13729 F f; 11809 F f;
13730 '''); 11810 ''');
13731 } 11811 }
13732 } 11812 }
13733 11813
13734 test_type_reference_to_import_export() async { 11814 test_type_reference_to_import_export() async {
13735 addLibrarySource('/a.dart', 'export "b.dart";'); 11815 addLibrarySource('/a.dart', 'export "b.dart";');
13736 addLibrarySource('/b.dart', 'class C {} enum E { v } typedef F();'); 11816 addLibrarySource('/b.dart', 'class C {} enum E { v } typedef F();');
13737 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); 11817 var library = await checkLibrary('import "a.dart"; C c; E e; F f;');
13738 if (isStrongMode) { 11818 if (isStrongMode) {
13739 checkElementText( 11819 checkElementText(library, r'''
13740 library,
13741 r'''
13742 import 'a.dart'; 11820 import 'a.dart';
13743 C c; 11821 C c;
13744 E e; 11822 E e;
13745 F f; 11823 F f;
13746 '''); 11824 ''');
13747 } else { 11825 } else {
13748 checkElementText( 11826 checkElementText(library, r'''
13749 library,
13750 r'''
13751 import 'a.dart'; 11827 import 'a.dart';
13752 C c; 11828 C c;
13753 E e; 11829 E e;
13754 F f; 11830 F f;
13755 '''); 11831 ''');
13756 } 11832 }
13757 } 11833 }
13758 11834
13759 test_type_reference_to_import_export_export() async { 11835 test_type_reference_to_import_export_export() async {
13760 addLibrarySource('/a.dart', 'export "b.dart";'); 11836 addLibrarySource('/a.dart', 'export "b.dart";');
13761 addLibrarySource('/b.dart', 'export "c.dart";'); 11837 addLibrarySource('/b.dart', 'export "c.dart";');
13762 addLibrarySource('/c.dart', 'class C {} enum E { v } typedef F();'); 11838 addLibrarySource('/c.dart', 'class C {} enum E { v } typedef F();');
13763 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); 11839 var library = await checkLibrary('import "a.dart"; C c; E e; F f;');
13764 if (isStrongMode) { 11840 if (isStrongMode) {
13765 checkElementText( 11841 checkElementText(library, r'''
13766 library,
13767 r'''
13768 import 'a.dart'; 11842 import 'a.dart';
13769 C c; 11843 C c;
13770 E e; 11844 E e;
13771 F f; 11845 F f;
13772 '''); 11846 ''');
13773 } else { 11847 } else {
13774 checkElementText( 11848 checkElementText(library, r'''
13775 library,
13776 r'''
13777 import 'a.dart'; 11849 import 'a.dart';
13778 C c; 11850 C c;
13779 E e; 11851 E e;
13780 F f; 11852 F f;
13781 '''); 11853 ''');
13782 } 11854 }
13783 } 11855 }
13784 11856
13785 test_type_reference_to_import_export_export_in_subdirs() async { 11857 test_type_reference_to_import_export_export_in_subdirs() async {
13786 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); 11858 addLibrarySource('/a/a.dart', 'export "b/b.dart";');
13787 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";'); 11859 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";');
13788 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();'); 11860 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();');
13789 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); 11861 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;');
13790 if (isStrongMode) { 11862 if (isStrongMode) {
13791 checkElementText( 11863 checkElementText(library, r'''
13792 library,
13793 r'''
13794 import 'a/a.dart'; 11864 import 'a/a.dart';
13795 C c; 11865 C c;
13796 E e; 11866 E e;
13797 F f; 11867 F f;
13798 '''); 11868 ''');
13799 } else { 11869 } else {
13800 checkElementText( 11870 checkElementText(library, r'''
13801 library,
13802 r'''
13803 import 'a/a.dart'; 11871 import 'a/a.dart';
13804 C c; 11872 C c;
13805 E e; 11873 E e;
13806 F f; 11874 F f;
13807 '''); 11875 ''');
13808 } 11876 }
13809 } 11877 }
13810 11878
13811 test_type_reference_to_import_export_in_subdirs() async { 11879 test_type_reference_to_import_export_in_subdirs() async {
13812 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); 11880 addLibrarySource('/a/a.dart', 'export "b/b.dart";');
13813 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();'); 11881 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();');
13814 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;'); 11882 var library = await checkLibrary('import "a/a.dart"; C c; E e; F f;');
13815 if (isStrongMode) { 11883 if (isStrongMode) {
13816 checkElementText( 11884 checkElementText(library, r'''
13817 library,
13818 r'''
13819 import 'a/a.dart'; 11885 import 'a/a.dart';
13820 C c; 11886 C c;
13821 E e; 11887 E e;
13822 F f; 11888 F f;
13823 '''); 11889 ''');
13824 } else { 11890 } else {
13825 checkElementText( 11891 checkElementText(library, r'''
13826 library,
13827 r'''
13828 import 'a/a.dart'; 11892 import 'a/a.dart';
13829 C c; 11893 C c;
13830 E e; 11894 E e;
13831 F f; 11895 F f;
13832 '''); 11896 ''');
13833 } 11897 }
13834 } 11898 }
13835 11899
13836 test_type_reference_to_import_part() async { 11900 test_type_reference_to_import_part() async {
13837 addLibrarySource('/a.dart', 'library l; part "b.dart";'); 11901 addLibrarySource('/a.dart', 'library l; part "b.dart";');
13838 addSource('/b.dart', 'part of l; class C {} enum E { v } typedef F();'); 11902 addSource('/b.dart', 'part of l; class C {} enum E { v } typedef F();');
13839 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); 11903 var library = await checkLibrary('import "a.dart"; C c; E e; F f;');
13840 if (isStrongMode) { 11904 if (isStrongMode) {
13841 checkElementText( 11905 checkElementText(library, r'''
13842 library,
13843 r'''
13844 import 'a.dart'; 11906 import 'a.dart';
13845 C c; 11907 C c;
13846 E e; 11908 E e;
13847 F f; 11909 F f;
13848 '''); 11910 ''');
13849 } else { 11911 } else {
13850 checkElementText( 11912 checkElementText(library, r'''
13851 library,
13852 r'''
13853 import 'a.dart'; 11913 import 'a.dart';
13854 C c; 11914 C c;
13855 E e; 11915 E e;
13856 F f; 11916 F f;
13857 '''); 11917 ''');
13858 } 11918 }
13859 } 11919 }
13860 11920
13861 test_type_reference_to_import_part2() async { 11921 test_type_reference_to_import_part2() async {
13862 addLibrarySource('/a.dart', 'library l; part "p1.dart"; part "p2.dart";'); 11922 addLibrarySource('/a.dart', 'library l; part "p1.dart"; part "p2.dart";');
13863 addSource('/p1.dart', 'part of l; class C1 {}'); 11923 addSource('/p1.dart', 'part of l; class C1 {}');
13864 addSource('/p2.dart', 'part of l; class C2 {}'); 11924 addSource('/p2.dart', 'part of l; class C2 {}');
13865 var library = await checkLibrary('import "a.dart"; C1 c1; C2 c2;'); 11925 var library = await checkLibrary('import "a.dart"; C1 c1; C2 c2;');
13866 if (isStrongMode) { 11926 if (isStrongMode) {
13867 checkElementText( 11927 checkElementText(library, r'''
13868 library,
13869 r'''
13870 import 'a.dart'; 11928 import 'a.dart';
13871 C1 c1; 11929 C1 c1;
13872 C2 c2; 11930 C2 c2;
13873 '''); 11931 ''');
13874 } else { 11932 } else {
13875 checkElementText( 11933 checkElementText(library, r'''
13876 library,
13877 r'''
13878 import 'a.dart'; 11934 import 'a.dart';
13879 C1 c1; 11935 C1 c1;
13880 C2 c2; 11936 C2 c2;
13881 '''); 11937 ''');
13882 } 11938 }
13883 } 11939 }
13884 11940
13885 test_type_reference_to_import_part_in_subdir() async { 11941 test_type_reference_to_import_part_in_subdir() async {
13886 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); 11942 addLibrarySource('/a/b.dart', 'library l; part "c.dart";');
13887 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); 11943 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();');
13888 var library = await checkLibrary('import "a/b.dart"; C c; E e; F f;'); 11944 var library = await checkLibrary('import "a/b.dart"; C c; E e; F f;');
13889 if (isStrongMode) { 11945 if (isStrongMode) {
13890 checkElementText( 11946 checkElementText(library, r'''
13891 library,
13892 r'''
13893 import 'a/b.dart'; 11947 import 'a/b.dart';
13894 C c; 11948 C c;
13895 E e; 11949 E e;
13896 F f; 11950 F f;
13897 '''); 11951 ''');
13898 } else { 11952 } else {
13899 checkElementText( 11953 checkElementText(library, r'''
13900 library,
13901 r'''
13902 import 'a/b.dart'; 11954 import 'a/b.dart';
13903 C c; 11955 C c;
13904 E e; 11956 E e;
13905 F f; 11957 F f;
13906 '''); 11958 ''');
13907 } 11959 }
13908 } 11960 }
13909 11961
13910 test_type_reference_to_import_relative() async { 11962 test_type_reference_to_import_relative() async {
13911 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); 11963 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();');
13912 var library = await checkLibrary('import "a.dart"; C c; E e; F f;'); 11964 var library = await checkLibrary('import "a.dart"; C c; E e; F f;');
13913 if (isStrongMode) { 11965 if (isStrongMode) {
13914 checkElementText( 11966 checkElementText(library, r'''
13915 library,
13916 r'''
13917 import 'a.dart'; 11967 import 'a.dart';
13918 C c; 11968 C c;
13919 E e; 11969 E e;
13920 F f; 11970 F f;
13921 '''); 11971 ''');
13922 } else { 11972 } else {
13923 checkElementText( 11973 checkElementText(library, r'''
13924 library,
13925 r'''
13926 import 'a.dart'; 11974 import 'a.dart';
13927 C c; 11975 C c;
13928 E e; 11976 E e;
13929 F f; 11977 F f;
13930 '''); 11978 ''');
13931 } 11979 }
13932 } 11980 }
13933 11981
13934 test_type_reference_to_typedef() async { 11982 test_type_reference_to_typedef() async {
13935 var library = await checkLibrary('typedef F(); F f;'); 11983 var library = await checkLibrary('typedef F(); F f;');
13936 if (isStrongMode) { 11984 if (isStrongMode) {
13937 checkElementText( 11985 checkElementText(library, r'''
13938 library,
13939 r'''
13940 typedef dynamic F(); 11986 typedef dynamic F();
13941 F f; 11987 F f;
13942 '''); 11988 ''');
13943 } else { 11989 } else {
13944 checkElementText( 11990 checkElementText(library, r'''
13945 library,
13946 r'''
13947 typedef dynamic F(); 11991 typedef dynamic F();
13948 F f; 11992 F f;
13949 '''); 11993 ''');
13950 } 11994 }
13951 } 11995 }
13952 11996
13953 test_type_reference_to_typedef_with_type_arguments() async { 11997 test_type_reference_to_typedef_with_type_arguments() async {
13954 var library = 11998 var library =
13955 await checkLibrary('typedef U F<T, U>(T t); F<int, String> f;'); 11999 await checkLibrary('typedef U F<T, U>(T t); F<int, String> f;');
13956 if (isStrongMode) { 12000 if (isStrongMode) {
13957 checkElementText( 12001 checkElementText(library, r'''
13958 library,
13959 r'''
13960 typedef U F<T, U>(T t); 12002 typedef U F<T, U>(T t);
13961 F<int, String> f; 12003 F<int, String> f;
13962 '''); 12004 ''');
13963 } else { 12005 } else {
13964 checkElementText( 12006 checkElementText(library, r'''
13965 library,
13966 r'''
13967 typedef U F<T, U>(T t); 12007 typedef U F<T, U>(T t);
13968 F<int, String> f; 12008 F<int, String> f;
13969 '''); 12009 ''');
13970 } 12010 }
13971 } 12011 }
13972 12012
13973 test_type_reference_to_typedef_with_type_arguments_implicit() async { 12013 test_type_reference_to_typedef_with_type_arguments_implicit() async {
13974 var library = await checkLibrary('typedef U F<T, U>(T t); F f;'); 12014 var library = await checkLibrary('typedef U F<T, U>(T t); F f;');
13975 if (isStrongMode) { 12015 if (isStrongMode) {
13976 checkElementText( 12016 checkElementText(library, r'''
13977 library,
13978 r'''
13979 typedef U F<T, U>(T t); 12017 typedef U F<T, U>(T t);
13980 F f; 12018 F f;
13981 '''); 12019 ''');
13982 } else { 12020 } else {
13983 checkElementText( 12021 checkElementText(library, r'''
13984 library,
13985 r'''
13986 typedef U F<T, U>(T t); 12022 typedef U F<T, U>(T t);
13987 F f; 12023 F f;
13988 '''); 12024 ''');
13989 } 12025 }
13990 } 12026 }
13991 12027
13992 test_type_unresolved() async { 12028 test_type_unresolved() async {
13993 var library = await checkLibrary('C c;', allowErrors: true); 12029 var library = await checkLibrary('C c;', allowErrors: true);
13994 if (isStrongMode) { 12030 if (isStrongMode) {
13995 checkElementText( 12031 checkElementText(library, r'''
13996 library,
13997 r'''
13998 dynamic c; 12032 dynamic c;
13999 '''); 12033 ''');
14000 } else { 12034 } else {
14001 checkElementText( 12035 checkElementText(library, r'''
14002 library,
14003 r'''
14004 dynamic c; 12036 dynamic c;
14005 '''); 12037 ''');
14006 } 12038 }
14007 } 12039 }
14008 12040
14009 test_type_unresolved_prefixed() async { 12041 test_type_unresolved_prefixed() async {
14010 var library = await checkLibrary('import "dart:core" as core; core.C c;', 12042 var library = await checkLibrary('import "dart:core" as core; core.C c;',
14011 allowErrors: true); 12043 allowErrors: true);
14012 if (isStrongMode) { 12044 if (isStrongMode) {
14013 checkElementText( 12045 checkElementText(library, r'''
14014 library,
14015 r'''
14016 import 'dart:core' as core; 12046 import 'dart:core' as core;
14017 dynamic c; 12047 dynamic c;
14018 '''); 12048 ''');
14019 } else { 12049 } else {
14020 checkElementText( 12050 checkElementText(library, r'''
14021 library,
14022 r'''
14023 import 'dart:core' as core; 12051 import 'dart:core' as core;
14024 dynamic c; 12052 dynamic c;
14025 '''); 12053 ''');
14026 } 12054 }
14027 } 12055 }
14028 12056
14029 test_typedef_documented() async { 12057 test_typedef_documented() async {
14030 var library = await checkLibrary(''' 12058 var library = await checkLibrary('''
14031 // Extra comment so doc comment offset != 0 12059 // Extra comment so doc comment offset != 0
14032 /** 12060 /**
14033 * Docs 12061 * Docs
14034 */ 12062 */
14035 typedef F();'''); 12063 typedef F();''');
14036 if (isStrongMode) { 12064 if (isStrongMode) {
14037 checkElementText( 12065 checkElementText(library, r'''
14038 library,
14039 r'''
14040 /** 12066 /**
14041 * Docs 12067 * Docs
14042 */ 12068 */
14043 typedef dynamic F(); 12069 typedef dynamic F();
14044 '''); 12070 ''');
14045 } else { 12071 } else {
14046 checkElementText( 12072 checkElementText(library, r'''
14047 library,
14048 r'''
14049 /** 12073 /**
14050 * Docs 12074 * Docs
14051 */ 12075 */
14052 typedef dynamic F(); 12076 typedef dynamic F();
14053 '''); 12077 ''');
14054 } 12078 }
14055 } 12079 }
14056 12080
14057 test_typedef_generic() async { 12081 test_typedef_generic() async {
14058 var library = await checkLibrary( 12082 var library = await checkLibrary(
14059 'typedef F<T> = int Function<S>(List<S> list, num Function<A>(A), T);'); 12083 'typedef F<T> = int Function<S>(List<S> list, num Function<A>(A), T);');
14060 if (isStrongMode) { 12084 if (isStrongMode) {
14061 checkElementText( 12085 checkElementText(library, r'''
14062 library,
14063 r'''
14064 typedef F<T> = int Function<S>(List<S> list, <A>(A) → num , T ); 12086 typedef F<T> = int Function<S>(List<S> list, <A>(A) → num , T );
14065 '''); 12087 ''');
14066 } else { 12088 } else {
14067 checkElementText( 12089 checkElementText(library, r'''
14068 library,
14069 r'''
14070 typedef F<T> = int Function<S>(List<S> list, <A>(A) → num , T ); 12090 typedef F<T> = int Function<S>(List<S> list, <A>(A) → num , T );
14071 '''); 12091 ''');
14072 } 12092 }
14073 } 12093 }
14074 12094
14075 test_typedef_generic_asFieldType() async { 12095 test_typedef_generic_asFieldType() async {
14076 shouldCompareLibraryElements = false; 12096 shouldCompareLibraryElements = false;
14077 var library = await checkLibrary(r''' 12097 var library = await checkLibrary(r'''
14078 typedef Foo<S> = S Function<T>(T x); 12098 typedef Foo<S> = S Function<T>(T x);
14079 class A { 12099 class A {
14080 Foo<int> f; 12100 Foo<int> f;
14081 } 12101 }
14082 '''); 12102 ''');
14083 if (isStrongMode) { 12103 if (isStrongMode) {
14084 checkElementText( 12104 checkElementText(library, r'''
14085 library,
14086 r'''
14087 typedef Foo<S> = S Function<T>(T x); 12105 typedef Foo<S> = S Function<T>(T x);
14088 class A { 12106 class A {
14089 <T>(T) → int f; 12107 <T>(T) → int f;
14090 } 12108 }
14091 '''); 12109 ''');
14092 } else { 12110 } else {
14093 checkElementText( 12111 checkElementText(library, r'''
14094 library,
14095 r'''
14096 typedef Foo<S> = S Function<T>(T x); 12112 typedef Foo<S> = S Function<T>(T x);
14097 class A { 12113 class A {
14098 <T>(T) → int f; 12114 <T>(T) → int f;
14099 } 12115 }
14100 '''); 12116 ''');
14101 } 12117 }
14102 } 12118 }
14103 12119
14104 test_typedef_parameter_parameters() async { 12120 test_typedef_parameter_parameters() async {
14105 var library = await checkLibrary('typedef F(g(x, y));'); 12121 var library = await checkLibrary('typedef F(g(x, y));');
14106 if (isStrongMode) { 12122 if (isStrongMode) {
14107 checkElementText( 12123 checkElementText(library, r'''
14108 library,
14109 r'''
14110 typedef dynamic F((dynamic, dynamic) → dynamic g); 12124 typedef dynamic F((dynamic, dynamic) → dynamic g);
14111 '''); 12125 ''');
14112 } else { 12126 } else {
14113 checkElementText( 12127 checkElementText(library, r'''
14114 library,
14115 r'''
14116 typedef dynamic F((dynamic, dynamic) → dynamic g); 12128 typedef dynamic F((dynamic, dynamic) → dynamic g);
14117 '''); 12129 ''');
14118 } 12130 }
14119 } 12131 }
14120 12132
14121 test_typedef_parameter_parameters_in_generic_class() async { 12133 test_typedef_parameter_parameters_in_generic_class() async {
14122 var library = await checkLibrary('typedef F<A, B>(A g(B x));'); 12134 var library = await checkLibrary('typedef F<A, B>(A g(B x));');
14123 if (isStrongMode) { 12135 if (isStrongMode) {
14124 checkElementText( 12136 checkElementText(library, r'''
14125 library,
14126 r'''
14127 typedef dynamic F<A, B>((B) → A g); 12137 typedef dynamic F<A, B>((B) → A g);
14128 '''); 12138 ''');
14129 } else { 12139 } else {
14130 checkElementText( 12140 checkElementText(library, r'''
14131 library,
14132 r'''
14133 typedef dynamic F<A, B>((B) → A g); 12141 typedef dynamic F<A, B>((B) → A g);
14134 '''); 12142 ''');
14135 } 12143 }
14136 } 12144 }
14137 12145
14138 test_typedef_parameter_return_type() async { 12146 test_typedef_parameter_return_type() async {
14139 var library = await checkLibrary('typedef F(int g());'); 12147 var library = await checkLibrary('typedef F(int g());');
14140 if (isStrongMode) { 12148 if (isStrongMode) {
14141 checkElementText( 12149 checkElementText(library, r'''
14142 library,
14143 r'''
14144 typedef dynamic F(() → int g); 12150 typedef dynamic F(() → int g);
14145 '''); 12151 ''');
14146 } else { 12152 } else {
14147 checkElementText( 12153 checkElementText(library, r'''
14148 library,
14149 r'''
14150 typedef dynamic F(() → int g); 12154 typedef dynamic F(() → int g);
14151 '''); 12155 ''');
14152 } 12156 }
14153 } 12157 }
14154 12158
14155 test_typedef_parameter_type() async { 12159 test_typedef_parameter_type() async {
14156 var library = await checkLibrary('typedef F(int i);'); 12160 var library = await checkLibrary('typedef F(int i);');
14157 if (isStrongMode) { 12161 if (isStrongMode) {
14158 checkElementText( 12162 checkElementText(library, r'''
14159 library,
14160 r'''
14161 typedef dynamic F(int i); 12163 typedef dynamic F(int i);
14162 '''); 12164 ''');
14163 } else { 12165 } else {
14164 checkElementText( 12166 checkElementText(library, r'''
14165 library,
14166 r'''
14167 typedef dynamic F(int i); 12167 typedef dynamic F(int i);
14168 '''); 12168 ''');
14169 } 12169 }
14170 } 12170 }
14171 12171
14172 test_typedef_parameter_type_generic() async { 12172 test_typedef_parameter_type_generic() async {
14173 var library = await checkLibrary('typedef F<T>(T t);'); 12173 var library = await checkLibrary('typedef F<T>(T t);');
14174 if (isStrongMode) { 12174 if (isStrongMode) {
14175 checkElementText( 12175 checkElementText(library, r'''
14176 library,
14177 r'''
14178 typedef dynamic F<T>(T t); 12176 typedef dynamic F<T>(T t);
14179 '''); 12177 ''');
14180 } else { 12178 } else {
14181 checkElementText( 12179 checkElementText(library, r'''
14182 library,
14183 r'''
14184 typedef dynamic F<T>(T t); 12180 typedef dynamic F<T>(T t);
14185 '''); 12181 ''');
14186 } 12182 }
14187 } 12183 }
14188 12184
14189 test_typedef_parameters() async { 12185 test_typedef_parameters() async {
14190 var library = await checkLibrary('typedef F(x, y);'); 12186 var library = await checkLibrary('typedef F(x, y);');
14191 if (isStrongMode) { 12187 if (isStrongMode) {
14192 checkElementText( 12188 checkElementText(library, r'''
14193 library,
14194 r'''
14195 typedef dynamic F(dynamic x, dynamic y); 12189 typedef dynamic F(dynamic x, dynamic y);
14196 '''); 12190 ''');
14197 } else { 12191 } else {
14198 checkElementText( 12192 checkElementText(library, r'''
14199 library,
14200 r'''
14201 typedef dynamic F(dynamic x, dynamic y); 12193 typedef dynamic F(dynamic x, dynamic y);
14202 '''); 12194 ''');
14203 } 12195 }
14204 } 12196 }
14205 12197
14206 test_typedef_return_type() async { 12198 test_typedef_return_type() async {
14207 var library = await checkLibrary('typedef int F();'); 12199 var library = await checkLibrary('typedef int F();');
14208 if (isStrongMode) { 12200 if (isStrongMode) {
14209 checkElementText( 12201 checkElementText(library, r'''
14210 library,
14211 r'''
14212 typedef int F(); 12202 typedef int F();
14213 '''); 12203 ''');
14214 } else { 12204 } else {
14215 checkElementText( 12205 checkElementText(library, r'''
14216 library,
14217 r'''
14218 typedef int F(); 12206 typedef int F();
14219 '''); 12207 ''');
14220 } 12208 }
14221 } 12209 }
14222 12210
14223 test_typedef_return_type_generic() async { 12211 test_typedef_return_type_generic() async {
14224 var library = await checkLibrary('typedef T F<T>();'); 12212 var library = await checkLibrary('typedef T F<T>();');
14225 if (isStrongMode) { 12213 if (isStrongMode) {
14226 checkElementText( 12214 checkElementText(library, r'''
14227 library,
14228 r'''
14229 typedef T F<T>(); 12215 typedef T F<T>();
14230 '''); 12216 ''');
14231 } else { 12217 } else {
14232 checkElementText( 12218 checkElementText(library, r'''
14233 library,
14234 r'''
14235 typedef T F<T>(); 12219 typedef T F<T>();
14236 '''); 12220 ''');
14237 } 12221 }
14238 } 12222 }
14239 12223
14240 test_typedef_return_type_implicit() async { 12224 test_typedef_return_type_implicit() async {
14241 var library = await checkLibrary('typedef F();'); 12225 var library = await checkLibrary('typedef F();');
14242 if (isStrongMode) { 12226 if (isStrongMode) {
14243 checkElementText( 12227 checkElementText(library, r'''
14244 library,
14245 r'''
14246 typedef dynamic F(); 12228 typedef dynamic F();
14247 '''); 12229 ''');
14248 } else { 12230 } else {
14249 checkElementText( 12231 checkElementText(library, r'''
14250 library,
14251 r'''
14252 typedef dynamic F(); 12232 typedef dynamic F();
14253 '''); 12233 ''');
14254 } 12234 }
14255 } 12235 }
14256 12236
14257 test_typedef_return_type_void() async { 12237 test_typedef_return_type_void() async {
14258 var library = await checkLibrary('typedef void F();'); 12238 var library = await checkLibrary('typedef void F();');
14259 if (isStrongMode) { 12239 if (isStrongMode) {
14260 checkElementText( 12240 checkElementText(library, r'''
14261 library,
14262 r'''
14263 typedef void F(); 12241 typedef void F();
14264 '''); 12242 ''');
14265 } else { 12243 } else {
14266 checkElementText( 12244 checkElementText(library, r'''
14267 library,
14268 r'''
14269 typedef void F(); 12245 typedef void F();
14270 '''); 12246 ''');
14271 } 12247 }
14272 } 12248 }
14273 12249
14274 test_typedef_type_parameters() async { 12250 test_typedef_type_parameters() async {
14275 var library = await checkLibrary('typedef U F<T, U>(T t);'); 12251 var library = await checkLibrary('typedef U F<T, U>(T t);');
14276 if (isStrongMode) { 12252 if (isStrongMode) {
14277 checkElementText( 12253 checkElementText(library, r'''
14278 library,
14279 r'''
14280 typedef U F<T, U>(T t); 12254 typedef U F<T, U>(T t);
14281 '''); 12255 ''');
14282 } else { 12256 } else {
14283 checkElementText( 12257 checkElementText(library, r'''
14284 library,
14285 r'''
14286 typedef U F<T, U>(T t); 12258 typedef U F<T, U>(T t);
14287 '''); 12259 ''');
14288 } 12260 }
14289 } 12261 }
14290 12262
14291 test_typedef_type_parameters_bound() async { 12263 test_typedef_type_parameters_bound() async {
14292 var library = await checkLibrary( 12264 var library = await checkLibrary(
14293 'typedef U F<T extends Object, U extends D>(T t); class D {}'); 12265 'typedef U F<T extends Object, U extends D>(T t); class D {}');
14294 if (isStrongMode) { 12266 if (isStrongMode) {
14295 checkElementText( 12267 checkElementText(library, r'''
14296 library,
14297 r'''
14298 typedef U F<T extends Object, U extends D>(T t); 12268 typedef U F<T extends Object, U extends D>(T t);
14299 class D { 12269 class D {
14300 } 12270 }
14301 '''); 12271 ''');
14302 } else { 12272 } else {
14303 checkElementText( 12273 checkElementText(library, r'''
14304 library,
14305 r'''
14306 typedef U F<T extends Object, U extends D>(T t); 12274 typedef U F<T extends Object, U extends D>(T t);
14307 class D { 12275 class D {
14308 } 12276 }
14309 '''); 12277 ''');
14310 } 12278 }
14311 } 12279 }
14312 12280
14313 test_typedef_type_parameters_bound_recursive() async { 12281 test_typedef_type_parameters_bound_recursive() async {
14314 shouldCompareLibraryElements = false; 12282 shouldCompareLibraryElements = false;
14315 var library = await checkLibrary('typedef void F<T extends F>();'); 12283 var library = await checkLibrary('typedef void F<T extends F>();');
14316 checkElementText( 12284 checkElementText(library, r'''
14317 library,
14318 r'''
14319 typedef void F<T extends F>(); 12285 typedef void F<T extends F>();
14320 '''); 12286 ''');
14321 } 12287 }
14322 12288
14323 test_typedef_type_parameters_bound_recursive2() async { 12289 test_typedef_type_parameters_bound_recursive2() async {
14324 shouldCompareLibraryElements = false; 12290 shouldCompareLibraryElements = false;
14325 var library = await checkLibrary('typedef void F<T extends List<F>>();'); 12291 var library = await checkLibrary('typedef void F<T extends List<F>>();');
14326 checkElementText( 12292 checkElementText(library, r'''
14327 library,
14328 r'''
14329 typedef void F<T extends List<F>>(); 12293 typedef void F<T extends List<F>>();
14330 '''); 12294 ''');
14331 } 12295 }
14332 12296
14333 test_typedef_type_parameters_f_bound_complex() async { 12297 test_typedef_type_parameters_f_bound_complex() async {
14334 var library = await checkLibrary('typedef U F<T extends List<U>, U>(T t);'); 12298 var library = await checkLibrary('typedef U F<T extends List<U>, U>(T t);');
14335 if (isStrongMode) { 12299 if (isStrongMode) {
14336 checkElementText( 12300 checkElementText(library, r'''
14337 library,
14338 r'''
14339 typedef U F<T extends List<U>, U>(T t); 12301 typedef U F<T extends List<U>, U>(T t);
14340 '''); 12302 ''');
14341 } else { 12303 } else {
14342 checkElementText( 12304 checkElementText(library, r'''
14343 library,
14344 r'''
14345 typedef U F<T extends List<U>, U>(T t); 12305 typedef U F<T extends List<U>, U>(T t);
14346 '''); 12306 ''');
14347 } 12307 }
14348 } 12308 }
14349 12309
14350 test_typedef_type_parameters_f_bound_simple() async { 12310 test_typedef_type_parameters_f_bound_simple() async {
14351 var library = await checkLibrary('typedef U F<T extends U, U>(T t);'); 12311 var library = await checkLibrary('typedef U F<T extends U, U>(T t);');
14352 if (isStrongMode) { 12312 if (isStrongMode) {
14353 checkElementText( 12313 checkElementText(library, r'''
14354 library,
14355 r'''
14356 typedef U F<T extends U, U>(T t); 12314 typedef U F<T extends U, U>(T t);
14357 '''); 12315 ''');
14358 } else { 12316 } else {
14359 checkElementText( 12317 checkElementText(library, r'''
14360 library,
14361 r'''
14362 typedef U F<T extends U, U>(T t); 12318 typedef U F<T extends U, U>(T t);
14363 '''); 12319 ''');
14364 } 12320 }
14365 } 12321 }
14366 12322
14367 test_typedefs() async { 12323 test_typedefs() async {
14368 var library = await checkLibrary('f() {} g() {}'); 12324 var library = await checkLibrary('f() {} g() {}');
14369 if (isStrongMode) { 12325 if (isStrongMode) {
14370 checkElementText( 12326 checkElementText(library, r'''
14371 library,
14372 r'''
14373 dynamic f() {} 12327 dynamic f() {}
14374 dynamic g() {} 12328 dynamic g() {}
14375 '''); 12329 ''');
14376 } else { 12330 } else {
14377 checkElementText( 12331 checkElementText(library, r'''
14378 library,
14379 r'''
14380 dynamic f() {} 12332 dynamic f() {}
14381 dynamic g() {} 12333 dynamic g() {}
14382 '''); 12334 ''');
14383 } 12335 }
14384 } 12336 }
14385 12337
14386 @failingTest 12338 @failingTest
14387 test_unresolved_annotation_instanceCreation_argument_super() async { 12339 test_unresolved_annotation_instanceCreation_argument_super() async {
14388 // TODO(scheglov) fix https://github.com/dart-lang/sdk/issues/28553 12340 // TODO(scheglov) fix https://github.com/dart-lang/sdk/issues/28553
14389 var library = await checkLibrary( 12341 var library = await checkLibrary('''
14390 '''
14391 class A { 12342 class A {
14392 const A(_); 12343 const A(_);
14393 } 12344 }
14394 12345
14395 @A(super) 12346 @A(super)
14396 class C {} 12347 class C {}
14397 ''', 12348 ''', allowErrors: true);
14398 allowErrors: true);
14399 if (isStrongMode) { 12349 if (isStrongMode) {
14400 checkElementText( 12350 checkElementText(library, r'''
14401 library,
14402 r'''
14403 class A { 12351 class A {
14404 A(_); 12352 A(_);
14405 } 12353 }
14406 12354
14407 class C { 12355 class C {
14408 synthetic C(); 12356 synthetic C();
14409 } 12357 }
14410 '''); 12358 ''');
14411 } else { 12359 } else {
14412 checkElementText( 12360 checkElementText(library, r'''
14413 library,
14414 r'''
14415 class A { 12361 class A {
14416 A(_); 12362 A(_);
14417 } 12363 }
14418 12364
14419 class C { 12365 class C {
14420 synthetic C(); 12366 synthetic C();
14421 } 12367 }
14422 '''); 12368 ''');
14423 } 12369 }
14424 } 12370 }
14425 12371
14426 test_unresolved_annotation_instanceCreation_argument_this() async { 12372 test_unresolved_annotation_instanceCreation_argument_this() async {
14427 var library = await checkLibrary( 12373 var library = await checkLibrary('''
14428 '''
14429 class A { 12374 class A {
14430 const A(_); 12375 const A(_);
14431 } 12376 }
14432 12377
14433 @A(this) 12378 @A(this)
14434 class C {} 12379 class C {}
14435 ''', 12380 ''', allowErrors: true);
14436 allowErrors: true);
14437 if (isStrongMode) { 12381 if (isStrongMode) {
14438 checkElementText( 12382 checkElementText(library, r'''
14439 library,
14440 r'''
14441 class A { 12383 class A {
14442 const A(dynamic _); 12384 const A(dynamic _);
14443 } 12385 }
14444 @ 12386 @
14445 A/*location: test.dart;A*/(this) 12387 A/*location: test.dart;A*/(this)
14446 class C { 12388 class C {
14447 } 12389 }
14448 '''); 12390 ''');
14449 } else { 12391 } else {
14450 checkElementText( 12392 checkElementText(library, r'''
14451 library,
14452 r'''
14453 class A { 12393 class A {
14454 const A(dynamic _); 12394 const A(dynamic _);
14455 } 12395 }
14456 @ 12396 @
14457 A/*location: test.dart;A*/(this) 12397 A/*location: test.dart;A*/(this)
14458 class C { 12398 class C {
14459 } 12399 }
14460 '''); 12400 ''');
14461 } 12401 }
14462 } 12402 }
14463 12403
14464 test_unresolved_annotation_namedConstructorCall_noClass() async { 12404 test_unresolved_annotation_namedConstructorCall_noClass() async {
14465 var library = 12405 var library =
14466 await checkLibrary('@foo.bar() class C {}', allowErrors: true); 12406 await checkLibrary('@foo.bar() class C {}', allowErrors: true);
14467 if (isStrongMode) { 12407 if (isStrongMode) {
14468 checkElementText( 12408 checkElementText(library, r'''
14469 library,
14470 r'''
14471 @ 12409 @
14472 foo/*location: null*/. 12410 foo/*location: null*/.
14473 bar/*location: null*/() 12411 bar/*location: null*/()
14474 class C { 12412 class C {
14475 } 12413 }
14476 '''); 12414 ''');
14477 } else { 12415 } else {
14478 checkElementText( 12416 checkElementText(library, r'''
14479 library,
14480 r'''
14481 @ 12417 @
14482 foo/*location: null*/. 12418 foo/*location: null*/.
14483 bar/*location: null*/() 12419 bar/*location: null*/()
14484 class C { 12420 class C {
14485 } 12421 }
14486 '''); 12422 ''');
14487 } 12423 }
14488 } 12424 }
14489 12425
14490 test_unresolved_annotation_namedConstructorCall_noConstructor() async { 12426 test_unresolved_annotation_namedConstructorCall_noConstructor() async {
14491 var library = 12427 var library =
14492 await checkLibrary('@String.foo() class C {}', allowErrors: true); 12428 await checkLibrary('@String.foo() class C {}', allowErrors: true);
14493 if (isStrongMode) { 12429 if (isStrongMode) {
14494 checkElementText( 12430 checkElementText(library, r'''
14495 library,
14496 r'''
14497 @ 12431 @
14498 String/*location: dart:core;String*/. 12432 String/*location: dart:core;String*/.
14499 foo/*location: null*/() 12433 foo/*location: null*/()
14500 class C { 12434 class C {
14501 } 12435 }
14502 '''); 12436 ''');
14503 } else { 12437 } else {
14504 checkElementText( 12438 checkElementText(library, r'''
14505 library,
14506 r'''
14507 @ 12439 @
14508 String/*location: dart:core;String*/. 12440 String/*location: dart:core;String*/.
14509 foo/*location: null*/() 12441 foo/*location: null*/()
14510 class C { 12442 class C {
14511 } 12443 }
14512 '''); 12444 ''');
14513 } 12445 }
14514 } 12446 }
14515 12447
14516 test_unresolved_annotation_prefixedIdentifier_badPrefix() async { 12448 test_unresolved_annotation_prefixedIdentifier_badPrefix() async {
14517 var library = await checkLibrary('@foo.bar class C {}', allowErrors: true); 12449 var library = await checkLibrary('@foo.bar class C {}', allowErrors: true);
14518 if (isStrongMode) { 12450 if (isStrongMode) {
14519 checkElementText( 12451 checkElementText(library, r'''
14520 library,
14521 r'''
14522 @ 12452 @
14523 foo/*location: null*/. 12453 foo/*location: null*/.
14524 bar/*location: null*/ 12454 bar/*location: null*/
14525 class C { 12455 class C {
14526 } 12456 }
14527 '''); 12457 ''');
14528 } else { 12458 } else {
14529 checkElementText( 12459 checkElementText(library, r'''
14530 library,
14531 r'''
14532 @ 12460 @
14533 foo/*location: null*/. 12461 foo/*location: null*/.
14534 bar/*location: null*/ 12462 bar/*location: null*/
14535 class C { 12463 class C {
14536 } 12464 }
14537 '''); 12465 ''');
14538 } 12466 }
14539 } 12467 }
14540 12468
14541 test_unresolved_annotation_prefixedIdentifier_noDeclaration() async { 12469 test_unresolved_annotation_prefixedIdentifier_noDeclaration() async {
14542 var library = await checkLibrary( 12470 var library = await checkLibrary(
14543 'import "dart:async" as foo; @foo.bar class C {}', 12471 'import "dart:async" as foo; @foo.bar class C {}',
14544 allowErrors: true); 12472 allowErrors: true);
14545 if (isStrongMode) { 12473 if (isStrongMode) {
14546 checkElementText( 12474 checkElementText(library, r'''
14547 library,
14548 r'''
14549 import 'dart:async' as foo; 12475 import 'dart:async' as foo;
14550 @ 12476 @
14551 foo/*location: test.dart;foo*/. 12477 foo/*location: test.dart;foo*/.
14552 bar/*location: null*/ 12478 bar/*location: null*/
14553 class C { 12479 class C {
14554 } 12480 }
14555 '''); 12481 ''');
14556 } else { 12482 } else {
14557 checkElementText( 12483 checkElementText(library, r'''
14558 library,
14559 r'''
14560 import 'dart:async' as foo; 12484 import 'dart:async' as foo;
14561 @ 12485 @
14562 foo/*location: test.dart;foo*/. 12486 foo/*location: test.dart;foo*/.
14563 bar/*location: null*/ 12487 bar/*location: null*/
14564 class C { 12488 class C {
14565 } 12489 }
14566 '''); 12490 ''');
14567 } 12491 }
14568 } 12492 }
14569 12493
14570 test_unresolved_annotation_prefixedNamedConstructorCall_badPrefix() async { 12494 test_unresolved_annotation_prefixedNamedConstructorCall_badPrefix() async {
14571 var library = 12495 var library =
14572 await checkLibrary('@foo.bar.baz() class C {}', allowErrors: true); 12496 await checkLibrary('@foo.bar.baz() class C {}', allowErrors: true);
14573 if (isStrongMode) { 12497 if (isStrongMode) {
14574 checkElementText( 12498 checkElementText(library, r'''
14575 library,
14576 r'''
14577 @ 12499 @
14578 foo/*location: null*/. 12500 foo/*location: null*/.
14579 bar/*location: null*/. 12501 bar/*location: null*/.
14580 baz/*location: null*/() 12502 baz/*location: null*/()
14581 class C { 12503 class C {
14582 } 12504 }
14583 '''); 12505 ''');
14584 } else { 12506 } else {
14585 checkElementText( 12507 checkElementText(library, r'''
14586 library,
14587 r'''
14588 @ 12508 @
14589 foo/*location: null*/. 12509 foo/*location: null*/.
14590 bar/*location: null*/. 12510 bar/*location: null*/.
14591 baz/*location: null*/() 12511 baz/*location: null*/()
14592 class C { 12512 class C {
14593 } 12513 }
14594 '''); 12514 ''');
14595 } 12515 }
14596 } 12516 }
14597 12517
14598 test_unresolved_annotation_prefixedNamedConstructorCall_noClass() async { 12518 test_unresolved_annotation_prefixedNamedConstructorCall_noClass() async {
14599 var library = await checkLibrary( 12519 var library = await checkLibrary(
14600 'import "dart:async" as foo; @foo.bar.baz() class C {}', 12520 'import "dart:async" as foo; @foo.bar.baz() class C {}',
14601 allowErrors: true); 12521 allowErrors: true);
14602 if (isStrongMode) { 12522 if (isStrongMode) {
14603 checkElementText( 12523 checkElementText(library, r'''
14604 library,
14605 r'''
14606 import 'dart:async' as foo; 12524 import 'dart:async' as foo;
14607 @ 12525 @
14608 foo/*location: test.dart;foo*/. 12526 foo/*location: test.dart;foo*/.
14609 bar/*location: null*/. 12527 bar/*location: null*/.
14610 baz/*location: null*/() 12528 baz/*location: null*/()
14611 class C { 12529 class C {
14612 } 12530 }
14613 '''); 12531 ''');
14614 } else { 12532 } else {
14615 checkElementText( 12533 checkElementText(library, r'''
14616 library,
14617 r'''
14618 import 'dart:async' as foo; 12534 import 'dart:async' as foo;
14619 @ 12535 @
14620 foo/*location: test.dart;foo*/. 12536 foo/*location: test.dart;foo*/.
14621 bar/*location: null*/. 12537 bar/*location: null*/.
14622 baz/*location: null*/() 12538 baz/*location: null*/()
14623 class C { 12539 class C {
14624 } 12540 }
14625 '''); 12541 ''');
14626 } 12542 }
14627 } 12543 }
14628 12544
14629 test_unresolved_annotation_prefixedNamedConstructorCall_noConstructor() async { 12545 test_unresolved_annotation_prefixedNamedConstructorCall_noConstructor() async {
14630 var library = await checkLibrary( 12546 var library = await checkLibrary(
14631 'import "dart:async" as foo; @foo.Future.bar() class C {}', 12547 'import "dart:async" as foo; @foo.Future.bar() class C {}',
14632 allowErrors: true); 12548 allowErrors: true);
14633 if (isStrongMode) { 12549 if (isStrongMode) {
14634 checkElementText( 12550 checkElementText(library, r'''
14635 library,
14636 r'''
14637 import 'dart:async' as foo; 12551 import 'dart:async' as foo;
14638 @ 12552 @
14639 foo/*location: test.dart;foo*/. 12553 foo/*location: test.dart;foo*/.
14640 Future/*location: dart:async;Future*/. 12554 Future/*location: dart:async;Future*/.
14641 bar/*location: null*/() 12555 bar/*location: null*/()
14642 class C { 12556 class C {
14643 } 12557 }
14644 '''); 12558 ''');
14645 } else { 12559 } else {
14646 checkElementText( 12560 checkElementText(library, r'''
14647 library,
14648 r'''
14649 import 'dart:async' as foo; 12561 import 'dart:async' as foo;
14650 @ 12562 @
14651 foo/*location: test.dart;foo*/. 12563 foo/*location: test.dart;foo*/.
14652 Future/*location: dart:async;Future*/. 12564 Future/*location: dart:async;Future*/.
14653 bar/*location: null*/() 12565 bar/*location: null*/()
14654 class C { 12566 class C {
14655 } 12567 }
14656 '''); 12568 ''');
14657 } 12569 }
14658 } 12570 }
14659 12571
14660 test_unresolved_annotation_prefixedUnnamedConstructorCall_badPrefix() async { 12572 test_unresolved_annotation_prefixedUnnamedConstructorCall_badPrefix() async {
14661 var library = 12573 var library =
14662 await checkLibrary('@foo.bar() class C {}', allowErrors: true); 12574 await checkLibrary('@foo.bar() class C {}', allowErrors: true);
14663 if (isStrongMode) { 12575 if (isStrongMode) {
14664 checkElementText( 12576 checkElementText(library, r'''
14665 library,
14666 r'''
14667 @ 12577 @
14668 foo/*location: null*/. 12578 foo/*location: null*/.
14669 bar/*location: null*/() 12579 bar/*location: null*/()
14670 class C { 12580 class C {
14671 } 12581 }
14672 '''); 12582 ''');
14673 } else { 12583 } else {
14674 checkElementText( 12584 checkElementText(library, r'''
14675 library,
14676 r'''
14677 @ 12585 @
14678 foo/*location: null*/. 12586 foo/*location: null*/.
14679 bar/*location: null*/() 12587 bar/*location: null*/()
14680 class C { 12588 class C {
14681 } 12589 }
14682 '''); 12590 ''');
14683 } 12591 }
14684 } 12592 }
14685 12593
14686 test_unresolved_annotation_prefixedUnnamedConstructorCall_noClass() async { 12594 test_unresolved_annotation_prefixedUnnamedConstructorCall_noClass() async {
14687 var library = await checkLibrary( 12595 var library = await checkLibrary(
14688 'import "dart:async" as foo; @foo.bar() class C {}', 12596 'import "dart:async" as foo; @foo.bar() class C {}',
14689 allowErrors: true); 12597 allowErrors: true);
14690 if (isStrongMode) { 12598 if (isStrongMode) {
14691 checkElementText( 12599 checkElementText(library, r'''
14692 library,
14693 r'''
14694 import 'dart:async' as foo; 12600 import 'dart:async' as foo;
14695 @ 12601 @
14696 foo/*location: test.dart;foo*/. 12602 foo/*location: test.dart;foo*/.
14697 bar/*location: null*/() 12603 bar/*location: null*/()
14698 class C { 12604 class C {
14699 } 12605 }
14700 '''); 12606 ''');
14701 } else { 12607 } else {
14702 checkElementText( 12608 checkElementText(library, r'''
14703 library,
14704 r'''
14705 import 'dart:async' as foo; 12609 import 'dart:async' as foo;
14706 @ 12610 @
14707 foo/*location: test.dart;foo*/. 12611 foo/*location: test.dart;foo*/.
14708 bar/*location: null*/() 12612 bar/*location: null*/()
14709 class C { 12613 class C {
14710 } 12614 }
14711 '''); 12615 ''');
14712 } 12616 }
14713 } 12617 }
14714 12618
14715 test_unresolved_annotation_simpleIdentifier() async { 12619 test_unresolved_annotation_simpleIdentifier() async {
14716 var library = await checkLibrary('@foo class C {}', allowErrors: true); 12620 var library = await checkLibrary('@foo class C {}', allowErrors: true);
14717 if (isStrongMode) { 12621 if (isStrongMode) {
14718 checkElementText( 12622 checkElementText(library, r'''
14719 library,
14720 r'''
14721 @ 12623 @
14722 foo/*location: null*/ 12624 foo/*location: null*/
14723 class C { 12625 class C {
14724 } 12626 }
14725 '''); 12627 ''');
14726 } else { 12628 } else {
14727 checkElementText( 12629 checkElementText(library, r'''
14728 library,
14729 r'''
14730 @ 12630 @
14731 foo/*location: null*/ 12631 foo/*location: null*/
14732 class C { 12632 class C {
14733 } 12633 }
14734 '''); 12634 ''');
14735 } 12635 }
14736 } 12636 }
14737 12637
14738 test_unresolved_annotation_unnamedConstructorCall_noClass() async { 12638 test_unresolved_annotation_unnamedConstructorCall_noClass() async {
14739 var library = await checkLibrary('@foo() class C {}', allowErrors: true); 12639 var library = await checkLibrary('@foo() class C {}', allowErrors: true);
14740 if (isStrongMode) { 12640 if (isStrongMode) {
14741 checkElementText( 12641 checkElementText(library, r'''
14742 library,
14743 r'''
14744 @ 12642 @
14745 foo/*location: null*/() 12643 foo/*location: null*/()
14746 class C { 12644 class C {
14747 } 12645 }
14748 '''); 12646 ''');
14749 } else { 12647 } else {
14750 checkElementText( 12648 checkElementText(library, r'''
14751 library,
14752 r'''
14753 @ 12649 @
14754 foo/*location: null*/() 12650 foo/*location: null*/()
14755 class C { 12651 class C {
14756 } 12652 }
14757 '''); 12653 ''');
14758 } 12654 }
14759 } 12655 }
14760 12656
14761 test_unresolved_export() async { 12657 test_unresolved_export() async {
14762 allowMissingFiles = true; 12658 allowMissingFiles = true;
14763 var library = await checkLibrary("export 'foo.dart';", allowErrors: true); 12659 var library = await checkLibrary("export 'foo.dart';", allowErrors: true);
14764 if (isStrongMode) { 12660 if (isStrongMode) {
14765 checkElementText( 12661 checkElementText(library, r'''
14766 library,
14767 r'''
14768 export 'foo.dart'; 12662 export 'foo.dart';
14769 '''); 12663 ''');
14770 } else { 12664 } else {
14771 checkElementText( 12665 checkElementText(library, r'''
14772 library,
14773 r'''
14774 export 'foo.dart'; 12666 export 'foo.dart';
14775 '''); 12667 ''');
14776 } 12668 }
14777 } 12669 }
14778 12670
14779 test_unresolved_import() async { 12671 test_unresolved_import() async {
14780 allowMissingFiles = true; 12672 allowMissingFiles = true;
14781 var library = await checkLibrary("import 'foo.dart';", allowErrors: true); 12673 var library = await checkLibrary("import 'foo.dart';", allowErrors: true);
14782 LibraryElement importedLibrary = library.imports[0].importedLibrary; 12674 LibraryElement importedLibrary = library.imports[0].importedLibrary;
14783 expect(importedLibrary.loadLibraryFunction, isNotNull); 12675 expect(importedLibrary.loadLibraryFunction, isNotNull);
14784 expect(importedLibrary.publicNamespace, isNotNull); 12676 expect(importedLibrary.publicNamespace, isNotNull);
14785 expect(importedLibrary.exportNamespace, isNotNull); 12677 expect(importedLibrary.exportNamespace, isNotNull);
14786 if (isStrongMode) { 12678 if (isStrongMode) {
14787 checkElementText( 12679 checkElementText(library, r'''
14788 library,
14789 r'''
14790 import 'foo.dart'; 12680 import 'foo.dart';
14791 '''); 12681 ''');
14792 } else { 12682 } else {
14793 checkElementText( 12683 checkElementText(library, r'''
14794 library,
14795 r'''
14796 import 'foo.dart'; 12684 import 'foo.dart';
14797 '''); 12685 ''');
14798 } 12686 }
14799 } 12687 }
14800 12688
14801 test_unresolved_part() async { 12689 test_unresolved_part() async {
14802 allowMissingFiles = true; 12690 allowMissingFiles = true;
14803 var library = await checkLibrary("part 'foo.dart';", allowErrors: true); 12691 var library = await checkLibrary("part 'foo.dart';", allowErrors: true);
14804 if (isStrongMode) { 12692 if (isStrongMode) {
14805 checkElementText( 12693 checkElementText(library, r'''
14806 library,
14807 r'''
14808 part 'foo.dart'; 12694 part 'foo.dart';
14809 -------------------- 12695 --------------------
14810 unit: foo.dart 12696 unit: foo.dart
14811 12697
14812 '''); 12698 ''');
14813 } else { 12699 } else {
14814 checkElementText( 12700 checkElementText(library, r'''
14815 library,
14816 r'''
14817 part 'foo.dart'; 12701 part 'foo.dart';
14818 -------------------- 12702 --------------------
14819 unit: foo.dart 12703 unit: foo.dart
14820 12704
14821 '''); 12705 ''');
14822 } 12706 }
14823 } 12707 }
14824 12708
14825 test_unused_type_parameter() async { 12709 test_unused_type_parameter() async {
14826 var library = await checkLibrary(''' 12710 var library = await checkLibrary('''
14827 class C<T> { 12711 class C<T> {
14828 void f() {} 12712 void f() {}
14829 } 12713 }
14830 C<int> c; 12714 C<int> c;
14831 var v = c.f; 12715 var v = c.f;
14832 '''); 12716 ''');
14833 if (isStrongMode) { 12717 if (isStrongMode) {
14834 checkElementText( 12718 checkElementText(library, r'''
14835 library,
14836 r'''
14837 class C<T> { 12719 class C<T> {
14838 void f() {} 12720 void f() {}
14839 } 12721 }
14840 C<int> c; 12722 C<int> c;
14841 () → void v; 12723 () → void v;
14842 '''); 12724 ''');
14843 } else { 12725 } else {
14844 checkElementText( 12726 checkElementText(library, r'''
14845 library,
14846 r'''
14847 class C<T> { 12727 class C<T> {
14848 void f() {} 12728 void f() {}
14849 } 12729 }
14850 C<int> c; 12730 C<int> c;
14851 dynamic v; 12731 dynamic v;
14852 '''); 12732 ''');
14853 } 12733 }
14854 } 12734 }
14855 12735
14856 test_variable_const() async { 12736 test_variable_const() async {
14857 var library = await checkLibrary('const int i = 0;'); 12737 var library = await checkLibrary('const int i = 0;');
14858 if (isStrongMode) { 12738 if (isStrongMode) {
14859 checkElementText( 12739 checkElementText(library, r'''
14860 library,
14861 r'''
14862 const int i = 0; 12740 const int i = 0;
14863 '''); 12741 ''');
14864 } else { 12742 } else {
14865 checkElementText( 12743 checkElementText(library, r'''
14866 library,
14867 r'''
14868 const int i = 0; 12744 const int i = 0;
14869 '''); 12745 ''');
14870 } 12746 }
14871 } 12747 }
14872 12748
14873 test_variable_documented() async { 12749 test_variable_documented() async {
14874 var library = await checkLibrary(''' 12750 var library = await checkLibrary('''
14875 // Extra comment so doc comment offset != 0 12751 // Extra comment so doc comment offset != 0
14876 /** 12752 /**
14877 * Docs 12753 * Docs
14878 */ 12754 */
14879 var x;'''); 12755 var x;''');
14880 if (isStrongMode) { 12756 if (isStrongMode) {
14881 checkElementText( 12757 checkElementText(library, r'''
14882 library,
14883 r'''
14884 /** 12758 /**
14885 * Docs 12759 * Docs
14886 */ 12760 */
14887 dynamic x; 12761 dynamic x;
14888 '''); 12762 ''');
14889 } else { 12763 } else {
14890 checkElementText( 12764 checkElementText(library, r'''
14891 library,
14892 r'''
14893 /** 12765 /**
14894 * Docs 12766 * Docs
14895 */ 12767 */
14896 dynamic x; 12768 dynamic x;
14897 '''); 12769 ''');
14898 } 12770 }
14899 } 12771 }
14900 12772
14901 test_variable_final() async { 12773 test_variable_final() async {
14902 var library = await checkLibrary('final int x = 0;'); 12774 var library = await checkLibrary('final int x = 0;');
14903 if (isStrongMode) { 12775 if (isStrongMode) {
14904 checkElementText( 12776 checkElementText(library, r'''
14905 library,
14906 r'''
14907 final int x; 12777 final int x;
14908 '''); 12778 ''');
14909 } else { 12779 } else {
14910 checkElementText( 12780 checkElementText(library, r'''
14911 library,
14912 r'''
14913 final int x; 12781 final int x;
14914 '''); 12782 ''');
14915 } 12783 }
14916 } 12784 }
14917 12785
14918 test_variable_final_top_level_untyped() async { 12786 test_variable_final_top_level_untyped() async {
14919 var library = await checkLibrary('final v = 0;'); 12787 var library = await checkLibrary('final v = 0;');
14920 if (isStrongMode) { 12788 if (isStrongMode) {
14921 checkElementText( 12789 checkElementText(library, r'''
14922 library,
14923 r'''
14924 final int v; 12790 final int v;
14925 '''); 12791 ''');
14926 } else { 12792 } else {
14927 checkElementText( 12793 checkElementText(library, r'''
14928 library,
14929 r'''
14930 final dynamic v; 12794 final dynamic v;
14931 '''); 12795 ''');
14932 } 12796 }
14933 } 12797 }
14934 12798
14935 test_variable_getterInLib_setterInPart() async { 12799 test_variable_getterInLib_setterInPart() async {
14936 addSource( 12800 addSource('/a.dart', '''
14937 '/a.dart',
14938 '''
14939 part of my.lib; 12801 part of my.lib;
14940 void set x(int _) {} 12802 void set x(int _) {}
14941 '''); 12803 ''');
14942 var library = await checkLibrary(''' 12804 var library = await checkLibrary('''
14943 library my.lib; 12805 library my.lib;
14944 part 'a.dart'; 12806 part 'a.dart';
14945 int get x => 42;'''); 12807 int get x => 42;''');
14946 if (isStrongMode) { 12808 if (isStrongMode) {
14947 checkElementText( 12809 checkElementText(library, r'''
14948 library,
14949 r'''
14950 library my.lib; 12810 library my.lib;
14951 part 'a.dart'; 12811 part 'a.dart';
14952 int get x {} 12812 int get x {}
14953 -------------------- 12813 --------------------
14954 unit: a.dart 12814 unit: a.dart
14955 12815
14956 void set x(int _) {} 12816 void set x(int _) {}
14957 '''); 12817 ''');
14958 } else { 12818 } else {
14959 checkElementText( 12819 checkElementText(library, r'''
14960 library,
14961 r'''
14962 library my.lib; 12820 library my.lib;
14963 part 'a.dart'; 12821 part 'a.dart';
14964 int get x {} 12822 int get x {}
14965 -------------------- 12823 --------------------
14966 unit: a.dart 12824 unit: a.dart
14967 12825
14968 void set x(int _) {} 12826 void set x(int _) {}
14969 '''); 12827 ''');
14970 } 12828 }
14971 } 12829 }
14972 12830
14973 test_variable_getterInPart_setterInLib() async { 12831 test_variable_getterInPart_setterInLib() async {
14974 addSource( 12832 addSource('/a.dart', '''
14975 '/a.dart',
14976 '''
14977 part of my.lib; 12833 part of my.lib;
14978 int get x => 42; 12834 int get x => 42;
14979 '''); 12835 ''');
14980 var library = await checkLibrary(''' 12836 var library = await checkLibrary('''
14981 library my.lib; 12837 library my.lib;
14982 part 'a.dart'; 12838 part 'a.dart';
14983 void set x(int _) {} 12839 void set x(int _) {}
14984 '''); 12840 ''');
14985 if (isStrongMode) { 12841 if (isStrongMode) {
14986 checkElementText( 12842 checkElementText(library, r'''
14987 library,
14988 r'''
14989 library my.lib; 12843 library my.lib;
14990 part 'a.dart'; 12844 part 'a.dart';
14991 void set x(int _) {} 12845 void set x(int _) {}
14992 -------------------- 12846 --------------------
14993 unit: a.dart 12847 unit: a.dart
14994 12848
14995 int get x {} 12849 int get x {}
14996 '''); 12850 ''');
14997 } else { 12851 } else {
14998 checkElementText( 12852 checkElementText(library, r'''
14999 library,
15000 r'''
15001 library my.lib; 12853 library my.lib;
15002 part 'a.dart'; 12854 part 'a.dart';
15003 void set x(int _) {} 12855 void set x(int _) {}
15004 -------------------- 12856 --------------------
15005 unit: a.dart 12857 unit: a.dart
15006 12858
15007 int get x {} 12859 int get x {}
15008 '''); 12860 ''');
15009 } 12861 }
15010 } 12862 }
15011 12863
15012 test_variable_getterInPart_setterInPart() async { 12864 test_variable_getterInPart_setterInPart() async {
15013 addSource('/a.dart', 'part of my.lib; int get x => 42;'); 12865 addSource('/a.dart', 'part of my.lib; int get x => 42;');
15014 addSource('/b.dart', 'part of my.lib; void set x(int _) {}'); 12866 addSource('/b.dart', 'part of my.lib; void set x(int _) {}');
15015 var library = 12867 var library =
15016 await checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); 12868 await checkLibrary('library my.lib; part "a.dart"; part "b.dart";');
15017 if (isStrongMode) { 12869 if (isStrongMode) {
15018 checkElementText( 12870 checkElementText(library, r'''
15019 library,
15020 r'''
15021 library my.lib; 12871 library my.lib;
15022 part 'a.dart'; 12872 part 'a.dart';
15023 part 'b.dart'; 12873 part 'b.dart';
15024 -------------------- 12874 --------------------
15025 unit: a.dart 12875 unit: a.dart
15026 12876
15027 int get x {} 12877 int get x {}
15028 -------------------- 12878 --------------------
15029 unit: b.dart 12879 unit: b.dart
15030 12880
15031 void set x(int _) {} 12881 void set x(int _) {}
15032 '''); 12882 ''');
15033 } else { 12883 } else {
15034 checkElementText( 12884 checkElementText(library, r'''
15035 library,
15036 r'''
15037 library my.lib; 12885 library my.lib;
15038 part 'a.dart'; 12886 part 'a.dart';
15039 part 'b.dart'; 12887 part 'b.dart';
15040 -------------------- 12888 --------------------
15041 unit: a.dart 12889 unit: a.dart
15042 12890
15043 int get x {} 12891 int get x {}
15044 -------------------- 12892 --------------------
15045 unit: b.dart 12893 unit: b.dart
15046 12894
15047 void set x(int _) {} 12895 void set x(int _) {}
15048 '''); 12896 ''');
15049 } 12897 }
15050 } 12898 }
15051 12899
15052 test_variable_implicit_type() async { 12900 test_variable_implicit_type() async {
15053 var library = await checkLibrary('var x;'); 12901 var library = await checkLibrary('var x;');
15054 if (isStrongMode) { 12902 if (isStrongMode) {
15055 checkElementText( 12903 checkElementText(library, r'''
15056 library,
15057 r'''
15058 dynamic x; 12904 dynamic x;
15059 '''); 12905 ''');
15060 } else { 12906 } else {
15061 checkElementText( 12907 checkElementText(library, r'''
15062 library,
15063 r'''
15064 dynamic x; 12908 dynamic x;
15065 '''); 12909 ''');
15066 } 12910 }
15067 } 12911 }
15068 12912
15069 test_variable_inferred_type_implicit_initialized() async { 12913 test_variable_inferred_type_implicit_initialized() async {
15070 var library = await checkLibrary('var v = 0;'); 12914 var library = await checkLibrary('var v = 0;');
15071 if (isStrongMode) { 12915 if (isStrongMode) {
15072 checkElementText( 12916 checkElementText(library, r'''
15073 library,
15074 r'''
15075 int v; 12917 int v;
15076 '''); 12918 ''');
15077 } else { 12919 } else {
15078 checkElementText( 12920 checkElementText(library, r'''
15079 library,
15080 r'''
15081 dynamic v; 12921 dynamic v;
15082 '''); 12922 ''');
15083 } 12923 }
15084 } 12924 }
15085 12925
15086 test_variable_propagatedType_const_noDep() async { 12926 test_variable_propagatedType_const_noDep() async {
15087 var library = await checkLibrary('const i = 0;'); 12927 var library = await checkLibrary('const i = 0;');
15088 if (isStrongMode) { 12928 if (isStrongMode) {
15089 checkElementText( 12929 checkElementText(library, r'''
15090 library,
15091 r'''
15092 const int i = 0; 12930 const int i = 0;
15093 '''); 12931 ''');
15094 } else { 12932 } else {
15095 checkElementText( 12933 checkElementText(library, r'''
15096 library,
15097 r'''
15098 const dynamic i = 0; 12934 const dynamic i = 0;
15099 '''); 12935 ''');
15100 } 12936 }
15101 } 12937 }
15102 12938
15103 test_variable_propagatedType_final_dep_inLib() async { 12939 test_variable_propagatedType_final_dep_inLib() async {
15104 addLibrarySource('/a.dart', 'final a = 1;'); 12940 addLibrarySource('/a.dart', 'final a = 1;');
15105 var library = await checkLibrary('import "a.dart"; final b = a / 2;'); 12941 var library = await checkLibrary('import "a.dart"; final b = a / 2;');
15106 if (isStrongMode) { 12942 if (isStrongMode) {
15107 checkElementText( 12943 checkElementText(library, r'''
15108 library,
15109 r'''
15110 import 'a.dart'; 12944 import 'a.dart';
15111 final double b; 12945 final double b;
15112 '''); 12946 ''');
15113 } else { 12947 } else {
15114 checkElementText( 12948 checkElementText(library, r'''
15115 library,
15116 r'''
15117 import 'a.dart'; 12949 import 'a.dart';
15118 final dynamic b; 12950 final dynamic b;
15119 '''); 12951 ''');
15120 } 12952 }
15121 } 12953 }
15122 12954
15123 test_variable_propagatedType_final_dep_inPart() async { 12955 test_variable_propagatedType_final_dep_inPart() async {
15124 addSource('/a.dart', 'part of lib; final a = 1;'); 12956 addSource('/a.dart', 'part of lib; final a = 1;');
15125 var library = 12957 var library =
15126 await checkLibrary('library lib; part "a.dart"; final b = a / 2;'); 12958 await checkLibrary('library lib; part "a.dart"; final b = a / 2;');
15127 if (isStrongMode) { 12959 if (isStrongMode) {
15128 checkElementText( 12960 checkElementText(library, r'''
15129 library,
15130 r'''
15131 library lib; 12961 library lib;
15132 part 'a.dart'; 12962 part 'a.dart';
15133 final double b; 12963 final double b;
15134 -------------------- 12964 --------------------
15135 unit: a.dart 12965 unit: a.dart
15136 12966
15137 final int a; 12967 final int a;
15138 '''); 12968 ''');
15139 } else { 12969 } else {
15140 checkElementText( 12970 checkElementText(library, r'''
15141 library,
15142 r'''
15143 library lib; 12971 library lib;
15144 part 'a.dart'; 12972 part 'a.dart';
15145 final dynamic b; 12973 final dynamic b;
15146 -------------------- 12974 --------------------
15147 unit: a.dart 12975 unit: a.dart
15148 12976
15149 final dynamic a; 12977 final dynamic a;
15150 '''); 12978 ''');
15151 } 12979 }
15152 } 12980 }
15153 12981
15154 test_variable_propagatedType_final_noDep() async { 12982 test_variable_propagatedType_final_noDep() async {
15155 var library = await checkLibrary('final i = 0;'); 12983 var library = await checkLibrary('final i = 0;');
15156 if (isStrongMode) { 12984 if (isStrongMode) {
15157 checkElementText( 12985 checkElementText(library, r'''
15158 library,
15159 r'''
15160 final int i; 12986 final int i;
15161 '''); 12987 ''');
15162 } else { 12988 } else {
15163 checkElementText( 12989 checkElementText(library, r'''
15164 library,
15165 r'''
15166 final dynamic i; 12990 final dynamic i;
15167 '''); 12991 ''');
15168 } 12992 }
15169 } 12993 }
15170 12994
15171 test_variable_propagatedType_implicit_dep() async { 12995 test_variable_propagatedType_implicit_dep() async {
15172 // The propagated type is defined in a library that is not imported. 12996 // The propagated type is defined in a library that is not imported.
15173 addLibrarySource('/a.dart', 'class C {}'); 12997 addLibrarySource('/a.dart', 'class C {}');
15174 addLibrarySource('/b.dart', 'import "a.dart"; C f() => null;'); 12998 addLibrarySource('/b.dart', 'import "a.dart"; C f() => null;');
15175 var library = await checkLibrary('import "b.dart"; final x = f();'); 12999 var library = await checkLibrary('import "b.dart"; final x = f();');
15176 if (isStrongMode) { 13000 if (isStrongMode) {
15177 checkElementText( 13001 checkElementText(library, r'''
15178 library,
15179 r'''
15180 import 'b.dart'; 13002 import 'b.dart';
15181 final C x; 13003 final C x;
15182 '''); 13004 ''');
15183 } else { 13005 } else {
15184 checkElementText( 13006 checkElementText(library, r'''
15185 library,
15186 r'''
15187 import 'b.dart'; 13007 import 'b.dart';
15188 final dynamic x; 13008 final dynamic x;
15189 '''); 13009 ''');
15190 } 13010 }
15191 } 13011 }
15192 13012
15193 test_variable_setterInPart_getterInPart() async { 13013 test_variable_setterInPart_getterInPart() async {
15194 addSource('/a.dart', 'part of my.lib; void set x(int _) {}'); 13014 addSource('/a.dart', 'part of my.lib; void set x(int _) {}');
15195 addSource('/b.dart', 'part of my.lib; int get x => 42;'); 13015 addSource('/b.dart', 'part of my.lib; int get x => 42;');
15196 var library = 13016 var library =
15197 await checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); 13017 await checkLibrary('library my.lib; part "a.dart"; part "b.dart";');
15198 if (isStrongMode) { 13018 if (isStrongMode) {
15199 checkElementText( 13019 checkElementText(library, r'''
15200 library,
15201 r'''
15202 library my.lib; 13020 library my.lib;
15203 part 'a.dart'; 13021 part 'a.dart';
15204 part 'b.dart'; 13022 part 'b.dart';
15205 -------------------- 13023 --------------------
15206 unit: a.dart 13024 unit: a.dart
15207 13025
15208 void set x(int _) {} 13026 void set x(int _) {}
15209 -------------------- 13027 --------------------
15210 unit: b.dart 13028 unit: b.dart
15211 13029
15212 int get x {} 13030 int get x {}
15213 '''); 13031 ''');
15214 } else { 13032 } else {
15215 checkElementText( 13033 checkElementText(library, r'''
15216 library,
15217 r'''
15218 library my.lib; 13034 library my.lib;
15219 part 'a.dart'; 13035 part 'a.dart';
15220 part 'b.dart'; 13036 part 'b.dart';
15221 -------------------- 13037 --------------------
15222 unit: a.dart 13038 unit: a.dart
15223 13039
15224 void set x(int _) {} 13040 void set x(int _) {}
15225 -------------------- 13041 --------------------
15226 unit: b.dart 13042 unit: b.dart
15227 13043
15228 int get x {} 13044 int get x {}
15229 '''); 13045 ''');
15230 } 13046 }
15231 } 13047 }
15232 13048
15233 test_variables() async { 13049 test_variables() async {
15234 var library = await checkLibrary('int i; int j;'); 13050 var library = await checkLibrary('int i; int j;');
15235 if (isStrongMode) { 13051 if (isStrongMode) {
15236 checkElementText( 13052 checkElementText(library, r'''
15237 library,
15238 r'''
15239 int i; 13053 int i;
15240 int j; 13054 int j;
15241 '''); 13055 ''');
15242 } else { 13056 } else {
15243 checkElementText( 13057 checkElementText(library, r'''
15244 library,
15245 r'''
15246 int i; 13058 int i;
15247 int j; 13059 int j;
15248 '''); 13060 ''');
15249 } 13061 }
15250 } 13062 }
15251 13063
15252 /** 13064 /**
15253 * Encode the library containing [original] into a summary and then use 13065 * Encode the library containing [original] into a summary and then use
15254 * [TestSummaryResynthesizer.getElement] to retrieve just the original 13066 * [TestSummaryResynthesizer.getElement] to retrieve just the original
15255 * element from the resynthesized summary. 13067 * element from the resynthesized summary.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
15312 fail('Unexpectedly tried to get unlinked summary for $uri'); 13124 fail('Unexpectedly tried to get unlinked summary for $uri');
15313 } 13125 }
15314 return serializedUnit; 13126 return serializedUnit;
15315 } 13127 }
15316 13128
15317 @override 13129 @override
15318 bool hasLibrarySummary(String uri) { 13130 bool hasLibrarySummary(String uri) {
15319 return true; 13131 return true;
15320 } 13132 }
15321 } 13133 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/linker_test.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698