Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 9 import 'package:analyzer/dart/constant/value.dart'; | 9 import 'package:analyzer/dart/constant/value.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
| 23 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; | 23 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; |
| 24 import 'package:analyzer/src/summary/idl.dart'; | 24 import 'package:analyzer/src/summary/idl.dart'; |
| 25 import 'package:analyzer/src/summary/resynthesize.dart'; | 25 import 'package:analyzer/src/summary/resynthesize.dart'; |
| 26 import 'package:test/test.dart'; | 26 import 'package:test/test.dart'; |
| 27 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 27 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 28 | 28 |
| 29 import '../../generated/test_support.dart'; | 29 import '../../generated/test_support.dart'; |
| 30 import '../abstract_single_unit.dart'; | 30 import '../abstract_single_unit.dart'; |
| 31 import '../context/abstract_context.dart'; | 31 import '../context/abstract_context.dart'; |
| 32 import 'element_text.dart'; | |
| 32 | 33 |
| 33 /** | 34 /** |
| 34 * Abstract base class for resynthesizing and comparing elements. | 35 * Abstract base class for resynthesizing and comparing elements. |
| 35 */ | 36 */ |
| 36 abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest { | 37 abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest { |
| 37 Set<Source> otherLibrarySources = new Set<Source>(); | 38 Set<Source> otherLibrarySources = new Set<Source>(); |
| 38 | 39 |
| 39 /** | 40 /** |
| 40 * Names of variables which have initializers that are not valid constants, | 41 * Names of variables which have initializers that are not valid constants, |
| 41 * so they are not resynthesized. | 42 * so they are not resynthesized. |
| 42 */ | 43 */ |
| 43 Set<String> variablesWithNotConstInitializers = new Set<String>(); | 44 Set<String> variablesWithNotConstInitializers = new Set<String>(); |
| 44 | 45 |
| 45 /** | 46 /** |
| 46 * Names that cannot be resolved, e.g. because of duplicate declaration. | 47 * Names that cannot be resolved, e.g. because of duplicate declaration. |
| 47 */ | 48 */ |
| 48 Set<String> namesThatCannotBeResolved = new Set<String>(); | 49 Set<String> namesThatCannotBeResolved = new Set<String>(); |
| 49 | 50 |
| 50 /** | 51 /** |
| 51 * Tests may set this to `true` to indicate that a missing file at the time of | 52 * Tests may set this to `true` to indicate that a missing file at the time of |
| 52 * summary resynthesis shouldn't trigger an error. | 53 * summary resynthesis shouldn't trigger an error. |
| 53 */ | 54 */ |
| 54 bool allowMissingFiles = false; | 55 bool allowMissingFiles = false; |
| 55 | 56 |
| 57 /** | |
| 58 * Return `true` if resynthesizing should be done is strong mode. | |
| 59 */ | |
| 60 bool get isStrongMode; | |
| 61 | |
| 56 void addLibrary(String uri) { | 62 void addLibrary(String uri) { |
| 57 otherLibrarySources.add(context.sourceFactory.forUri(uri)); | 63 otherLibrarySources.add(context.sourceFactory.forUri(uri)); |
| 58 } | 64 } |
| 59 | 65 |
| 60 Source addLibrarySource(String filePath, String contents) { | 66 Source addLibrarySource(String filePath, String contents) { |
| 61 Source source = addSource(filePath, contents); | 67 Source source = addSource(filePath, contents); |
| 62 otherLibrarySources.add(source); | 68 otherLibrarySources.add(source); |
| 63 return source; | 69 return source; |
| 64 } | 70 } |
| 65 | 71 |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1309 abstract class ResynthesizeTest extends AbstractResynthesizeTest { | 1315 abstract class ResynthesizeTest extends AbstractResynthesizeTest { |
| 1310 LibraryElementImpl checkLibrary(String text, | 1316 LibraryElementImpl checkLibrary(String text, |
| 1311 {bool allowErrors: false, bool dumpSummaries: false}); | 1317 {bool allowErrors: false, bool dumpSummaries: false}); |
| 1312 | 1318 |
| 1313 /** | 1319 /** |
| 1314 * Return a [SummaryResynthesizer] to resynthesize the library with the | 1320 * Return a [SummaryResynthesizer] to resynthesize the library with the |
| 1315 * given [librarySource]. | 1321 * given [librarySource]. |
| 1316 */ | 1322 */ |
| 1317 SummaryResynthesizer encodeDecodeLibrarySource(Source librarySource); | 1323 SummaryResynthesizer encodeDecodeLibrarySource(Source librarySource); |
| 1318 | 1324 |
| 1319 fail_library_hasExtUri() { | 1325 fail_library_hasExtUri() { |
|
Brian Wilkerson
2017/03/03 16:09:33
We might want to break this file up into smaller p
| |
| 1320 checkLibrary('import "dart-ext:doesNotExist.dart";'); | 1326 var library = checkLibrary('import "dart-ext:doesNotExist.dart";'); |
| 1327 if (isStrongMode) { | |
| 1328 checkElementText( | |
| 1329 library, | |
| 1330 r''' | |
| 1331 '''); | |
| 1332 } else { | |
| 1333 checkElementText( | |
| 1334 library, | |
| 1335 r''' | |
| 1336 '''); | |
| 1337 } | |
| 1321 } | 1338 } |
| 1322 | 1339 |
| 1323 test_class_abstract() { | 1340 test_class_abstract() { |
| 1324 checkLibrary('abstract class C {}'); | 1341 var library = checkLibrary('abstract class C {}'); |
| 1342 if (isStrongMode) { | |
| 1343 checkElementText( | |
| 1344 library, | |
| 1345 r''' | |
| 1346 abstract class C { | |
| 1347 } | |
| 1348 '''); | |
| 1349 } else { | |
| 1350 checkElementText( | |
| 1351 library, | |
| 1352 r''' | |
| 1353 abstract class C { | |
| 1354 } | |
| 1355 '''); | |
| 1356 } | |
| 1325 } | 1357 } |
| 1326 | 1358 |
| 1327 test_class_alias() { | 1359 test_class_alias() { |
| 1328 checkLibrary('class C = D with E, F; class D {} class E {} class F {}'); | 1360 var library = |
| 1361 checkLibrary('class C = D with E, F; class D {} class E {} class F {}'); | |
| 1362 if (isStrongMode) { | |
| 1363 checkElementText( | |
| 1364 library, | |
| 1365 r''' | |
| 1366 class C extends D with E, F { | |
| 1367 synthetic C(); | |
| 1368 } | |
| 1369 class D { | |
| 1370 } | |
| 1371 class E { | |
| 1372 } | |
| 1373 class F { | |
| 1374 } | |
| 1375 '''); | |
| 1376 } else { | |
| 1377 checkElementText( | |
| 1378 library, | |
| 1379 r''' | |
| 1380 class C extends D with E, F { | |
| 1381 synthetic C(); | |
| 1382 } | |
| 1383 class D { | |
| 1384 } | |
| 1385 class E { | |
| 1386 } | |
| 1387 class F { | |
| 1388 } | |
| 1389 '''); | |
| 1390 } | |
| 1329 } | 1391 } |
| 1330 | 1392 |
| 1331 test_class_alias_abstract() { | 1393 test_class_alias_abstract() { |
| 1332 checkLibrary('abstract class C = D with E; class D {} class E {}'); | 1394 var library = |
| 1395 checkLibrary('abstract class C = D with E; class D {} class E {}'); | |
| 1396 if (isStrongMode) { | |
| 1397 checkElementText( | |
| 1398 library, | |
| 1399 r''' | |
| 1400 abstract class C extends D with E { | |
| 1401 synthetic C(); | |
| 1402 } | |
| 1403 class D { | |
| 1404 } | |
| 1405 class E { | |
| 1406 } | |
| 1407 '''); | |
| 1408 } else { | |
| 1409 checkElementText( | |
| 1410 library, | |
| 1411 r''' | |
| 1412 abstract class C extends D with E { | |
| 1413 synthetic C(); | |
| 1414 } | |
| 1415 class D { | |
| 1416 } | |
| 1417 class E { | |
| 1418 } | |
| 1419 '''); | |
| 1420 } | |
| 1333 } | 1421 } |
| 1334 | 1422 |
| 1335 test_class_alias_documented() { | 1423 test_class_alias_documented() { |
| 1336 checkLibrary(''' | 1424 var library = checkLibrary(''' |
| 1337 // Extra comment so doc comment offset != 0 | 1425 // Extra comment so doc comment offset != 0 |
| 1338 /** | 1426 /** |
| 1339 * Docs | 1427 * Docs |
| 1340 */ | 1428 */ |
| 1341 class C = D with E; | 1429 class C = D with E; |
| 1342 | 1430 |
| 1343 class D {} | 1431 class D {} |
| 1344 class E {}'''); | 1432 class E {}'''); |
| 1433 if (isStrongMode) { | |
| 1434 checkElementText( | |
| 1435 library, | |
| 1436 r''' | |
| 1437 class C extends D with E { | |
| 1438 synthetic C(); | |
| 1439 } | |
| 1440 class D { | |
| 1441 } | |
| 1442 class E { | |
| 1443 } | |
| 1444 '''); | |
| 1445 } else { | |
| 1446 checkElementText( | |
| 1447 library, | |
| 1448 r''' | |
| 1449 class C extends D with E { | |
| 1450 synthetic C(); | |
| 1451 } | |
| 1452 class D { | |
| 1453 } | |
| 1454 class E { | |
| 1455 } | |
| 1456 '''); | |
| 1457 } | |
| 1345 } | 1458 } |
| 1346 | 1459 |
| 1347 test_class_alias_with_forwarding_constructors() { | 1460 test_class_alias_with_forwarding_constructors() { |
| 1348 addLibrarySource( | 1461 addLibrarySource( |
| 1349 '/a.dart', | 1462 '/a.dart', |
| 1350 ''' | 1463 ''' |
| 1351 class Base { | 1464 class Base { |
| 1352 Base._priv(); | 1465 Base._priv(); |
| 1353 Base(); | 1466 Base(); |
| 1354 Base.noArgs(); | 1467 Base.noArgs(); |
| 1355 Base.requiredArg(x); | 1468 Base.requiredArg(x); |
| 1356 Base.positionalArg([x]); | 1469 Base.positionalArg([x]); |
| 1357 Base.namedArg({x}); | 1470 Base.namedArg({x}); |
| 1358 factory Base.fact() => null; | 1471 factory Base.fact() => null; |
| 1359 factory Base.fact2() = Base.noArgs; | 1472 factory Base.fact2() = Base.noArgs; |
| 1360 } | 1473 } |
| 1361 '''); | 1474 '''); |
| 1362 checkLibrary(''' | 1475 var library = checkLibrary(''' |
| 1363 import "a.dart"; | 1476 import "a.dart"; |
| 1364 class M {} | 1477 class M {} |
| 1365 class MixinApp = Base with M; | 1478 class MixinApp = Base with M; |
| 1366 '''); | 1479 '''); |
| 1480 if (isStrongMode) { | |
| 1481 checkElementText( | |
| 1482 library, | |
| 1483 r''' | |
| 1484 import 'a.dart'; | |
| 1485 class M { | |
| 1486 } | |
| 1487 class MixinApp extends Base with M { | |
| 1488 synthetic MixinApp._priv(); | |
| 1489 synthetic MixinApp(); | |
| 1490 synthetic MixinApp.noArgs(); | |
| 1491 synthetic MixinApp.requiredArg(x); | |
| 1492 synthetic MixinApp.fact(); | |
| 1493 synthetic MixinApp.fact2(); | |
| 1494 } | |
| 1495 '''); | |
| 1496 } else { | |
| 1497 checkElementText( | |
| 1498 library, | |
| 1499 r''' | |
| 1500 import 'a.dart'; | |
| 1501 class M { | |
| 1502 } | |
| 1503 class MixinApp extends Base with M { | |
| 1504 synthetic MixinApp._priv(); | |
| 1505 synthetic MixinApp(); | |
| 1506 synthetic MixinApp.noArgs(); | |
| 1507 synthetic MixinApp.requiredArg(x); | |
| 1508 synthetic MixinApp.fact(); | |
| 1509 synthetic MixinApp.fact2(); | |
| 1510 } | |
| 1511 '''); | |
| 1512 } | |
| 1367 } | 1513 } |
| 1368 | 1514 |
| 1369 test_class_alias_with_forwarding_constructors_type_substitution() { | 1515 test_class_alias_with_forwarding_constructors_type_substitution() { |
| 1370 checkLibrary(''' | 1516 var library = checkLibrary(''' |
| 1371 class Base<T> { | 1517 class Base<T> { |
| 1372 Base.ctor(T t, List<T> l); | 1518 Base.ctor(T t, List<T> l); |
| 1373 } | 1519 } |
| 1374 class M {} | 1520 class M {} |
| 1375 class MixinApp = Base with M; | 1521 class MixinApp = Base with M; |
| 1376 '''); | 1522 '''); |
| 1523 if (isStrongMode) { | |
| 1524 checkElementText( | |
| 1525 library, | |
| 1526 r''' | |
| 1527 class Base<T> { | |
| 1528 Base.ctor(T t, List<T> l); | |
| 1529 } | |
| 1530 class M { | |
| 1531 } | |
| 1532 class MixinApp extends Base with M { | |
| 1533 synthetic MixinApp.ctor(t, List l); | |
| 1534 } | |
| 1535 '''); | |
| 1536 } else { | |
| 1537 checkElementText( | |
| 1538 library, | |
| 1539 r''' | |
| 1540 class Base<T> { | |
| 1541 Base.ctor(T t, List<T> l); | |
| 1542 } | |
| 1543 class M { | |
| 1544 } | |
| 1545 class MixinApp extends Base with M { | |
| 1546 synthetic MixinApp.ctor(t, List l); | |
| 1547 } | |
| 1548 '''); | |
| 1549 } | |
| 1377 } | 1550 } |
| 1378 | 1551 |
| 1379 test_class_alias_with_forwarding_constructors_type_substitution_complex() { | 1552 test_class_alias_with_forwarding_constructors_type_substitution_complex() { |
| 1380 checkLibrary(''' | 1553 var library = checkLibrary(''' |
| 1381 class Base<T> { | 1554 class Base<T> { |
| 1382 Base.ctor(T t, List<T> l); | 1555 Base.ctor(T t, List<T> l); |
| 1383 } | 1556 } |
| 1384 class M {} | 1557 class M {} |
| 1385 class MixinApp<U> = Base<List<U>> with M; | 1558 class MixinApp<U> = Base<List<U>> with M; |
| 1386 '''); | 1559 '''); |
| 1560 if (isStrongMode) { | |
| 1561 checkElementText( | |
| 1562 library, | |
| 1563 r''' | |
| 1564 class Base<T> { | |
| 1565 Base.ctor(T t, List<T> l); | |
| 1566 } | |
| 1567 class M { | |
| 1568 } | |
| 1569 class MixinApp<U> extends Base<List<U>> with M { | |
| 1570 synthetic MixinApp.ctor(List<U> t, List<List<U>> l); | |
| 1571 } | |
| 1572 '''); | |
| 1573 } else { | |
| 1574 checkElementText( | |
| 1575 library, | |
| 1576 r''' | |
| 1577 class Base<T> { | |
| 1578 Base.ctor(T t, List<T> l); | |
| 1579 } | |
| 1580 class M { | |
| 1581 } | |
| 1582 class MixinApp<U> extends Base<List<U>> with M { | |
| 1583 synthetic MixinApp.ctor(List<U> t, List<List<U>> l); | |
| 1584 } | |
| 1585 '''); | |
| 1586 } | |
| 1387 } | 1587 } |
| 1388 | 1588 |
| 1389 test_class_alias_with_mixin_members() { | 1589 test_class_alias_with_mixin_members() { |
| 1390 checkLibrary(''' | 1590 var library = checkLibrary(''' |
| 1391 class C = D with E; | 1591 class C = D with E; |
| 1392 class D {} | 1592 class D {} |
| 1393 class E { | 1593 class E { |
| 1394 int get a => null; | 1594 int get a => null; |
| 1395 void set b(int i) {} | 1595 void set b(int i) {} |
| 1396 void f() {} | 1596 void f() {} |
| 1397 int x; | 1597 int x; |
| 1398 }'''); | 1598 }'''); |
| 1599 if (isStrongMode) { | |
| 1600 checkElementText( | |
| 1601 library, | |
| 1602 r''' | |
| 1603 class C extends D with E { | |
| 1604 synthetic C(); | |
| 1605 } | |
| 1606 class D { | |
| 1607 } | |
| 1608 class E { | |
| 1609 int x; | |
| 1610 int get a {} | |
| 1611 void set b(int i) {} | |
| 1612 void f() {} | |
| 1613 } | |
| 1614 '''); | |
| 1615 } else { | |
| 1616 checkElementText( | |
| 1617 library, | |
| 1618 r''' | |
| 1619 class C extends D with E { | |
| 1620 synthetic C(); | |
| 1621 } | |
| 1622 class D { | |
| 1623 } | |
| 1624 class E { | |
| 1625 int x; | |
| 1626 int get a {} | |
| 1627 void set b(int i) {} | |
| 1628 void f() {} | |
| 1629 } | |
| 1630 '''); | |
| 1631 } | |
| 1399 } | 1632 } |
| 1400 | 1633 |
| 1401 test_class_constructor_const() { | 1634 test_class_constructor_const() { |
| 1402 checkLibrary('class C { const C(); }'); | 1635 var library = checkLibrary('class C { const C(); }'); |
| 1636 if (isStrongMode) { | |
| 1637 checkElementText( | |
| 1638 library, | |
| 1639 r''' | |
| 1640 class C { | |
| 1641 C(); | |
| 1642 } | |
| 1643 '''); | |
| 1644 } else { | |
| 1645 checkElementText( | |
| 1646 library, | |
| 1647 r''' | |
| 1648 class C { | |
| 1649 C(); | |
| 1650 } | |
| 1651 '''); | |
| 1652 } | |
| 1403 } | 1653 } |
| 1404 | 1654 |
| 1405 test_class_constructor_const_external() { | 1655 test_class_constructor_const_external() { |
| 1406 checkLibrary('class C { external const C(); }'); | 1656 var library = checkLibrary('class C { external const C(); }'); |
| 1657 if (isStrongMode) { | |
| 1658 checkElementText( | |
| 1659 library, | |
| 1660 r''' | |
| 1661 class C { | |
| 1662 C(); | |
| 1663 } | |
| 1664 '''); | |
| 1665 } else { | |
| 1666 checkElementText( | |
| 1667 library, | |
| 1668 r''' | |
| 1669 class C { | |
| 1670 C(); | |
| 1671 } | |
| 1672 '''); | |
| 1673 } | |
| 1407 } | 1674 } |
| 1408 | 1675 |
| 1409 test_class_constructor_explicit_named() { | 1676 test_class_constructor_explicit_named() { |
| 1410 checkLibrary('class C { C.foo(); }'); | 1677 var library = checkLibrary('class C { C.foo(); }'); |
| 1678 if (isStrongMode) { | |
| 1679 checkElementText( | |
| 1680 library, | |
| 1681 r''' | |
| 1682 class C { | |
| 1683 C.foo(); | |
| 1684 } | |
| 1685 '''); | |
| 1686 } else { | |
| 1687 checkElementText( | |
| 1688 library, | |
| 1689 r''' | |
| 1690 class C { | |
| 1691 C.foo(); | |
| 1692 } | |
| 1693 '''); | |
| 1694 } | |
| 1411 } | 1695 } |
| 1412 | 1696 |
| 1413 test_class_constructor_explicit_type_params() { | 1697 test_class_constructor_explicit_type_params() { |
| 1414 checkLibrary('class C<T, U> { C(); }'); | 1698 var library = checkLibrary('class C<T, U> { C(); }'); |
| 1699 if (isStrongMode) { | |
| 1700 checkElementText( | |
| 1701 library, | |
| 1702 r''' | |
| 1703 class C<T, U> { | |
| 1704 C(); | |
| 1705 } | |
| 1706 '''); | |
| 1707 } else { | |
| 1708 checkElementText( | |
| 1709 library, | |
| 1710 r''' | |
| 1711 class C<T, U> { | |
| 1712 C(); | |
| 1713 } | |
| 1714 '''); | |
| 1715 } | |
| 1415 } | 1716 } |
| 1416 | 1717 |
| 1417 test_class_constructor_explicit_unnamed() { | 1718 test_class_constructor_explicit_unnamed() { |
| 1418 checkLibrary('class C { C(); }'); | 1719 var library = checkLibrary('class C { C(); }'); |
| 1720 if (isStrongMode) { | |
| 1721 checkElementText( | |
| 1722 library, | |
| 1723 r''' | |
| 1724 class C { | |
| 1725 C(); | |
| 1726 } | |
| 1727 '''); | |
| 1728 } else { | |
| 1729 checkElementText( | |
| 1730 library, | |
| 1731 r''' | |
| 1732 class C { | |
| 1733 C(); | |
| 1734 } | |
| 1735 '''); | |
| 1736 } | |
| 1419 } | 1737 } |
| 1420 | 1738 |
| 1421 test_class_constructor_external() { | 1739 test_class_constructor_external() { |
| 1422 checkLibrary('class C { external C(); }'); | 1740 var library = checkLibrary('class C { external C(); }'); |
| 1741 if (isStrongMode) { | |
| 1742 checkElementText( | |
| 1743 library, | |
| 1744 r''' | |
| 1745 class C { | |
| 1746 C(); | |
| 1747 } | |
| 1748 '''); | |
| 1749 } else { | |
| 1750 checkElementText( | |
| 1751 library, | |
| 1752 r''' | |
| 1753 class C { | |
| 1754 C(); | |
| 1755 } | |
| 1756 '''); | |
| 1757 } | |
| 1423 } | 1758 } |
| 1424 | 1759 |
| 1425 test_class_constructor_factory() { | 1760 test_class_constructor_factory() { |
| 1426 checkLibrary('class C { factory C() => null; }'); | 1761 var library = checkLibrary('class C { factory C() => null; }'); |
| 1762 if (isStrongMode) { | |
| 1763 checkElementText( | |
| 1764 library, | |
| 1765 r''' | |
| 1766 class C { | |
| 1767 C(); | |
| 1768 } | |
| 1769 '''); | |
| 1770 } else { | |
| 1771 checkElementText( | |
| 1772 library, | |
| 1773 r''' | |
| 1774 class C { | |
| 1775 C(); | |
| 1776 } | |
| 1777 '''); | |
| 1778 } | |
| 1427 } | 1779 } |
| 1428 | 1780 |
| 1429 test_class_constructor_field_formal_dynamic_dynamic() { | 1781 test_class_constructor_field_formal_dynamic_dynamic() { |
| 1430 checkLibrary('class C { dynamic x; C(dynamic this.x); }'); | 1782 var library = checkLibrary('class C { dynamic x; C(dynamic this.x); }'); |
| 1783 if (isStrongMode) { | |
| 1784 checkElementText( | |
| 1785 library, | |
| 1786 r''' | |
| 1787 class C { | |
| 1788 var x; | |
| 1789 C(this.x); | |
| 1790 } | |
| 1791 '''); | |
| 1792 } else { | |
| 1793 checkElementText( | |
| 1794 library, | |
| 1795 r''' | |
| 1796 class C { | |
| 1797 var x; | |
| 1798 C(this.x); | |
| 1799 } | |
| 1800 '''); | |
| 1801 } | |
| 1431 } | 1802 } |
| 1432 | 1803 |
| 1433 test_class_constructor_field_formal_dynamic_typed() { | 1804 test_class_constructor_field_formal_dynamic_typed() { |
| 1434 checkLibrary('class C { dynamic x; C(int this.x); }'); | 1805 var library = checkLibrary('class C { dynamic x; C(int this.x); }'); |
| 1806 if (isStrongMode) { | |
| 1807 checkElementText( | |
| 1808 library, | |
| 1809 r''' | |
| 1810 class C { | |
| 1811 var x; | |
| 1812 C(int this.x); | |
| 1813 } | |
| 1814 '''); | |
| 1815 } else { | |
| 1816 checkElementText( | |
| 1817 library, | |
| 1818 r''' | |
| 1819 class C { | |
| 1820 var x; | |
| 1821 C(int this.x); | |
| 1822 } | |
| 1823 '''); | |
| 1824 } | |
| 1435 } | 1825 } |
| 1436 | 1826 |
| 1437 test_class_constructor_field_formal_dynamic_untyped() { | 1827 test_class_constructor_field_formal_dynamic_untyped() { |
| 1438 checkLibrary('class C { dynamic x; C(this.x); }'); | 1828 var library = checkLibrary('class C { dynamic x; C(this.x); }'); |
| 1829 if (isStrongMode) { | |
| 1830 checkElementText( | |
| 1831 library, | |
| 1832 r''' | |
| 1833 class C { | |
| 1834 var x; | |
| 1835 C(this.x); | |
| 1836 } | |
| 1837 '''); | |
| 1838 } else { | |
| 1839 checkElementText( | |
| 1840 library, | |
| 1841 r''' | |
| 1842 class C { | |
| 1843 var x; | |
| 1844 C(this.x); | |
| 1845 } | |
| 1846 '''); | |
| 1847 } | |
| 1439 } | 1848 } |
| 1440 | 1849 |
| 1441 test_class_constructor_field_formal_multiple_matching_fields() { | 1850 test_class_constructor_field_formal_multiple_matching_fields() { |
| 1442 // This is a compile-time error but it should still analyze consistently. | 1851 // This is a compile-time error but it should still analyze consistently. |
| 1443 checkLibrary('class C { C(this.x); int x; String x; }', allowErrors: true); | 1852 var library = checkLibrary('class C { C(this.x); int x; String x; }', |
| 1853 allowErrors: true); | |
| 1854 if (isStrongMode) { | |
| 1855 checkElementText( | |
| 1856 library, | |
| 1857 r''' | |
| 1858 class C { | |
| 1859 int x; | |
| 1860 String x; | |
| 1861 C(int this.x); | |
| 1862 } | |
| 1863 '''); | |
| 1864 } else { | |
| 1865 checkElementText( | |
| 1866 library, | |
| 1867 r''' | |
| 1868 class C { | |
| 1869 int x; | |
| 1870 String x; | |
| 1871 C(int this.x); | |
| 1872 } | |
| 1873 '''); | |
| 1874 } | |
| 1444 } | 1875 } |
| 1445 | 1876 |
| 1446 test_class_constructor_field_formal_no_matching_field() { | 1877 test_class_constructor_field_formal_no_matching_field() { |
| 1447 // This is a compile-time error but it should still analyze consistently. | 1878 // This is a compile-time error but it should still analyze consistently. |
| 1448 checkLibrary('class C { C(this.x); }', allowErrors: true); | 1879 var library = checkLibrary('class C { C(this.x); }', allowErrors: true); |
| 1880 if (isStrongMode) { | |
| 1881 checkElementText( | |
| 1882 library, | |
| 1883 r''' | |
| 1884 class C { | |
| 1885 C(this.x); | |
| 1886 } | |
| 1887 '''); | |
| 1888 } else { | |
| 1889 checkElementText( | |
| 1890 library, | |
| 1891 r''' | |
| 1892 class C { | |
| 1893 C(this.x); | |
| 1894 } | |
| 1895 '''); | |
| 1896 } | |
| 1449 } | 1897 } |
| 1450 | 1898 |
| 1451 test_class_constructor_field_formal_typed_dynamic() { | 1899 test_class_constructor_field_formal_typed_dynamic() { |
| 1452 checkLibrary('class C { num x; C(dynamic this.x); }', allowErrors: true); | 1900 var library = checkLibrary('class C { num x; C(dynamic this.x); }', |
| 1901 allowErrors: true); | |
| 1902 if (isStrongMode) { | |
| 1903 checkElementText( | |
| 1904 library, | |
| 1905 r''' | |
| 1906 class C { | |
| 1907 num x; | |
| 1908 C(this.x); | |
| 1909 } | |
| 1910 '''); | |
| 1911 } else { | |
| 1912 checkElementText( | |
| 1913 library, | |
| 1914 r''' | |
| 1915 class C { | |
| 1916 num x; | |
| 1917 C(this.x); | |
| 1918 } | |
| 1919 '''); | |
| 1920 } | |
| 1453 } | 1921 } |
| 1454 | 1922 |
| 1455 test_class_constructor_field_formal_typed_typed() { | 1923 test_class_constructor_field_formal_typed_typed() { |
| 1456 checkLibrary('class C { num x; C(int this.x); }'); | 1924 var library = checkLibrary('class C { num x; C(int this.x); }'); |
| 1925 if (isStrongMode) { | |
| 1926 checkElementText( | |
| 1927 library, | |
| 1928 r''' | |
| 1929 class C { | |
| 1930 num x; | |
| 1931 C(int this.x); | |
| 1932 } | |
| 1933 '''); | |
| 1934 } else { | |
| 1935 checkElementText( | |
| 1936 library, | |
| 1937 r''' | |
| 1938 class C { | |
| 1939 num x; | |
| 1940 C(int this.x); | |
| 1941 } | |
| 1942 '''); | |
| 1943 } | |
| 1457 } | 1944 } |
| 1458 | 1945 |
| 1459 test_class_constructor_field_formal_typed_untyped() { | 1946 test_class_constructor_field_formal_typed_untyped() { |
| 1460 checkLibrary('class C { num x; C(this.x); }'); | 1947 var library = checkLibrary('class C { num x; C(this.x); }'); |
| 1948 if (isStrongMode) { | |
| 1949 checkElementText( | |
| 1950 library, | |
| 1951 r''' | |
| 1952 class C { | |
| 1953 num x; | |
| 1954 C(num this.x); | |
| 1955 } | |
| 1956 '''); | |
| 1957 } else { | |
| 1958 checkElementText( | |
| 1959 library, | |
| 1960 r''' | |
| 1961 class C { | |
| 1962 num x; | |
| 1963 C(num this.x); | |
| 1964 } | |
| 1965 '''); | |
| 1966 } | |
| 1461 } | 1967 } |
| 1462 | 1968 |
| 1463 test_class_constructor_field_formal_untyped_dynamic() { | 1969 test_class_constructor_field_formal_untyped_dynamic() { |
| 1464 checkLibrary('class C { var x; C(dynamic this.x); }'); | 1970 var library = checkLibrary('class C { var x; C(dynamic this.x); }'); |
| 1971 if (isStrongMode) { | |
| 1972 checkElementText( | |
| 1973 library, | |
| 1974 r''' | |
| 1975 class C { | |
| 1976 var x; | |
| 1977 C(this.x); | |
| 1978 } | |
| 1979 '''); | |
| 1980 } else { | |
| 1981 checkElementText( | |
| 1982 library, | |
| 1983 r''' | |
| 1984 class C { | |
| 1985 var x; | |
| 1986 C(this.x); | |
| 1987 } | |
| 1988 '''); | |
| 1989 } | |
| 1465 } | 1990 } |
| 1466 | 1991 |
| 1467 test_class_constructor_field_formal_untyped_typed() { | 1992 test_class_constructor_field_formal_untyped_typed() { |
| 1468 checkLibrary('class C { var x; C(int this.x); }'); | 1993 var library = checkLibrary('class C { var x; C(int this.x); }'); |
| 1994 if (isStrongMode) { | |
| 1995 checkElementText( | |
| 1996 library, | |
| 1997 r''' | |
| 1998 class C { | |
| 1999 var x; | |
| 2000 C(int this.x); | |
| 2001 } | |
| 2002 '''); | |
| 2003 } else { | |
| 2004 checkElementText( | |
| 2005 library, | |
| 2006 r''' | |
| 2007 class C { | |
| 2008 var x; | |
| 2009 C(int this.x); | |
| 2010 } | |
| 2011 '''); | |
| 2012 } | |
| 1469 } | 2013 } |
| 1470 | 2014 |
| 1471 test_class_constructor_field_formal_untyped_untyped() { | 2015 test_class_constructor_field_formal_untyped_untyped() { |
| 1472 checkLibrary('class C { var x; C(this.x); }'); | 2016 var library = checkLibrary('class C { var x; C(this.x); }'); |
| 2017 if (isStrongMode) { | |
| 2018 checkElementText( | |
| 2019 library, | |
| 2020 r''' | |
| 2021 class C { | |
| 2022 var x; | |
| 2023 C(this.x); | |
| 2024 } | |
| 2025 '''); | |
| 2026 } else { | |
| 2027 checkElementText( | |
| 2028 library, | |
| 2029 r''' | |
| 2030 class C { | |
| 2031 var x; | |
| 2032 C(this.x); | |
| 2033 } | |
| 2034 '''); | |
| 2035 } | |
| 1473 } | 2036 } |
| 1474 | 2037 |
| 1475 test_class_constructor_fieldFormal_named_noDefault() { | 2038 test_class_constructor_fieldFormal_named_noDefault() { |
| 1476 checkLibrary('class C { int x; C({this.x}); }'); | 2039 var library = checkLibrary('class C { int x; C({this.x}); }'); |
| 2040 if (isStrongMode) { | |
| 2041 checkElementText( | |
| 2042 library, | |
| 2043 r''' | |
| 2044 class C { | |
| 2045 int x; | |
| 2046 C({int this.x}); | |
| 2047 } | |
| 2048 '''); | |
| 2049 } else { | |
| 2050 checkElementText( | |
| 2051 library, | |
| 2052 r''' | |
| 2053 class C { | |
| 2054 int x; | |
| 2055 C({int this.x}); | |
| 2056 } | |
| 2057 '''); | |
| 2058 } | |
| 1477 } | 2059 } |
| 1478 | 2060 |
| 1479 test_class_constructor_fieldFormal_named_withDefault() { | 2061 test_class_constructor_fieldFormal_named_withDefault() { |
| 1480 checkLibrary('class C { int x; C({this.x: 42}); }'); | 2062 var library = checkLibrary('class C { int x; C({this.x: 42}); }'); |
| 2063 if (isStrongMode) { | |
| 2064 checkElementText( | |
| 2065 library, | |
| 2066 r''' | |
| 2067 class C { | |
| 2068 int x; | |
| 2069 C({int this.x}); | |
| 2070 } | |
| 2071 '''); | |
| 2072 } else { | |
| 2073 checkElementText( | |
| 2074 library, | |
| 2075 r''' | |
| 2076 class C { | |
| 2077 int x; | |
| 2078 C({int this.x}); | |
| 2079 } | |
| 2080 '''); | |
| 2081 } | |
| 1481 } | 2082 } |
| 1482 | 2083 |
| 1483 test_class_constructor_fieldFormal_optional_noDefault() { | 2084 test_class_constructor_fieldFormal_optional_noDefault() { |
| 1484 checkLibrary('class C { int x; C([this.x]); }'); | 2085 var library = checkLibrary('class C { int x; C([this.x]); }'); |
| 2086 if (isStrongMode) { | |
| 2087 checkElementText( | |
| 2088 library, | |
| 2089 r''' | |
| 2090 class C { | |
| 2091 int x; | |
| 2092 C([int this.x]); | |
| 2093 } | |
| 2094 '''); | |
| 2095 } else { | |
| 2096 checkElementText( | |
| 2097 library, | |
| 2098 r''' | |
| 2099 class C { | |
| 2100 int x; | |
| 2101 C([int this.x]); | |
| 2102 } | |
| 2103 '''); | |
| 2104 } | |
| 1485 } | 2105 } |
| 1486 | 2106 |
| 1487 test_class_constructor_fieldFormal_optional_withDefault() { | 2107 test_class_constructor_fieldFormal_optional_withDefault() { |
| 1488 checkLibrary('class C { int x; C([this.x = 42]); }'); | 2108 var library = checkLibrary('class C { int x; C([this.x = 42]); }'); |
| 2109 if (isStrongMode) { | |
| 2110 checkElementText( | |
| 2111 library, | |
| 2112 r''' | |
| 2113 class C { | |
| 2114 int x; | |
| 2115 C([int this.x]); | |
| 2116 } | |
| 2117 '''); | |
| 2118 } else { | |
| 2119 checkElementText( | |
| 2120 library, | |
| 2121 r''' | |
| 2122 class C { | |
| 2123 int x; | |
| 2124 C([int this.x]); | |
| 2125 } | |
| 2126 '''); | |
| 2127 } | |
| 1489 } | 2128 } |
| 1490 | 2129 |
| 1491 test_class_constructor_implicit() { | 2130 test_class_constructor_implicit() { |
| 1492 checkLibrary('class C {}'); | 2131 var library = checkLibrary('class C {}'); |
| 2132 if (isStrongMode) { | |
| 2133 checkElementText( | |
| 2134 library, | |
| 2135 r''' | |
| 2136 class C { | |
| 2137 } | |
| 2138 '''); | |
| 2139 } else { | |
| 2140 checkElementText( | |
| 2141 library, | |
| 2142 r''' | |
| 2143 class C { | |
| 2144 } | |
| 2145 '''); | |
| 2146 } | |
| 1493 } | 2147 } |
| 1494 | 2148 |
| 1495 test_class_constructor_implicit_type_params() { | 2149 test_class_constructor_implicit_type_params() { |
| 1496 checkLibrary('class C<T, U> {}'); | 2150 var library = checkLibrary('class C<T, U> {}'); |
| 2151 if (isStrongMode) { | |
| 2152 checkElementText( | |
| 2153 library, | |
| 2154 r''' | |
| 2155 class C<T, U> { | |
| 2156 } | |
| 2157 '''); | |
| 2158 } else { | |
| 2159 checkElementText( | |
| 2160 library, | |
| 2161 r''' | |
| 2162 class C<T, U> { | |
| 2163 } | |
| 2164 '''); | |
| 2165 } | |
| 1497 } | 2166 } |
| 1498 | 2167 |
| 1499 test_class_constructor_params() { | 2168 test_class_constructor_params() { |
| 1500 checkLibrary('class C { C(x, y); }'); | 2169 var library = checkLibrary('class C { C(x, int y); }'); |
| 2170 if (isStrongMode) { | |
| 2171 checkElementText( | |
| 2172 library, | |
| 2173 r''' | |
| 2174 class C { | |
| 2175 C(x, int y); | |
| 2176 } | |
| 2177 '''); | |
| 2178 } else { | |
| 2179 checkElementText( | |
| 2180 library, | |
| 2181 r''' | |
| 2182 class C { | |
| 2183 C(x, int y); | |
| 2184 } | |
| 2185 '''); | |
| 2186 } | |
| 1501 } | 2187 } |
| 1502 | 2188 |
| 1503 test_class_constructors() { | 2189 test_class_constructors() { |
| 1504 checkLibrary('class C { C.foo(); C.bar(); }'); | 2190 var library = checkLibrary('class C { C.foo(); C.bar(); }'); |
| 2191 if (isStrongMode) { | |
| 2192 checkElementText( | |
| 2193 library, | |
| 2194 r''' | |
| 2195 class C { | |
| 2196 C.foo(); | |
| 2197 C.bar(); | |
| 2198 } | |
| 2199 '''); | |
| 2200 } else { | |
| 2201 checkElementText( | |
| 2202 library, | |
| 2203 r''' | |
| 2204 class C { | |
| 2205 C.foo(); | |
| 2206 C.bar(); | |
| 2207 } | |
| 2208 '''); | |
| 2209 } | |
| 1505 } | 2210 } |
| 1506 | 2211 |
| 1507 test_class_documented() { | 2212 test_class_documented() { |
| 1508 checkLibrary(''' | 2213 var library = checkLibrary(''' |
| 1509 // Extra comment so doc comment offset != 0 | 2214 // Extra comment so doc comment offset != 0 |
| 1510 /** | 2215 /** |
| 1511 * Docs | 2216 * Docs |
| 1512 */ | 2217 */ |
| 1513 class C {}'''); | 2218 class C {}'''); |
| 2219 if (isStrongMode) { | |
| 2220 checkElementText( | |
| 2221 library, | |
| 2222 r''' | |
| 2223 class C { | |
| 2224 } | |
| 2225 '''); | |
| 2226 } else { | |
| 2227 checkElementText( | |
| 2228 library, | |
| 2229 r''' | |
| 2230 class C { | |
| 2231 } | |
| 2232 '''); | |
| 2233 } | |
| 1514 } | 2234 } |
| 1515 | 2235 |
| 1516 test_class_documented_tripleSlash() { | 2236 test_class_documented_tripleSlash() { |
| 1517 checkLibrary(''' | 2237 var library = checkLibrary(''' |
| 1518 /// aaa | 2238 /// aaa |
| 1519 /// bbbb | 2239 /// bbbb |
| 1520 /// cc | 2240 /// cc |
| 1521 class C {}'''); | 2241 class C {}'''); |
| 2242 if (isStrongMode) { | |
| 2243 checkElementText( | |
| 2244 library, | |
| 2245 r''' | |
| 2246 class C { | |
| 2247 } | |
| 2248 '''); | |
| 2249 } else { | |
| 2250 checkElementText( | |
| 2251 library, | |
| 2252 r''' | |
| 2253 class C { | |
| 2254 } | |
| 2255 '''); | |
| 2256 } | |
| 1522 } | 2257 } |
| 1523 | 2258 |
| 1524 test_class_documented_with_references() { | 2259 test_class_documented_with_references() { |
| 1525 checkLibrary(''' | 2260 var library = checkLibrary(''' |
| 1526 /** | 2261 /** |
| 1527 * Docs referring to [D] and [E] | 2262 * Docs referring to [D] and [E] |
| 1528 */ | 2263 */ |
| 1529 class C {} | 2264 class C {} |
| 1530 | 2265 |
| 1531 class D {} | 2266 class D {} |
| 1532 class E {}'''); | 2267 class E {}'''); |
| 2268 if (isStrongMode) { | |
| 2269 checkElementText( | |
| 2270 library, | |
| 2271 r''' | |
| 2272 class C { | |
| 2273 } | |
| 2274 class D { | |
| 2275 } | |
| 2276 class E { | |
| 2277 } | |
| 2278 '''); | |
| 2279 } else { | |
| 2280 checkElementText( | |
| 2281 library, | |
| 2282 r''' | |
| 2283 class C { | |
| 2284 } | |
| 2285 class D { | |
| 2286 } | |
| 2287 class E { | |
| 2288 } | |
| 2289 '''); | |
| 2290 } | |
| 1533 } | 2291 } |
| 1534 | 2292 |
| 1535 test_class_documented_with_windows_line_endings() { | 2293 test_class_documented_with_windows_line_endings() { |
| 1536 checkLibrary('/**\r\n * Docs\r\n */\r\nclass C {}'); | 2294 var library = checkLibrary('/**\r\n * Docs\r\n */\r\nclass C {}'); |
| 2295 if (isStrongMode) { | |
| 2296 checkElementText( | |
| 2297 library, | |
| 2298 r''' | |
| 2299 class C { | |
| 2300 } | |
| 2301 '''); | |
| 2302 } else { | |
| 2303 checkElementText( | |
| 2304 library, | |
| 2305 r''' | |
| 2306 class C { | |
| 2307 } | |
| 2308 '''); | |
| 2309 } | |
| 1537 } | 2310 } |
| 1538 | 2311 |
| 1539 test_class_field_const() { | 2312 test_class_field_const() { |
| 1540 checkLibrary('class C { static const int i = 0; }'); | 2313 var library = checkLibrary('class C { static const int i = 0; }'); |
| 2314 if (isStrongMode) { | |
| 2315 checkElementText( | |
| 2316 library, | |
| 2317 r''' | |
| 2318 class C { | |
| 2319 static const int i; | |
| 2320 } | |
| 2321 '''); | |
| 2322 } else { | |
| 2323 checkElementText( | |
| 2324 library, | |
| 2325 r''' | |
| 2326 class C { | |
| 2327 static const int i; | |
| 2328 } | |
| 2329 '''); | |
| 2330 } | |
| 1541 } | 2331 } |
| 1542 | 2332 |
| 1543 test_class_field_implicit_type() { | 2333 test_class_field_implicit_type() { |
| 1544 checkLibrary('class C { var x; }'); | 2334 var library = checkLibrary('class C { var x; }'); |
| 2335 if (isStrongMode) { | |
| 2336 checkElementText( | |
| 2337 library, | |
| 2338 r''' | |
| 2339 class C { | |
| 2340 var x; | |
| 2341 } | |
| 2342 '''); | |
| 2343 } else { | |
| 2344 checkElementText( | |
| 2345 library, | |
| 2346 r''' | |
| 2347 class C { | |
| 2348 var x; | |
| 2349 } | |
| 2350 '''); | |
| 2351 } | |
| 1545 } | 2352 } |
| 1546 | 2353 |
| 1547 test_class_field_static() { | 2354 test_class_field_static() { |
| 1548 checkLibrary('class C { static int i; }'); | 2355 var library = checkLibrary('class C { static int i; }'); |
| 2356 if (isStrongMode) { | |
| 2357 checkElementText( | |
| 2358 library, | |
| 2359 r''' | |
| 2360 class C { | |
| 2361 static int i; | |
| 2362 } | |
| 2363 '''); | |
| 2364 } else { | |
| 2365 checkElementText( | |
| 2366 library, | |
| 2367 r''' | |
| 2368 class C { | |
| 2369 static int i; | |
| 2370 } | |
| 2371 '''); | |
| 2372 } | |
| 1549 } | 2373 } |
| 1550 | 2374 |
| 1551 test_class_fields() { | 2375 test_class_fields() { |
| 1552 checkLibrary('class C { int i; int j; }'); | 2376 var library = checkLibrary('class C { int i; int j; }'); |
| 2377 if (isStrongMode) { | |
| 2378 checkElementText( | |
| 2379 library, | |
| 2380 r''' | |
| 2381 class C { | |
| 2382 int i; | |
| 2383 int j; | |
| 2384 } | |
| 2385 '''); | |
| 2386 } else { | |
| 2387 checkElementText( | |
| 2388 library, | |
| 2389 r''' | |
| 2390 class C { | |
| 2391 int i; | |
| 2392 int j; | |
| 2393 } | |
| 2394 '''); | |
| 2395 } | |
| 1553 } | 2396 } |
| 1554 | 2397 |
| 1555 test_class_getter_abstract() { | 2398 test_class_getter_abstract() { |
| 1556 checkLibrary('abstract class C { int get x; }'); | 2399 var library = checkLibrary('abstract class C { int get x; }'); |
| 2400 if (isStrongMode) { | |
| 2401 checkElementText( | |
| 2402 library, | |
| 2403 r''' | |
| 2404 abstract class C { | |
| 2405 int get x; | |
| 2406 } | |
| 2407 '''); | |
| 2408 } else { | |
| 2409 checkElementText( | |
| 2410 library, | |
| 2411 r''' | |
| 2412 abstract class C { | |
| 2413 int get x; | |
| 2414 } | |
| 2415 '''); | |
| 2416 } | |
| 1557 } | 2417 } |
| 1558 | 2418 |
| 1559 test_class_getter_external() { | 2419 test_class_getter_external() { |
| 1560 checkLibrary('class C { external int get x; }'); | 2420 var library = checkLibrary('class C { external int get x; }'); |
| 2421 if (isStrongMode) { | |
| 2422 checkElementText( | |
| 2423 library, | |
| 2424 r''' | |
| 2425 class C { | |
| 2426 external int get x {} | |
| 2427 } | |
| 2428 '''); | |
| 2429 } else { | |
| 2430 checkElementText( | |
| 2431 library, | |
| 2432 r''' | |
| 2433 class C { | |
| 2434 external int get x {} | |
| 2435 } | |
| 2436 '''); | |
| 2437 } | |
| 1561 } | 2438 } |
| 1562 | 2439 |
| 1563 test_class_getter_implicit_return_type() { | 2440 test_class_getter_implicit_return_type() { |
| 1564 checkLibrary('class C { get x => null; }'); | 2441 var library = checkLibrary('class C { get x => null; }'); |
| 2442 if (isStrongMode) { | |
| 2443 checkElementText( | |
| 2444 library, | |
| 2445 r''' | |
| 2446 class C { | |
| 2447 get x {} | |
| 2448 } | |
| 2449 '''); | |
| 2450 } else { | |
| 2451 checkElementText( | |
| 2452 library, | |
| 2453 r''' | |
| 2454 class C { | |
| 2455 get x {} | |
| 2456 } | |
| 2457 '''); | |
| 2458 } | |
| 1565 } | 2459 } |
| 1566 | 2460 |
| 1567 test_class_getter_static() { | 2461 test_class_getter_static() { |
| 1568 checkLibrary('class C { static int get x => null; }'); | 2462 var library = checkLibrary('class C { static int get x => null; }'); |
| 2463 if (isStrongMode) { | |
| 2464 checkElementText( | |
| 2465 library, | |
| 2466 r''' | |
| 2467 class C { | |
| 2468 static int get x {} | |
| 2469 } | |
| 2470 '''); | |
| 2471 } else { | |
| 2472 checkElementText( | |
| 2473 library, | |
| 2474 r''' | |
| 2475 class C { | |
| 2476 static int get x {} | |
| 2477 } | |
| 2478 '''); | |
| 2479 } | |
| 1569 } | 2480 } |
| 1570 | 2481 |
| 1571 test_class_getters() { | 2482 test_class_getters() { |
| 1572 checkLibrary('class C { int get x => null; get y => null; }'); | 2483 var library = checkLibrary('class C { int get x => null; get y => null; }'); |
| 2484 if (isStrongMode) { | |
| 2485 checkElementText( | |
| 2486 library, | |
| 2487 r''' | |
| 2488 class C { | |
| 2489 int get x {} | |
| 2490 get y {} | |
| 2491 } | |
| 2492 '''); | |
| 2493 } else { | |
| 2494 checkElementText( | |
| 2495 library, | |
| 2496 r''' | |
| 2497 class C { | |
| 2498 int get x {} | |
| 2499 get y {} | |
| 2500 } | |
| 2501 '''); | |
| 2502 } | |
| 1573 } | 2503 } |
| 1574 | 2504 |
| 1575 test_class_implicitField_getterFirst() { | 2505 test_class_implicitField_getterFirst() { |
| 1576 checkLibrary('class C { int get x => 0; void set x(int value) {} }'); | 2506 var library = |
| 2507 checkLibrary('class C { int get x => 0; void set x(int value) {} }'); | |
| 2508 if (isStrongMode) { | |
| 2509 checkElementText( | |
| 2510 library, | |
| 2511 r''' | |
| 2512 class C { | |
| 2513 int get x {} | |
| 2514 void set x(int value) {} | |
| 2515 } | |
| 2516 '''); | |
| 2517 } else { | |
| 2518 checkElementText( | |
| 2519 library, | |
| 2520 r''' | |
| 2521 class C { | |
| 2522 int get x {} | |
| 2523 void set x(int value) {} | |
| 2524 } | |
| 2525 '''); | |
| 2526 } | |
| 1577 } | 2527 } |
| 1578 | 2528 |
| 1579 test_class_implicitField_setterFirst() { | 2529 test_class_implicitField_setterFirst() { |
| 1580 checkLibrary('class C { void set x(int value) {} int get x => 0; }'); | 2530 var library = |
| 2531 checkLibrary('class C { void set x(int value) {} int get x => 0; }'); | |
| 2532 if (isStrongMode) { | |
| 2533 checkElementText( | |
| 2534 library, | |
| 2535 r''' | |
| 2536 class C { | |
| 2537 void set x(int value) {} | |
| 2538 int get x {} | |
| 2539 } | |
| 2540 '''); | |
| 2541 } else { | |
| 2542 checkElementText( | |
| 2543 library, | |
| 2544 r''' | |
| 2545 class C { | |
| 2546 void set x(int value) {} | |
| 2547 int get x {} | |
| 2548 } | |
| 2549 '''); | |
| 2550 } | |
| 1581 } | 2551 } |
| 1582 | 2552 |
| 1583 test_class_interfaces() { | 2553 test_class_interfaces() { |
| 1584 checkLibrary('class C implements D, E {} class D {} class E {}'); | 2554 var library = |
| 2555 checkLibrary('class C implements D, E {} class D {} class E {}'); | |
| 2556 if (isStrongMode) { | |
| 2557 checkElementText( | |
| 2558 library, | |
| 2559 r''' | |
| 2560 class C implements D, E { | |
| 2561 } | |
| 2562 class D { | |
| 2563 } | |
| 2564 class E { | |
| 2565 } | |
| 2566 '''); | |
| 2567 } else { | |
| 2568 checkElementText( | |
| 2569 library, | |
| 2570 r''' | |
| 2571 class C implements D, E { | |
| 2572 } | |
| 2573 class D { | |
| 2574 } | |
| 2575 class E { | |
| 2576 } | |
| 2577 '''); | |
| 2578 } | |
| 1585 } | 2579 } |
| 1586 | 2580 |
| 1587 test_class_interfaces_unresolved() { | 2581 test_class_interfaces_unresolved() { |
| 1588 checkLibrary('class C implements X, Y, Z {} class X {} class Z {}', | 2582 var library = checkLibrary( |
| 2583 'class C implements X, Y, Z {} class X {} class Z {}', | |
| 1589 allowErrors: true); | 2584 allowErrors: true); |
| 2585 if (isStrongMode) { | |
| 2586 checkElementText( | |
| 2587 library, | |
| 2588 r''' | |
| 2589 class C implements X, Z { | |
| 2590 } | |
| 2591 class X { | |
| 2592 } | |
| 2593 class Z { | |
| 2594 } | |
| 2595 '''); | |
| 2596 } else { | |
| 2597 checkElementText( | |
| 2598 library, | |
| 2599 r''' | |
| 2600 class C implements X, Z { | |
| 2601 } | |
| 2602 class X { | |
| 2603 } | |
| 2604 class Z { | |
| 2605 } | |
| 2606 '''); | |
| 2607 } | |
| 1590 } | 2608 } |
| 1591 | 2609 |
| 1592 test_class_method_abstract() { | 2610 test_class_method_abstract() { |
| 1593 checkLibrary('abstract class C { f(); }'); | 2611 var library = checkLibrary('abstract class C { f(); }'); |
| 2612 if (isStrongMode) { | |
| 2613 checkElementText( | |
| 2614 library, | |
| 2615 r''' | |
| 2616 abstract class C { | |
| 2617 f(); | |
| 2618 } | |
| 2619 '''); | |
| 2620 } else { | |
| 2621 checkElementText( | |
| 2622 library, | |
| 2623 r''' | |
| 2624 abstract class C { | |
| 2625 f(); | |
| 2626 } | |
| 2627 '''); | |
| 2628 } | |
| 1594 } | 2629 } |
| 1595 | 2630 |
| 1596 test_class_method_external() { | 2631 test_class_method_external() { |
| 1597 checkLibrary('class C { external f(); }'); | 2632 var library = checkLibrary('class C { external f(); }'); |
| 2633 if (isStrongMode) { | |
| 2634 checkElementText( | |
| 2635 library, | |
| 2636 r''' | |
| 2637 class C { | |
| 2638 external f() {} | |
| 2639 } | |
| 2640 '''); | |
| 2641 } else { | |
| 2642 checkElementText( | |
| 2643 library, | |
| 2644 r''' | |
| 2645 class C { | |
| 2646 external f() {} | |
| 2647 } | |
| 2648 '''); | |
| 2649 } | |
| 1598 } | 2650 } |
| 1599 | 2651 |
| 1600 test_class_method_params() { | 2652 test_class_method_params() { |
| 1601 checkLibrary('class C { f(x, y) {} }'); | 2653 var library = checkLibrary('class C { f(x, y) {} }'); |
| 2654 if (isStrongMode) { | |
| 2655 checkElementText( | |
| 2656 library, | |
| 2657 r''' | |
| 2658 class C { | |
| 2659 f(x, y) {} | |
| 2660 } | |
| 2661 '''); | |
| 2662 } else { | |
| 2663 checkElementText( | |
| 2664 library, | |
| 2665 r''' | |
| 2666 class C { | |
| 2667 f(x, y) {} | |
| 2668 } | |
| 2669 '''); | |
| 2670 } | |
| 1602 } | 2671 } |
| 1603 | 2672 |
| 1604 test_class_method_static() { | 2673 test_class_method_static() { |
| 1605 checkLibrary('class C { static f() {} }'); | 2674 var library = checkLibrary('class C { static f() {} }'); |
| 2675 if (isStrongMode) { | |
| 2676 checkElementText( | |
| 2677 library, | |
| 2678 r''' | |
| 2679 class C { | |
| 2680 static f() {} | |
| 2681 } | |
| 2682 '''); | |
| 2683 } else { | |
| 2684 checkElementText( | |
| 2685 library, | |
| 2686 r''' | |
| 2687 class C { | |
| 2688 static f() {} | |
| 2689 } | |
| 2690 '''); | |
| 2691 } | |
| 1606 } | 2692 } |
| 1607 | 2693 |
| 1608 test_class_methods() { | 2694 test_class_methods() { |
| 1609 checkLibrary('class C { f() {} g() {} }'); | 2695 var library = checkLibrary('class C { f() {} g() {} }'); |
| 2696 if (isStrongMode) { | |
| 2697 checkElementText( | |
| 2698 library, | |
| 2699 r''' | |
| 2700 class C { | |
| 2701 f() {} | |
| 2702 g() {} | |
| 2703 } | |
| 2704 '''); | |
| 2705 } else { | |
| 2706 checkElementText( | |
| 2707 library, | |
| 2708 r''' | |
| 2709 class C { | |
| 2710 f() {} | |
| 2711 g() {} | |
| 2712 } | |
| 2713 '''); | |
| 2714 } | |
| 1610 } | 2715 } |
| 1611 | 2716 |
| 1612 test_class_mixins() { | 2717 test_class_mixins() { |
| 1613 checkLibrary('class C extends Object with D, E {} class D {} class E {}'); | 2718 var library = checkLibrary( |
| 2719 'class C extends Object with D, E {} class D {} class E {}'); | |
| 2720 if (isStrongMode) { | |
| 2721 checkElementText( | |
| 2722 library, | |
| 2723 r''' | |
| 2724 class C extends Object with D, E { | |
| 2725 synthetic C(); | |
| 2726 } | |
| 2727 class D { | |
| 2728 } | |
| 2729 class E { | |
| 2730 } | |
| 2731 '''); | |
| 2732 } else { | |
| 2733 checkElementText( | |
| 2734 library, | |
| 2735 r''' | |
| 2736 class C extends Object with D, E { | |
| 2737 synthetic C(); | |
| 2738 } | |
| 2739 class D { | |
| 2740 } | |
| 2741 class E { | |
| 2742 } | |
| 2743 '''); | |
| 2744 } | |
| 1614 } | 2745 } |
| 1615 | 2746 |
| 1616 test_class_mixins_unresolved() { | 2747 test_class_mixins_unresolved() { |
| 1617 checkLibrary('class C extends Object with X, Y, Z; class X {} class Z {}', | 2748 var library = checkLibrary( |
| 2749 'class C extends Object with X, Y, Z; class X {} class Z {}', | |
| 1618 allowErrors: true); | 2750 allowErrors: true); |
| 2751 if (isStrongMode) { | |
| 2752 checkElementText( | |
| 2753 library, | |
| 2754 r''' | |
| 2755 class C extends Object with X, Z { | |
| 2756 synthetic C(); | |
| 2757 } | |
| 2758 class X { | |
| 2759 } | |
| 2760 class Z { | |
| 2761 } | |
| 2762 '''); | |
| 2763 } else { | |
| 2764 checkElementText( | |
| 2765 library, | |
| 2766 r''' | |
| 2767 class C extends Object with X, Z { | |
| 2768 synthetic C(); | |
| 2769 } | |
| 2770 class X { | |
| 2771 } | |
| 2772 class Z { | |
| 2773 } | |
| 2774 '''); | |
| 2775 } | |
| 1619 } | 2776 } |
| 1620 | 2777 |
| 1621 test_class_setter_abstract() { | 2778 test_class_setter_abstract() { |
| 1622 checkLibrary('abstract class C { void set x(int value); }'); | 2779 var library = checkLibrary('abstract class C { void set x(int value); }'); |
| 2780 if (isStrongMode) { | |
| 2781 checkElementText( | |
| 2782 library, | |
| 2783 r''' | |
| 2784 abstract class C { | |
| 2785 void set x(int value); | |
| 2786 } | |
| 2787 '''); | |
| 2788 } else { | |
| 2789 checkElementText( | |
| 2790 library, | |
| 2791 r''' | |
| 2792 abstract class C { | |
| 2793 void set x(int value); | |
| 2794 } | |
| 2795 '''); | |
| 2796 } | |
| 1623 } | 2797 } |
| 1624 | 2798 |
| 1625 test_class_setter_external() { | 2799 test_class_setter_external() { |
| 1626 checkLibrary('class C { external void set x(int value); }'); | 2800 var library = checkLibrary('class C { external void set x(int value); }'); |
| 2801 if (isStrongMode) { | |
| 2802 checkElementText( | |
| 2803 library, | |
| 2804 r''' | |
| 2805 class C { | |
| 2806 external void set x(int value) {} | |
| 2807 } | |
| 2808 '''); | |
| 2809 } else { | |
| 2810 checkElementText( | |
| 2811 library, | |
| 2812 r''' | |
| 2813 class C { | |
| 2814 external void set x(int value) {} | |
| 2815 } | |
| 2816 '''); | |
| 2817 } | |
| 1627 } | 2818 } |
| 1628 | 2819 |
| 1629 test_class_setter_implicit_param_type() { | 2820 test_class_setter_implicit_param_type() { |
| 1630 checkLibrary('class C { void set x(value) {} }'); | 2821 var library = checkLibrary('class C { void set x(value) {} }'); |
| 2822 if (isStrongMode) { | |
| 2823 checkElementText( | |
| 2824 library, | |
| 2825 r''' | |
| 2826 class C { | |
| 2827 void set x(value) {} | |
| 2828 } | |
| 2829 '''); | |
| 2830 } else { | |
| 2831 checkElementText( | |
| 2832 library, | |
| 2833 r''' | |
| 2834 class C { | |
| 2835 void set x(value) {} | |
| 2836 } | |
| 2837 '''); | |
| 2838 } | |
| 1631 } | 2839 } |
| 1632 | 2840 |
| 1633 test_class_setter_implicit_return_type() { | 2841 test_class_setter_implicit_return_type() { |
| 1634 checkLibrary('class C { set x(int value) {} }'); | 2842 var library = checkLibrary('class C { set x(int value) {} }'); |
| 2843 if (isStrongMode) { | |
| 2844 checkElementText( | |
| 2845 library, | |
| 2846 r''' | |
| 2847 class C { | |
| 2848 void set x(int value) {} | |
| 2849 } | |
| 2850 '''); | |
| 2851 } else { | |
| 2852 checkElementText( | |
| 2853 library, | |
| 2854 r''' | |
| 2855 class C { | |
| 2856 set x(int value) {} | |
| 2857 } | |
| 2858 '''); | |
| 2859 } | |
| 1635 } | 2860 } |
| 1636 | 2861 |
| 1637 test_class_setter_invalid_no_parameter() { | 2862 test_class_setter_invalid_no_parameter() { |
| 1638 checkLibrary('class C { void set x() {} }'); | 2863 var library = checkLibrary('class C { void set x() {} }'); |
| 2864 if (isStrongMode) { | |
| 2865 checkElementText( | |
| 2866 library, | |
| 2867 r''' | |
| 2868 class C { | |
| 2869 void set x() {} | |
| 2870 } | |
| 2871 '''); | |
| 2872 } else { | |
| 2873 checkElementText( | |
| 2874 library, | |
| 2875 r''' | |
| 2876 class C { | |
| 2877 void set x() {} | |
| 2878 } | |
| 2879 '''); | |
| 2880 } | |
| 1639 } | 2881 } |
| 1640 | 2882 |
| 1641 test_class_setter_static() { | 2883 test_class_setter_static() { |
| 1642 checkLibrary('class C { static void set x(int value) {} }'); | 2884 var library = checkLibrary('class C { static void set x(int value) {} }'); |
| 2885 if (isStrongMode) { | |
| 2886 checkElementText( | |
| 2887 library, | |
| 2888 r''' | |
| 2889 class C { | |
| 2890 static void set x(int value) {} | |
| 2891 } | |
| 2892 '''); | |
| 2893 } else { | |
| 2894 checkElementText( | |
| 2895 library, | |
| 2896 r''' | |
| 2897 class C { | |
| 2898 static void set x(int value) {} | |
| 2899 } | |
| 2900 '''); | |
| 2901 } | |
| 1643 } | 2902 } |
| 1644 | 2903 |
| 1645 test_class_setters() { | 2904 test_class_setters() { |
| 1646 checkLibrary('class C { void set x(int value) {} set y(value) {} }'); | 2905 var library = |
| 2906 checkLibrary('class C { void set x(int value) {} set y(value) {} }'); | |
| 2907 if (isStrongMode) { | |
| 2908 checkElementText( | |
| 2909 library, | |
| 2910 r''' | |
| 2911 class C { | |
| 2912 void set x(int value) {} | |
| 2913 void set y(value) {} | |
| 2914 } | |
| 2915 '''); | |
| 2916 } else { | |
| 2917 checkElementText( | |
| 2918 library, | |
| 2919 r''' | |
| 2920 class C { | |
| 2921 void set x(int value) {} | |
| 2922 set y(value) {} | |
| 2923 } | |
| 2924 '''); | |
| 2925 } | |
| 1647 } | 2926 } |
| 1648 | 2927 |
| 1649 test_class_supertype() { | 2928 test_class_supertype() { |
| 1650 checkLibrary('class C extends D {} class D {}'); | 2929 var library = checkLibrary('class C extends D {} class D {}'); |
| 2930 if (isStrongMode) { | |
| 2931 checkElementText( | |
| 2932 library, | |
| 2933 r''' | |
| 2934 class C extends D { | |
| 2935 } | |
| 2936 class D { | |
| 2937 } | |
| 2938 '''); | |
| 2939 } else { | |
| 2940 checkElementText( | |
| 2941 library, | |
| 2942 r''' | |
| 2943 class C extends D { | |
| 2944 } | |
| 2945 class D { | |
| 2946 } | |
| 2947 '''); | |
| 2948 } | |
| 1651 } | 2949 } |
| 1652 | 2950 |
| 1653 test_class_supertype_unresolved() { | 2951 test_class_supertype_unresolved() { |
| 1654 checkLibrary('class C extends D {}', allowErrors: true); | 2952 var library = checkLibrary('class C extends D {}', allowErrors: true); |
| 2953 if (isStrongMode) { | |
| 2954 checkElementText( | |
| 2955 library, | |
| 2956 r''' | |
| 2957 class C { | |
| 2958 } | |
| 2959 '''); | |
| 2960 } else { | |
| 2961 checkElementText( | |
| 2962 library, | |
| 2963 r''' | |
| 2964 class C { | |
| 2965 } | |
| 2966 '''); | |
| 2967 } | |
| 1655 } | 2968 } |
| 1656 | 2969 |
| 1657 test_class_type_parameters() { | 2970 test_class_type_parameters() { |
| 1658 checkLibrary('class C<T, U> {}'); | 2971 var library = checkLibrary('class C<T, U> {}'); |
| 2972 if (isStrongMode) { | |
| 2973 checkElementText( | |
| 2974 library, | |
| 2975 r''' | |
| 2976 class C<T, U> { | |
| 2977 } | |
| 2978 '''); | |
| 2979 } else { | |
| 2980 checkElementText( | |
| 2981 library, | |
| 2982 r''' | |
| 2983 class C<T, U> { | |
| 2984 } | |
| 2985 '''); | |
| 2986 } | |
| 1659 } | 2987 } |
| 1660 | 2988 |
| 1661 test_class_type_parameters_bound() { | 2989 test_class_type_parameters_bound() { |
| 1662 checkLibrary('class C<T extends Object, U extends D> {} class D {}'); | 2990 var library = |
| 2991 checkLibrary('class C<T extends Object, U extends D> {} class D {}'); | |
| 2992 if (isStrongMode) { | |
| 2993 checkElementText( | |
| 2994 library, | |
| 2995 r''' | |
| 2996 class C<T extends Object, U extends D> { | |
| 2997 } | |
| 2998 class D { | |
| 2999 } | |
| 3000 '''); | |
| 3001 } else { | |
| 3002 checkElementText( | |
| 3003 library, | |
| 3004 r''' | |
| 3005 class C<T extends Object, U extends D> { | |
| 3006 } | |
| 3007 class D { | |
| 3008 } | |
| 3009 '''); | |
| 3010 } | |
| 1663 } | 3011 } |
| 1664 | 3012 |
| 1665 test_class_type_parameters_f_bound_complex() { | 3013 test_class_type_parameters_f_bound_complex() { |
| 1666 checkLibrary('class C<T extends List<U>, U> {}'); | 3014 var library = checkLibrary('class C<T extends List<U>, U> {}'); |
| 3015 if (isStrongMode) { | |
| 3016 checkElementText( | |
| 3017 library, | |
| 3018 r''' | |
| 3019 class C<T extends List<U>, U> { | |
| 3020 } | |
| 3021 '''); | |
| 3022 } else { | |
| 3023 checkElementText( | |
| 3024 library, | |
| 3025 r''' | |
| 3026 class C<T extends List<U>, U> { | |
| 3027 } | |
| 3028 '''); | |
| 3029 } | |
| 1667 } | 3030 } |
| 1668 | 3031 |
| 1669 test_class_type_parameters_f_bound_simple() { | 3032 test_class_type_parameters_f_bound_simple() { |
| 1670 checkLibrary('class C<T extends U, U> {}'); | 3033 var library = checkLibrary('class C<T extends U, U> {}'); |
| 3034 if (isStrongMode) { | |
| 3035 checkElementText( | |
| 3036 library, | |
| 3037 r''' | |
| 3038 class C<T extends U, U> { | |
| 3039 } | |
| 3040 '''); | |
| 3041 } else { | |
| 3042 checkElementText( | |
| 3043 library, | |
| 3044 r''' | |
| 3045 class C<T extends U, U> { | |
| 3046 } | |
| 3047 '''); | |
| 3048 } | |
| 1671 } | 3049 } |
| 1672 | 3050 |
| 1673 test_classes() { | 3051 test_classes() { |
| 1674 checkLibrary('class C {} class D {}'); | 3052 var library = checkLibrary('class C {} class D {}'); |
| 3053 if (isStrongMode) { | |
| 3054 checkElementText( | |
| 3055 library, | |
| 3056 r''' | |
| 3057 class C { | |
| 3058 } | |
| 3059 class D { | |
| 3060 } | |
| 3061 '''); | |
| 3062 } else { | |
| 3063 checkElementText( | |
| 3064 library, | |
| 3065 r''' | |
| 3066 class C { | |
| 3067 } | |
| 3068 class D { | |
| 3069 } | |
| 3070 '''); | |
| 3071 } | |
| 1675 } | 3072 } |
| 1676 | 3073 |
| 1677 test_closure_executable_with_return_type_from_closure() { | 3074 test_closure_executable_with_return_type_from_closure() { |
| 1678 checkLibrary(''' | 3075 var library = checkLibrary(''' |
| 1679 f() { | 3076 f() { |
| 1680 print(() {}); | 3077 print(() {}); |
| 1681 print(() => () => 0); | 3078 print(() => () => 0); |
| 1682 } | 3079 } |
| 1683 '''); | 3080 '''); |
| 3081 if (isStrongMode) { | |
| 3082 checkElementText( | |
| 3083 library, | |
| 3084 r''' | |
| 3085 f() {} | |
| 3086 '''); | |
| 3087 } else { | |
| 3088 checkElementText( | |
| 3089 library, | |
| 3090 r''' | |
| 3091 f() {} | |
| 3092 '''); | |
| 3093 } | |
| 1684 } | 3094 } |
| 1685 | 3095 |
| 1686 test_closure_generic() { | 3096 test_closure_generic() { |
| 1687 checkLibrary('final f = <U, V>(U x, V y) => y;'); | 3097 var library = checkLibrary('final f = <U, V>(U x, V y) => y;'); |
| 3098 if (isStrongMode) { | |
| 3099 checkElementText( | |
| 3100 library, | |
| 3101 r''' | |
| 3102 final <U,V>(U, V) → V f; | |
| 3103 '''); | |
| 3104 } else { | |
| 3105 checkElementText( | |
| 3106 library, | |
| 3107 r''' | |
| 3108 final f; | |
| 3109 '''); | |
| 3110 } | |
| 1688 } | 3111 } |
| 1689 | 3112 |
| 1690 test_closure_in_variable_declaration_in_part() { | 3113 test_closure_in_variable_declaration_in_part() { |
| 1691 addSource('/a.dart', 'part of lib; final f = (int i) => i.toDouble();'); | 3114 addSource('/a.dart', 'part of lib; final f = (int i) => i.toDouble();'); |
| 1692 checkLibrary(''' | 3115 var library = checkLibrary(''' |
| 1693 library lib; | 3116 library lib; |
| 1694 part "a.dart"; | 3117 part "a.dart"; |
| 1695 '''); | 3118 '''); |
| 3119 if (isStrongMode) { | |
| 3120 checkElementText( | |
| 3121 library, | |
| 3122 r''' | |
| 3123 library lib; | |
| 3124 part 'a.dart'; | |
| 3125 -------------------- | |
| 3126 unit: a.dart | |
| 3127 | |
| 3128 final (int) → double f; | |
| 3129 '''); | |
| 3130 } else { | |
| 3131 checkElementText( | |
| 3132 library, | |
| 3133 r''' | |
| 3134 library lib; | |
| 3135 part 'a.dart'; | |
| 3136 -------------------- | |
| 3137 unit: a.dart | |
| 3138 | |
| 3139 final f; | |
| 3140 '''); | |
| 3141 } | |
| 1696 } | 3142 } |
| 1697 | 3143 |
| 1698 test_const_invalid_field_const() { | 3144 test_const_invalid_field_const() { |
| 1699 variablesWithNotConstInitializers.add('f'); | 3145 variablesWithNotConstInitializers.add('f'); |
| 1700 checkLibrary( | 3146 var library = checkLibrary( |
| 1701 r''' | 3147 r''' |
| 1702 class C { | 3148 class C { |
| 1703 static const f = 1 + foo(); | 3149 static const f = 1 + foo(); |
| 1704 } | 3150 } |
| 1705 int foo() => 42; | 3151 int foo() => 42; |
| 1706 ''', | 3152 ''', |
| 1707 allowErrors: true); | 3153 allowErrors: true); |
| 3154 if (isStrongMode) { | |
| 3155 checkElementText( | |
| 3156 library, | |
| 3157 r''' | |
| 3158 class C { | |
| 3159 static const int f; | |
| 3160 } | |
| 3161 int foo() {} | |
| 3162 '''); | |
| 3163 } else { | |
| 3164 checkElementText( | |
| 3165 library, | |
| 3166 r''' | |
| 3167 class C { | |
| 3168 static const f; | |
| 3169 } | |
| 3170 int foo() {} | |
| 3171 '''); | |
| 3172 } | |
| 1708 } | 3173 } |
| 1709 | 3174 |
| 1710 test_const_invalid_field_final() { | 3175 test_const_invalid_field_final() { |
| 1711 variablesWithNotConstInitializers.add('f'); | 3176 variablesWithNotConstInitializers.add('f'); |
| 1712 checkLibrary( | 3177 var library = checkLibrary( |
| 1713 r''' | 3178 r''' |
| 1714 class C { | 3179 class C { |
| 1715 final f = 1 + foo(); | 3180 final f = 1 + foo(); |
| 1716 } | 3181 } |
| 1717 int foo() => 42; | 3182 int foo() => 42; |
| 1718 ''', | 3183 ''', |
| 1719 allowErrors: true); | 3184 allowErrors: true); |
| 3185 if (isStrongMode) { | |
| 3186 checkElementText( | |
| 3187 library, | |
| 3188 r''' | |
| 3189 class C { | |
| 3190 final int f; | |
| 3191 } | |
| 3192 int foo() {} | |
| 3193 '''); | |
| 3194 } else { | |
| 3195 checkElementText( | |
| 3196 library, | |
| 3197 r''' | |
| 3198 class C { | |
| 3199 final f; | |
| 3200 } | |
| 3201 int foo() {} | |
| 3202 '''); | |
| 3203 } | |
| 1720 } | 3204 } |
| 1721 | 3205 |
| 1722 test_const_invalid_topLevel() { | 3206 test_const_invalid_topLevel() { |
| 1723 variablesWithNotConstInitializers.add('v'); | 3207 variablesWithNotConstInitializers.add('v'); |
| 1724 checkLibrary( | 3208 var library = checkLibrary( |
| 1725 r''' | 3209 r''' |
| 1726 const v = 1 + foo(); | 3210 const v = 1 + foo(); |
| 1727 int foo() => 42; | 3211 int foo() => 42; |
| 1728 ''', | 3212 ''', |
| 1729 allowErrors: true); | 3213 allowErrors: true); |
| 3214 if (isStrongMode) { | |
| 3215 checkElementText( | |
| 3216 library, | |
| 3217 r''' | |
| 3218 const int v; | |
| 3219 int foo() {} | |
| 3220 '''); | |
| 3221 } else { | |
| 3222 checkElementText( | |
| 3223 library, | |
| 3224 r''' | |
| 3225 const v; | |
| 3226 int foo() {} | |
| 3227 '''); | |
| 3228 } | |
| 1730 } | 3229 } |
| 1731 | 3230 |
| 1732 test_const_invokeConstructor_generic_named() { | 3231 test_const_invokeConstructor_generic_named() { |
| 1733 checkLibrary(r''' | 3232 var library = checkLibrary(r''' |
| 1734 class C<K, V> { | 3233 class C<K, V> { |
| 1735 const C.named(K k, V v); | 3234 const C.named(K k, V v); |
| 1736 } | 3235 } |
| 1737 const V = const C<int, String>.named(1, '222'); | 3236 const V = const C<int, String>.named(1, '222'); |
| 1738 '''); | 3237 '''); |
| 3238 if (isStrongMode) { | |
| 3239 checkElementText( | |
| 3240 library, | |
| 3241 r''' | |
| 3242 class C<K, V> { | |
| 3243 C.named(K k, V v); | |
| 3244 } | |
| 3245 const C<int, String> V; | |
| 3246 '''); | |
| 3247 } else { | |
| 3248 checkElementText( | |
| 3249 library, | |
| 3250 r''' | |
| 3251 class C<K, V> { | |
| 3252 C.named(K k, V v); | |
| 3253 } | |
| 3254 const V; | |
| 3255 '''); | |
| 3256 } | |
| 1739 } | 3257 } |
| 1740 | 3258 |
| 1741 test_const_invokeConstructor_generic_named_imported() { | 3259 test_const_invokeConstructor_generic_named_imported() { |
| 1742 addLibrarySource( | 3260 addLibrarySource( |
| 1743 '/a.dart', | 3261 '/a.dart', |
| 1744 r''' | 3262 r''' |
| 1745 class C<K, V> { | 3263 class C<K, V> { |
| 1746 const C.named(K k, V v); | 3264 const C.named(K k, V v); |
| 1747 } | 3265 } |
| 1748 '''); | 3266 '''); |
| 1749 checkLibrary(r''' | 3267 var library = checkLibrary(r''' |
| 1750 import 'a.dart'; | 3268 import 'a.dart'; |
| 1751 const V = const C<int, String>.named(1, '222'); | 3269 const V = const C<int, String>.named(1, '222'); |
| 1752 '''); | 3270 '''); |
| 3271 if (isStrongMode) { | |
| 3272 checkElementText( | |
| 3273 library, | |
| 3274 r''' | |
| 3275 import 'a.dart'; | |
| 3276 const C<int, String> V; | |
| 3277 '''); | |
| 3278 } else { | |
| 3279 checkElementText( | |
| 3280 library, | |
| 3281 r''' | |
| 3282 import 'a.dart'; | |
| 3283 const V; | |
| 3284 '''); | |
| 3285 } | |
| 1753 } | 3286 } |
| 1754 | 3287 |
| 1755 test_const_invokeConstructor_generic_named_imported_withPrefix() { | 3288 test_const_invokeConstructor_generic_named_imported_withPrefix() { |
| 1756 addLibrarySource( | 3289 addLibrarySource( |
| 1757 '/a.dart', | 3290 '/a.dart', |
| 1758 r''' | 3291 r''' |
| 1759 class C<K, V> { | 3292 class C<K, V> { |
| 1760 const C.named(K k, V v); | 3293 const C.named(K k, V v); |
| 1761 } | 3294 } |
| 1762 '''); | 3295 '''); |
| 1763 checkLibrary(r''' | 3296 var library = checkLibrary(r''' |
| 1764 import 'a.dart' as p; | 3297 import 'a.dart' as p; |
| 1765 const V = const p.C<int, String>.named(1, '222'); | 3298 const V = const p.C<int, String>.named(1, '222'); |
| 1766 '''); | 3299 '''); |
| 3300 if (isStrongMode) { | |
| 3301 checkElementText( | |
| 3302 library, | |
| 3303 r''' | |
| 3304 import 'a.dart' as p; | |
| 3305 const C<int, String> V; | |
| 3306 '''); | |
| 3307 } else { | |
| 3308 checkElementText( | |
| 3309 library, | |
| 3310 r''' | |
| 3311 import 'a.dart' as p; | |
| 3312 const V; | |
| 3313 '''); | |
| 3314 } | |
| 1767 } | 3315 } |
| 1768 | 3316 |
| 1769 test_const_invokeConstructor_generic_noTypeArguments() { | 3317 test_const_invokeConstructor_generic_noTypeArguments() { |
| 1770 checkLibrary(r''' | 3318 var library = checkLibrary(r''' |
| 1771 class C<K, V> { | 3319 class C<K, V> { |
| 1772 const C(); | 3320 const C(); |
| 1773 } | 3321 } |
| 1774 const V = const C(); | 3322 const V = const C(); |
| 1775 '''); | 3323 '''); |
| 3324 if (isStrongMode) { | |
| 3325 checkElementText( | |
| 3326 library, | |
| 3327 r''' | |
| 3328 class C<K, V> { | |
| 3329 C(); | |
| 3330 } | |
| 3331 const C V; | |
| 3332 '''); | |
| 3333 } else { | |
| 3334 checkElementText( | |
| 3335 library, | |
| 3336 r''' | |
| 3337 class C<K, V> { | |
| 3338 C(); | |
| 3339 } | |
| 3340 const V; | |
| 3341 '''); | |
| 3342 } | |
| 1776 } | 3343 } |
| 1777 | 3344 |
| 1778 test_const_invokeConstructor_generic_unnamed() { | 3345 test_const_invokeConstructor_generic_unnamed() { |
| 1779 checkLibrary(r''' | 3346 var library = checkLibrary(r''' |
| 1780 class C<K, V> { | 3347 class C<K, V> { |
| 1781 const C(); | 3348 const C(); |
| 1782 } | 3349 } |
| 1783 const V = const C<int, String>(); | 3350 const V = const C<int, String>(); |
| 1784 '''); | 3351 '''); |
| 3352 if (isStrongMode) { | |
| 3353 checkElementText( | |
| 3354 library, | |
| 3355 r''' | |
| 3356 class C<K, V> { | |
| 3357 C(); | |
| 3358 } | |
| 3359 const C<int, String> V; | |
| 3360 '''); | |
| 3361 } else { | |
| 3362 checkElementText( | |
| 3363 library, | |
| 3364 r''' | |
| 3365 class C<K, V> { | |
| 3366 C(); | |
| 3367 } | |
| 3368 const V; | |
| 3369 '''); | |
| 3370 } | |
| 1785 } | 3371 } |
| 1786 | 3372 |
| 1787 test_const_invokeConstructor_generic_unnamed_imported() { | 3373 test_const_invokeConstructor_generic_unnamed_imported() { |
| 1788 addLibrarySource( | 3374 addLibrarySource( |
| 1789 '/a.dart', | 3375 '/a.dart', |
| 1790 r''' | 3376 r''' |
| 1791 class C<K, V> { | 3377 class C<K, V> { |
| 1792 const C(); | 3378 const C(); |
| 1793 } | 3379 } |
| 1794 '''); | 3380 '''); |
| 1795 checkLibrary(r''' | 3381 var library = checkLibrary(r''' |
| 1796 import 'a.dart'; | 3382 import 'a.dart'; |
| 1797 const V = const C<int, String>(); | 3383 const V = const C<int, String>(); |
| 1798 '''); | 3384 '''); |
| 3385 if (isStrongMode) { | |
| 3386 checkElementText( | |
| 3387 library, | |
| 3388 r''' | |
| 3389 import 'a.dart'; | |
| 3390 const C<int, String> V; | |
| 3391 '''); | |
| 3392 } else { | |
| 3393 checkElementText( | |
| 3394 library, | |
| 3395 r''' | |
| 3396 import 'a.dart'; | |
| 3397 const V; | |
| 3398 '''); | |
| 3399 } | |
| 1799 } | 3400 } |
| 1800 | 3401 |
| 1801 test_const_invokeConstructor_generic_unnamed_imported_withPrefix() { | 3402 test_const_invokeConstructor_generic_unnamed_imported_withPrefix() { |
| 1802 addLibrarySource( | 3403 addLibrarySource( |
| 1803 '/a.dart', | 3404 '/a.dart', |
| 1804 r''' | 3405 r''' |
| 1805 class C<K, V> { | 3406 class C<K, V> { |
| 1806 const C(); | 3407 const C(); |
| 1807 } | 3408 } |
| 1808 '''); | 3409 '''); |
| 1809 checkLibrary(r''' | 3410 var library = checkLibrary(r''' |
| 1810 import 'a.dart' as p; | 3411 import 'a.dart' as p; |
| 1811 const V = const p.C<int, String>(); | 3412 const V = const p.C<int, String>(); |
| 1812 '''); | 3413 '''); |
| 3414 if (isStrongMode) { | |
| 3415 checkElementText( | |
| 3416 library, | |
| 3417 r''' | |
| 3418 import 'a.dart' as p; | |
| 3419 const C<int, String> V; | |
| 3420 '''); | |
| 3421 } else { | |
| 3422 checkElementText( | |
| 3423 library, | |
| 3424 r''' | |
| 3425 import 'a.dart' as p; | |
| 3426 const V; | |
| 3427 '''); | |
| 3428 } | |
| 1813 } | 3429 } |
| 1814 | 3430 |
| 1815 test_const_invokeConstructor_named() { | 3431 test_const_invokeConstructor_named() { |
| 1816 checkLibrary(r''' | 3432 var library = checkLibrary(r''' |
| 1817 class C { | 3433 class C { |
| 1818 const C.named(bool a, int b, int c, {String d, double e}); | 3434 const C.named(bool a, int b, int c, {String d, double e}); |
| 1819 } | 3435 } |
| 1820 const V = const C.named(true, 1, 2, d: 'ccc', e: 3.4); | 3436 const V = const C.named(true, 1, 2, d: 'ccc', e: 3.4); |
| 1821 '''); | 3437 '''); |
| 3438 if (isStrongMode) { | |
| 3439 checkElementText( | |
| 3440 library, | |
| 3441 r''' | |
| 3442 class C { | |
| 3443 C.named(bool a, int b, int c, {String d}, {double e}); | |
| 3444 } | |
| 3445 const C V; | |
| 3446 '''); | |
| 3447 } else { | |
| 3448 checkElementText( | |
| 3449 library, | |
| 3450 r''' | |
| 3451 class C { | |
| 3452 C.named(bool a, int b, int c, {String d}, {double e}); | |
| 3453 } | |
| 3454 const V; | |
| 3455 '''); | |
| 3456 } | |
| 1822 } | 3457 } |
| 1823 | 3458 |
| 1824 test_const_invokeConstructor_named_imported() { | 3459 test_const_invokeConstructor_named_imported() { |
| 1825 addLibrarySource( | 3460 addLibrarySource( |
| 1826 '/a.dart', | 3461 '/a.dart', |
| 1827 r''' | 3462 r''' |
| 1828 class C { | 3463 class C { |
| 1829 const C.named(); | 3464 const C.named(); |
| 1830 } | 3465 } |
| 1831 '''); | 3466 '''); |
| 1832 checkLibrary(r''' | 3467 var library = checkLibrary(r''' |
| 1833 import 'a.dart'; | 3468 import 'a.dart'; |
| 1834 const V = const C.named(); | 3469 const V = const C.named(); |
| 1835 '''); | 3470 '''); |
| 3471 if (isStrongMode) { | |
| 3472 checkElementText( | |
| 3473 library, | |
| 3474 r''' | |
| 3475 import 'a.dart'; | |
| 3476 const C V; | |
| 3477 '''); | |
| 3478 } else { | |
| 3479 checkElementText( | |
| 3480 library, | |
| 3481 r''' | |
| 3482 import 'a.dart'; | |
| 3483 const V; | |
| 3484 '''); | |
| 3485 } | |
| 1836 } | 3486 } |
| 1837 | 3487 |
| 1838 test_const_invokeConstructor_named_imported_withPrefix() { | 3488 test_const_invokeConstructor_named_imported_withPrefix() { |
| 1839 addLibrarySource( | 3489 addLibrarySource( |
| 1840 '/a.dart', | 3490 '/a.dart', |
| 1841 r''' | 3491 r''' |
| 1842 class C { | 3492 class C { |
| 1843 const C.named(); | 3493 const C.named(); |
| 1844 } | 3494 } |
| 1845 '''); | 3495 '''); |
| 1846 checkLibrary(r''' | 3496 var library = checkLibrary(r''' |
| 1847 import 'a.dart' as p; | 3497 import 'a.dart' as p; |
| 1848 const V = const p.C.named(); | 3498 const V = const p.C.named(); |
| 1849 '''); | 3499 '''); |
| 3500 if (isStrongMode) { | |
| 3501 checkElementText( | |
| 3502 library, | |
| 3503 r''' | |
| 3504 import 'a.dart' as p; | |
| 3505 const C V; | |
| 3506 '''); | |
| 3507 } else { | |
| 3508 checkElementText( | |
| 3509 library, | |
| 3510 r''' | |
| 3511 import 'a.dart' as p; | |
| 3512 const V; | |
| 3513 '''); | |
| 3514 } | |
| 1850 } | 3515 } |
| 1851 | 3516 |
| 1852 test_const_invokeConstructor_named_unresolved() { | 3517 test_const_invokeConstructor_named_unresolved() { |
| 1853 checkLibrary( | 3518 var library = checkLibrary( |
| 1854 r''' | 3519 r''' |
| 1855 class C {} | 3520 class C {} |
| 1856 const V = const C.named(); | 3521 const V = const C.named(); |
| 1857 ''', | 3522 ''', |
| 1858 allowErrors: true); | 3523 allowErrors: true); |
| 3524 if (isStrongMode) { | |
| 3525 checkElementText( | |
| 3526 library, | |
| 3527 r''' | |
| 3528 class C { | |
| 3529 } | |
| 3530 const C V; | |
| 3531 '''); | |
| 3532 } else { | |
| 3533 checkElementText( | |
| 3534 library, | |
| 3535 r''' | |
| 3536 class C { | |
| 3537 } | |
| 3538 const V; | |
| 3539 '''); | |
| 3540 } | |
| 1859 } | 3541 } |
| 1860 | 3542 |
| 1861 test_const_invokeConstructor_named_unresolved2() { | 3543 test_const_invokeConstructor_named_unresolved2() { |
| 1862 checkLibrary( | 3544 var library = checkLibrary( |
| 1863 r''' | 3545 r''' |
| 1864 const V = const C.named(); | 3546 const V = const C.named(); |
| 1865 ''', | 3547 ''', |
| 1866 allowErrors: true); | 3548 allowErrors: true); |
| 3549 if (isStrongMode) { | |
| 3550 checkElementText( | |
| 3551 library, | |
| 3552 r''' | |
| 3553 const V; | |
| 3554 '''); | |
| 3555 } else { | |
| 3556 checkElementText( | |
| 3557 library, | |
| 3558 r''' | |
| 3559 const V; | |
| 3560 '''); | |
| 3561 } | |
| 1867 } | 3562 } |
| 1868 | 3563 |
| 1869 test_const_invokeConstructor_named_unresolved3() { | 3564 test_const_invokeConstructor_named_unresolved3() { |
| 1870 addLibrarySource( | 3565 addLibrarySource( |
| 1871 '/a.dart', | 3566 '/a.dart', |
| 1872 r''' | 3567 r''' |
| 1873 class C { | 3568 class C { |
| 1874 } | 3569 } |
| 1875 '''); | 3570 '''); |
| 1876 checkLibrary( | 3571 var library = checkLibrary( |
| 1877 r''' | 3572 r''' |
| 1878 import 'a.dart' as p; | 3573 import 'a.dart' as p; |
| 1879 const V = const p.C.named(); | 3574 const V = const p.C.named(); |
| 1880 ''', | 3575 ''', |
| 1881 allowErrors: true); | 3576 allowErrors: true); |
| 3577 if (isStrongMode) { | |
| 3578 checkElementText( | |
| 3579 library, | |
| 3580 r''' | |
| 3581 import 'a.dart' as p; | |
| 3582 const C V; | |
| 3583 '''); | |
| 3584 } else { | |
| 3585 checkElementText( | |
| 3586 library, | |
| 3587 r''' | |
| 3588 import 'a.dart' as p; | |
| 3589 const V; | |
| 3590 '''); | |
| 3591 } | |
| 1882 } | 3592 } |
| 1883 | 3593 |
| 1884 test_const_invokeConstructor_named_unresolved4() { | 3594 test_const_invokeConstructor_named_unresolved4() { |
| 1885 addLibrarySource('/a.dart', ''); | 3595 addLibrarySource('/a.dart', ''); |
| 1886 checkLibrary( | 3596 var library = checkLibrary( |
| 1887 r''' | 3597 r''' |
| 1888 import 'a.dart' as p; | 3598 import 'a.dart' as p; |
| 1889 const V = const p.C.named(); | 3599 const V = const p.C.named(); |
| 1890 ''', | 3600 ''', |
| 1891 allowErrors: true); | 3601 allowErrors: true); |
| 3602 if (isStrongMode) { | |
| 3603 checkElementText( | |
| 3604 library, | |
| 3605 r''' | |
| 3606 import 'a.dart' as p; | |
| 3607 const V; | |
| 3608 '''); | |
| 3609 } else { | |
| 3610 checkElementText( | |
| 3611 library, | |
| 3612 r''' | |
| 3613 import 'a.dart' as p; | |
| 3614 const V; | |
| 3615 '''); | |
| 3616 } | |
| 1892 } | 3617 } |
| 1893 | 3618 |
| 1894 test_const_invokeConstructor_named_unresolved5() { | 3619 test_const_invokeConstructor_named_unresolved5() { |
| 1895 checkLibrary( | 3620 var library = checkLibrary( |
| 1896 r''' | 3621 r''' |
| 1897 const V = const p.C.named(); | 3622 const V = const p.C.named(); |
| 1898 ''', | 3623 ''', |
| 1899 allowErrors: true); | 3624 allowErrors: true); |
| 3625 if (isStrongMode) { | |
| 3626 checkElementText( | |
| 3627 library, | |
| 3628 r''' | |
| 3629 const V; | |
| 3630 '''); | |
| 3631 } else { | |
| 3632 checkElementText( | |
| 3633 library, | |
| 3634 r''' | |
| 3635 const V; | |
| 3636 '''); | |
| 3637 } | |
| 1900 } | 3638 } |
| 1901 | 3639 |
| 1902 test_const_invokeConstructor_unnamed() { | 3640 test_const_invokeConstructor_unnamed() { |
| 1903 checkLibrary(r''' | 3641 var library = checkLibrary(r''' |
| 1904 class C { | 3642 class C { |
| 1905 const C(); | 3643 const C(); |
| 1906 } | 3644 } |
| 1907 const V = const C(); | 3645 const V = const C(); |
| 1908 '''); | 3646 '''); |
| 3647 if (isStrongMode) { | |
| 3648 checkElementText( | |
| 3649 library, | |
| 3650 r''' | |
| 3651 class C { | |
| 3652 C(); | |
| 3653 } | |
| 3654 const C V; | |
| 3655 '''); | |
| 3656 } else { | |
| 3657 checkElementText( | |
| 3658 library, | |
| 3659 r''' | |
| 3660 class C { | |
| 3661 C(); | |
| 3662 } | |
| 3663 const V; | |
| 3664 '''); | |
| 3665 } | |
| 1909 } | 3666 } |
| 1910 | 3667 |
| 1911 test_const_invokeConstructor_unnamed_imported() { | 3668 test_const_invokeConstructor_unnamed_imported() { |
| 1912 addLibrarySource( | 3669 addLibrarySource( |
| 1913 '/a.dart', | 3670 '/a.dart', |
| 1914 r''' | 3671 r''' |
| 1915 class C { | 3672 class C { |
| 1916 const C(); | 3673 const C(); |
| 1917 } | 3674 } |
| 1918 '''); | 3675 '''); |
| 1919 checkLibrary(r''' | 3676 var library = checkLibrary(r''' |
| 1920 import 'a.dart'; | 3677 import 'a.dart'; |
| 1921 const V = const C(); | 3678 const V = const C(); |
| 1922 '''); | 3679 '''); |
| 3680 if (isStrongMode) { | |
| 3681 checkElementText( | |
| 3682 library, | |
| 3683 r''' | |
| 3684 import 'a.dart'; | |
| 3685 const C V; | |
| 3686 '''); | |
| 3687 } else { | |
| 3688 checkElementText( | |
| 3689 library, | |
| 3690 r''' | |
| 3691 import 'a.dart'; | |
| 3692 const V; | |
| 3693 '''); | |
| 3694 } | |
| 1923 } | 3695 } |
| 1924 | 3696 |
| 1925 test_const_invokeConstructor_unnamed_imported_withPrefix() { | 3697 test_const_invokeConstructor_unnamed_imported_withPrefix() { |
| 1926 addLibrarySource( | 3698 addLibrarySource( |
| 1927 '/a.dart', | 3699 '/a.dart', |
| 1928 r''' | 3700 r''' |
| 1929 class C { | 3701 class C { |
| 1930 const C(); | 3702 const C(); |
| 1931 } | 3703 } |
| 1932 '''); | 3704 '''); |
| 1933 checkLibrary(r''' | 3705 var library = checkLibrary(r''' |
| 1934 import 'a.dart' as p; | 3706 import 'a.dart' as p; |
| 1935 const V = const p.C(); | 3707 const V = const p.C(); |
| 1936 '''); | 3708 '''); |
| 3709 if (isStrongMode) { | |
| 3710 checkElementText( | |
| 3711 library, | |
| 3712 r''' | |
| 3713 import 'a.dart' as p; | |
| 3714 const C V; | |
| 3715 '''); | |
| 3716 } else { | |
| 3717 checkElementText( | |
| 3718 library, | |
| 3719 r''' | |
| 3720 import 'a.dart' as p; | |
| 3721 const V; | |
| 3722 '''); | |
| 3723 } | |
| 1937 } | 3724 } |
| 1938 | 3725 |
| 1939 test_const_invokeConstructor_unnamed_unresolved() { | 3726 test_const_invokeConstructor_unnamed_unresolved() { |
| 1940 checkLibrary( | 3727 var library = checkLibrary( |
| 1941 r''' | 3728 r''' |
| 1942 const V = const C(); | 3729 const V = const C(); |
| 1943 ''', | 3730 ''', |
| 1944 allowErrors: true); | 3731 allowErrors: true); |
| 3732 if (isStrongMode) { | |
| 3733 checkElementText( | |
| 3734 library, | |
| 3735 r''' | |
| 3736 const V; | |
| 3737 '''); | |
| 3738 } else { | |
| 3739 checkElementText( | |
| 3740 library, | |
| 3741 r''' | |
| 3742 const V; | |
| 3743 '''); | |
| 3744 } | |
| 1945 } | 3745 } |
| 1946 | 3746 |
| 1947 test_const_invokeConstructor_unnamed_unresolved2() { | 3747 test_const_invokeConstructor_unnamed_unresolved2() { |
| 1948 addLibrarySource('/a.dart', ''); | 3748 addLibrarySource('/a.dart', ''); |
| 1949 checkLibrary( | 3749 var library = checkLibrary( |
| 1950 r''' | 3750 r''' |
| 1951 import 'a.dart' as p; | 3751 import 'a.dart' as p; |
| 1952 const V = const p.C(); | 3752 const V = const p.C(); |
| 1953 ''', | 3753 ''', |
| 1954 allowErrors: true); | 3754 allowErrors: true); |
| 3755 if (isStrongMode) { | |
| 3756 checkElementText( | |
| 3757 library, | |
| 3758 r''' | |
| 3759 import 'a.dart' as p; | |
| 3760 const V; | |
| 3761 '''); | |
| 3762 } else { | |
| 3763 checkElementText( | |
| 3764 library, | |
| 3765 r''' | |
| 3766 import 'a.dart' as p; | |
| 3767 const V; | |
| 3768 '''); | |
| 3769 } | |
| 1955 } | 3770 } |
| 1956 | 3771 |
| 1957 test_const_invokeConstructor_unnamed_unresolved3() { | 3772 test_const_invokeConstructor_unnamed_unresolved3() { |
| 1958 checkLibrary( | 3773 var library = checkLibrary( |
| 1959 r''' | 3774 r''' |
| 1960 const V = const p.C(); | 3775 const V = const p.C(); |
| 1961 ''', | 3776 ''', |
| 1962 allowErrors: true); | 3777 allowErrors: true); |
| 3778 if (isStrongMode) { | |
| 3779 checkElementText( | |
| 3780 library, | |
| 3781 r''' | |
| 3782 const V; | |
| 3783 '''); | |
| 3784 } else { | |
| 3785 checkElementText( | |
| 3786 library, | |
| 3787 r''' | |
| 3788 const V; | |
| 3789 '''); | |
| 3790 } | |
| 1963 } | 3791 } |
| 1964 | 3792 |
| 1965 test_const_length_ofClassConstField() { | 3793 test_const_length_ofClassConstField() { |
| 1966 checkLibrary(r''' | 3794 var library = checkLibrary(r''' |
| 1967 class C { | 3795 class C { |
| 1968 static const String F = ''; | 3796 static const String F = ''; |
| 1969 } | 3797 } |
| 1970 const int v = C.F.length; | 3798 const int v = C.F.length; |
| 1971 '''); | 3799 '''); |
| 3800 if (isStrongMode) { | |
| 3801 checkElementText( | |
| 3802 library, | |
| 3803 r''' | |
| 3804 class C { | |
| 3805 static const String F; | |
| 3806 } | |
| 3807 const int v; | |
| 3808 '''); | |
| 3809 } else { | |
| 3810 checkElementText( | |
| 3811 library, | |
| 3812 r''' | |
| 3813 class C { | |
| 3814 static const String F; | |
| 3815 } | |
| 3816 const int v; | |
| 3817 '''); | |
| 3818 } | |
| 1972 } | 3819 } |
| 1973 | 3820 |
| 1974 test_const_length_ofClassConstField_imported() { | 3821 test_const_length_ofClassConstField_imported() { |
| 1975 addLibrarySource( | 3822 addLibrarySource( |
| 1976 '/a.dart', | 3823 '/a.dart', |
| 1977 r''' | 3824 r''' |
| 1978 class C { | 3825 class C { |
| 1979 static const String F = ''; | 3826 static const String F = ''; |
| 1980 } | 3827 } |
| 1981 '''); | 3828 '''); |
| 1982 checkLibrary(r''' | 3829 var library = checkLibrary(r''' |
| 1983 import 'a.dart'; | 3830 import 'a.dart'; |
| 1984 const int v = C.F.length; | 3831 const int v = C.F.length; |
| 1985 '''); | 3832 '''); |
| 3833 if (isStrongMode) { | |
| 3834 checkElementText( | |
| 3835 library, | |
| 3836 r''' | |
| 3837 import 'a.dart'; | |
| 3838 const int v; | |
| 3839 '''); | |
| 3840 } else { | |
| 3841 checkElementText( | |
| 3842 library, | |
| 3843 r''' | |
| 3844 import 'a.dart'; | |
| 3845 const int v; | |
| 3846 '''); | |
| 3847 } | |
| 1986 } | 3848 } |
| 1987 | 3849 |
| 1988 test_const_length_ofClassConstField_imported_withPrefix() { | 3850 test_const_length_ofClassConstField_imported_withPrefix() { |
| 1989 addLibrarySource( | 3851 addLibrarySource( |
| 1990 '/a.dart', | 3852 '/a.dart', |
| 1991 r''' | 3853 r''' |
| 1992 class C { | 3854 class C { |
| 1993 static const String F = ''; | 3855 static const String F = ''; |
| 1994 } | 3856 } |
| 1995 '''); | 3857 '''); |
| 1996 checkLibrary(r''' | 3858 var library = checkLibrary(r''' |
| 1997 import 'a.dart' as p; | 3859 import 'a.dart' as p; |
| 1998 const int v = p.C.F.length; | 3860 const int v = p.C.F.length; |
| 1999 '''); | 3861 '''); |
| 3862 if (isStrongMode) { | |
| 3863 checkElementText( | |
| 3864 library, | |
| 3865 r''' | |
| 3866 import 'a.dart' as p; | |
| 3867 const int v; | |
| 3868 '''); | |
| 3869 } else { | |
| 3870 checkElementText( | |
| 3871 library, | |
| 3872 r''' | |
| 3873 import 'a.dart' as p; | |
| 3874 const int v; | |
| 3875 '''); | |
| 3876 } | |
| 2000 } | 3877 } |
| 2001 | 3878 |
| 2002 test_const_length_ofStringLiteral() { | 3879 test_const_length_ofStringLiteral() { |
| 2003 checkLibrary(r''' | 3880 var library = checkLibrary(r''' |
| 2004 const v = 'abc'.length; | 3881 const v = 'abc'.length; |
| 2005 '''); | 3882 '''); |
| 3883 if (isStrongMode) { | |
| 3884 checkElementText( | |
| 3885 library, | |
| 3886 r''' | |
| 3887 const int v; | |
| 3888 '''); | |
| 3889 } else { | |
| 3890 checkElementText( | |
| 3891 library, | |
| 3892 r''' | |
| 3893 const v; | |
| 3894 '''); | |
| 3895 } | |
| 2006 } | 3896 } |
| 2007 | 3897 |
| 2008 test_const_length_ofTopLevelVariable() { | 3898 test_const_length_ofTopLevelVariable() { |
| 2009 checkLibrary(r''' | 3899 var library = checkLibrary(r''' |
| 2010 const String S = 'abc'; | 3900 const String S = 'abc'; |
| 2011 const v = S.length; | 3901 const v = S.length; |
| 2012 '''); | 3902 '''); |
| 3903 if (isStrongMode) { | |
| 3904 checkElementText( | |
| 3905 library, | |
| 3906 r''' | |
| 3907 const String S; | |
| 3908 const int v; | |
| 3909 '''); | |
| 3910 } else { | |
| 3911 checkElementText( | |
| 3912 library, | |
| 3913 r''' | |
| 3914 const String S; | |
| 3915 const v; | |
| 3916 '''); | |
| 3917 } | |
| 2013 } | 3918 } |
| 2014 | 3919 |
| 2015 test_const_length_ofTopLevelVariable_imported() { | 3920 test_const_length_ofTopLevelVariable_imported() { |
| 2016 addLibrarySource( | 3921 addLibrarySource( |
| 2017 '/a.dart', | 3922 '/a.dart', |
| 2018 r''' | 3923 r''' |
| 2019 const String S = 'abc'; | 3924 const String S = 'abc'; |
| 2020 '''); | 3925 '''); |
| 2021 checkLibrary(r''' | 3926 var library = checkLibrary(r''' |
| 2022 import 'a.dart'; | 3927 import 'a.dart'; |
| 2023 const v = S.length; | 3928 const v = S.length; |
| 2024 '''); | 3929 '''); |
| 3930 if (isStrongMode) { | |
| 3931 checkElementText( | |
| 3932 library, | |
| 3933 r''' | |
| 3934 import 'a.dart'; | |
| 3935 const int v; | |
| 3936 '''); | |
| 3937 } else { | |
| 3938 checkElementText( | |
| 3939 library, | |
| 3940 r''' | |
| 3941 import 'a.dart'; | |
| 3942 const v; | |
| 3943 '''); | |
| 3944 } | |
| 2025 } | 3945 } |
| 2026 | 3946 |
| 2027 test_const_length_ofTopLevelVariable_imported_withPrefix() { | 3947 test_const_length_ofTopLevelVariable_imported_withPrefix() { |
| 2028 addLibrarySource( | 3948 addLibrarySource( |
| 2029 '/a.dart', | 3949 '/a.dart', |
| 2030 r''' | 3950 r''' |
| 2031 const String S = 'abc'; | 3951 const String S = 'abc'; |
| 2032 '''); | 3952 '''); |
| 2033 checkLibrary(r''' | 3953 var library = checkLibrary(r''' |
| 2034 import 'a.dart' as p; | 3954 import 'a.dart' as p; |
| 2035 const v = p.S.length; | 3955 const v = p.S.length; |
| 2036 '''); | 3956 '''); |
| 3957 if (isStrongMode) { | |
| 3958 checkElementText( | |
| 3959 library, | |
| 3960 r''' | |
| 3961 import 'a.dart' as p; | |
| 3962 const int v; | |
| 3963 '''); | |
| 3964 } else { | |
| 3965 checkElementText( | |
| 3966 library, | |
| 3967 r''' | |
| 3968 import 'a.dart' as p; | |
| 3969 const v; | |
| 3970 '''); | |
| 3971 } | |
| 2037 } | 3972 } |
| 2038 | 3973 |
| 2039 test_const_length_staticMethod() { | 3974 test_const_length_staticMethod() { |
| 2040 checkLibrary(r''' | 3975 var library = checkLibrary(r''' |
| 2041 class C { | 3976 class C { |
| 2042 static int length() => 42; | 3977 static int length() => 42; |
| 2043 } | 3978 } |
| 2044 const v = C.length; | 3979 const v = C.length; |
| 2045 '''); | 3980 '''); |
| 3981 if (isStrongMode) { | |
| 3982 checkElementText( | |
| 3983 library, | |
| 3984 r''' | |
| 3985 class C { | |
| 3986 static int length() {} | |
| 3987 } | |
| 3988 const () → int v; | |
| 3989 '''); | |
| 3990 } else { | |
| 3991 checkElementText( | |
| 3992 library, | |
| 3993 r''' | |
| 3994 class C { | |
| 3995 static int length() {} | |
| 3996 } | |
| 3997 const v; | |
| 3998 '''); | |
| 3999 } | |
| 2046 } | 4000 } |
| 2047 | 4001 |
| 2048 test_const_parameterDefaultValue_initializingFormal_functionTyped() { | 4002 test_const_parameterDefaultValue_initializingFormal_functionTyped() { |
| 2049 checkLibrary(r''' | 4003 var library = checkLibrary(r''' |
| 2050 class C { | 4004 class C { |
| 2051 final x; | 4005 final x; |
| 2052 const C({this.x: foo}); | 4006 const C({this.x: foo}); |
| 2053 } | 4007 } |
| 2054 int foo() => 42; | 4008 int foo() => 42; |
| 2055 '''); | 4009 '''); |
| 4010 if (isStrongMode) { | |
| 4011 checkElementText( | |
| 4012 library, | |
| 4013 r''' | |
| 4014 class C { | |
| 4015 final x; | |
| 4016 C({this.x}); | |
| 4017 } | |
| 4018 int foo() {} | |
| 4019 '''); | |
| 4020 } else { | |
| 4021 checkElementText( | |
| 4022 library, | |
| 4023 r''' | |
| 4024 class C { | |
| 4025 final x; | |
| 4026 C({this.x}); | |
| 4027 } | |
| 4028 int foo() {} | |
| 4029 '''); | |
| 4030 } | |
| 2056 } | 4031 } |
| 2057 | 4032 |
| 2058 test_const_parameterDefaultValue_initializingFormal_named() { | 4033 test_const_parameterDefaultValue_initializingFormal_named() { |
| 2059 checkLibrary(r''' | 4034 var library = checkLibrary(r''' |
| 2060 class C { | 4035 class C { |
| 2061 final x; | 4036 final x; |
| 2062 const C({this.x: 1 + 2}); | 4037 const C({this.x: 1 + 2}); |
| 2063 } | 4038 } |
| 2064 '''); | 4039 '''); |
| 4040 if (isStrongMode) { | |
| 4041 checkElementText( | |
| 4042 library, | |
| 4043 r''' | |
| 4044 class C { | |
| 4045 final x; | |
| 4046 C({this.x}); | |
| 4047 } | |
| 4048 '''); | |
| 4049 } else { | |
| 4050 checkElementText( | |
| 4051 library, | |
| 4052 r''' | |
| 4053 class C { | |
| 4054 final x; | |
| 4055 C({this.x}); | |
| 4056 } | |
| 4057 '''); | |
| 4058 } | |
| 2065 } | 4059 } |
| 2066 | 4060 |
| 2067 test_const_parameterDefaultValue_initializingFormal_positional() { | 4061 test_const_parameterDefaultValue_initializingFormal_positional() { |
| 2068 checkLibrary(r''' | 4062 var library = checkLibrary(r''' |
| 2069 class C { | 4063 class C { |
| 2070 final x; | 4064 final x; |
| 2071 const C([this.x = 1 + 2]); | 4065 const C([this.x = 1 + 2]); |
| 2072 } | 4066 } |
| 2073 '''); | 4067 '''); |
| 4068 if (isStrongMode) { | |
| 4069 checkElementText( | |
| 4070 library, | |
| 4071 r''' | |
| 4072 class C { | |
| 4073 final x; | |
| 4074 C([this.x]); | |
| 4075 } | |
| 4076 '''); | |
| 4077 } else { | |
| 4078 checkElementText( | |
| 4079 library, | |
| 4080 r''' | |
| 4081 class C { | |
| 4082 final x; | |
| 4083 C([this.x]); | |
| 4084 } | |
| 4085 '''); | |
| 4086 } | |
| 2074 } | 4087 } |
| 2075 | 4088 |
| 2076 test_const_parameterDefaultValue_normal() { | 4089 test_const_parameterDefaultValue_normal() { |
| 2077 checkLibrary(r''' | 4090 var library = checkLibrary(r''' |
| 2078 class C { | 4091 class C { |
| 2079 const C.positional([p = 1 + 2]); | 4092 const C.positional([p = 1 + 2]); |
| 2080 const C.named({p: 1 + 2}); | 4093 const C.named({p: 1 + 2}); |
| 2081 void methodPositional([p = 1 + 2]) {} | 4094 void methodPositional([p = 1 + 2]) {} |
| 2082 void methodPositionalWithoutDefault([p]) {} | 4095 void methodPositionalWithoutDefault([p]) {} |
| 2083 void methodNamed({p: 1 + 2}) {} | 4096 void methodNamed({p: 1 + 2}) {} |
| 2084 void methodNamedWithoutDefault({p}) {} | 4097 void methodNamedWithoutDefault({p}) {} |
| 2085 } | 4098 } |
| 2086 '''); | 4099 '''); |
| 4100 if (isStrongMode) { | |
| 4101 checkElementText( | |
| 4102 library, | |
| 4103 r''' | |
| 4104 class C { | |
| 4105 C.positional([p]); | |
| 4106 C.named({p}); | |
| 4107 void methodPositional([p]) {} | |
| 4108 void methodPositionalWithoutDefault([p]) {} | |
| 4109 void methodNamed({p}) {} | |
| 4110 void methodNamedWithoutDefault({p}) {} | |
| 4111 } | |
| 4112 '''); | |
| 4113 } else { | |
| 4114 checkElementText( | |
| 4115 library, | |
| 4116 r''' | |
| 4117 class C { | |
| 4118 C.positional([p]); | |
| 4119 C.named({p}); | |
| 4120 void methodPositional([p]) {} | |
| 4121 void methodPositionalWithoutDefault([p]) {} | |
| 4122 void methodNamed({p}) {} | |
| 4123 void methodNamedWithoutDefault({p}) {} | |
| 4124 } | |
| 4125 '''); | |
| 4126 } | |
| 2087 } | 4127 } |
| 2088 | 4128 |
| 2089 test_const_reference_staticField() { | 4129 test_const_reference_staticField() { |
| 2090 checkLibrary(r''' | 4130 var library = checkLibrary(r''' |
| 2091 class C { | 4131 class C { |
| 2092 static const int F = 42; | 4132 static const int F = 42; |
| 2093 } | 4133 } |
| 2094 const V = C.F; | 4134 const V = C.F; |
| 2095 '''); | 4135 '''); |
| 4136 if (isStrongMode) { | |
| 4137 checkElementText( | |
| 4138 library, | |
| 4139 r''' | |
| 4140 class C { | |
| 4141 static const int F; | |
| 4142 } | |
| 4143 const int V; | |
| 4144 '''); | |
| 4145 } else { | |
| 4146 checkElementText( | |
| 4147 library, | |
| 4148 r''' | |
| 4149 class C { | |
| 4150 static const int F; | |
| 4151 } | |
| 4152 const V; | |
| 4153 '''); | |
| 4154 } | |
| 2096 } | 4155 } |
| 2097 | 4156 |
| 2098 test_const_reference_staticField_imported() { | 4157 test_const_reference_staticField_imported() { |
| 2099 addLibrarySource( | 4158 addLibrarySource( |
| 2100 '/a.dart', | 4159 '/a.dart', |
| 2101 r''' | 4160 r''' |
| 2102 class C { | 4161 class C { |
| 2103 static const int F = 42; | 4162 static const int F = 42; |
| 2104 } | 4163 } |
| 2105 '''); | 4164 '''); |
| 2106 checkLibrary(r''' | 4165 var library = checkLibrary(r''' |
| 2107 import 'a.dart'; | 4166 import 'a.dart'; |
| 2108 const V = C.F; | 4167 const V = C.F; |
| 2109 '''); | 4168 '''); |
| 4169 if (isStrongMode) { | |
| 4170 checkElementText( | |
| 4171 library, | |
| 4172 r''' | |
| 4173 import 'a.dart'; | |
| 4174 const int V; | |
| 4175 '''); | |
| 4176 } else { | |
| 4177 checkElementText( | |
| 4178 library, | |
| 4179 r''' | |
| 4180 import 'a.dart'; | |
| 4181 const V; | |
| 4182 '''); | |
| 4183 } | |
| 2110 } | 4184 } |
| 2111 | 4185 |
| 2112 test_const_reference_staticField_imported_withPrefix() { | 4186 test_const_reference_staticField_imported_withPrefix() { |
| 2113 addLibrarySource( | 4187 addLibrarySource( |
| 2114 '/a.dart', | 4188 '/a.dart', |
| 2115 r''' | 4189 r''' |
| 2116 class C { | 4190 class C { |
| 2117 static const int F = 42; | 4191 static const int F = 42; |
| 2118 } | 4192 } |
| 2119 '''); | 4193 '''); |
| 2120 checkLibrary(r''' | 4194 var library = checkLibrary(r''' |
| 2121 import 'a.dart' as p; | 4195 import 'a.dart' as p; |
| 2122 const V = p.C.F; | 4196 const V = p.C.F; |
| 2123 '''); | 4197 '''); |
| 4198 if (isStrongMode) { | |
| 4199 checkElementText( | |
| 4200 library, | |
| 4201 r''' | |
| 4202 import 'a.dart' as p; | |
| 4203 const int V; | |
| 4204 '''); | |
| 4205 } else { | |
| 4206 checkElementText( | |
| 4207 library, | |
| 4208 r''' | |
| 4209 import 'a.dart' as p; | |
| 4210 const V; | |
| 4211 '''); | |
| 4212 } | |
| 2124 } | 4213 } |
| 2125 | 4214 |
| 2126 test_const_reference_staticMethod() { | 4215 test_const_reference_staticMethod() { |
| 2127 checkLibrary(r''' | 4216 var library = checkLibrary(r''' |
| 2128 class C { | 4217 class C { |
| 2129 static int m(int a, String b) => 42; | 4218 static int m(int a, String b) => 42; |
| 2130 } | 4219 } |
| 2131 const V = C.m; | 4220 const V = C.m; |
| 2132 '''); | 4221 '''); |
| 4222 if (isStrongMode) { | |
| 4223 checkElementText( | |
| 4224 library, | |
| 4225 r''' | |
| 4226 class C { | |
| 4227 static int m(int a, String b) {} | |
| 4228 } | |
| 4229 const (int, String) → int V; | |
| 4230 '''); | |
| 4231 } else { | |
| 4232 checkElementText( | |
| 4233 library, | |
| 4234 r''' | |
| 4235 class C { | |
| 4236 static int m(int a, String b) {} | |
| 4237 } | |
| 4238 const V; | |
| 4239 '''); | |
| 4240 } | |
| 2133 } | 4241 } |
| 2134 | 4242 |
| 2135 test_const_reference_staticMethod_imported() { | 4243 test_const_reference_staticMethod_imported() { |
| 2136 addLibrarySource( | 4244 addLibrarySource( |
| 2137 '/a.dart', | 4245 '/a.dart', |
| 2138 r''' | 4246 r''' |
| 2139 class C { | 4247 class C { |
| 2140 static int m(int a, String b) => 42; | 4248 static int m(int a, String b) => 42; |
| 2141 } | 4249 } |
| 2142 '''); | 4250 '''); |
| 2143 checkLibrary(r''' | 4251 var library = checkLibrary(r''' |
| 2144 import 'a.dart'; | 4252 import 'a.dart'; |
| 2145 const V = C.m; | 4253 const V = C.m; |
| 2146 '''); | 4254 '''); |
| 4255 if (isStrongMode) { | |
| 4256 checkElementText( | |
| 4257 library, | |
| 4258 r''' | |
| 4259 import 'a.dart'; | |
| 4260 const (int, String) → int V; | |
| 4261 '''); | |
| 4262 } else { | |
| 4263 checkElementText( | |
| 4264 library, | |
| 4265 r''' | |
| 4266 import 'a.dart'; | |
| 4267 const V; | |
| 4268 '''); | |
| 4269 } | |
| 2147 } | 4270 } |
| 2148 | 4271 |
| 2149 test_const_reference_staticMethod_imported_withPrefix() { | 4272 test_const_reference_staticMethod_imported_withPrefix() { |
| 2150 addLibrarySource( | 4273 addLibrarySource( |
| 2151 '/a.dart', | 4274 '/a.dart', |
| 2152 r''' | 4275 r''' |
| 2153 class C { | 4276 class C { |
| 2154 static int m(int a, String b) => 42; | 4277 static int m(int a, String b) => 42; |
| 2155 } | 4278 } |
| 2156 '''); | 4279 '''); |
| 2157 checkLibrary(r''' | 4280 var library = checkLibrary(r''' |
| 2158 import 'a.dart' as p; | 4281 import 'a.dart' as p; |
| 2159 const V = p.C.m; | 4282 const V = p.C.m; |
| 2160 '''); | 4283 '''); |
| 4284 if (isStrongMode) { | |
| 4285 checkElementText( | |
| 4286 library, | |
| 4287 r''' | |
| 4288 import 'a.dart' as p; | |
| 4289 const (int, String) → int V; | |
| 4290 '''); | |
| 4291 } else { | |
| 4292 checkElementText( | |
| 4293 library, | |
| 4294 r''' | |
| 4295 import 'a.dart' as p; | |
| 4296 const V; | |
| 4297 '''); | |
| 4298 } | |
| 2161 } | 4299 } |
| 2162 | 4300 |
| 2163 test_const_reference_topLevelFunction() { | 4301 test_const_reference_topLevelFunction() { |
| 2164 checkLibrary(r''' | 4302 var library = checkLibrary(r''' |
| 2165 foo() {} | 4303 foo() {} |
| 2166 const V = foo; | 4304 const V = foo; |
| 2167 '''); | 4305 '''); |
| 4306 if (isStrongMode) { | |
| 4307 checkElementText( | |
| 4308 library, | |
| 4309 r''' | |
| 4310 const () → dynamic V; | |
| 4311 foo() {} | |
| 4312 '''); | |
| 4313 } else { | |
| 4314 checkElementText( | |
| 4315 library, | |
| 4316 r''' | |
| 4317 const V; | |
| 4318 foo() {} | |
| 4319 '''); | |
| 4320 } | |
| 2168 } | 4321 } |
| 2169 | 4322 |
| 2170 test_const_reference_topLevelFunction_imported() { | 4323 test_const_reference_topLevelFunction_imported() { |
| 2171 addLibrarySource( | 4324 addLibrarySource( |
| 2172 '/a.dart', | 4325 '/a.dart', |
| 2173 r''' | 4326 r''' |
| 2174 foo() {} | 4327 foo() {} |
| 2175 '''); | 4328 '''); |
| 2176 checkLibrary(r''' | 4329 var library = checkLibrary(r''' |
| 2177 import 'a.dart'; | 4330 import 'a.dart'; |
| 2178 const V = foo; | 4331 const V = foo; |
| 2179 '''); | 4332 '''); |
| 4333 if (isStrongMode) { | |
| 4334 checkElementText( | |
| 4335 library, | |
| 4336 r''' | |
| 4337 import 'a.dart'; | |
| 4338 const () → dynamic V; | |
| 4339 '''); | |
| 4340 } else { | |
| 4341 checkElementText( | |
| 4342 library, | |
| 4343 r''' | |
| 4344 import 'a.dart'; | |
| 4345 const V; | |
| 4346 '''); | |
| 4347 } | |
| 2180 } | 4348 } |
| 2181 | 4349 |
| 2182 test_const_reference_topLevelFunction_imported_withPrefix() { | 4350 test_const_reference_topLevelFunction_imported_withPrefix() { |
| 2183 addLibrarySource( | 4351 addLibrarySource( |
| 2184 '/a.dart', | 4352 '/a.dart', |
| 2185 r''' | 4353 r''' |
| 2186 foo() {} | 4354 foo() {} |
| 2187 '''); | 4355 '''); |
| 2188 checkLibrary(r''' | 4356 var library = checkLibrary(r''' |
| 2189 import 'a.dart' as p; | 4357 import 'a.dart' as p; |
| 2190 const V = p.foo; | 4358 const V = p.foo; |
| 2191 '''); | 4359 '''); |
| 4360 if (isStrongMode) { | |
| 4361 checkElementText( | |
| 4362 library, | |
| 4363 r''' | |
| 4364 import 'a.dart' as p; | |
| 4365 const () → dynamic V; | |
| 4366 '''); | |
| 4367 } else { | |
| 4368 checkElementText( | |
| 4369 library, | |
| 4370 r''' | |
| 4371 import 'a.dart' as p; | |
| 4372 const V; | |
| 4373 '''); | |
| 4374 } | |
| 2192 } | 4375 } |
| 2193 | 4376 |
| 2194 test_const_reference_topLevelVariable() { | 4377 test_const_reference_topLevelVariable() { |
| 2195 checkLibrary(r''' | 4378 var library = checkLibrary(r''' |
| 2196 const A = 1; | 4379 const A = 1; |
| 2197 const B = A + 2; | 4380 const B = A + 2; |
| 2198 '''); | 4381 '''); |
| 4382 if (isStrongMode) { | |
| 4383 checkElementText( | |
| 4384 library, | |
| 4385 r''' | |
| 4386 const int A; | |
| 4387 const int B; | |
| 4388 '''); | |
| 4389 } else { | |
| 4390 checkElementText( | |
| 4391 library, | |
| 4392 r''' | |
| 4393 const A; | |
| 4394 const B; | |
| 4395 '''); | |
| 4396 } | |
| 2199 } | 4397 } |
| 2200 | 4398 |
| 2201 test_const_reference_topLevelVariable_imported() { | 4399 test_const_reference_topLevelVariable_imported() { |
| 2202 addLibrarySource( | 4400 addLibrarySource( |
| 2203 '/a.dart', | 4401 '/a.dart', |
| 2204 r''' | 4402 r''' |
| 2205 const A = 1; | 4403 const A = 1; |
| 2206 '''); | 4404 '''); |
| 2207 checkLibrary(r''' | 4405 var library = checkLibrary(r''' |
| 2208 import 'a.dart'; | 4406 import 'a.dart'; |
| 2209 const B = A + 2; | 4407 const B = A + 2; |
| 2210 '''); | 4408 '''); |
| 4409 if (isStrongMode) { | |
| 4410 checkElementText( | |
| 4411 library, | |
| 4412 r''' | |
| 4413 import 'a.dart'; | |
| 4414 const int B; | |
| 4415 '''); | |
| 4416 } else { | |
| 4417 checkElementText( | |
| 4418 library, | |
| 4419 r''' | |
| 4420 import 'a.dart'; | |
| 4421 const B; | |
| 4422 '''); | |
| 4423 } | |
| 2211 } | 4424 } |
| 2212 | 4425 |
| 2213 test_const_reference_topLevelVariable_imported_withPrefix() { | 4426 test_const_reference_topLevelVariable_imported_withPrefix() { |
| 2214 addLibrarySource( | 4427 addLibrarySource( |
| 2215 '/a.dart', | 4428 '/a.dart', |
| 2216 r''' | 4429 r''' |
| 2217 const A = 1; | 4430 const A = 1; |
| 2218 '''); | 4431 '''); |
| 2219 checkLibrary(r''' | 4432 var library = checkLibrary(r''' |
| 2220 import 'a.dart' as p; | 4433 import 'a.dart' as p; |
| 2221 const B = p.A + 2; | 4434 const B = p.A + 2; |
| 2222 '''); | 4435 '''); |
| 4436 if (isStrongMode) { | |
| 4437 checkElementText( | |
| 4438 library, | |
| 4439 r''' | |
| 4440 import 'a.dart' as p; | |
| 4441 const int B; | |
| 4442 '''); | |
| 4443 } else { | |
| 4444 checkElementText( | |
| 4445 library, | |
| 4446 r''' | |
| 4447 import 'a.dart' as p; | |
| 4448 const B; | |
| 4449 '''); | |
| 4450 } | |
| 2223 } | 4451 } |
| 2224 | 4452 |
| 2225 test_const_reference_type() { | 4453 test_const_reference_type() { |
| 2226 checkLibrary(r''' | 4454 var library = checkLibrary(r''' |
| 2227 class C {} | 4455 class C {} |
| 2228 class D<T> {} | 4456 class D<T> {} |
| 2229 enum E {a, b, c} | 4457 enum E {a, b, c} |
| 2230 typedef F(int a, String b); | 4458 typedef F(int a, String b); |
| 2231 const vDynamic = dynamic; | 4459 const vDynamic = dynamic; |
| 2232 const vNull = Null; | 4460 const vNull = Null; |
| 2233 const vObject = Object; | 4461 const vObject = Object; |
| 2234 const vClass = C; | 4462 const vClass = C; |
| 2235 const vGenericClass = D; | 4463 const vGenericClass = D; |
| 2236 const vEnum = E; | 4464 const vEnum = E; |
| 2237 const vFunctionTypeAlias = F; | 4465 const vFunctionTypeAlias = F; |
| 2238 '''); | 4466 '''); |
| 4467 if (isStrongMode) { | |
| 4468 checkElementText( | |
| 4469 library, | |
| 4470 r''' | |
| 4471 typedef F(int a, String b); | |
| 4472 enum E { a, b, c } | |
| 4473 class C { | |
| 4474 } | |
| 4475 class D<T> { | |
| 4476 } | |
| 4477 const Type vDynamic; | |
| 4478 const Type vNull; | |
| 4479 const Type vObject; | |
| 4480 const Type vClass; | |
| 4481 const Type vGenericClass; | |
| 4482 const Type vEnum; | |
| 4483 const Type vFunctionTypeAlias; | |
| 4484 '''); | |
| 4485 } else { | |
| 4486 checkElementText( | |
| 4487 library, | |
| 4488 r''' | |
| 4489 typedef F(int a, String b); | |
| 4490 enum E { a, b, c } | |
| 4491 class C { | |
| 4492 } | |
| 4493 class D<T> { | |
| 4494 } | |
| 4495 const vDynamic; | |
| 4496 const vNull; | |
| 4497 const vObject; | |
| 4498 const vClass; | |
| 4499 const vGenericClass; | |
| 4500 const vEnum; | |
| 4501 const vFunctionTypeAlias; | |
| 4502 '''); | |
| 4503 } | |
| 2239 } | 4504 } |
| 2240 | 4505 |
| 2241 test_const_reference_type_functionType() { | 4506 test_const_reference_type_functionType() { |
| 2242 checkLibrary(r''' | 4507 var library = checkLibrary(r''' |
| 2243 typedef F(); | 4508 typedef F(); |
| 2244 class C { | 4509 class C { |
| 2245 final f = <F>[]; | 4510 final f = <F>[]; |
| 2246 } | 4511 } |
| 2247 '''); | 4512 '''); |
| 4513 if (isStrongMode) { | |
| 4514 checkElementText( | |
| 4515 library, | |
| 4516 r''' | |
| 4517 typedef F(); | |
| 4518 class C { | |
| 4519 final List<F> f; | |
| 4520 } | |
| 4521 '''); | |
| 4522 } else { | |
| 4523 checkElementText( | |
| 4524 library, | |
| 4525 r''' | |
| 4526 typedef F(); | |
| 4527 class C { | |
| 4528 final f; | |
| 4529 } | |
| 4530 '''); | |
| 4531 } | |
| 2248 } | 4532 } |
| 2249 | 4533 |
| 2250 test_const_reference_type_imported() { | 4534 test_const_reference_type_imported() { |
| 2251 addLibrarySource( | 4535 addLibrarySource( |
| 2252 '/a.dart', | 4536 '/a.dart', |
| 2253 r''' | 4537 r''' |
| 2254 class C {} | 4538 class C {} |
| 2255 enum E {a, b, c} | 4539 enum E {a, b, c} |
| 2256 typedef F(int a, String b); | 4540 typedef F(int a, String b); |
| 2257 '''); | 4541 '''); |
| 2258 checkLibrary(r''' | 4542 var library = checkLibrary(r''' |
| 2259 import 'a.dart'; | 4543 import 'a.dart'; |
| 2260 const vClass = C; | 4544 const vClass = C; |
| 2261 const vEnum = E; | 4545 const vEnum = E; |
| 2262 const vFunctionTypeAlias = F; | 4546 const vFunctionTypeAlias = F; |
| 2263 '''); | 4547 '''); |
| 4548 if (isStrongMode) { | |
| 4549 checkElementText( | |
| 4550 library, | |
| 4551 r''' | |
| 4552 import 'a.dart'; | |
| 4553 const Type vClass; | |
| 4554 const Type vEnum; | |
| 4555 const Type vFunctionTypeAlias; | |
| 4556 '''); | |
| 4557 } else { | |
| 4558 checkElementText( | |
| 4559 library, | |
| 4560 r''' | |
| 4561 import 'a.dart'; | |
| 4562 const vClass; | |
| 4563 const vEnum; | |
| 4564 const vFunctionTypeAlias; | |
| 4565 '''); | |
| 4566 } | |
| 2264 } | 4567 } |
| 2265 | 4568 |
| 2266 test_const_reference_type_imported_withPrefix() { | 4569 test_const_reference_type_imported_withPrefix() { |
| 2267 addLibrarySource( | 4570 addLibrarySource( |
| 2268 '/a.dart', | 4571 '/a.dart', |
| 2269 r''' | 4572 r''' |
| 2270 class C {} | 4573 class C {} |
| 2271 enum E {a, b, c} | 4574 enum E {a, b, c} |
| 2272 typedef F(int a, String b); | 4575 typedef F(int a, String b); |
| 2273 '''); | 4576 '''); |
| 2274 checkLibrary(r''' | 4577 var library = checkLibrary(r''' |
| 2275 import 'a.dart' as p; | 4578 import 'a.dart' as p; |
| 2276 const vClass = p.C; | 4579 const vClass = p.C; |
| 2277 const vEnum = p.E; | 4580 const vEnum = p.E; |
| 2278 const vFunctionTypeAlias = p.F; | 4581 const vFunctionTypeAlias = p.F; |
| 2279 '''); | 4582 '''); |
| 4583 if (isStrongMode) { | |
| 4584 checkElementText( | |
| 4585 library, | |
| 4586 r''' | |
| 4587 import 'a.dart' as p; | |
| 4588 const Type vClass; | |
| 4589 const Type vEnum; | |
| 4590 const Type vFunctionTypeAlias; | |
| 4591 '''); | |
| 4592 } else { | |
| 4593 checkElementText( | |
| 4594 library, | |
| 4595 r''' | |
| 4596 import 'a.dart' as p; | |
| 4597 const vClass; | |
| 4598 const vEnum; | |
| 4599 const vFunctionTypeAlias; | |
| 4600 '''); | |
| 4601 } | |
| 2280 } | 4602 } |
| 2281 | 4603 |
| 2282 test_const_reference_type_typeParameter() { | 4604 test_const_reference_type_typeParameter() { |
| 2283 checkLibrary(r''' | 4605 var library = checkLibrary(r''' |
| 2284 class C<T> { | 4606 class C<T> { |
| 2285 final f = <T>[]; | 4607 final f = <T>[]; |
| 2286 } | 4608 } |
| 2287 '''); | 4609 '''); |
| 4610 if (isStrongMode) { | |
| 4611 checkElementText( | |
| 4612 library, | |
| 4613 r''' | |
| 4614 class C<T> { | |
| 4615 final List<T> f; | |
| 4616 } | |
| 4617 '''); | |
| 4618 } else { | |
| 4619 checkElementText( | |
| 4620 library, | |
| 4621 r''' | |
| 4622 class C<T> { | |
| 4623 final f; | |
| 4624 } | |
| 4625 '''); | |
| 4626 } | |
| 2288 } | 4627 } |
| 2289 | 4628 |
| 2290 test_const_reference_unresolved_prefix0() { | 4629 test_const_reference_unresolved_prefix0() { |
| 2291 checkLibrary( | 4630 var library = checkLibrary( |
| 2292 r''' | 4631 r''' |
| 2293 const V = foo; | 4632 const V = foo; |
| 2294 ''', | 4633 ''', |
| 2295 allowErrors: true); | 4634 allowErrors: true); |
| 4635 if (isStrongMode) { | |
| 4636 checkElementText( | |
| 4637 library, | |
| 4638 r''' | |
| 4639 const V; | |
| 4640 '''); | |
| 4641 } else { | |
| 4642 checkElementText( | |
| 4643 library, | |
| 4644 r''' | |
| 4645 const V; | |
| 4646 '''); | |
| 4647 } | |
| 2296 } | 4648 } |
| 2297 | 4649 |
| 2298 test_const_reference_unresolved_prefix1() { | 4650 test_const_reference_unresolved_prefix1() { |
| 2299 checkLibrary( | 4651 var library = checkLibrary( |
| 2300 r''' | 4652 r''' |
| 2301 class C {} | 4653 class C {} |
| 2302 const v = C.foo; | 4654 const v = C.foo; |
| 2303 ''', | 4655 ''', |
| 2304 allowErrors: true); | 4656 allowErrors: true); |
| 4657 if (isStrongMode) { | |
| 4658 checkElementText( | |
| 4659 library, | |
| 4660 r''' | |
| 4661 class C { | |
| 4662 } | |
| 4663 const v; | |
| 4664 '''); | |
| 4665 } else { | |
| 4666 checkElementText( | |
| 4667 library, | |
| 4668 r''' | |
| 4669 class C { | |
| 4670 } | |
| 4671 const v; | |
| 4672 '''); | |
| 4673 } | |
| 2305 } | 4674 } |
| 2306 | 4675 |
| 2307 test_const_reference_unresolved_prefix2() { | 4676 test_const_reference_unresolved_prefix2() { |
| 2308 addLibrarySource( | 4677 addLibrarySource( |
| 2309 '/foo.dart', | 4678 '/foo.dart', |
| 2310 ''' | 4679 ''' |
| 2311 class C {} | 4680 class C {} |
| 2312 '''); | 4681 '''); |
| 2313 checkLibrary( | 4682 var library = checkLibrary( |
| 2314 r''' | 4683 r''' |
| 2315 import 'foo.dart' as p; | 4684 import 'foo.dart' as p; |
| 2316 const v = p.C.foo; | 4685 const v = p.C.foo; |
| 2317 ''', | 4686 ''', |
| 2318 allowErrors: true); | 4687 allowErrors: true); |
| 4688 if (isStrongMode) { | |
| 4689 checkElementText( | |
| 4690 library, | |
| 4691 r''' | |
| 4692 import 'foo.dart' as p; | |
| 4693 const v; | |
| 4694 '''); | |
| 4695 } else { | |
| 4696 checkElementText( | |
| 4697 library, | |
| 4698 r''' | |
| 4699 import 'foo.dart' as p; | |
| 4700 const v; | |
| 4701 '''); | |
| 4702 } | |
| 2319 } | 4703 } |
| 2320 | 4704 |
| 2321 test_const_topLevel_binary() { | 4705 test_const_topLevel_binary() { |
| 2322 checkLibrary(r''' | 4706 var library = checkLibrary(r''' |
| 2323 const vEqual = 1 == 2; | 4707 const vEqual = 1 == 2; |
| 2324 const vAnd = true && false; | 4708 const vAnd = true && false; |
| 2325 const vOr = false || true; | 4709 const vOr = false || true; |
| 2326 const vBitXor = 1 ^ 2; | 4710 const vBitXor = 1 ^ 2; |
| 2327 const vBitAnd = 1 & 2; | 4711 const vBitAnd = 1 & 2; |
| 2328 const vBitOr = 1 | 2; | 4712 const vBitOr = 1 | 2; |
| 2329 const vBitShiftLeft = 1 << 2; | 4713 const vBitShiftLeft = 1 << 2; |
| 2330 const vBitShiftRight = 1 >> 2; | 4714 const vBitShiftRight = 1 >> 2; |
| 2331 const vAdd = 1 + 2; | 4715 const vAdd = 1 + 2; |
| 2332 const vSubtract = 1 - 2; | 4716 const vSubtract = 1 - 2; |
| 2333 const vMiltiply = 1 * 2; | 4717 const vMiltiply = 1 * 2; |
| 2334 const vDivide = 1 / 2; | 4718 const vDivide = 1 / 2; |
| 2335 const vFloorDivide = 1 ~/ 2; | 4719 const vFloorDivide = 1 ~/ 2; |
| 2336 const vModulo = 1 % 2; | 4720 const vModulo = 1 % 2; |
| 2337 const vGreater = 1 > 2; | 4721 const vGreater = 1 > 2; |
| 2338 const vGreaterEqual = 1 >= 2; | 4722 const vGreaterEqual = 1 >= 2; |
| 2339 const vLess = 1 < 2; | 4723 const vLess = 1 < 2; |
| 2340 const vLessEqual = 1 <= 2; | 4724 const vLessEqual = 1 <= 2; |
| 2341 '''); | 4725 '''); |
| 4726 if (isStrongMode) { | |
| 4727 checkElementText( | |
| 4728 library, | |
| 4729 r''' | |
| 4730 const bool vEqual; | |
| 4731 const bool vAnd; | |
| 4732 const bool vOr; | |
| 4733 const int vBitXor; | |
| 4734 const int vBitAnd; | |
| 4735 const int vBitOr; | |
| 4736 const int vBitShiftLeft; | |
| 4737 const int vBitShiftRight; | |
| 4738 const int vAdd; | |
| 4739 const int vSubtract; | |
| 4740 const int vMiltiply; | |
| 4741 const num vDivide; | |
| 4742 const int vFloorDivide; | |
| 4743 const int vModulo; | |
| 4744 const bool vGreater; | |
| 4745 const bool vGreaterEqual; | |
| 4746 const bool vLess; | |
| 4747 const bool vLessEqual; | |
| 4748 '''); | |
| 4749 } else { | |
| 4750 checkElementText( | |
| 4751 library, | |
| 4752 r''' | |
| 4753 const vEqual; | |
| 4754 const vAnd; | |
| 4755 const vOr; | |
| 4756 const vBitXor; | |
| 4757 const vBitAnd; | |
| 4758 const vBitOr; | |
| 4759 const vBitShiftLeft; | |
| 4760 const vBitShiftRight; | |
| 4761 const vAdd; | |
| 4762 const vSubtract; | |
| 4763 const vMiltiply; | |
| 4764 const vDivide; | |
| 4765 const vFloorDivide; | |
| 4766 const vModulo; | |
| 4767 const vGreater; | |
| 4768 const vGreaterEqual; | |
| 4769 const vLess; | |
| 4770 const vLessEqual; | |
| 4771 '''); | |
| 4772 } | |
| 2342 } | 4773 } |
| 2343 | 4774 |
| 2344 test_const_topLevel_conditional() { | 4775 test_const_topLevel_conditional() { |
| 2345 checkLibrary(r''' | 4776 var library = checkLibrary(r''' |
| 2346 const vConditional = (1 == 2) ? 11 : 22; | 4777 const vConditional = (1 == 2) ? 11 : 22; |
| 2347 '''); | 4778 '''); |
| 4779 if (isStrongMode) { | |
| 4780 checkElementText( | |
| 4781 library, | |
| 4782 r''' | |
| 4783 const int vConditional; | |
| 4784 '''); | |
| 4785 } else { | |
| 4786 checkElementText( | |
| 4787 library, | |
| 4788 r''' | |
| 4789 const vConditional; | |
| 4790 '''); | |
| 4791 } | |
| 2348 } | 4792 } |
| 2349 | 4793 |
| 2350 test_const_topLevel_identical() { | 4794 test_const_topLevel_identical() { |
| 2351 checkLibrary(r''' | 4795 var library = checkLibrary(r''' |
| 2352 const vIdentical = (1 == 2) ? 11 : 22; | 4796 const vIdentical = (1 == 2) ? 11 : 22; |
| 2353 '''); | 4797 '''); |
| 4798 if (isStrongMode) { | |
| 4799 checkElementText( | |
| 4800 library, | |
| 4801 r''' | |
| 4802 const int vIdentical; | |
| 4803 '''); | |
| 4804 } else { | |
| 4805 checkElementText( | |
| 4806 library, | |
| 4807 r''' | |
| 4808 const vIdentical; | |
| 4809 '''); | |
| 4810 } | |
| 2354 } | 4811 } |
| 2355 | 4812 |
| 2356 test_const_topLevel_ifNull() { | 4813 test_const_topLevel_ifNull() { |
| 2357 checkLibrary(r''' | 4814 var library = checkLibrary(r''' |
| 2358 const vIfNull = 1 ?? 2.0; | 4815 const vIfNull = 1 ?? 2.0; |
| 2359 '''); | 4816 '''); |
| 4817 if (isStrongMode) { | |
| 4818 checkElementText( | |
| 4819 library, | |
| 4820 r''' | |
| 4821 const num vIfNull; | |
| 4822 '''); | |
| 4823 } else { | |
| 4824 checkElementText( | |
| 4825 library, | |
| 4826 r''' | |
| 4827 const vIfNull; | |
| 4828 '''); | |
| 4829 } | |
| 2360 } | 4830 } |
| 2361 | 4831 |
| 2362 test_const_topLevel_literal() { | 4832 test_const_topLevel_literal() { |
| 2363 checkLibrary(r''' | 4833 var library = checkLibrary(r''' |
| 2364 const vNull = null; | 4834 const vNull = null; |
| 2365 const vBoolFalse = false; | 4835 const vBoolFalse = false; |
| 2366 const vBoolTrue = true; | 4836 const vBoolTrue = true; |
| 2367 const vInt = 1; | 4837 const vInt = 1; |
| 2368 const vIntLong = 0x9876543210987654321; | 4838 const vIntLong = 0x9876543210987654321; |
| 2369 const vDouble = 2.3; | 4839 const vDouble = 2.3; |
| 2370 const vString = 'abc'; | 4840 const vString = 'abc'; |
| 2371 const vStringConcat = 'aaa' 'bbb'; | 4841 const vStringConcat = 'aaa' 'bbb'; |
| 2372 const vStringInterpolation = 'aaa ${true} ${42} bbb'; | 4842 const vStringInterpolation = 'aaa ${true} ${42} bbb'; |
| 2373 const vSymbol = #aaa.bbb.ccc; | 4843 const vSymbol = #aaa.bbb.ccc; |
| 2374 '''); | 4844 '''); |
| 4845 if (isStrongMode) { | |
| 4846 checkElementText( | |
| 4847 library, | |
| 4848 r''' | |
| 4849 const vNull; | |
| 4850 const bool vBoolFalse; | |
| 4851 const bool vBoolTrue; | |
| 4852 const int vInt; | |
| 4853 const int vIntLong; | |
| 4854 const double vDouble; | |
| 4855 const String vString; | |
| 4856 const String vStringConcat; | |
| 4857 const String vStringInterpolation; | |
| 4858 const Symbol vSymbol; | |
| 4859 '''); | |
| 4860 } else { | |
| 4861 checkElementText( | |
| 4862 library, | |
| 4863 r''' | |
| 4864 const vNull; | |
| 4865 const vBoolFalse; | |
| 4866 const vBoolTrue; | |
| 4867 const vInt; | |
| 4868 const vIntLong; | |
| 4869 const vDouble; | |
| 4870 const vString; | |
| 4871 const vStringConcat; | |
| 4872 const vStringInterpolation; | |
| 4873 const vSymbol; | |
| 4874 '''); | |
| 4875 } | |
| 2375 } | 4876 } |
| 2376 | 4877 |
| 2377 test_const_topLevel_prefix() { | 4878 test_const_topLevel_prefix() { |
| 2378 checkLibrary(r''' | 4879 var library = checkLibrary(r''' |
| 2379 const vNotEqual = 1 != 2; | 4880 const vNotEqual = 1 != 2; |
| 2380 const vNot = !true; | 4881 const vNot = !true; |
| 2381 const vNegate = -1; | 4882 const vNegate = -1; |
| 2382 const vComplement = ~1; | 4883 const vComplement = ~1; |
| 2383 '''); | 4884 '''); |
| 4885 if (isStrongMode) { | |
| 4886 checkElementText( | |
| 4887 library, | |
| 4888 r''' | |
| 4889 const bool vNotEqual; | |
| 4890 const bool vNot; | |
| 4891 const int vNegate; | |
| 4892 const int vComplement; | |
| 4893 '''); | |
| 4894 } else { | |
| 4895 checkElementText( | |
| 4896 library, | |
| 4897 r''' | |
| 4898 const vNotEqual; | |
| 4899 const vNot; | |
| 4900 const vNegate; | |
| 4901 const vComplement; | |
| 4902 '''); | |
| 4903 } | |
| 2384 } | 4904 } |
| 2385 | 4905 |
| 2386 test_const_topLevel_super() { | 4906 test_const_topLevel_super() { |
| 2387 checkLibrary(r''' | 4907 var library = checkLibrary(r''' |
| 2388 const vSuper = super; | 4908 const vSuper = super; |
| 2389 '''); | 4909 '''); |
| 4910 if (isStrongMode) { | |
| 4911 checkElementText( | |
| 4912 library, | |
| 4913 r''' | |
| 4914 const vSuper; | |
| 4915 '''); | |
| 4916 } else { | |
| 4917 checkElementText( | |
| 4918 library, | |
| 4919 r''' | |
| 4920 const vSuper; | |
| 4921 '''); | |
| 4922 } | |
| 2390 } | 4923 } |
| 2391 | 4924 |
| 2392 test_const_topLevel_this() { | 4925 test_const_topLevel_this() { |
| 2393 checkLibrary(r''' | 4926 var library = checkLibrary(r''' |
| 2394 const vThis = this; | 4927 const vThis = this; |
| 2395 '''); | 4928 '''); |
| 4929 if (isStrongMode) { | |
| 4930 checkElementText( | |
| 4931 library, | |
| 4932 r''' | |
| 4933 const vThis; | |
| 4934 '''); | |
| 4935 } else { | |
| 4936 checkElementText( | |
| 4937 library, | |
| 4938 r''' | |
| 4939 const vThis; | |
| 4940 '''); | |
| 4941 } | |
| 2396 } | 4942 } |
| 2397 | 4943 |
| 2398 test_const_topLevel_typedList() { | 4944 test_const_topLevel_typedList() { |
| 2399 checkLibrary(r''' | 4945 var library = checkLibrary(r''' |
| 2400 const vNull = const <Null>[]; | 4946 const vNull = const <Null>[]; |
| 2401 const vDynamic = const <dynamic>[1, 2, 3]; | 4947 const vDynamic = const <dynamic>[1, 2, 3]; |
| 2402 const vInterfaceNoTypeParameters = const <int>[1, 2, 3]; | 4948 const vInterfaceNoTypeParameters = const <int>[1, 2, 3]; |
| 2403 const vInterfaceNoTypeArguments = const <List>[]; | 4949 const vInterfaceNoTypeArguments = const <List>[]; |
| 2404 const vInterfaceWithTypeArguments = const <List<String>>[]; | 4950 const vInterfaceWithTypeArguments = const <List<String>>[]; |
| 2405 const vInterfaceWithTypeArguments2 = const <Map<int, List<String>>>[]; | 4951 const vInterfaceWithTypeArguments2 = const <Map<int, List<String>>>[]; |
| 2406 '''); | 4952 '''); |
| 4953 if (isStrongMode) { | |
| 4954 checkElementText( | |
| 4955 library, | |
| 4956 r''' | |
| 4957 const List<Null> vNull; | |
| 4958 const List vDynamic; | |
| 4959 const List<int> vInterfaceNoTypeParameters; | |
| 4960 const List<List> vInterfaceNoTypeArguments; | |
| 4961 const List<List<String>> vInterfaceWithTypeArguments; | |
| 4962 const List<Map<int, List<String>>> vInterfaceWithTypeArguments2; | |
| 4963 '''); | |
| 4964 } else { | |
| 4965 checkElementText( | |
| 4966 library, | |
| 4967 r''' | |
| 4968 const vNull; | |
| 4969 const vDynamic; | |
| 4970 const vInterfaceNoTypeParameters; | |
| 4971 const vInterfaceNoTypeArguments; | |
| 4972 const vInterfaceWithTypeArguments; | |
| 4973 const vInterfaceWithTypeArguments2; | |
| 4974 '''); | |
| 4975 } | |
| 2407 } | 4976 } |
| 2408 | 4977 |
| 2409 test_const_topLevel_typedList_imported() { | 4978 test_const_topLevel_typedList_imported() { |
| 2410 addLibrarySource('/a.dart', 'class C {}'); | 4979 addLibrarySource('/a.dart', 'class C {}'); |
| 2411 checkLibrary(r''' | 4980 var library = checkLibrary(r''' |
| 2412 import 'a.dart'; | 4981 import 'a.dart'; |
| 2413 const v = const <C>[]; | 4982 const v = const <C>[]; |
| 2414 '''); | 4983 '''); |
| 4984 if (isStrongMode) { | |
| 4985 checkElementText( | |
| 4986 library, | |
| 4987 r''' | |
| 4988 import 'a.dart'; | |
| 4989 const List<C> v; | |
| 4990 '''); | |
| 4991 } else { | |
| 4992 checkElementText( | |
| 4993 library, | |
| 4994 r''' | |
| 4995 import 'a.dart'; | |
| 4996 const v; | |
| 4997 '''); | |
| 4998 } | |
| 2415 } | 4999 } |
| 2416 | 5000 |
| 2417 test_const_topLevel_typedList_importedWithPrefix() { | 5001 test_const_topLevel_typedList_importedWithPrefix() { |
| 2418 addLibrarySource('/a.dart', 'class C {}'); | 5002 addLibrarySource('/a.dart', 'class C {}'); |
| 2419 checkLibrary(r''' | 5003 var library = checkLibrary(r''' |
| 2420 import 'a.dart' as p; | 5004 import 'a.dart' as p; |
| 2421 const v = const <p.C>[]; | 5005 const v = const <p.C>[]; |
| 2422 '''); | 5006 '''); |
| 5007 if (isStrongMode) { | |
| 5008 checkElementText( | |
| 5009 library, | |
| 5010 r''' | |
| 5011 import 'a.dart' as p; | |
| 5012 const List<C> v; | |
| 5013 '''); | |
| 5014 } else { | |
| 5015 checkElementText( | |
| 5016 library, | |
| 5017 r''' | |
| 5018 import 'a.dart' as p; | |
| 5019 const v; | |
| 5020 '''); | |
| 5021 } | |
| 2423 } | 5022 } |
| 2424 | 5023 |
| 2425 test_const_topLevel_typedMap() { | 5024 test_const_topLevel_typedMap() { |
| 2426 checkLibrary(r''' | 5025 var library = checkLibrary(r''' |
| 2427 const vDynamic1 = const <dynamic, int>{}; | 5026 const vDynamic1 = const <dynamic, int>{}; |
| 2428 const vDynamic2 = const <int, dynamic>{}; | 5027 const vDynamic2 = const <int, dynamic>{}; |
| 2429 const vInterface = const <int, String>{}; | 5028 const vInterface = const <int, String>{}; |
| 2430 const vInterfaceWithTypeArguments = const <int, List<String>>{}; | 5029 const vInterfaceWithTypeArguments = const <int, List<String>>{}; |
| 2431 '''); | 5030 '''); |
| 5031 if (isStrongMode) { | |
| 5032 checkElementText( | |
| 5033 library, | |
| 5034 r''' | |
| 5035 const Map<dynamic, int> vDynamic1; | |
| 5036 const Map<int, dynamic> vDynamic2; | |
| 5037 const Map<int, String> vInterface; | |
| 5038 const Map<int, List<String>> vInterfaceWithTypeArguments; | |
| 5039 '''); | |
| 5040 } else { | |
| 5041 checkElementText( | |
| 5042 library, | |
| 5043 r''' | |
| 5044 const vDynamic1; | |
| 5045 const vDynamic2; | |
| 5046 const vInterface; | |
| 5047 const vInterfaceWithTypeArguments; | |
| 5048 '''); | |
| 5049 } | |
| 2432 } | 5050 } |
| 2433 | 5051 |
| 2434 test_const_topLevel_untypedList() { | 5052 test_const_topLevel_untypedList() { |
| 2435 checkLibrary(r''' | 5053 var library = checkLibrary(r''' |
| 2436 const v = const [1, 2, 3]; | 5054 const v = const [1, 2, 3]; |
| 2437 '''); | 5055 '''); |
| 5056 if (isStrongMode) { | |
| 5057 checkElementText( | |
| 5058 library, | |
| 5059 r''' | |
| 5060 const List<int> v; | |
| 5061 '''); | |
| 5062 } else { | |
| 5063 checkElementText( | |
| 5064 library, | |
| 5065 r''' | |
| 5066 const v; | |
| 5067 '''); | |
| 5068 } | |
| 2438 } | 5069 } |
| 2439 | 5070 |
| 2440 test_const_topLevel_untypedMap() { | 5071 test_const_topLevel_untypedMap() { |
| 2441 checkLibrary(r''' | 5072 var library = checkLibrary(r''' |
| 2442 const v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'}; | 5073 const v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'}; |
| 2443 '''); | 5074 '''); |
| 5075 if (isStrongMode) { | |
| 5076 checkElementText( | |
| 5077 library, | |
| 5078 r''' | |
| 5079 const Map<int, String> v; | |
| 5080 '''); | |
| 5081 } else { | |
| 5082 checkElementText( | |
| 5083 library, | |
| 5084 r''' | |
| 5085 const v; | |
| 5086 '''); | |
| 5087 } | |
| 2444 } | 5088 } |
| 2445 | 5089 |
| 2446 test_constExpr_pushReference_field_simpleIdentifier() { | 5090 test_constExpr_pushReference_field_simpleIdentifier() { |
| 2447 checkLibrary(''' | 5091 var library = checkLibrary(''' |
| 2448 class C { | 5092 class C { |
| 2449 static const a = b; | 5093 static const a = b; |
| 2450 static const b = null; | 5094 static const b = null; |
| 2451 } | 5095 } |
| 2452 '''); | 5096 '''); |
| 5097 if (isStrongMode) { | |
| 5098 checkElementText( | |
| 5099 library, | |
| 5100 r''' | |
| 5101 class C { | |
| 5102 static const a; | |
| 5103 static const b; | |
| 5104 } | |
| 5105 '''); | |
| 5106 } else { | |
| 5107 checkElementText( | |
| 5108 library, | |
| 5109 r''' | |
| 5110 class C { | |
| 5111 static const a; | |
| 5112 static const b; | |
| 5113 } | |
| 5114 '''); | |
| 5115 } | |
| 2453 } | 5116 } |
| 2454 | 5117 |
| 2455 test_constExpr_pushReference_staticMethod_simpleIdentifier() { | 5118 test_constExpr_pushReference_staticMethod_simpleIdentifier() { |
| 2456 checkLibrary(''' | 5119 var library = checkLibrary(''' |
| 2457 class C { | 5120 class C { |
| 2458 static const a = m; | 5121 static const a = m; |
| 2459 static m() {} | 5122 static m() {} |
| 2460 } | 5123 } |
| 2461 '''); | 5124 '''); |
| 5125 if (isStrongMode) { | |
| 5126 checkElementText( | |
| 5127 library, | |
| 5128 r''' | |
| 5129 class C { | |
| 5130 static const () → dynamic a; | |
| 5131 static m() {} | |
| 5132 } | |
| 5133 '''); | |
| 5134 } else { | |
| 5135 checkElementText( | |
| 5136 library, | |
| 5137 r''' | |
| 5138 class C { | |
| 5139 static const a; | |
| 5140 static m() {} | |
| 5141 } | |
| 5142 '''); | |
| 5143 } | |
| 2462 } | 5144 } |
| 2463 | 5145 |
| 2464 test_constructor_documented() { | 5146 test_constructor_documented() { |
| 2465 checkLibrary(''' | 5147 var library = checkLibrary(''' |
| 2466 class C { | 5148 class C { |
| 2467 /** | 5149 /** |
| 2468 * Docs | 5150 * Docs |
| 2469 */ | 5151 */ |
| 2470 C(); | 5152 C(); |
| 2471 }'''); | 5153 }'''); |
| 5154 if (isStrongMode) { | |
| 5155 checkElementText( | |
| 5156 library, | |
| 5157 r''' | |
| 5158 class C { | |
| 5159 C(); | |
| 5160 } | |
| 5161 '''); | |
| 5162 } else { | |
| 5163 checkElementText( | |
| 5164 library, | |
| 5165 r''' | |
| 5166 class C { | |
| 5167 C(); | |
| 5168 } | |
| 5169 '''); | |
| 5170 } | |
| 2472 } | 5171 } |
| 2473 | 5172 |
| 2474 test_constructor_initializers_assertInvocation() { | 5173 test_constructor_initializers_assertInvocation() { |
| 2475 checkLibrary(''' | 5174 var library = checkLibrary(''' |
| 2476 class C { | 5175 class C { |
| 2477 const C(int x) : assert(x >= 42); | 5176 const C(int x) : assert(x >= 42); |
| 2478 } | 5177 } |
| 2479 '''); | 5178 '''); |
| 5179 if (isStrongMode) { | |
| 5180 checkElementText( | |
| 5181 library, | |
| 5182 r''' | |
| 5183 class C { | |
| 5184 C(int x); | |
| 5185 } | |
| 5186 '''); | |
| 5187 } else { | |
| 5188 checkElementText( | |
| 5189 library, | |
| 5190 r''' | |
| 5191 class C { | |
| 5192 C(int x); | |
| 5193 } | |
| 5194 '''); | |
| 5195 } | |
| 2480 } | 5196 } |
| 2481 | 5197 |
| 2482 test_constructor_initializers_assertInvocation_message() { | 5198 test_constructor_initializers_assertInvocation_message() { |
| 2483 checkLibrary(''' | 5199 var library = checkLibrary(''' |
| 2484 class C { | 5200 class C { |
| 2485 const C(int x) : assert(x >= 42, 'foo'); | 5201 const C(int x) : assert(x >= 42, 'foo'); |
| 2486 } | 5202 } |
| 2487 '''); | 5203 '''); |
| 5204 if (isStrongMode) { | |
| 5205 checkElementText( | |
| 5206 library, | |
| 5207 r''' | |
| 5208 class C { | |
| 5209 C(int x); | |
| 5210 } | |
| 5211 '''); | |
| 5212 } else { | |
| 5213 checkElementText( | |
| 5214 library, | |
| 5215 r''' | |
| 5216 class C { | |
| 5217 C(int x); | |
| 5218 } | |
| 5219 '''); | |
| 5220 } | |
| 2488 } | 5221 } |
| 2489 | 5222 |
| 2490 test_constructor_initializers_field() { | 5223 test_constructor_initializers_field() { |
| 2491 checkLibrary(''' | 5224 var library = checkLibrary(''' |
| 2492 class C { | 5225 class C { |
| 2493 final x; | 5226 final x; |
| 2494 const C() : x = 42; | 5227 const C() : x = 42; |
| 2495 } | 5228 } |
| 2496 '''); | 5229 '''); |
| 5230 if (isStrongMode) { | |
| 5231 checkElementText( | |
| 5232 library, | |
| 5233 r''' | |
| 5234 class C { | |
| 5235 final x; | |
| 5236 C(); | |
| 5237 } | |
| 5238 '''); | |
| 5239 } else { | |
| 5240 checkElementText( | |
| 5241 library, | |
| 5242 r''' | |
| 5243 class C { | |
| 5244 final x; | |
| 5245 C(); | |
| 5246 } | |
| 5247 '''); | |
| 5248 } | |
| 2497 } | 5249 } |
| 2498 | 5250 |
| 2499 test_constructor_initializers_field_notConst() { | 5251 test_constructor_initializers_field_notConst() { |
| 2500 variablesWithNotConstInitializers.add('x'); | 5252 variablesWithNotConstInitializers.add('x'); |
| 2501 checkLibrary( | 5253 var library = checkLibrary( |
| 2502 ''' | 5254 ''' |
| 2503 class C { | 5255 class C { |
| 2504 final x; | 5256 final x; |
| 2505 const A() : x = foo(); | 5257 const A() : x = foo(); |
| 2506 } | 5258 } |
| 2507 int foo() => 42; | 5259 int foo() => 42; |
| 2508 ''', | 5260 ''', |
| 2509 allowErrors: true); | 5261 allowErrors: true); |
| 5262 if (isStrongMode) { | |
| 5263 checkElementText( | |
| 5264 library, | |
| 5265 r''' | |
| 5266 class C { | |
| 5267 final x; | |
| 5268 C(); | |
| 5269 } | |
| 5270 int foo() {} | |
| 5271 '''); | |
| 5272 } else { | |
| 5273 checkElementText( | |
| 5274 library, | |
| 5275 r''' | |
| 5276 class C { | |
| 5277 final x; | |
| 5278 C(); | |
| 5279 } | |
| 5280 int foo() {} | |
| 5281 '''); | |
| 5282 } | |
| 2510 } | 5283 } |
| 2511 | 5284 |
| 2512 test_constructor_initializers_field_withParameter() { | 5285 test_constructor_initializers_field_withParameter() { |
| 2513 checkLibrary(''' | 5286 var library = checkLibrary(''' |
| 2514 class C { | 5287 class C { |
| 2515 final x; | 5288 final x; |
| 2516 const C(int p) : x = 1 + p; | 5289 const C(int p) : x = 1 + p; |
| 2517 } | 5290 } |
| 2518 '''); | 5291 '''); |
| 5292 if (isStrongMode) { | |
| 5293 checkElementText( | |
| 5294 library, | |
| 5295 r''' | |
| 5296 class C { | |
| 5297 final x; | |
| 5298 C(int p); | |
| 5299 } | |
| 5300 '''); | |
| 5301 } else { | |
| 5302 checkElementText( | |
| 5303 library, | |
| 5304 r''' | |
| 5305 class C { | |
| 5306 final x; | |
| 5307 C(int p); | |
| 5308 } | |
| 5309 '''); | |
| 5310 } | |
| 2519 } | 5311 } |
| 2520 | 5312 |
| 2521 test_constructor_initializers_superInvocation_named() { | 5313 test_constructor_initializers_superInvocation_named() { |
| 2522 checkLibrary(''' | 5314 var library = checkLibrary(''' |
| 2523 class A { | 5315 class A { |
| 2524 const A.aaa(int p); | 5316 const A.aaa(int p); |
| 2525 } | 5317 } |
| 2526 class C extends A { | 5318 class C extends A { |
| 2527 const C() : super.aaa(42); | 5319 const C() : super.aaa(42); |
| 2528 } | 5320 } |
| 2529 '''); | 5321 '''); |
| 5322 if (isStrongMode) { | |
| 5323 checkElementText( | |
| 5324 library, | |
| 5325 r''' | |
| 5326 class A { | |
| 5327 A.aaa(int p); | |
| 5328 } | |
| 5329 class C extends A { | |
| 5330 C(); | |
| 5331 } | |
| 5332 '''); | |
| 5333 } else { | |
| 5334 checkElementText( | |
| 5335 library, | |
| 5336 r''' | |
| 5337 class A { | |
| 5338 A.aaa(int p); | |
| 5339 } | |
| 5340 class C extends A { | |
| 5341 C(); | |
| 5342 } | |
| 5343 '''); | |
| 5344 } | |
| 2530 } | 5345 } |
| 2531 | 5346 |
| 2532 test_constructor_initializers_superInvocation_namedExpression() { | 5347 test_constructor_initializers_superInvocation_namedExpression() { |
| 2533 checkLibrary(''' | 5348 var library = checkLibrary(''' |
| 2534 class A { | 5349 class A { |
| 2535 const A.aaa(a, {int b}); | 5350 const A.aaa(a, {int b}); |
| 2536 } | 5351 } |
| 2537 class C extends A { | 5352 class C extends A { |
| 2538 const C() : super.aaa(1, b: 2); | 5353 const C() : super.aaa(1, b: 2); |
| 2539 } | 5354 } |
| 2540 '''); | 5355 '''); |
| 5356 if (isStrongMode) { | |
| 5357 checkElementText( | |
| 5358 library, | |
| 5359 r''' | |
| 5360 class A { | |
| 5361 A.aaa(a, {int b}); | |
| 5362 } | |
| 5363 class C extends A { | |
| 5364 C(); | |
| 5365 } | |
| 5366 '''); | |
| 5367 } else { | |
| 5368 checkElementText( | |
| 5369 library, | |
| 5370 r''' | |
| 5371 class A { | |
| 5372 A.aaa(a, {int b}); | |
| 5373 } | |
| 5374 class C extends A { | |
| 5375 C(); | |
| 5376 } | |
| 5377 '''); | |
| 5378 } | |
| 2541 } | 5379 } |
| 2542 | 5380 |
| 2543 test_constructor_initializers_superInvocation_unnamed() { | 5381 test_constructor_initializers_superInvocation_unnamed() { |
| 2544 checkLibrary(''' | 5382 var library = checkLibrary(''' |
| 2545 class A { | 5383 class A { |
| 2546 const A(int p); | 5384 const A(int p); |
| 2547 } | 5385 } |
| 2548 class C extends A { | 5386 class C extends A { |
| 2549 const C.ccc() : super(42); | 5387 const C.ccc() : super(42); |
| 2550 } | 5388 } |
| 2551 '''); | 5389 '''); |
| 5390 if (isStrongMode) { | |
| 5391 checkElementText( | |
| 5392 library, | |
| 5393 r''' | |
| 5394 class A { | |
| 5395 A(int p); | |
| 5396 } | |
| 5397 class C extends A { | |
| 5398 C.ccc(); | |
| 5399 } | |
| 5400 '''); | |
| 5401 } else { | |
| 5402 checkElementText( | |
| 5403 library, | |
| 5404 r''' | |
| 5405 class A { | |
| 5406 A(int p); | |
| 5407 } | |
| 5408 class C extends A { | |
| 5409 C.ccc(); | |
| 5410 } | |
| 5411 '''); | |
| 5412 } | |
| 2552 } | 5413 } |
| 2553 | 5414 |
| 2554 test_constructor_initializers_thisInvocation_named() { | 5415 test_constructor_initializers_thisInvocation_named() { |
| 2555 checkLibrary(''' | 5416 var library = checkLibrary(''' |
| 2556 class C { | 5417 class C { |
| 2557 const C() : this.named(1, 'bbb'); | 5418 const C() : this.named(1, 'bbb'); |
| 2558 const C.named(int a, String b); | 5419 const C.named(int a, String b); |
| 2559 } | 5420 } |
| 2560 '''); | 5421 '''); |
| 5422 if (isStrongMode) { | |
| 5423 checkElementText( | |
| 5424 library, | |
| 5425 r''' | |
| 5426 class C { | |
| 5427 C(); | |
| 5428 C.named(int a, String b); | |
| 5429 } | |
| 5430 '''); | |
| 5431 } else { | |
| 5432 checkElementText( | |
| 5433 library, | |
| 5434 r''' | |
| 5435 class C { | |
| 5436 C(); | |
| 5437 C.named(int a, String b); | |
| 5438 } | |
| 5439 '''); | |
| 5440 } | |
| 2561 } | 5441 } |
| 2562 | 5442 |
| 2563 test_constructor_initializers_thisInvocation_namedExpression() { | 5443 test_constructor_initializers_thisInvocation_namedExpression() { |
| 2564 checkLibrary(''' | 5444 var library = checkLibrary(''' |
| 2565 class C { | 5445 class C { |
| 2566 const C() : this.named(1, b: 2); | 5446 const C() : this.named(1, b: 2); |
| 2567 const C.named(a, {int b}); | 5447 const C.named(a, {int b}); |
| 2568 } | 5448 } |
| 2569 '''); | 5449 '''); |
| 5450 if (isStrongMode) { | |
| 5451 checkElementText( | |
| 5452 library, | |
| 5453 r''' | |
| 5454 class C { | |
| 5455 C(); | |
| 5456 C.named(a, {int b}); | |
| 5457 } | |
| 5458 '''); | |
| 5459 } else { | |
| 5460 checkElementText( | |
| 5461 library, | |
| 5462 r''' | |
| 5463 class C { | |
| 5464 C(); | |
| 5465 C.named(a, {int b}); | |
| 5466 } | |
| 5467 '''); | |
| 5468 } | |
| 2570 } | 5469 } |
| 2571 | 5470 |
| 2572 test_constructor_initializers_thisInvocation_unnamed() { | 5471 test_constructor_initializers_thisInvocation_unnamed() { |
| 2573 checkLibrary(''' | 5472 var library = checkLibrary(''' |
| 2574 class C { | 5473 class C { |
| 2575 const C.named() : this(1, 'bbb'); | 5474 const C.named() : this(1, 'bbb'); |
| 2576 const C(int a, String b); | 5475 const C(int a, String b); |
| 2577 } | 5476 } |
| 2578 '''); | 5477 '''); |
| 5478 if (isStrongMode) { | |
| 5479 checkElementText( | |
| 5480 library, | |
| 5481 r''' | |
| 5482 class C { | |
| 5483 C.named(); | |
| 5484 C(int a, String b); | |
| 5485 } | |
| 5486 '''); | |
| 5487 } else { | |
| 5488 checkElementText( | |
| 5489 library, | |
| 5490 r''' | |
| 5491 class C { | |
| 5492 C.named(); | |
| 5493 C(int a, String b); | |
| 5494 } | |
| 5495 '''); | |
| 5496 } | |
| 2579 } | 5497 } |
| 2580 | 5498 |
| 2581 test_constructor_redirected_factory_named() { | 5499 test_constructor_redirected_factory_named() { |
| 2582 checkLibrary(''' | 5500 var library = checkLibrary(''' |
| 2583 class C { | 5501 class C { |
| 2584 factory C() = D.named; | 5502 factory C() = D.named; |
| 2585 C._(); | 5503 C._(); |
| 2586 } | 5504 } |
| 2587 class D extends C { | 5505 class D extends C { |
| 2588 D.named() : super._(); | 5506 D.named() : super._(); |
| 2589 } | 5507 } |
| 2590 '''); | 5508 '''); |
| 5509 if (isStrongMode) { | |
| 5510 checkElementText( | |
| 5511 library, | |
| 5512 r''' | |
| 5513 class C { | |
| 5514 C(); | |
| 5515 C._(); | |
| 5516 } | |
| 5517 class D extends C { | |
| 5518 D.named(); | |
| 5519 } | |
| 5520 '''); | |
| 5521 } else { | |
| 5522 checkElementText( | |
| 5523 library, | |
| 5524 r''' | |
| 5525 class C { | |
| 5526 C(); | |
| 5527 C._(); | |
| 5528 } | |
| 5529 class D extends C { | |
| 5530 D.named(); | |
| 5531 } | |
| 5532 '''); | |
| 5533 } | |
| 2591 } | 5534 } |
| 2592 | 5535 |
| 2593 test_constructor_redirected_factory_named_generic() { | 5536 test_constructor_redirected_factory_named_generic() { |
| 2594 checkLibrary(''' | 5537 var library = checkLibrary(''' |
| 2595 class C<T, U> { | 5538 class C<T, U> { |
| 2596 factory C() = D<U, T>.named; | 5539 factory C() = D<U, T>.named; |
| 2597 C._(); | 5540 C._(); |
| 2598 } | 5541 } |
| 2599 class D<T, U> extends C<U, T> { | 5542 class D<T, U> extends C<U, T> { |
| 2600 D.named() : super._(); | 5543 D.named() : super._(); |
| 2601 } | 5544 } |
| 2602 '''); | 5545 '''); |
| 5546 if (isStrongMode) { | |
| 5547 checkElementText( | |
| 5548 library, | |
| 5549 r''' | |
| 5550 class C<T, U> { | |
| 5551 C(); | |
| 5552 C._(); | |
| 5553 } | |
| 5554 class D<T, U> extends C<U, T> { | |
| 5555 D.named(); | |
| 5556 } | |
| 5557 '''); | |
| 5558 } else { | |
| 5559 checkElementText( | |
| 5560 library, | |
| 5561 r''' | |
| 5562 class C<T, U> { | |
| 5563 C(); | |
| 5564 C._(); | |
| 5565 } | |
| 5566 class D<T, U> extends C<U, T> { | |
| 5567 D.named(); | |
| 5568 } | |
| 5569 '''); | |
| 5570 } | |
| 2603 } | 5571 } |
| 2604 | 5572 |
| 2605 test_constructor_redirected_factory_named_imported() { | 5573 test_constructor_redirected_factory_named_imported() { |
| 2606 addLibrarySource( | 5574 addLibrarySource( |
| 2607 '/foo.dart', | 5575 '/foo.dart', |
| 2608 ''' | 5576 ''' |
| 2609 import 'test.dart'; | 5577 import 'test.dart'; |
| 2610 class D extends C { | 5578 class D extends C { |
| 2611 D.named() : super._(); | 5579 D.named() : super._(); |
| 2612 } | 5580 } |
| 2613 '''); | 5581 '''); |
| 2614 checkLibrary(''' | 5582 var library = checkLibrary(''' |
| 2615 import 'foo.dart'; | 5583 import 'foo.dart'; |
| 2616 class C { | 5584 class C { |
| 2617 factory C() = D.named; | 5585 factory C() = D.named; |
| 2618 C._(); | 5586 C._(); |
| 2619 } | 5587 } |
| 2620 '''); | 5588 '''); |
| 5589 if (isStrongMode) { | |
| 5590 checkElementText( | |
| 5591 library, | |
| 5592 r''' | |
| 5593 import 'foo.dart'; | |
| 5594 class C { | |
| 5595 C(); | |
| 5596 C._(); | |
| 5597 } | |
| 5598 '''); | |
| 5599 } else { | |
| 5600 checkElementText( | |
| 5601 library, | |
| 5602 r''' | |
| 5603 import 'foo.dart'; | |
| 5604 class C { | |
| 5605 C(); | |
| 5606 C._(); | |
| 5607 } | |
| 5608 '''); | |
| 5609 } | |
| 2621 } | 5610 } |
| 2622 | 5611 |
| 2623 test_constructor_redirected_factory_named_imported_generic() { | 5612 test_constructor_redirected_factory_named_imported_generic() { |
| 2624 addLibrarySource( | 5613 addLibrarySource( |
| 2625 '/foo.dart', | 5614 '/foo.dart', |
| 2626 ''' | 5615 ''' |
| 2627 import 'test.dart'; | 5616 import 'test.dart'; |
| 2628 class D<T, U> extends C<U, T> { | 5617 class D<T, U> extends C<U, T> { |
| 2629 D.named() : super._(); | 5618 D.named() : super._(); |
| 2630 } | 5619 } |
| 2631 '''); | 5620 '''); |
| 2632 checkLibrary(''' | 5621 var library = checkLibrary(''' |
| 2633 import 'foo.dart'; | 5622 import 'foo.dart'; |
| 2634 class C<T, U> { | 5623 class C<T, U> { |
| 2635 factory C() = D<U, T>.named; | 5624 factory C() = D<U, T>.named; |
| 2636 C._(); | 5625 C._(); |
| 2637 } | 5626 } |
| 2638 '''); | 5627 '''); |
| 5628 if (isStrongMode) { | |
| 5629 checkElementText( | |
| 5630 library, | |
| 5631 r''' | |
| 5632 import 'foo.dart'; | |
| 5633 class C<T, U> { | |
| 5634 C(); | |
| 5635 C._(); | |
| 5636 } | |
| 5637 '''); | |
| 5638 } else { | |
| 5639 checkElementText( | |
| 5640 library, | |
| 5641 r''' | |
| 5642 import 'foo.dart'; | |
| 5643 class C<T, U> { | |
| 5644 C(); | |
| 5645 C._(); | |
| 5646 } | |
| 5647 '''); | |
| 5648 } | |
| 2639 } | 5649 } |
| 2640 | 5650 |
| 2641 test_constructor_redirected_factory_named_prefixed() { | 5651 test_constructor_redirected_factory_named_prefixed() { |
| 2642 addLibrarySource( | 5652 addLibrarySource( |
| 2643 '/foo.dart', | 5653 '/foo.dart', |
| 2644 ''' | 5654 ''' |
| 2645 import 'test.dart'; | 5655 import 'test.dart'; |
| 2646 class D extends C { | 5656 class D extends C { |
| 2647 D.named() : super._(); | 5657 D.named() : super._(); |
| 2648 } | 5658 } |
| 2649 '''); | 5659 '''); |
| 2650 checkLibrary(''' | 5660 var library = checkLibrary(''' |
| 2651 import 'foo.dart' as foo; | 5661 import 'foo.dart' as foo; |
| 2652 class C { | 5662 class C { |
| 2653 factory C() = foo.D.named; | 5663 factory C() = foo.D.named; |
| 2654 C._(); | 5664 C._(); |
| 2655 } | 5665 } |
| 2656 '''); | 5666 '''); |
| 5667 if (isStrongMode) { | |
| 5668 checkElementText( | |
| 5669 library, | |
| 5670 r''' | |
| 5671 import 'foo.dart' as foo; | |
| 5672 class C { | |
| 5673 C(); | |
| 5674 C._(); | |
| 5675 } | |
| 5676 '''); | |
| 5677 } else { | |
| 5678 checkElementText( | |
| 5679 library, | |
| 5680 r''' | |
| 5681 import 'foo.dart' as foo; | |
| 5682 class C { | |
| 5683 C(); | |
| 5684 C._(); | |
| 5685 } | |
| 5686 '''); | |
| 5687 } | |
| 2657 } | 5688 } |
| 2658 | 5689 |
| 2659 test_constructor_redirected_factory_named_prefixed_generic() { | 5690 test_constructor_redirected_factory_named_prefixed_generic() { |
| 2660 addLibrarySource( | 5691 addLibrarySource( |
| 2661 '/foo.dart', | 5692 '/foo.dart', |
| 2662 ''' | 5693 ''' |
| 2663 import 'test.dart'; | 5694 import 'test.dart'; |
| 2664 class D<T, U> extends C<U, T> { | 5695 class D<T, U> extends C<U, T> { |
| 2665 D.named() : super._(); | 5696 D.named() : super._(); |
| 2666 } | 5697 } |
| 2667 '''); | 5698 '''); |
| 2668 checkLibrary(''' | 5699 var library = checkLibrary(''' |
| 2669 import 'foo.dart' as foo; | 5700 import 'foo.dart' as foo; |
| 2670 class C<T, U> { | 5701 class C<T, U> { |
| 2671 factory C() = foo.D<U, T>.named; | 5702 factory C() = foo.D<U, T>.named; |
| 2672 C._(); | 5703 C._(); |
| 2673 } | 5704 } |
| 2674 '''); | 5705 '''); |
| 5706 if (isStrongMode) { | |
| 5707 checkElementText( | |
| 5708 library, | |
| 5709 r''' | |
| 5710 import 'foo.dart' as foo; | |
| 5711 class C<T, U> { | |
| 5712 C(); | |
| 5713 C._(); | |
| 5714 } | |
| 5715 '''); | |
| 5716 } else { | |
| 5717 checkElementText( | |
| 5718 library, | |
| 5719 r''' | |
| 5720 import 'foo.dart' as foo; | |
| 5721 class C<T, U> { | |
| 5722 C(); | |
| 5723 C._(); | |
| 5724 } | |
| 5725 '''); | |
| 5726 } | |
| 2675 } | 5727 } |
| 2676 | 5728 |
| 2677 test_constructor_redirected_factory_named_unresolved_class() { | 5729 test_constructor_redirected_factory_named_unresolved_class() { |
| 2678 checkLibrary( | 5730 var library = checkLibrary( |
| 2679 ''' | 5731 ''' |
| 2680 class C<E> { | 5732 class C<E> { |
| 2681 factory C() = D.named<E>; | 5733 factory C() = D.named<E>; |
| 2682 } | 5734 } |
| 2683 ''', | 5735 ''', |
| 2684 allowErrors: true); | 5736 allowErrors: true); |
| 5737 if (isStrongMode) { | |
| 5738 checkElementText( | |
| 5739 library, | |
| 5740 r''' | |
| 5741 class C<E> { | |
| 5742 C(); | |
| 5743 } | |
| 5744 '''); | |
| 5745 } else { | |
| 5746 checkElementText( | |
| 5747 library, | |
| 5748 r''' | |
| 5749 class C<E> { | |
| 5750 C(); | |
| 5751 } | |
| 5752 '''); | |
| 5753 } | |
| 2685 } | 5754 } |
| 2686 | 5755 |
| 2687 test_constructor_redirected_factory_named_unresolved_constructor() { | 5756 test_constructor_redirected_factory_named_unresolved_constructor() { |
| 2688 checkLibrary( | 5757 var library = checkLibrary( |
| 2689 ''' | 5758 ''' |
| 2690 class D {} | 5759 class D {} |
| 2691 class C<E> { | 5760 class C<E> { |
| 2692 factory C() = D.named<E>; | 5761 factory C() = D.named<E>; |
| 2693 } | 5762 } |
| 2694 ''', | 5763 ''', |
| 2695 allowErrors: true); | 5764 allowErrors: true); |
| 5765 if (isStrongMode) { | |
| 5766 checkElementText( | |
| 5767 library, | |
| 5768 r''' | |
| 5769 class D { | |
| 5770 } | |
| 5771 class C<E> { | |
| 5772 C(); | |
| 5773 } | |
| 5774 '''); | |
| 5775 } else { | |
| 5776 checkElementText( | |
| 5777 library, | |
| 5778 r''' | |
| 5779 class D { | |
| 5780 } | |
| 5781 class C<E> { | |
| 5782 C(); | |
| 5783 } | |
| 5784 '''); | |
| 5785 } | |
| 2696 } | 5786 } |
| 2697 | 5787 |
| 2698 test_constructor_redirected_factory_unnamed() { | 5788 test_constructor_redirected_factory_unnamed() { |
| 2699 checkLibrary(''' | 5789 var library = checkLibrary(''' |
| 2700 class C { | 5790 class C { |
| 2701 factory C() = D; | 5791 factory C() = D; |
| 2702 C._(); | 5792 C._(); |
| 2703 } | 5793 } |
| 2704 class D extends C { | 5794 class D extends C { |
| 2705 D() : super._(); | 5795 D() : super._(); |
| 2706 } | 5796 } |
| 2707 '''); | 5797 '''); |
| 5798 if (isStrongMode) { | |
| 5799 checkElementText( | |
| 5800 library, | |
| 5801 r''' | |
| 5802 class C { | |
| 5803 C(); | |
| 5804 C._(); | |
| 5805 } | |
| 5806 class D extends C { | |
| 5807 D(); | |
| 5808 } | |
| 5809 '''); | |
| 5810 } else { | |
| 5811 checkElementText( | |
| 5812 library, | |
| 5813 r''' | |
| 5814 class C { | |
| 5815 C(); | |
| 5816 C._(); | |
| 5817 } | |
| 5818 class D extends C { | |
| 5819 D(); | |
| 5820 } | |
| 5821 '''); | |
| 5822 } | |
| 2708 } | 5823 } |
| 2709 | 5824 |
| 2710 test_constructor_redirected_factory_unnamed_generic() { | 5825 test_constructor_redirected_factory_unnamed_generic() { |
| 2711 checkLibrary(''' | 5826 var library = checkLibrary(''' |
| 2712 class C<T, U> { | 5827 class C<T, U> { |
| 2713 factory C() = D<U, T>; | 5828 factory C() = D<U, T>; |
| 2714 C._(); | 5829 C._(); |
| 2715 } | 5830 } |
| 2716 class D<T, U> extends C<U, T> { | 5831 class D<T, U> extends C<U, T> { |
| 2717 D() : super._(); | 5832 D() : super._(); |
| 2718 } | 5833 } |
| 2719 '''); | 5834 '''); |
| 5835 if (isStrongMode) { | |
| 5836 checkElementText( | |
| 5837 library, | |
| 5838 r''' | |
| 5839 class C<T, U> { | |
| 5840 C(); | |
| 5841 C._(); | |
| 5842 } | |
| 5843 class D<T, U> extends C<U, T> { | |
| 5844 D(); | |
| 5845 } | |
| 5846 '''); | |
| 5847 } else { | |
| 5848 checkElementText( | |
| 5849 library, | |
| 5850 r''' | |
| 5851 class C<T, U> { | |
| 5852 C(); | |
| 5853 C._(); | |
| 5854 } | |
| 5855 class D<T, U> extends C<U, T> { | |
| 5856 D(); | |
| 5857 } | |
| 5858 '''); | |
| 5859 } | |
| 2720 } | 5860 } |
| 2721 | 5861 |
| 2722 test_constructor_redirected_factory_unnamed_imported() { | 5862 test_constructor_redirected_factory_unnamed_imported() { |
| 2723 addLibrarySource( | 5863 addLibrarySource( |
| 2724 '/foo.dart', | 5864 '/foo.dart', |
| 2725 ''' | 5865 ''' |
| 2726 import 'test.dart'; | 5866 import 'test.dart'; |
| 2727 class D extends C { | 5867 class D extends C { |
| 2728 D() : super._(); | 5868 D() : super._(); |
| 2729 } | 5869 } |
| 2730 '''); | 5870 '''); |
| 2731 checkLibrary(''' | 5871 var library = checkLibrary(''' |
| 2732 import 'foo.dart'; | 5872 import 'foo.dart'; |
| 2733 class C { | 5873 class C { |
| 2734 factory C() = D; | 5874 factory C() = D; |
| 2735 C._(); | 5875 C._(); |
| 2736 } | 5876 } |
| 2737 '''); | 5877 '''); |
| 5878 if (isStrongMode) { | |
| 5879 checkElementText( | |
| 5880 library, | |
| 5881 r''' | |
| 5882 import 'foo.dart'; | |
| 5883 class C { | |
| 5884 C(); | |
| 5885 C._(); | |
| 5886 } | |
| 5887 '''); | |
| 5888 } else { | |
| 5889 checkElementText( | |
| 5890 library, | |
| 5891 r''' | |
| 5892 import 'foo.dart'; | |
| 5893 class C { | |
| 5894 C(); | |
| 5895 C._(); | |
| 5896 } | |
| 5897 '''); | |
| 5898 } | |
| 2738 } | 5899 } |
| 2739 | 5900 |
| 2740 test_constructor_redirected_factory_unnamed_imported_generic() { | 5901 test_constructor_redirected_factory_unnamed_imported_generic() { |
| 2741 addLibrarySource( | 5902 addLibrarySource( |
| 2742 '/foo.dart', | 5903 '/foo.dart', |
| 2743 ''' | 5904 ''' |
| 2744 import 'test.dart'; | 5905 import 'test.dart'; |
| 2745 class D<T, U> extends C<U, T> { | 5906 class D<T, U> extends C<U, T> { |
| 2746 D() : super._(); | 5907 D() : super._(); |
| 2747 } | 5908 } |
| 2748 '''); | 5909 '''); |
| 2749 checkLibrary(''' | 5910 var library = checkLibrary(''' |
| 2750 import 'foo.dart'; | 5911 import 'foo.dart'; |
| 2751 class C<T, U> { | 5912 class C<T, U> { |
| 2752 factory C() = D<U, T>; | 5913 factory C() = D<U, T>; |
| 2753 C._(); | 5914 C._(); |
| 2754 } | 5915 } |
| 2755 '''); | 5916 '''); |
| 5917 if (isStrongMode) { | |
| 5918 checkElementText( | |
| 5919 library, | |
| 5920 r''' | |
| 5921 import 'foo.dart'; | |
| 5922 class C<T, U> { | |
| 5923 C(); | |
| 5924 C._(); | |
| 5925 } | |
| 5926 '''); | |
| 5927 } else { | |
| 5928 checkElementText( | |
| 5929 library, | |
| 5930 r''' | |
| 5931 import 'foo.dart'; | |
| 5932 class C<T, U> { | |
| 5933 C(); | |
| 5934 C._(); | |
| 5935 } | |
| 5936 '''); | |
| 5937 } | |
| 2756 } | 5938 } |
| 2757 | 5939 |
| 2758 test_constructor_redirected_factory_unnamed_prefixed() { | 5940 test_constructor_redirected_factory_unnamed_prefixed() { |
| 2759 addLibrarySource( | 5941 addLibrarySource( |
| 2760 '/foo.dart', | 5942 '/foo.dart', |
| 2761 ''' | 5943 ''' |
| 2762 import 'test.dart'; | 5944 import 'test.dart'; |
| 2763 class D extends C { | 5945 class D extends C { |
| 2764 D() : super._(); | 5946 D() : super._(); |
| 2765 } | 5947 } |
| 2766 '''); | 5948 '''); |
| 2767 checkLibrary(''' | 5949 var library = checkLibrary(''' |
| 2768 import 'foo.dart' as foo; | 5950 import 'foo.dart' as foo; |
| 2769 class C { | 5951 class C { |
| 2770 factory C() = foo.D; | 5952 factory C() = foo.D; |
| 2771 C._(); | 5953 C._(); |
| 2772 } | 5954 } |
| 2773 '''); | 5955 '''); |
| 5956 if (isStrongMode) { | |
| 5957 checkElementText( | |
| 5958 library, | |
| 5959 r''' | |
| 5960 import 'foo.dart' as foo; | |
| 5961 class C { | |
| 5962 C(); | |
| 5963 C._(); | |
| 5964 } | |
| 5965 '''); | |
| 5966 } else { | |
| 5967 checkElementText( | |
| 5968 library, | |
| 5969 r''' | |
| 5970 import 'foo.dart' as foo; | |
| 5971 class C { | |
| 5972 C(); | |
| 5973 C._(); | |
| 5974 } | |
| 5975 '''); | |
| 5976 } | |
| 2774 } | 5977 } |
| 2775 | 5978 |
| 2776 test_constructor_redirected_factory_unnamed_prefixed_generic() { | 5979 test_constructor_redirected_factory_unnamed_prefixed_generic() { |
| 2777 addLibrarySource( | 5980 addLibrarySource( |
| 2778 '/foo.dart', | 5981 '/foo.dart', |
| 2779 ''' | 5982 ''' |
| 2780 import 'test.dart'; | 5983 import 'test.dart'; |
| 2781 class D<T, U> extends C<U, T> { | 5984 class D<T, U> extends C<U, T> { |
| 2782 D() : super._(); | 5985 D() : super._(); |
| 2783 } | 5986 } |
| 2784 '''); | 5987 '''); |
| 2785 checkLibrary(''' | 5988 var library = checkLibrary(''' |
| 2786 import 'foo.dart' as foo; | 5989 import 'foo.dart' as foo; |
| 2787 class C<T, U> { | 5990 class C<T, U> { |
| 2788 factory C() = foo.D<U, T>; | 5991 factory C() = foo.D<U, T>; |
| 2789 C._(); | 5992 C._(); |
| 2790 } | 5993 } |
| 2791 '''); | 5994 '''); |
| 5995 if (isStrongMode) { | |
| 5996 checkElementText( | |
| 5997 library, | |
| 5998 r''' | |
| 5999 import 'foo.dart' as foo; | |
| 6000 class C<T, U> { | |
| 6001 C(); | |
| 6002 C._(); | |
| 6003 } | |
| 6004 '''); | |
| 6005 } else { | |
| 6006 checkElementText( | |
| 6007 library, | |
| 6008 r''' | |
| 6009 import 'foo.dart' as foo; | |
| 6010 class C<T, U> { | |
| 6011 C(); | |
| 6012 C._(); | |
| 6013 } | |
| 6014 '''); | |
| 6015 } | |
| 2792 } | 6016 } |
| 2793 | 6017 |
| 2794 test_constructor_redirected_factory_unnamed_unresolved() { | 6018 test_constructor_redirected_factory_unnamed_unresolved() { |
| 2795 checkLibrary( | 6019 var library = checkLibrary( |
| 2796 ''' | 6020 ''' |
| 2797 class C<E> { | 6021 class C<E> { |
| 2798 factory C() = D<E>; | 6022 factory C() = D<E>; |
| 2799 } | 6023 } |
| 2800 ''', | 6024 ''', |
| 2801 allowErrors: true); | 6025 allowErrors: true); |
| 6026 if (isStrongMode) { | |
| 6027 checkElementText( | |
| 6028 library, | |
| 6029 r''' | |
| 6030 class C<E> { | |
| 6031 C(); | |
| 6032 } | |
| 6033 '''); | |
| 6034 } else { | |
| 6035 checkElementText( | |
| 6036 library, | |
| 6037 r''' | |
| 6038 class C<E> { | |
| 6039 C(); | |
| 6040 } | |
| 6041 '''); | |
| 6042 } | |
| 2802 } | 6043 } |
| 2803 | 6044 |
| 2804 test_constructor_redirected_thisInvocation_named() { | 6045 test_constructor_redirected_thisInvocation_named() { |
| 2805 checkLibrary(''' | 6046 var library = checkLibrary(''' |
| 2806 class C { | 6047 class C { |
| 2807 C.named(); | 6048 C.named(); |
| 2808 C() : this.named(); | 6049 C() : this.named(); |
| 2809 } | 6050 } |
| 2810 '''); | 6051 '''); |
| 6052 if (isStrongMode) { | |
| 6053 checkElementText( | |
| 6054 library, | |
| 6055 r''' | |
| 6056 class C { | |
| 6057 C.named(); | |
| 6058 C(); | |
| 6059 } | |
| 6060 '''); | |
| 6061 } else { | |
| 6062 checkElementText( | |
| 6063 library, | |
| 6064 r''' | |
| 6065 class C { | |
| 6066 C.named(); | |
| 6067 C(); | |
| 6068 } | |
| 6069 '''); | |
| 6070 } | |
| 2811 } | 6071 } |
| 2812 | 6072 |
| 2813 test_constructor_redirected_thisInvocation_named_generic() { | 6073 test_constructor_redirected_thisInvocation_named_generic() { |
| 2814 checkLibrary(''' | 6074 var library = checkLibrary(''' |
| 2815 class C<T> { | 6075 class C<T> { |
| 2816 C.named(); | 6076 C.named(); |
| 2817 C() : this.named(); | 6077 C() : this.named(); |
| 2818 } | 6078 } |
| 2819 '''); | 6079 '''); |
| 6080 if (isStrongMode) { | |
| 6081 checkElementText( | |
| 6082 library, | |
| 6083 r''' | |
| 6084 class C<T> { | |
| 6085 C.named(); | |
| 6086 C(); | |
| 6087 } | |
| 6088 '''); | |
| 6089 } else { | |
| 6090 checkElementText( | |
| 6091 library, | |
| 6092 r''' | |
| 6093 class C<T> { | |
| 6094 C.named(); | |
| 6095 C(); | |
| 6096 } | |
| 6097 '''); | |
| 6098 } | |
| 2820 } | 6099 } |
| 2821 | 6100 |
| 2822 test_constructor_redirected_thisInvocation_unnamed() { | 6101 test_constructor_redirected_thisInvocation_unnamed() { |
| 2823 checkLibrary(''' | 6102 var library = checkLibrary(''' |
| 2824 class C { | 6103 class C { |
| 2825 C(); | 6104 C(); |
| 2826 C.named() : this(); | 6105 C.named() : this(); |
| 2827 } | 6106 } |
| 2828 '''); | 6107 '''); |
| 6108 if (isStrongMode) { | |
| 6109 checkElementText( | |
| 6110 library, | |
| 6111 r''' | |
| 6112 class C { | |
| 6113 C(); | |
| 6114 C.named(); | |
| 6115 } | |
| 6116 '''); | |
| 6117 } else { | |
| 6118 checkElementText( | |
| 6119 library, | |
| 6120 r''' | |
| 6121 class C { | |
| 6122 C(); | |
| 6123 C.named(); | |
| 6124 } | |
| 6125 '''); | |
| 6126 } | |
| 2829 } | 6127 } |
| 2830 | 6128 |
| 2831 test_constructor_redirected_thisInvocation_unnamed_generic() { | 6129 test_constructor_redirected_thisInvocation_unnamed_generic() { |
| 2832 checkLibrary(''' | 6130 var library = checkLibrary(''' |
| 2833 class C<T> { | 6131 class C<T> { |
| 2834 C(); | 6132 C(); |
| 2835 C.named() : this(); | 6133 C.named() : this(); |
| 2836 } | 6134 } |
| 2837 '''); | 6135 '''); |
| 6136 if (isStrongMode) { | |
| 6137 checkElementText( | |
| 6138 library, | |
| 6139 r''' | |
| 6140 class C<T> { | |
| 6141 C(); | |
| 6142 C.named(); | |
| 6143 } | |
| 6144 '''); | |
| 6145 } else { | |
| 6146 checkElementText( | |
| 6147 library, | |
| 6148 r''' | |
| 6149 class C<T> { | |
| 6150 C(); | |
| 6151 C.named(); | |
| 6152 } | |
| 6153 '''); | |
| 6154 } | |
| 2838 } | 6155 } |
| 2839 | 6156 |
| 2840 test_constructor_withCycles_const() { | 6157 test_constructor_withCycles_const() { |
| 2841 checkLibrary(''' | 6158 var library = checkLibrary(''' |
| 2842 class C { | 6159 class C { |
| 2843 final x; | 6160 final x; |
| 2844 const C() : x = const D(); | 6161 const C() : x = const D(); |
| 2845 } | 6162 } |
| 2846 class D { | 6163 class D { |
| 2847 final x; | 6164 final x; |
| 2848 const D() : x = const C(); | 6165 const D() : x = const C(); |
| 2849 } | 6166 } |
| 2850 '''); | 6167 '''); |
| 6168 if (isStrongMode) { | |
| 6169 checkElementText( | |
| 6170 library, | |
| 6171 r''' | |
| 6172 class C { | |
| 6173 final x; | |
| 6174 C(); | |
| 6175 } | |
| 6176 class D { | |
| 6177 final x; | |
| 6178 D(); | |
| 6179 } | |
| 6180 '''); | |
| 6181 } else { | |
| 6182 checkElementText( | |
| 6183 library, | |
| 6184 r''' | |
| 6185 class C { | |
| 6186 final x; | |
| 6187 C(); | |
| 6188 } | |
| 6189 class D { | |
| 6190 final x; | |
| 6191 D(); | |
| 6192 } | |
| 6193 '''); | |
| 6194 } | |
| 2851 } | 6195 } |
| 2852 | 6196 |
| 2853 test_constructor_withCycles_nonConst() { | 6197 test_constructor_withCycles_nonConst() { |
| 2854 checkLibrary(''' | 6198 var library = checkLibrary(''' |
| 2855 class C { | 6199 class C { |
| 2856 final x; | 6200 final x; |
| 2857 C() : x = new D(); | 6201 C() : x = new D(); |
| 2858 } | 6202 } |
| 2859 class D { | 6203 class D { |
| 2860 final x; | 6204 final x; |
| 2861 D() : x = new C(); | 6205 D() : x = new C(); |
| 2862 } | 6206 } |
| 2863 '''); | 6207 '''); |
| 6208 if (isStrongMode) { | |
| 6209 checkElementText( | |
| 6210 library, | |
| 6211 r''' | |
| 6212 class C { | |
| 6213 final x; | |
| 6214 C(); | |
| 6215 } | |
| 6216 class D { | |
| 6217 final x; | |
| 6218 D(); | |
| 6219 } | |
| 6220 '''); | |
| 6221 } else { | |
| 6222 checkElementText( | |
| 6223 library, | |
| 6224 r''' | |
| 6225 class C { | |
| 6226 final x; | |
| 6227 C(); | |
| 6228 } | |
| 6229 class D { | |
| 6230 final x; | |
| 6231 D(); | |
| 6232 } | |
| 6233 '''); | |
| 6234 } | |
| 2864 } | 6235 } |
| 2865 | 6236 |
| 2866 test_defaultValue_refersToGenericClass_constructor() { | 6237 test_defaultValue_refersToGenericClass_constructor() { |
| 2867 checkLibrary(''' | 6238 var library = checkLibrary(''' |
| 2868 class B<T> { | 6239 class B<T> { |
| 2869 const B(); | 6240 const B(); |
| 2870 } | 6241 } |
| 2871 class C<T> { | 6242 class C<T> { |
| 2872 const C([B<T> b = const B()]); | 6243 const C([B<T> b = const B()]); |
| 2873 } | 6244 } |
| 2874 '''); | 6245 '''); |
| 6246 if (isStrongMode) { | |
| 6247 checkElementText( | |
| 6248 library, | |
| 6249 r''' | |
| 6250 class B<T> { | |
| 6251 B(); | |
| 6252 } | |
| 6253 class C<T> { | |
| 6254 C([B<T> b]); | |
| 6255 } | |
| 6256 '''); | |
| 6257 } else { | |
| 6258 checkElementText( | |
| 6259 library, | |
| 6260 r''' | |
| 6261 class B<T> { | |
| 6262 B(); | |
| 6263 } | |
| 6264 class C<T> { | |
| 6265 C([B<T> b]); | |
| 6266 } | |
| 6267 '''); | |
| 6268 } | |
| 2875 } | 6269 } |
| 2876 | 6270 |
| 2877 test_defaultValue_refersToGenericClass_constructor2() { | 6271 test_defaultValue_refersToGenericClass_constructor2() { |
| 2878 checkLibrary(''' | 6272 var library = checkLibrary(''' |
| 2879 abstract class A<T> {} | 6273 abstract class A<T> {} |
| 2880 class B<T> implements A<T> { | 6274 class B<T> implements A<T> { |
| 2881 const B(); | 6275 const B(); |
| 2882 } | 6276 } |
| 2883 class C<T> implements A<Iterable<T>> { | 6277 class C<T> implements A<Iterable<T>> { |
| 2884 const C([A<T> a = const B()]); | 6278 const C([A<T> a = const B()]); |
| 2885 } | 6279 } |
| 2886 '''); | 6280 '''); |
| 6281 if (isStrongMode) { | |
| 6282 checkElementText( | |
| 6283 library, | |
| 6284 r''' | |
| 6285 abstract class A<T> { | |
| 6286 } | |
| 6287 class B<T> implements A<T> { | |
| 6288 B(); | |
| 6289 } | |
| 6290 class C<T> implements A<Iterable<T>> { | |
| 6291 C([A<T> a]); | |
| 6292 } | |
| 6293 '''); | |
| 6294 } else { | |
| 6295 checkElementText( | |
| 6296 library, | |
| 6297 r''' | |
| 6298 abstract class A<T> { | |
| 6299 } | |
| 6300 class B<T> implements A<T> { | |
| 6301 B(); | |
| 6302 } | |
| 6303 class C<T> implements A<Iterable<T>> { | |
| 6304 C([A<T> a]); | |
| 6305 } | |
| 6306 '''); | |
| 6307 } | |
| 2887 } | 6308 } |
| 2888 | 6309 |
| 2889 test_defaultValue_refersToGenericClass_functionG() { | 6310 test_defaultValue_refersToGenericClass_functionG() { |
| 2890 checkLibrary(''' | 6311 var library = checkLibrary(''' |
| 2891 class B<T> { | 6312 class B<T> { |
| 2892 const B(); | 6313 const B(); |
| 2893 } | 6314 } |
| 2894 void foo<T>([B<T> b = const B()]) {} | 6315 void foo<T>([B<T> b = const B()]) {} |
| 2895 '''); | 6316 '''); |
| 6317 if (isStrongMode) { | |
| 6318 checkElementText( | |
| 6319 library, | |
| 6320 r''' | |
| 6321 class B<T> { | |
| 6322 B(); | |
| 6323 } | |
| 6324 void foo<T>([B<T> b]) {} | |
| 6325 '''); | |
| 6326 } else { | |
| 6327 checkElementText( | |
| 6328 library, | |
| 6329 r''' | |
| 6330 class B<T> { | |
| 6331 B(); | |
| 6332 } | |
| 6333 void foo<T>([B<T> b]) {} | |
| 6334 '''); | |
| 6335 } | |
| 2896 } | 6336 } |
| 2897 | 6337 |
| 2898 test_defaultValue_refersToGenericClass_methodG() { | 6338 test_defaultValue_refersToGenericClass_methodG() { |
| 2899 checkLibrary(''' | 6339 var library = checkLibrary(''' |
| 2900 class B<T> { | 6340 class B<T> { |
| 2901 const B(); | 6341 const B(); |
| 2902 } | 6342 } |
| 2903 class C { | 6343 class C { |
| 2904 void foo<T>([B<T> b = const B()]) {} | 6344 void foo<T>([B<T> b = const B()]) {} |
| 2905 } | 6345 } |
| 2906 '''); | 6346 '''); |
| 6347 if (isStrongMode) { | |
| 6348 checkElementText( | |
| 6349 library, | |
| 6350 r''' | |
| 6351 class B<T> { | |
| 6352 B(); | |
| 6353 } | |
| 6354 class C { | |
| 6355 void foo<T>([B<T> b]) {} | |
| 6356 } | |
| 6357 '''); | |
| 6358 } else { | |
| 6359 checkElementText( | |
| 6360 library, | |
| 6361 r''' | |
| 6362 class B<T> { | |
| 6363 B(); | |
| 6364 } | |
| 6365 class C { | |
| 6366 void foo<T>([B<T> b]) {} | |
| 6367 } | |
| 6368 '''); | |
| 6369 } | |
| 2907 } | 6370 } |
| 2908 | 6371 |
| 2909 test_defaultValue_refersToGenericClass_methodG_classG() { | 6372 test_defaultValue_refersToGenericClass_methodG_classG() { |
| 2910 checkLibrary(''' | 6373 var library = checkLibrary(''' |
| 2911 class B<T1, T2> { | 6374 class B<T1, T2> { |
| 2912 const B(); | 6375 const B(); |
| 2913 } | 6376 } |
| 2914 class C<E1> { | 6377 class C<E1> { |
| 2915 void foo<E2>([B<E1, E2> b = const B()]) {} | 6378 void foo<E2>([B<E1, E2> b = const B()]) {} |
| 2916 } | 6379 } |
| 2917 '''); | 6380 '''); |
| 6381 if (isStrongMode) { | |
| 6382 checkElementText( | |
| 6383 library, | |
| 6384 r''' | |
| 6385 class B<T1, T2> { | |
| 6386 B(); | |
| 6387 } | |
| 6388 class C<E1> { | |
| 6389 void foo<E2>([B<E1, E2> b]) {} | |
| 6390 } | |
| 6391 '''); | |
| 6392 } else { | |
| 6393 checkElementText( | |
| 6394 library, | |
| 6395 r''' | |
| 6396 class B<T1, T2> { | |
| 6397 B(); | |
| 6398 } | |
| 6399 class C<E1> { | |
| 6400 void foo<E2>([B<E1, E2> b]) {} | |
| 6401 } | |
| 6402 '''); | |
| 6403 } | |
| 2918 } | 6404 } |
| 2919 | 6405 |
| 2920 test_defaultValue_refersToGenericClass_methodNG() { | 6406 test_defaultValue_refersToGenericClass_methodNG() { |
| 2921 checkLibrary(''' | 6407 var library = checkLibrary(''' |
| 2922 class B<T> { | 6408 class B<T> { |
| 2923 const B(); | 6409 const B(); |
| 2924 } | 6410 } |
| 2925 class C<T> { | 6411 class C<T> { |
| 2926 void foo([B<T> b = const B()]) {} | 6412 void foo([B<T> b = const B()]) {} |
| 2927 } | 6413 } |
| 2928 '''); | 6414 '''); |
| 6415 if (isStrongMode) { | |
| 6416 checkElementText( | |
| 6417 library, | |
| 6418 r''' | |
| 6419 class B<T> { | |
| 6420 B(); | |
| 6421 } | |
| 6422 class C<T> { | |
| 6423 void foo([B<T> b]) {} | |
| 6424 } | |
| 6425 '''); | |
| 6426 } else { | |
| 6427 checkElementText( | |
| 6428 library, | |
| 6429 r''' | |
| 6430 class B<T> { | |
| 6431 B(); | |
| 6432 } | |
| 6433 class C<T> { | |
| 6434 void foo([B<T> b]) {} | |
| 6435 } | |
| 6436 '''); | |
| 6437 } | |
| 2929 } | 6438 } |
| 2930 | 6439 |
| 2931 test_enum_documented() { | 6440 test_enum_documented() { |
| 2932 checkLibrary(''' | 6441 var library = checkLibrary(''' |
| 2933 // Extra comment so doc comment offset != 0 | 6442 // Extra comment so doc comment offset != 0 |
| 2934 /** | 6443 /** |
| 2935 * Docs | 6444 * Docs |
| 2936 */ | 6445 */ |
| 2937 enum E { v }'''); | 6446 enum E { v }'''); |
| 6447 if (isStrongMode) { | |
| 6448 checkElementText( | |
| 6449 library, | |
| 6450 r''' | |
| 6451 enum E { v } | |
| 6452 '''); | |
| 6453 } else { | |
| 6454 checkElementText( | |
| 6455 library, | |
| 6456 r''' | |
| 6457 enum E { v } | |
| 6458 '''); | |
| 6459 } | |
| 2938 } | 6460 } |
| 2939 | 6461 |
| 2940 test_enum_value_documented() { | 6462 test_enum_value_documented() { |
| 2941 checkLibrary(''' | 6463 var library = checkLibrary(''' |
| 2942 enum E { | 6464 enum E { |
| 2943 /** | 6465 /** |
| 2944 * Docs | 6466 * Docs |
| 2945 */ | 6467 */ |
| 2946 v | 6468 v |
| 2947 }'''); | 6469 }'''); |
| 6470 if (isStrongMode) { | |
| 6471 checkElementText( | |
| 6472 library, | |
| 6473 r''' | |
| 6474 enum E { v } | |
| 6475 '''); | |
| 6476 } else { | |
| 6477 checkElementText( | |
| 6478 library, | |
| 6479 r''' | |
| 6480 enum E { v } | |
| 6481 '''); | |
| 6482 } | |
| 2948 } | 6483 } |
| 2949 | 6484 |
| 2950 test_enum_values() { | 6485 test_enum_values() { |
| 2951 checkLibrary('enum E { v1, v2 }'); | 6486 var library = checkLibrary('enum E { v1, v2 }'); |
| 6487 if (isStrongMode) { | |
| 6488 checkElementText( | |
| 6489 library, | |
| 6490 r''' | |
| 6491 enum E { v1, v2 } | |
| 6492 '''); | |
| 6493 } else { | |
| 6494 checkElementText( | |
| 6495 library, | |
| 6496 r''' | |
| 6497 enum E { v1, v2 } | |
| 6498 '''); | |
| 6499 } | |
| 2952 } | 6500 } |
| 2953 | 6501 |
| 2954 test_enums() { | 6502 test_enums() { |
| 2955 checkLibrary('enum E1 { v1 } enum E2 { v2 }'); | 6503 var library = checkLibrary('enum E1 { v1 } enum E2 { v2 }'); |
| 6504 if (isStrongMode) { | |
| 6505 checkElementText( | |
| 6506 library, | |
| 6507 r''' | |
| 6508 enum E1 { v1 } | |
| 6509 enum E2 { v2 } | |
| 6510 '''); | |
| 6511 } else { | |
| 6512 checkElementText( | |
| 6513 library, | |
| 6514 r''' | |
| 6515 enum E1 { v1 } | |
| 6516 enum E2 { v2 } | |
| 6517 '''); | |
| 6518 } | |
| 2956 } | 6519 } |
| 2957 | 6520 |
| 2958 test_error_extendsEnum() { | 6521 test_error_extendsEnum() { |
| 2959 checkLibrary(''' | 6522 var library = checkLibrary(''' |
| 2960 enum E {a, b, c} | 6523 enum E {a, b, c} |
| 2961 | 6524 |
| 2962 class M {} | 6525 class M {} |
| 2963 | 6526 |
| 2964 class A extends E { | 6527 class A extends E { |
| 2965 foo() {} | 6528 foo() {} |
| 2966 } | 6529 } |
| 2967 | 6530 |
| 2968 class B implements E, M { | 6531 class B implements E, M { |
| 2969 foo() {} | 6532 foo() {} |
| 2970 } | 6533 } |
| 2971 | 6534 |
| 2972 class C extends Object with E, M { | 6535 class C extends Object with E, M { |
| 2973 foo() {} | 6536 foo() {} |
| 2974 } | 6537 } |
| 2975 | 6538 |
| 2976 class D = Object with M, E; | 6539 class D = Object with M, E; |
| 2977 '''); | 6540 '''); |
| 6541 if (isStrongMode) { | |
| 6542 checkElementText( | |
| 6543 library, | |
| 6544 r''' | |
| 6545 enum E { a, b, c } | |
| 6546 class M { | |
| 6547 } | |
| 6548 class A { | |
| 6549 foo() {} | |
| 6550 } | |
| 6551 class B implements M { | |
| 6552 foo() {} | |
| 6553 } | |
| 6554 class C extends Object with M { | |
| 6555 synthetic C(); | |
| 6556 foo() {} | |
| 6557 } | |
| 6558 class D extends Object with M { | |
| 6559 synthetic D(); | |
| 6560 } | |
| 6561 '''); | |
| 6562 } else { | |
| 6563 checkElementText( | |
| 6564 library, | |
| 6565 r''' | |
| 6566 enum E { a, b, c } | |
| 6567 class M { | |
| 6568 } | |
| 6569 class A { | |
| 6570 foo() {} | |
| 6571 } | |
| 6572 class B implements M { | |
| 6573 foo() {} | |
| 6574 } | |
| 6575 class C extends Object with M { | |
| 6576 synthetic C(); | |
| 6577 foo() {} | |
| 6578 } | |
| 6579 class D extends Object with M { | |
| 6580 synthetic D(); | |
| 6581 } | |
| 6582 '''); | |
| 6583 } | |
| 2978 } | 6584 } |
| 2979 | 6585 |
| 2980 test_executable_parameter_type_typedef() { | 6586 test_executable_parameter_type_typedef() { |
| 2981 checkLibrary(r''' | 6587 var library = checkLibrary(r''' |
| 2982 typedef F(int p); | 6588 typedef F(int p); |
| 2983 main(F f) {} | 6589 main(F f) {} |
| 2984 '''); | 6590 '''); |
| 6591 if (isStrongMode) { | |
| 6592 checkElementText( | |
| 6593 library, | |
| 6594 r''' | |
| 6595 typedef F(int p); | |
| 6596 main(F f) {} | |
| 6597 '''); | |
| 6598 } else { | |
| 6599 checkElementText( | |
| 6600 library, | |
| 6601 r''' | |
| 6602 typedef F(int p); | |
| 6603 main(F f) {} | |
| 6604 '''); | |
| 6605 } | |
| 2985 } | 6606 } |
| 2986 | 6607 |
| 2987 test_export_class() { | 6608 test_export_class() { |
| 2988 addLibrarySource('/a.dart', 'class C {}'); | 6609 addLibrarySource('/a.dart', 'class C {}'); |
| 2989 checkLibrary('export "a.dart";'); | 6610 var library = checkLibrary('export "a.dart";'); |
| 6611 if (isStrongMode) { | |
| 6612 checkElementText( | |
| 6613 library, | |
| 6614 r''' | |
| 6615 export 'a.dart'; | |
| 6616 '''); | |
| 6617 } else { | |
| 6618 checkElementText( | |
| 6619 library, | |
| 6620 r''' | |
| 6621 export 'a.dart'; | |
| 6622 '''); | |
| 6623 } | |
| 2990 } | 6624 } |
| 2991 | 6625 |
| 2992 test_export_class_type_alias() { | 6626 test_export_class_type_alias() { |
| 2993 addLibrarySource( | 6627 addLibrarySource( |
| 2994 '/a.dart', 'class C {} exends _D with _E; class _D {} class _E {}'); | 6628 '/a.dart', 'class C {} exends _D with _E; class _D {} class _E {}'); |
| 2995 checkLibrary('export "a.dart";'); | 6629 var library = checkLibrary('export "a.dart";'); |
| 6630 if (isStrongMode) { | |
| 6631 checkElementText( | |
| 6632 library, | |
| 6633 r''' | |
| 6634 export 'a.dart'; | |
| 6635 '''); | |
| 6636 } else { | |
| 6637 checkElementText( | |
| 6638 library, | |
| 6639 r''' | |
| 6640 export 'a.dart'; | |
| 6641 '''); | |
| 6642 } | |
| 2996 } | 6643 } |
| 2997 | 6644 |
| 2998 test_export_configurations_useDefault() { | 6645 test_export_configurations_useDefault() { |
| 2999 context.declaredVariables.define('dart.library.io', 'false'); | 6646 context.declaredVariables.define('dart.library.io', 'false'); |
| 3000 addLibrarySource('/foo.dart', 'class A {}'); | 6647 addLibrarySource('/foo.dart', 'class A {}'); |
| 3001 addLibrarySource('/foo_io.dart', 'class A {}'); | 6648 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 3002 addLibrarySource('/foo_html.dart', 'class A {}'); | 6649 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 3003 LibraryElementImpl library = checkLibrary(r''' | 6650 LibraryElementImpl library = checkLibrary(r''' |
| 3004 export 'foo.dart' | 6651 export 'foo.dart' |
| 3005 if (dart.library.io) 'foo_io.dart' | 6652 if (dart.library.io) 'foo_io.dart' |
| 3006 if (dart.library.html) 'foo_html.dart'; | 6653 if (dart.library.html) 'foo_html.dart'; |
| 3007 '''); | 6654 '''); |
| 6655 if (isStrongMode) { | |
| 6656 checkElementText( | |
| 6657 library, | |
| 6658 r''' | |
| 6659 export 'foo.dart'; | |
| 6660 '''); | |
| 6661 } else { | |
| 6662 checkElementText( | |
| 6663 library, | |
| 6664 r''' | |
| 6665 export 'foo.dart'; | |
| 6666 '''); | |
| 6667 } | |
| 3008 expect(library.exports[0].uri, 'foo.dart'); | 6668 expect(library.exports[0].uri, 'foo.dart'); |
| 3009 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart'); | 6669 expect(library.exports[0].exportedLibrary.source.shortName, 'foo.dart'); |
| 3010 } | 6670 } |
| 3011 | 6671 |
| 3012 test_export_configurations_useFirst() { | 6672 test_export_configurations_useFirst() { |
| 3013 context.declaredVariables.define('dart.library.io', 'true'); | 6673 context.declaredVariables.define('dart.library.io', 'true'); |
| 3014 context.declaredVariables.define('dart.library.html', 'true'); | 6674 context.declaredVariables.define('dart.library.html', 'true'); |
| 3015 addLibrarySource('/foo.dart', 'class A {}'); | 6675 addLibrarySource('/foo.dart', 'class A {}'); |
| 3016 addLibrarySource('/foo_io.dart', 'class A {}'); | 6676 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 3017 addLibrarySource('/foo_html.dart', 'class A {}'); | 6677 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 3018 LibraryElementImpl library = checkLibrary(r''' | 6678 LibraryElementImpl library = checkLibrary(r''' |
| 3019 export 'foo.dart' | 6679 export 'foo.dart' |
| 3020 if (dart.library.io) 'foo_io.dart' | 6680 if (dart.library.io) 'foo_io.dart' |
| 3021 if (dart.library.html) 'foo_html.dart'; | 6681 if (dart.library.html) 'foo_html.dart'; |
| 3022 '''); | 6682 '''); |
| 6683 if (isStrongMode) { | |
| 6684 checkElementText( | |
| 6685 library, | |
| 6686 r''' | |
| 6687 export 'foo_io.dart'; | |
| 6688 '''); | |
| 6689 } else { | |
| 6690 checkElementText( | |
| 6691 library, | |
| 6692 r''' | |
| 6693 export 'foo_io.dart'; | |
| 6694 '''); | |
| 6695 } | |
| 3023 expect(library.exports[0].uri, 'foo_io.dart'); | 6696 expect(library.exports[0].uri, 'foo_io.dart'); |
| 3024 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart'); | 6697 expect(library.exports[0].exportedLibrary.source.shortName, 'foo_io.dart'); |
| 3025 } | 6698 } |
| 3026 | 6699 |
| 3027 test_export_configurations_useSecond() { | 6700 test_export_configurations_useSecond() { |
| 3028 context.declaredVariables.define('dart.library.io', 'false'); | 6701 context.declaredVariables.define('dart.library.io', 'false'); |
| 3029 context.declaredVariables.define('dart.library.html', 'true'); | 6702 context.declaredVariables.define('dart.library.html', 'true'); |
| 3030 addLibrarySource('/foo.dart', 'class A {}'); | 6703 addLibrarySource('/foo.dart', 'class A {}'); |
| 3031 addLibrarySource('/foo_io.dart', 'class A {}'); | 6704 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 3032 addLibrarySource('/foo_html.dart', 'class A {}'); | 6705 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 3033 LibraryElementImpl library = checkLibrary(r''' | 6706 LibraryElementImpl library = checkLibrary(r''' |
| 3034 export 'foo.dart' | 6707 export 'foo.dart' |
| 3035 if (dart.library.io) 'foo_io.dart' | 6708 if (dart.library.io) 'foo_io.dart' |
| 3036 if (dart.library.html) 'foo_html.dart'; | 6709 if (dart.library.html) 'foo_html.dart'; |
| 3037 '''); | 6710 '''); |
| 6711 if (isStrongMode) { | |
| 6712 checkElementText( | |
| 6713 library, | |
| 6714 r''' | |
| 6715 export 'foo_html.dart'; | |
| 6716 '''); | |
| 6717 } else { | |
| 6718 checkElementText( | |
| 6719 library, | |
| 6720 r''' | |
| 6721 export 'foo_html.dart'; | |
| 6722 '''); | |
| 6723 } | |
| 3038 ExportElement export = library.exports[0]; | 6724 ExportElement export = library.exports[0]; |
| 3039 expect(export.uri, 'foo_html.dart'); | 6725 expect(export.uri, 'foo_html.dart'); |
| 3040 expect(export.exportedLibrary.source.shortName, 'foo_html.dart'); | 6726 expect(export.exportedLibrary.source.shortName, 'foo_html.dart'); |
| 3041 } | 6727 } |
| 3042 | 6728 |
| 3043 test_export_function() { | 6729 test_export_function() { |
| 3044 addLibrarySource('/a.dart', 'f() {}'); | 6730 addLibrarySource('/a.dart', 'f() {}'); |
| 3045 checkLibrary('export "a.dart";'); | 6731 var library = checkLibrary('export "a.dart";'); |
| 6732 if (isStrongMode) { | |
| 6733 checkElementText( | |
| 6734 library, | |
| 6735 r''' | |
| 6736 export 'a.dart'; | |
| 6737 '''); | |
| 6738 } else { | |
| 6739 checkElementText( | |
| 6740 library, | |
| 6741 r''' | |
| 6742 export 'a.dart'; | |
| 6743 '''); | |
| 6744 } | |
| 3046 } | 6745 } |
| 3047 | 6746 |
| 3048 test_export_getter() { | 6747 test_export_getter() { |
| 3049 addLibrarySource('/a.dart', 'get f() => null;'); | 6748 addLibrarySource('/a.dart', 'get f() => null;'); |
| 3050 checkLibrary('export "a.dart";'); | 6749 var library = checkLibrary('export "a.dart";'); |
| 6750 if (isStrongMode) { | |
| 6751 checkElementText( | |
| 6752 library, | |
| 6753 r''' | |
| 6754 export 'a.dart'; | |
| 6755 '''); | |
| 6756 } else { | |
| 6757 checkElementText( | |
| 6758 library, | |
| 6759 r''' | |
| 6760 export 'a.dart'; | |
| 6761 '''); | |
| 6762 } | |
| 3051 } | 6763 } |
| 3052 | 6764 |
| 3053 test_export_hide() { | 6765 test_export_hide() { |
| 3054 addLibrary('dart:async'); | 6766 addLibrary('dart:async'); |
| 3055 checkLibrary('export "dart:async" hide Stream, Future;'); | 6767 var library = checkLibrary('export "dart:async" hide Stream, Future;'); |
| 6768 if (isStrongMode) { | |
| 6769 checkElementText( | |
| 6770 library, | |
| 6771 r''' | |
| 6772 export 'dart:async' hide Stream, Future; | |
| 6773 '''); | |
| 6774 } else { | |
| 6775 checkElementText( | |
| 6776 library, | |
| 6777 r''' | |
| 6778 export 'dart:async' hide Stream, Future; | |
| 6779 '''); | |
| 6780 } | |
| 3056 } | 6781 } |
| 3057 | 6782 |
| 3058 test_export_multiple_combinators() { | 6783 test_export_multiple_combinators() { |
| 3059 addLibrary('dart:async'); | 6784 addLibrary('dart:async'); |
| 3060 checkLibrary('export "dart:async" hide Stream show Future;'); | 6785 var library = checkLibrary('export "dart:async" hide Stream show Future;'); |
| 6786 if (isStrongMode) { | |
| 6787 checkElementText( | |
| 6788 library, | |
| 6789 r''' | |
| 6790 export 'dart:async' hide Stream show Future; | |
| 6791 '''); | |
| 6792 } else { | |
| 6793 checkElementText( | |
| 6794 library, | |
| 6795 r''' | |
| 6796 export 'dart:async' hide Stream show Future; | |
| 6797 '''); | |
| 6798 } | |
| 3061 } | 6799 } |
| 3062 | 6800 |
| 3063 test_export_setter() { | 6801 test_export_setter() { |
| 3064 addLibrarySource('/a.dart', 'void set f(value) {}'); | 6802 addLibrarySource('/a.dart', 'void set f(value) {}'); |
| 3065 checkLibrary('export "a.dart";'); | 6803 var library = checkLibrary('export "a.dart";'); |
| 6804 if (isStrongMode) { | |
| 6805 checkElementText( | |
| 6806 library, | |
| 6807 r''' | |
| 6808 export 'a.dart'; | |
| 6809 '''); | |
| 6810 } else { | |
| 6811 checkElementText( | |
| 6812 library, | |
| 6813 r''' | |
| 6814 export 'a.dart'; | |
| 6815 '''); | |
| 6816 } | |
| 3066 } | 6817 } |
| 3067 | 6818 |
| 3068 test_export_show() { | 6819 test_export_show() { |
| 3069 addLibrary('dart:async'); | 6820 addLibrary('dart:async'); |
| 3070 checkLibrary('export "dart:async" show Future, Stream;'); | 6821 var library = checkLibrary('export "dart:async" show Future, Stream;'); |
| 6822 if (isStrongMode) { | |
| 6823 checkElementText( | |
| 6824 library, | |
| 6825 r''' | |
| 6826 export 'dart:async' show Future, Stream; | |
| 6827 '''); | |
| 6828 } else { | |
| 6829 checkElementText( | |
| 6830 library, | |
| 6831 r''' | |
| 6832 export 'dart:async' show Future, Stream; | |
| 6833 '''); | |
| 6834 } | |
| 3071 } | 6835 } |
| 3072 | 6836 |
| 3073 test_export_typedef() { | 6837 test_export_typedef() { |
| 3074 addLibrarySource('/a.dart', 'typedef F();'); | 6838 addLibrarySource('/a.dart', 'typedef F();'); |
| 3075 checkLibrary('export "a.dart";'); | 6839 var library = checkLibrary('export "a.dart";'); |
| 6840 if (isStrongMode) { | |
| 6841 checkElementText( | |
| 6842 library, | |
| 6843 r''' | |
| 6844 export 'a.dart'; | |
| 6845 '''); | |
| 6846 } else { | |
| 6847 checkElementText( | |
| 6848 library, | |
| 6849 r''' | |
| 6850 export 'a.dart'; | |
| 6851 '''); | |
| 6852 } | |
| 3076 } | 6853 } |
| 3077 | 6854 |
| 3078 test_export_variable() { | 6855 test_export_variable() { |
| 3079 addLibrarySource('/a.dart', 'var x;'); | 6856 addLibrarySource('/a.dart', 'var x;'); |
| 3080 checkLibrary('export "a.dart";'); | 6857 var library = checkLibrary('export "a.dart";'); |
| 6858 if (isStrongMode) { | |
| 6859 checkElementText( | |
| 6860 library, | |
| 6861 r''' | |
| 6862 export 'a.dart'; | |
| 6863 '''); | |
| 6864 } else { | |
| 6865 checkElementText( | |
| 6866 library, | |
| 6867 r''' | |
| 6868 export 'a.dart'; | |
| 6869 '''); | |
| 6870 } | |
| 3081 } | 6871 } |
| 3082 | 6872 |
| 3083 test_export_variable_const() { | 6873 test_export_variable_const() { |
| 3084 addLibrarySource('/a.dart', 'const x = 0;'); | 6874 addLibrarySource('/a.dart', 'const x = 0;'); |
| 3085 checkLibrary('export "a.dart";'); | 6875 var library = checkLibrary('export "a.dart";'); |
| 6876 if (isStrongMode) { | |
| 6877 checkElementText( | |
| 6878 library, | |
| 6879 r''' | |
| 6880 export 'a.dart'; | |
| 6881 '''); | |
| 6882 } else { | |
| 6883 checkElementText( | |
| 6884 library, | |
| 6885 r''' | |
| 6886 export 'a.dart'; | |
| 6887 '''); | |
| 6888 } | |
| 3086 } | 6889 } |
| 3087 | 6890 |
| 3088 test_export_variable_final() { | 6891 test_export_variable_final() { |
| 3089 addLibrarySource('/a.dart', 'final x = 0;'); | 6892 addLibrarySource('/a.dart', 'final x = 0;'); |
| 3090 checkLibrary('export "a.dart";'); | 6893 var library = checkLibrary('export "a.dart";'); |
| 6894 if (isStrongMode) { | |
| 6895 checkElementText( | |
| 6896 library, | |
| 6897 r''' | |
| 6898 export 'a.dart'; | |
| 6899 '''); | |
| 6900 } else { | |
| 6901 checkElementText( | |
| 6902 library, | |
| 6903 r''' | |
| 6904 export 'a.dart'; | |
| 6905 '''); | |
| 6906 } | |
| 3091 } | 6907 } |
| 3092 | 6908 |
| 3093 test_exportImport_configurations_useDefault() { | 6909 test_exportImport_configurations_useDefault() { |
| 3094 context.declaredVariables.define('dart.library.io', 'false'); | 6910 context.declaredVariables.define('dart.library.io', 'false'); |
| 3095 addLibrarySource('/foo.dart', 'class A {}'); | 6911 addLibrarySource('/foo.dart', 'class A {}'); |
| 3096 addLibrarySource('/foo_io.dart', 'class A {}'); | 6912 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 3097 addLibrarySource('/foo_html.dart', 'class A {}'); | 6913 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 3098 addLibrarySource( | 6914 addLibrarySource( |
| 3099 '/bar.dart', | 6915 '/bar.dart', |
| 3100 r''' | 6916 r''' |
| 3101 export 'foo.dart' | 6917 export 'foo.dart' |
| 3102 if (dart.library.io) 'foo_io.dart' | 6918 if (dart.library.io) 'foo_io.dart' |
| 3103 if (dart.library.html) 'foo_html.dart'; | 6919 if (dart.library.html) 'foo_html.dart'; |
| 3104 '''); | 6920 '''); |
| 3105 LibraryElementImpl library = checkLibrary(r''' | 6921 LibraryElementImpl library = checkLibrary(r''' |
| 3106 import 'bar.dart'; | 6922 import 'bar.dart'; |
| 3107 class B extends A {} | 6923 class B extends A {} |
| 3108 '''); | 6924 '''); |
| 6925 if (isStrongMode) { | |
| 6926 checkElementText( | |
| 6927 library, | |
| 6928 r''' | |
| 6929 import 'bar.dart'; | |
| 6930 class B extends A { | |
| 6931 } | |
| 6932 '''); | |
| 6933 } else { | |
| 6934 checkElementText( | |
| 6935 library, | |
| 6936 r''' | |
| 6937 import 'bar.dart'; | |
| 6938 class B extends A { | |
| 6939 } | |
| 6940 '''); | |
| 6941 } | |
| 3109 var typeA = library.definingCompilationUnit.getType('B').supertype; | 6942 var typeA = library.definingCompilationUnit.getType('B').supertype; |
| 3110 expect(typeA.element.source.shortName, 'foo.dart'); | 6943 expect(typeA.element.source.shortName, 'foo.dart'); |
| 3111 } | 6944 } |
| 3112 | 6945 |
| 3113 test_exportImport_configurations_useFirst() { | 6946 test_exportImport_configurations_useFirst() { |
| 3114 context.declaredVariables.define('dart.library.io', 'true'); | 6947 context.declaredVariables.define('dart.library.io', 'true'); |
| 3115 context.declaredVariables.define('dart.library.html', 'true'); | 6948 context.declaredVariables.define('dart.library.html', 'true'); |
| 3116 addLibrarySource('/foo.dart', 'class A {}'); | 6949 addLibrarySource('/foo.dart', 'class A {}'); |
| 3117 addLibrarySource('/foo_io.dart', 'class A {}'); | 6950 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 3118 addLibrarySource('/foo_html.dart', 'class A {}'); | 6951 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 3119 addLibrarySource( | 6952 addLibrarySource( |
| 3120 '/bar.dart', | 6953 '/bar.dart', |
| 3121 r''' | 6954 r''' |
| 3122 export 'foo.dart' | 6955 export 'foo.dart' |
| 3123 if (dart.library.io) 'foo_io.dart' | 6956 if (dart.library.io) 'foo_io.dart' |
| 3124 if (dart.library.html) 'foo_html.dart'; | 6957 if (dart.library.html) 'foo_html.dart'; |
| 3125 '''); | 6958 '''); |
| 3126 var library = checkLibrary(r''' | 6959 var library = checkLibrary(r''' |
| 3127 import 'bar.dart'; | 6960 import 'bar.dart'; |
| 3128 class B extends A {} | 6961 class B extends A {} |
| 3129 '''); | 6962 '''); |
| 6963 if (isStrongMode) { | |
| 6964 checkElementText( | |
| 6965 library, | |
| 6966 r''' | |
| 6967 import 'bar.dart'; | |
| 6968 class B extends A { | |
| 6969 } | |
| 6970 '''); | |
| 6971 } else { | |
| 6972 checkElementText( | |
| 6973 library, | |
| 6974 r''' | |
| 6975 import 'bar.dart'; | |
| 6976 class B extends A { | |
| 6977 } | |
| 6978 '''); | |
| 6979 } | |
| 3130 var typeA = library.definingCompilationUnit.getType('B').supertype; | 6980 var typeA = library.definingCompilationUnit.getType('B').supertype; |
| 3131 expect(typeA.element.source.shortName, 'foo_io.dart'); | 6981 expect(typeA.element.source.shortName, 'foo_io.dart'); |
| 3132 } | 6982 } |
| 3133 | 6983 |
| 3134 test_exports() { | 6984 test_exports() { |
| 3135 addLibrarySource('/a.dart', 'library a;'); | 6985 addLibrarySource('/a.dart', 'library a;'); |
| 3136 addLibrarySource('/b.dart', 'library b;'); | 6986 addLibrarySource('/b.dart', 'library b;'); |
| 3137 checkLibrary('export "a.dart"; export "b.dart";'); | 6987 var library = checkLibrary('export "a.dart"; export "b.dart";'); |
| 6988 if (isStrongMode) { | |
| 6989 checkElementText( | |
| 6990 library, | |
| 6991 r''' | |
| 6992 export 'a.dart'; | |
| 6993 export 'b.dart'; | |
| 6994 '''); | |
| 6995 } else { | |
| 6996 checkElementText( | |
| 6997 library, | |
| 6998 r''' | |
| 6999 export 'a.dart'; | |
| 7000 export 'b.dart'; | |
| 7001 '''); | |
| 7002 } | |
| 3138 } | 7003 } |
| 3139 | 7004 |
| 3140 test_expr_invalid_typeParameter_asPrefix() { | 7005 test_expr_invalid_typeParameter_asPrefix() { |
| 3141 variablesWithNotConstInitializers.add('f'); | 7006 variablesWithNotConstInitializers.add('f'); |
| 3142 checkLibrary(''' | 7007 var library = checkLibrary(''' |
| 3143 class C<T> { | 7008 class C<T> { |
| 3144 final f = T.k; | 7009 final f = T.k; |
| 3145 } | 7010 } |
| 3146 '''); | 7011 '''); |
| 7012 if (isStrongMode) { | |
| 7013 checkElementText( | |
| 7014 library, | |
| 7015 r''' | |
| 7016 class C<T> { | |
| 7017 final f; | |
| 7018 } | |
| 7019 '''); | |
| 7020 } else { | |
| 7021 checkElementText( | |
| 7022 library, | |
| 7023 r''' | |
| 7024 class C<T> { | |
| 7025 final f; | |
| 7026 } | |
| 7027 '''); | |
| 7028 } | |
| 3147 } | 7029 } |
| 3148 | 7030 |
| 3149 test_field_covariant() { | 7031 test_field_covariant() { |
| 3150 checkLibrary(''' | 7032 var library = checkLibrary(''' |
| 3151 class C { | 7033 class C { |
| 3152 covariant int x; | 7034 covariant int x; |
| 3153 }'''); | 7035 }'''); |
| 7036 if (isStrongMode) { | |
| 7037 checkElementText( | |
| 7038 library, | |
| 7039 r''' | |
| 7040 class C { | |
| 7041 convariant int x; | |
| 7042 } | |
| 7043 '''); | |
| 7044 } else { | |
| 7045 checkElementText( | |
| 7046 library, | |
| 7047 r''' | |
| 7048 class C { | |
| 7049 convariant int x; | |
| 7050 } | |
| 7051 '''); | |
| 7052 } | |
| 3154 } | 7053 } |
| 3155 | 7054 |
| 3156 test_field_documented() { | 7055 test_field_documented() { |
| 3157 checkLibrary(''' | 7056 var library = checkLibrary(''' |
| 3158 class C { | 7057 class C { |
| 3159 /** | 7058 /** |
| 3160 * Docs | 7059 * Docs |
| 3161 */ | 7060 */ |
| 3162 var x; | 7061 var x; |
| 3163 }'''); | 7062 }'''); |
| 7063 if (isStrongMode) { | |
| 7064 checkElementText( | |
| 7065 library, | |
| 7066 r''' | |
| 7067 class C { | |
| 7068 var x; | |
| 7069 } | |
| 7070 '''); | |
| 7071 } else { | |
| 7072 checkElementText( | |
| 7073 library, | |
| 7074 r''' | |
| 7075 class C { | |
| 7076 var x; | |
| 7077 } | |
| 7078 '''); | |
| 7079 } | |
| 3164 } | 7080 } |
| 3165 | 7081 |
| 3166 test_field_formal_param_inferred_type_implicit() { | 7082 test_field_formal_param_inferred_type_implicit() { |
| 3167 checkLibrary('class C extends D { var v; C(this.v); }' | 7083 var library = checkLibrary('class C extends D { var v; C(this.v); }' |
| 3168 ' abstract class D { int get v; }'); | 7084 ' abstract class D { int get v; }'); |
| 7085 if (isStrongMode) { | |
| 7086 checkElementText( | |
| 7087 library, | |
| 7088 r''' | |
| 7089 class C extends D { | |
| 7090 int v; | |
| 7091 C(int this.v); | |
| 7092 } | |
| 7093 abstract class D { | |
| 7094 int get v; | |
| 7095 } | |
| 7096 '''); | |
| 7097 } else { | |
| 7098 checkElementText( | |
| 7099 library, | |
| 7100 r''' | |
| 7101 class C extends D { | |
| 7102 var v; | |
| 7103 C(this.v); | |
| 7104 } | |
| 7105 abstract class D { | |
| 7106 int get v; | |
| 7107 } | |
| 7108 '''); | |
| 7109 } | |
| 3169 } | 7110 } |
| 3170 | 7111 |
| 3171 test_field_inferred_type_nonStatic_explicit_initialized() { | 7112 test_field_inferred_type_nonStatic_explicit_initialized() { |
| 3172 checkLibrary('class C { num v = 0; }'); | 7113 var library = checkLibrary('class C { num v = 0; }'); |
| 7114 if (isStrongMode) { | |
| 7115 checkElementText( | |
| 7116 library, | |
| 7117 r''' | |
| 7118 class C { | |
| 7119 num v; | |
| 7120 } | |
| 7121 '''); | |
| 7122 } else { | |
| 7123 checkElementText( | |
| 7124 library, | |
| 7125 r''' | |
| 7126 class C { | |
| 7127 num v; | |
| 7128 } | |
| 7129 '''); | |
| 7130 } | |
| 3173 } | 7131 } |
| 3174 | 7132 |
| 3175 test_field_inferred_type_nonStatic_implicit_initialized() { | 7133 test_field_inferred_type_nonStatic_implicit_initialized() { |
| 3176 checkLibrary('class C { var v = 0; }'); | 7134 var library = checkLibrary('class C { var v = 0; }'); |
| 7135 if (isStrongMode) { | |
| 7136 checkElementText( | |
| 7137 library, | |
| 7138 r''' | |
| 7139 class C { | |
| 7140 int v; | |
| 7141 } | |
| 7142 '''); | |
| 7143 } else { | |
| 7144 checkElementText( | |
| 7145 library, | |
| 7146 r''' | |
| 7147 class C { | |
| 7148 var v; | |
| 7149 } | |
| 7150 '''); | |
| 7151 } | |
| 3177 } | 7152 } |
| 3178 | 7153 |
| 3179 test_field_inferred_type_nonStatic_implicit_uninitialized() { | 7154 test_field_inferred_type_nonStatic_implicit_uninitialized() { |
| 3180 checkLibrary( | 7155 var library = checkLibrary( |
| 3181 'class C extends D { var v; } abstract class D { int get v; }'); | 7156 'class C extends D { var v; } abstract class D { int get v; }'); |
| 7157 if (isStrongMode) { | |
| 7158 checkElementText( | |
| 7159 library, | |
| 7160 r''' | |
| 7161 class C extends D { | |
| 7162 int v; | |
| 7163 } | |
| 7164 abstract class D { | |
| 7165 int get v; | |
| 7166 } | |
| 7167 '''); | |
| 7168 } else { | |
| 7169 checkElementText( | |
| 7170 library, | |
| 7171 r''' | |
| 7172 class C extends D { | |
| 7173 var v; | |
| 7174 } | |
| 7175 abstract class D { | |
| 7176 int get v; | |
| 7177 } | |
| 7178 '''); | |
| 7179 } | |
| 3182 } | 7180 } |
| 3183 | 7181 |
| 3184 test_field_inferred_type_static_implicit_initialized() { | 7182 test_field_inferred_type_static_implicit_initialized() { |
| 3185 checkLibrary('class C { static var v = 0; }'); | 7183 var library = checkLibrary('class C { static var v = 0; }'); |
| 7184 if (isStrongMode) { | |
| 7185 checkElementText( | |
| 7186 library, | |
| 7187 r''' | |
| 7188 class C { | |
| 7189 static int v; | |
| 7190 } | |
| 7191 '''); | |
| 7192 } else { | |
| 7193 checkElementText( | |
| 7194 library, | |
| 7195 r''' | |
| 7196 class C { | |
| 7197 static var v; | |
| 7198 } | |
| 7199 '''); | |
| 7200 } | |
| 3186 } | 7201 } |
| 3187 | 7202 |
| 3188 test_field_propagatedType_const_noDep() { | 7203 test_field_propagatedType_const_noDep() { |
| 3189 checkLibrary(''' | 7204 var library = checkLibrary(''' |
| 3190 class C { | 7205 class C { |
| 3191 static const x = 0; | 7206 static const x = 0; |
| 3192 }'''); | 7207 }'''); |
| 7208 if (isStrongMode) { | |
| 7209 checkElementText( | |
| 7210 library, | |
| 7211 r''' | |
| 7212 class C { | |
| 7213 static const int x; | |
| 7214 } | |
| 7215 '''); | |
| 7216 } else { | |
| 7217 checkElementText( | |
| 7218 library, | |
| 7219 r''' | |
| 7220 class C { | |
| 7221 static const x; | |
| 7222 } | |
| 7223 '''); | |
| 7224 } | |
| 3193 } | 7225 } |
| 3194 | 7226 |
| 3195 test_field_propagatedType_final_dep_inLib() { | 7227 test_field_propagatedType_final_dep_inLib() { |
| 3196 addLibrarySource('/a.dart', 'final a = 1;'); | 7228 addLibrarySource('/a.dart', 'final a = 1;'); |
| 3197 checkLibrary(''' | 7229 var library = checkLibrary(''' |
| 3198 import "a.dart"; | 7230 import "a.dart"; |
| 3199 class C { | 7231 class C { |
| 3200 final b = a / 2; | 7232 final b = a / 2; |
| 3201 }'''); | 7233 }'''); |
| 7234 if (isStrongMode) { | |
| 7235 checkElementText( | |
| 7236 library, | |
| 7237 r''' | |
| 7238 import 'a.dart'; | |
| 7239 class C { | |
| 7240 final num b; | |
| 7241 } | |
| 7242 '''); | |
| 7243 } else { | |
| 7244 checkElementText( | |
| 7245 library, | |
| 7246 r''' | |
| 7247 import 'a.dart'; | |
| 7248 class C { | |
| 7249 final b; | |
| 7250 } | |
| 7251 '''); | |
| 7252 } | |
| 3202 } | 7253 } |
| 3203 | 7254 |
| 3204 test_field_propagatedType_final_dep_inPart() { | 7255 test_field_propagatedType_final_dep_inPart() { |
| 3205 addSource('/a.dart', 'part of lib; final a = 1;'); | 7256 addSource('/a.dart', 'part of lib; final a = 1;'); |
| 3206 checkLibrary(''' | 7257 var library = checkLibrary(''' |
| 3207 library lib; | 7258 library lib; |
| 3208 part "a.dart"; | 7259 part "a.dart"; |
| 3209 class C { | 7260 class C { |
| 3210 final b = a / 2; | 7261 final b = a / 2; |
| 3211 }'''); | 7262 }'''); |
| 7263 if (isStrongMode) { | |
| 7264 checkElementText( | |
| 7265 library, | |
| 7266 r''' | |
| 7267 library lib; | |
| 7268 part 'a.dart'; | |
| 7269 class C { | |
| 7270 final num b; | |
| 7271 } | |
| 7272 -------------------- | |
| 7273 unit: a.dart | |
| 7274 | |
| 7275 final int a; | |
| 7276 '''); | |
| 7277 } else { | |
| 7278 checkElementText( | |
| 7279 library, | |
| 7280 r''' | |
| 7281 library lib; | |
| 7282 part 'a.dart'; | |
| 7283 class C { | |
| 7284 final b; | |
| 7285 } | |
| 7286 -------------------- | |
| 7287 unit: a.dart | |
| 7288 | |
| 7289 final a; | |
| 7290 '''); | |
| 7291 } | |
| 3212 } | 7292 } |
| 3213 | 7293 |
| 3214 test_field_propagatedType_final_noDep_instance() { | 7294 test_field_propagatedType_final_noDep_instance() { |
| 3215 checkLibrary(''' | 7295 var library = checkLibrary(''' |
| 3216 class C { | 7296 class C { |
| 3217 final x = 0; | 7297 final x = 0; |
| 3218 }'''); | 7298 }'''); |
| 7299 if (isStrongMode) { | |
| 7300 checkElementText( | |
| 7301 library, | |
| 7302 r''' | |
| 7303 class C { | |
| 7304 final int x; | |
| 7305 } | |
| 7306 '''); | |
| 7307 } else { | |
| 7308 checkElementText( | |
| 7309 library, | |
| 7310 r''' | |
| 7311 class C { | |
| 7312 final x; | |
| 7313 } | |
| 7314 '''); | |
| 7315 } | |
| 3219 } | 7316 } |
| 3220 | 7317 |
| 3221 test_field_propagatedType_final_noDep_static() { | 7318 test_field_propagatedType_final_noDep_static() { |
| 3222 checkLibrary(''' | 7319 var library = checkLibrary(''' |
| 3223 class C { | 7320 class C { |
| 3224 static final x = 0; | 7321 static final x = 0; |
| 3225 }'''); | 7322 }'''); |
| 7323 if (isStrongMode) { | |
| 7324 checkElementText( | |
| 7325 library, | |
| 7326 r''' | |
| 7327 class C { | |
| 7328 static final int x; | |
| 7329 } | |
| 7330 '''); | |
| 7331 } else { | |
| 7332 checkElementText( | |
| 7333 library, | |
| 7334 r''' | |
| 7335 class C { | |
| 7336 static final x; | |
| 7337 } | |
| 7338 '''); | |
| 7339 } | |
| 3226 } | 7340 } |
| 3227 | 7341 |
| 3228 test_field_static_final_untyped() { | 7342 test_field_static_final_untyped() { |
| 3229 checkLibrary('class C { static final x = 0; }'); | 7343 var library = checkLibrary('class C { static final x = 0; }'); |
| 7344 if (isStrongMode) { | |
| 7345 checkElementText( | |
| 7346 library, | |
| 7347 r''' | |
| 7348 class C { | |
| 7349 static final int x; | |
| 7350 } | |
| 7351 '''); | |
| 7352 } else { | |
| 7353 checkElementText( | |
| 7354 library, | |
| 7355 r''' | |
| 7356 class C { | |
| 7357 static final x; | |
| 7358 } | |
| 7359 '''); | |
| 7360 } | |
| 3230 } | 7361 } |
| 3231 | 7362 |
| 3232 test_field_untyped() { | 7363 test_field_untyped() { |
| 3233 checkLibrary('class C { var x = 0; }'); | 7364 var library = checkLibrary('class C { var x = 0; }'); |
| 7365 if (isStrongMode) { | |
| 7366 checkElementText( | |
| 7367 library, | |
| 7368 r''' | |
| 7369 class C { | |
| 7370 int x; | |
| 7371 } | |
| 7372 '''); | |
| 7373 } else { | |
| 7374 checkElementText( | |
| 7375 library, | |
| 7376 r''' | |
| 7377 class C { | |
| 7378 var x; | |
| 7379 } | |
| 7380 '''); | |
| 7381 } | |
| 3234 } | 7382 } |
| 3235 | 7383 |
| 3236 test_function_async() { | 7384 test_function_async() { |
| 3237 checkLibrary(r''' | 7385 var library = checkLibrary(r''' |
| 3238 import 'dart:async'; | 7386 import 'dart:async'; |
| 3239 Future f() async {} | 7387 Future f() async {} |
| 3240 '''); | 7388 '''); |
| 7389 if (isStrongMode) { | |
| 7390 checkElementText( | |
| 7391 library, | |
| 7392 r''' | |
| 7393 import 'dart:async'; | |
| 7394 Future f() {} | |
| 7395 '''); | |
| 7396 } else { | |
| 7397 checkElementText( | |
| 7398 library, | |
| 7399 r''' | |
| 7400 import 'dart:async'; | |
| 7401 Future f() {} | |
| 7402 '''); | |
| 7403 } | |
| 3241 } | 7404 } |
| 3242 | 7405 |
| 3243 test_function_asyncStar() { | 7406 test_function_asyncStar() { |
| 3244 checkLibrary(r''' | 7407 var library = checkLibrary(r''' |
| 3245 import 'dart:async'; | 7408 import 'dart:async'; |
| 3246 Stream f() async* {} | 7409 Stream f() async* {} |
| 3247 '''); | 7410 '''); |
| 7411 if (isStrongMode) { | |
| 7412 checkElementText( | |
| 7413 library, | |
| 7414 r''' | |
| 7415 import 'dart:async'; | |
| 7416 Stream f() {} | |
| 7417 '''); | |
| 7418 } else { | |
| 7419 checkElementText( | |
| 7420 library, | |
| 7421 r''' | |
| 7422 import 'dart:async'; | |
| 7423 Stream f() {} | |
| 7424 '''); | |
| 7425 } | |
| 3248 } | 7426 } |
| 3249 | 7427 |
| 3250 test_function_documented() { | 7428 test_function_documented() { |
| 3251 checkLibrary(''' | 7429 var library = checkLibrary(''' |
| 3252 // Extra comment so doc comment offset != 0 | 7430 // Extra comment so doc comment offset != 0 |
| 3253 /** | 7431 /** |
| 3254 * Docs | 7432 * Docs |
| 3255 */ | 7433 */ |
| 3256 f() {}'''); | 7434 f() {}'''); |
| 7435 if (isStrongMode) { | |
| 7436 checkElementText( | |
| 7437 library, | |
| 7438 r''' | |
| 7439 f() {} | |
| 7440 '''); | |
| 7441 } else { | |
| 7442 checkElementText( | |
| 7443 library, | |
| 7444 r''' | |
| 7445 f() {} | |
| 7446 '''); | |
| 7447 } | |
| 3257 } | 7448 } |
| 3258 | 7449 |
| 3259 test_function_entry_point() { | 7450 test_function_entry_point() { |
| 3260 checkLibrary('main() {}'); | 7451 var library = checkLibrary('main() {}'); |
| 7452 if (isStrongMode) { | |
| 7453 checkElementText( | |
| 7454 library, | |
| 7455 r''' | |
| 7456 main() {} | |
| 7457 '''); | |
| 7458 } else { | |
| 7459 checkElementText( | |
| 7460 library, | |
| 7461 r''' | |
| 7462 main() {} | |
| 7463 '''); | |
| 7464 } | |
| 3261 } | 7465 } |
| 3262 | 7466 |
| 3263 test_function_entry_point_in_export() { | 7467 test_function_entry_point_in_export() { |
| 3264 addLibrarySource('/a.dart', 'library a; main() {}'); | 7468 addLibrarySource('/a.dart', 'library a; main() {}'); |
| 3265 checkLibrary('export "a.dart";'); | 7469 var library = checkLibrary('export "a.dart";'); |
| 7470 if (isStrongMode) { | |
| 7471 checkElementText( | |
| 7472 library, | |
| 7473 r''' | |
| 7474 export 'a.dart'; | |
| 7475 '''); | |
| 7476 } else { | |
| 7477 checkElementText( | |
| 7478 library, | |
| 7479 r''' | |
| 7480 export 'a.dart'; | |
| 7481 '''); | |
| 7482 } | |
| 3266 } | 7483 } |
| 3267 | 7484 |
| 3268 test_function_entry_point_in_export_hidden() { | 7485 test_function_entry_point_in_export_hidden() { |
| 3269 addLibrarySource('/a.dart', 'library a; main() {}'); | 7486 addLibrarySource('/a.dart', 'library a; main() {}'); |
| 3270 checkLibrary('export "a.dart" hide main;'); | 7487 var library = checkLibrary('export "a.dart" hide main;'); |
| 7488 if (isStrongMode) { | |
| 7489 checkElementText( | |
| 7490 library, | |
| 7491 r''' | |
| 7492 export 'a.dart' hide main; | |
| 7493 '''); | |
| 7494 } else { | |
| 7495 checkElementText( | |
| 7496 library, | |
| 7497 r''' | |
| 7498 export 'a.dart' hide main; | |
| 7499 '''); | |
| 7500 } | |
| 3271 } | 7501 } |
| 3272 | 7502 |
| 3273 test_function_entry_point_in_part() { | 7503 test_function_entry_point_in_part() { |
| 3274 addSource('/a.dart', 'part of my.lib; main() {}'); | 7504 addSource('/a.dart', 'part of my.lib; main() {}'); |
| 3275 checkLibrary('library my.lib; part "a.dart";'); | 7505 var library = checkLibrary('library my.lib; part "a.dart";'); |
| 7506 if (isStrongMode) { | |
| 7507 checkElementText( | |
| 7508 library, | |
| 7509 r''' | |
| 7510 library my.lib; | |
| 7511 part 'a.dart'; | |
| 7512 -------------------- | |
| 7513 unit: a.dart | |
| 7514 | |
| 7515 main() {} | |
| 7516 '''); | |
| 7517 } else { | |
| 7518 checkElementText( | |
| 7519 library, | |
| 7520 r''' | |
| 7521 library my.lib; | |
| 7522 part 'a.dart'; | |
| 7523 -------------------- | |
| 7524 unit: a.dart | |
| 7525 | |
| 7526 main() {} | |
| 7527 '''); | |
| 7528 } | |
| 3276 } | 7529 } |
| 3277 | 7530 |
| 3278 test_function_external() { | 7531 test_function_external() { |
| 3279 checkLibrary('external f();'); | 7532 var library = checkLibrary('external f();'); |
| 7533 if (isStrongMode) { | |
| 7534 checkElementText( | |
| 7535 library, | |
| 7536 r''' | |
| 7537 external f() {} | |
| 7538 '''); | |
| 7539 } else { | |
| 7540 checkElementText( | |
| 7541 library, | |
| 7542 r''' | |
| 7543 external f() {} | |
| 7544 '''); | |
| 7545 } | |
| 3280 } | 7546 } |
| 3281 | 7547 |
| 3282 test_function_parameter_final() { | 7548 test_function_parameter_final() { |
| 3283 checkLibrary('f(final x) {}'); | 7549 var library = checkLibrary('f(final x) {}'); |
| 7550 if (isStrongMode) { | |
| 7551 checkElementText( | |
| 7552 library, | |
| 7553 r''' | |
| 7554 f(final x) {} | |
| 7555 '''); | |
| 7556 } else { | |
| 7557 checkElementText( | |
| 7558 library, | |
| 7559 r''' | |
| 7560 f(final x) {} | |
| 7561 '''); | |
| 7562 } | |
| 3284 } | 7563 } |
| 3285 | 7564 |
| 3286 test_function_parameter_kind_named() { | 7565 test_function_parameter_kind_named() { |
| 3287 checkLibrary('f({x}) {}'); | 7566 var library = checkLibrary('f({x}) {}'); |
| 7567 if (isStrongMode) { | |
| 7568 checkElementText( | |
| 7569 library, | |
| 7570 r''' | |
| 7571 f({x}) {} | |
| 7572 '''); | |
| 7573 } else { | |
| 7574 checkElementText( | |
| 7575 library, | |
| 7576 r''' | |
| 7577 f({x}) {} | |
| 7578 '''); | |
| 7579 } | |
| 3288 } | 7580 } |
| 3289 | 7581 |
| 3290 test_function_parameter_kind_positional() { | 7582 test_function_parameter_kind_positional() { |
| 3291 checkLibrary('f([x]) {}'); | 7583 var library = checkLibrary('f([x]) {}'); |
| 7584 if (isStrongMode) { | |
| 7585 checkElementText( | |
| 7586 library, | |
| 7587 r''' | |
| 7588 f([x]) {} | |
| 7589 '''); | |
| 7590 } else { | |
| 7591 checkElementText( | |
| 7592 library, | |
| 7593 r''' | |
| 7594 f([x]) {} | |
| 7595 '''); | |
| 7596 } | |
| 3292 } | 7597 } |
| 3293 | 7598 |
| 3294 test_function_parameter_kind_required() { | 7599 test_function_parameter_kind_required() { |
| 3295 checkLibrary('f(x) {}'); | 7600 var library = checkLibrary('f(x) {}'); |
| 7601 if (isStrongMode) { | |
| 7602 checkElementText( | |
| 7603 library, | |
| 7604 r''' | |
| 7605 f(x) {} | |
| 7606 '''); | |
| 7607 } else { | |
| 7608 checkElementText( | |
| 7609 library, | |
| 7610 r''' | |
| 7611 f(x) {} | |
| 7612 '''); | |
| 7613 } | |
| 3296 } | 7614 } |
| 3297 | 7615 |
| 3298 test_function_parameter_parameters() { | 7616 test_function_parameter_parameters() { |
| 3299 checkLibrary('f(g(x, y)) {}'); | 7617 var library = checkLibrary('f(g(x, y)) {}'); |
| 7618 if (isStrongMode) { | |
| 7619 checkElementText( | |
| 7620 library, | |
| 7621 r''' | |
| 7622 f((dynamic, dynamic) → dynamic g) {} | |
| 7623 '''); | |
| 7624 } else { | |
| 7625 checkElementText( | |
| 7626 library, | |
| 7627 r''' | |
| 7628 f((dynamic, dynamic) → dynamic g) {} | |
| 7629 '''); | |
| 7630 } | |
| 3300 } | 7631 } |
| 3301 | 7632 |
| 3302 test_function_parameter_return_type() { | 7633 test_function_parameter_return_type() { |
| 3303 checkLibrary('f(int g()) {}'); | 7634 var library = checkLibrary('f(int g()) {}'); |
| 7635 if (isStrongMode) { | |
| 7636 checkElementText( | |
| 7637 library, | |
| 7638 r''' | |
| 7639 f(() → int g) {} | |
| 7640 '''); | |
| 7641 } else { | |
| 7642 checkElementText( | |
| 7643 library, | |
| 7644 r''' | |
| 7645 f(() → int g) {} | |
| 7646 '''); | |
| 7647 } | |
| 3304 } | 7648 } |
| 3305 | 7649 |
| 3306 test_function_parameter_return_type_void() { | 7650 test_function_parameter_return_type_void() { |
| 3307 checkLibrary('f(void g()) {}'); | 7651 var library = checkLibrary('f(void g()) {}'); |
| 7652 if (isStrongMode) { | |
| 7653 checkElementText( | |
| 7654 library, | |
| 7655 r''' | |
| 7656 f(() → void g) {} | |
| 7657 '''); | |
| 7658 } else { | |
| 7659 checkElementText( | |
| 7660 library, | |
| 7661 r''' | |
| 7662 f(() → void g) {} | |
| 7663 '''); | |
| 7664 } | |
| 3308 } | 7665 } |
| 3309 | 7666 |
| 3310 test_function_parameter_type() { | 7667 test_function_parameter_type() { |
| 3311 checkLibrary('f(int i) {}'); | 7668 var library = checkLibrary('f(int i) {}'); |
| 7669 if (isStrongMode) { | |
| 7670 checkElementText( | |
| 7671 library, | |
| 7672 r''' | |
| 7673 f(int i) {} | |
| 7674 '''); | |
| 7675 } else { | |
| 7676 checkElementText( | |
| 7677 library, | |
| 7678 r''' | |
| 7679 f(int i) {} | |
| 7680 '''); | |
| 7681 } | |
| 3312 } | 7682 } |
| 3313 | 7683 |
| 3314 test_function_parameters() { | 7684 test_function_parameters() { |
| 3315 checkLibrary('f(x, y) {}'); | 7685 var library = checkLibrary('f(x, y) {}'); |
| 7686 if (isStrongMode) { | |
| 7687 checkElementText( | |
| 7688 library, | |
| 7689 r''' | |
| 7690 f(x, y) {} | |
| 7691 '''); | |
| 7692 } else { | |
| 7693 checkElementText( | |
| 7694 library, | |
| 7695 r''' | |
| 7696 f(x, y) {} | |
| 7697 '''); | |
| 7698 } | |
| 3316 } | 7699 } |
| 3317 | 7700 |
| 3318 test_function_return_type() { | 7701 test_function_return_type() { |
| 3319 checkLibrary('int f() => null;'); | 7702 var library = checkLibrary('int f() => null;'); |
| 7703 if (isStrongMode) { | |
| 7704 checkElementText( | |
| 7705 library, | |
| 7706 r''' | |
| 7707 int f() {} | |
| 7708 '''); | |
| 7709 } else { | |
| 7710 checkElementText( | |
| 7711 library, | |
| 7712 r''' | |
| 7713 int f() {} | |
| 7714 '''); | |
| 7715 } | |
| 3320 } | 7716 } |
| 3321 | 7717 |
| 3322 test_function_return_type_implicit() { | 7718 test_function_return_type_implicit() { |
| 3323 checkLibrary('f() => null;'); | 7719 var library = checkLibrary('f() => null;'); |
| 7720 if (isStrongMode) { | |
| 7721 checkElementText( | |
| 7722 library, | |
| 7723 r''' | |
| 7724 f() {} | |
| 7725 '''); | |
| 7726 } else { | |
| 7727 checkElementText( | |
| 7728 library, | |
| 7729 r''' | |
| 7730 f() {} | |
| 7731 '''); | |
| 7732 } | |
| 3324 } | 7733 } |
| 3325 | 7734 |
| 3326 test_function_return_type_void() { | 7735 test_function_return_type_void() { |
| 3327 checkLibrary('void f() {}'); | 7736 var library = checkLibrary('void f() {}'); |
| 7737 if (isStrongMode) { | |
| 7738 checkElementText( | |
| 7739 library, | |
| 7740 r''' | |
| 7741 void f() {} | |
| 7742 '''); | |
| 7743 } else { | |
| 7744 checkElementText( | |
| 7745 library, | |
| 7746 r''' | |
| 7747 void f() {} | |
| 7748 '''); | |
| 7749 } | |
| 3328 } | 7750 } |
| 3329 | 7751 |
| 3330 test_function_type_parameter() { | 7752 test_function_type_parameter() { |
| 3331 prepareAnalysisContext(createOptions()); | 7753 prepareAnalysisContext(createOptions()); |
| 3332 checkLibrary('T f<T, U>(U u) => null;'); | 7754 var library = checkLibrary('T f<T, U>(U u) => null;'); |
| 7755 if (isStrongMode) { | |
| 7756 checkElementText( | |
| 7757 library, | |
| 7758 r''' | |
| 7759 T f<T, U>(U u) {} | |
| 7760 '''); | |
| 7761 } else { | |
| 7762 checkElementText( | |
| 7763 library, | |
| 7764 r''' | |
| 7765 T f<T, U>(U u) {} | |
| 7766 '''); | |
| 7767 } | |
| 3333 } | 7768 } |
| 3334 | 7769 |
| 3335 test_function_type_parameter_with_function_typed_parameter() { | 7770 test_function_type_parameter_with_function_typed_parameter() { |
| 3336 prepareAnalysisContext(createOptions()); | 7771 prepareAnalysisContext(createOptions()); |
| 3337 checkLibrary('void f<T, U>(T x(U u)) {}'); | 7772 var library = checkLibrary('void f<T, U>(T x(U u)) {}'); |
| 7773 if (isStrongMode) { | |
| 7774 checkElementText( | |
| 7775 library, | |
| 7776 r''' | |
| 7777 void f<T, U>((U) → T x) {} | |
| 7778 '''); | |
| 7779 } else { | |
| 7780 checkElementText( | |
| 7781 library, | |
| 7782 r''' | |
| 7783 void f<T, U>((U) → T x) {} | |
| 7784 '''); | |
| 7785 } | |
| 3338 } | 7786 } |
| 3339 | 7787 |
| 3340 test_functions() { | 7788 test_functions() { |
| 3341 checkLibrary('f() {} g() {}'); | 7789 var library = checkLibrary('f() {} g() {}'); |
| 7790 if (isStrongMode) { | |
| 7791 checkElementText( | |
| 7792 library, | |
| 7793 r''' | |
| 7794 f() {} | |
| 7795 g() {} | |
| 7796 '''); | |
| 7797 } else { | |
| 7798 checkElementText( | |
| 7799 library, | |
| 7800 r''' | |
| 7801 f() {} | |
| 7802 g() {} | |
| 7803 '''); | |
| 7804 } | |
| 3342 } | 7805 } |
| 3343 | 7806 |
| 3344 test_futureOr() { | 7807 test_futureOr() { |
| 3345 var library = checkLibrary('import "dart:async"; FutureOr<int> x;'); | 7808 var library = checkLibrary('import "dart:async"; FutureOr<int> x;'); |
| 7809 if (isStrongMode) { | |
| 7810 checkElementText( | |
| 7811 library, | |
| 7812 r''' | |
| 7813 import 'dart:async'; | |
| 7814 FutureOr<int> x; | |
| 7815 '''); | |
| 7816 } else { | |
| 7817 checkElementText( | |
| 7818 library, | |
| 7819 r''' | |
| 7820 import 'dart:async'; | |
| 7821 var x; | |
| 7822 '''); | |
| 7823 } | |
| 3346 var variables = library.definingCompilationUnit.topLevelVariables; | 7824 var variables = library.definingCompilationUnit.topLevelVariables; |
| 3347 expect(variables, hasLength(1)); | 7825 expect(variables, hasLength(1)); |
| 3348 if (createOptions().strongMode) { | 7826 if (createOptions().strongMode) { |
| 3349 expect(variables[0].type.toString(), 'FutureOr<int>'); | 7827 expect(variables[0].type.toString(), 'FutureOr<int>'); |
| 3350 } else { | 7828 } else { |
| 3351 expect(variables[0].type.toString(), 'dynamic'); | 7829 expect(variables[0].type.toString(), 'dynamic'); |
| 3352 } | 7830 } |
| 3353 } | 7831 } |
| 3354 | 7832 |
| 3355 test_futureOr_const() { | 7833 test_futureOr_const() { |
| 3356 var library = checkLibrary('import "dart:async"; const x = FutureOr;'); | 7834 var library = checkLibrary('import "dart:async"; const x = FutureOr;'); |
| 7835 if (isStrongMode) { | |
| 7836 checkElementText( | |
| 7837 library, | |
| 7838 r''' | |
| 7839 import 'dart:async'; | |
| 7840 const Type x; | |
| 7841 '''); | |
| 7842 } else { | |
| 7843 checkElementText( | |
| 7844 library, | |
| 7845 r''' | |
| 7846 import 'dart:async'; | |
| 7847 const x; | |
| 7848 '''); | |
| 7849 } | |
| 3357 var variables = library.definingCompilationUnit.topLevelVariables; | 7850 var variables = library.definingCompilationUnit.topLevelVariables; |
| 3358 expect(variables, hasLength(1)); | 7851 expect(variables, hasLength(1)); |
| 3359 var x = variables[0] as ConstTopLevelVariableElementImpl; | 7852 var x = variables[0] as ConstTopLevelVariableElementImpl; |
| 3360 if (createOptions().strongMode) { | 7853 if (createOptions().strongMode) { |
| 3361 expect(x.type.toString(), 'Type'); | 7854 expect(x.type.toString(), 'Type'); |
| 3362 } else { | 7855 } else { |
| 3363 expect(x.type.toString(), 'dynamic'); | 7856 expect(x.type.toString(), 'dynamic'); |
| 3364 } | 7857 } |
| 3365 expect(x.constantInitializer.toString(), 'FutureOr'); | 7858 expect(x.constantInitializer.toString(), 'FutureOr'); |
| 3366 } | 7859 } |
| 3367 | 7860 |
| 3368 test_futureOr_inferred() { | 7861 test_futureOr_inferred() { |
| 3369 var library = checkLibrary(''' | 7862 var library = checkLibrary(''' |
| 3370 import "dart:async"; | 7863 import "dart:async"; |
| 3371 FutureOr<int> f() => null; | 7864 FutureOr<int> f() => null; |
| 3372 var x = f(); | 7865 var x = f(); |
| 3373 var y = x.then((z) => z.asDouble()); | 7866 var y = x.then((z) => z.asDouble()); |
| 3374 '''); | 7867 '''); |
| 7868 if (isStrongMode) { | |
| 7869 checkElementText( | |
| 7870 library, | |
| 7871 r''' | |
| 7872 import 'dart:async'; | |
| 7873 FutureOr<int> x; | |
| 7874 var y; | |
| 7875 FutureOr<int> f() {} | |
| 7876 '''); | |
| 7877 } else { | |
| 7878 checkElementText( | |
| 7879 library, | |
| 7880 r''' | |
| 7881 import 'dart:async'; | |
| 7882 var x; | |
| 7883 var y; | |
| 7884 f() {} | |
| 7885 '''); | |
| 7886 } | |
| 3375 var variables = library.definingCompilationUnit.topLevelVariables; | 7887 var variables = library.definingCompilationUnit.topLevelVariables; |
| 3376 expect(variables, hasLength(2)); | 7888 expect(variables, hasLength(2)); |
| 3377 var x = variables[0]; | 7889 var x = variables[0]; |
| 3378 expect(x.name, 'x'); | 7890 expect(x.name, 'x'); |
| 3379 var y = variables[1]; | 7891 var y = variables[1]; |
| 3380 expect(y.name, 'y'); | 7892 expect(y.name, 'y'); |
| 3381 if (createOptions().strongMode) { | 7893 if (createOptions().strongMode) { |
| 3382 expect(x.type.toString(), 'FutureOr<int>'); | 7894 expect(x.type.toString(), 'FutureOr<int>'); |
| 3383 expect(y.type.toString(), 'dynamic'); | 7895 expect(y.type.toString(), 'dynamic'); |
| 3384 } else { | 7896 } else { |
| 3385 expect(x.type.toString(), 'dynamic'); | 7897 expect(x.type.toString(), 'dynamic'); |
| 3386 expect(y.type.toString(), 'dynamic'); | 7898 expect(y.type.toString(), 'dynamic'); |
| 3387 } | 7899 } |
| 3388 } | 7900 } |
| 3389 | 7901 |
| 3390 test_generic_gClass_gMethodStatic() { | 7902 test_generic_gClass_gMethodStatic() { |
| 3391 prepareAnalysisContext(createOptions()); | 7903 prepareAnalysisContext(createOptions()); |
| 3392 checkLibrary(''' | 7904 var library = checkLibrary(''' |
| 3393 class C<T, U> { | 7905 class C<T, U> { |
| 3394 static void m<V, W>(V v, W w) { | 7906 static void m<V, W>(V v, W w) { |
| 3395 void f<X, Y>(V v, W w, X x, Y y) { | 7907 void f<X, Y>(V v, W w, X x, Y y) { |
| 3396 } | 7908 } |
| 3397 } | 7909 } |
| 3398 } | 7910 } |
| 3399 '''); | 7911 '''); |
| 7912 if (isStrongMode) { | |
| 7913 checkElementText( | |
| 7914 library, | |
| 7915 r''' | |
| 7916 class C<T, U> { | |
| 7917 static void m<V, W>(V v, W w) {} | |
| 7918 } | |
| 7919 '''); | |
| 7920 } else { | |
| 7921 checkElementText( | |
| 7922 library, | |
| 7923 r''' | |
| 7924 class C<T, U> { | |
| 7925 static void m<V, W>(V v, W w) {} | |
| 7926 } | |
| 7927 '''); | |
| 7928 } | |
| 3400 } | 7929 } |
| 3401 | 7930 |
| 3402 test_getElement_constructor_named() { | 7931 test_getElement_constructor_named() { |
| 3403 String text = 'class C { C.named(); }'; | 7932 String text = 'class C { C.named(); }'; |
| 3404 Source source = addLibrarySource('/test.dart', text); | 7933 Source source = addLibrarySource('/test.dart', text); |
| 3405 ConstructorElement original = context | 7934 ConstructorElement original = context |
| 3406 .computeLibraryElement(source) | 7935 .computeLibraryElement(source) |
| 3407 .getType('C') | 7936 .getType('C') |
| 3408 .getNamedConstructor('named'); | 7937 .getNamedConstructor('named'); |
| 3409 expect(original, isNotNull); | 7938 expect(original, isNotNull); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3475 String text = 'class C { f() {} }'; | 8004 String text = 'class C { f() {} }'; |
| 3476 Source source = addLibrarySource('/test.dart', text); | 8005 Source source = addLibrarySource('/test.dart', text); |
| 3477 CompilationUnitElement original = | 8006 CompilationUnitElement original = |
| 3478 context.computeLibraryElement(source).definingCompilationUnit; | 8007 context.computeLibraryElement(source).definingCompilationUnit; |
| 3479 expect(original, isNotNull); | 8008 expect(original, isNotNull); |
| 3480 CompilationUnitElement resynthesized = validateGetElement(text, original); | 8009 CompilationUnitElement resynthesized = validateGetElement(text, original); |
| 3481 compareCompilationUnitElements(resynthesized, original); | 8010 compareCompilationUnitElements(resynthesized, original); |
| 3482 } | 8011 } |
| 3483 | 8012 |
| 3484 test_getter_documented() { | 8013 test_getter_documented() { |
| 3485 checkLibrary(''' | 8014 var library = checkLibrary(''' |
| 3486 // Extra comment so doc comment offset != 0 | 8015 // Extra comment so doc comment offset != 0 |
| 3487 /** | 8016 /** |
| 3488 * Docs | 8017 * Docs |
| 3489 */ | 8018 */ |
| 3490 get x => null;'''); | 8019 get x => null;'''); |
| 8020 if (isStrongMode) { | |
| 8021 checkElementText( | |
| 8022 library, | |
| 8023 r''' | |
| 8024 get x {} | |
| 8025 '''); | |
| 8026 } else { | |
| 8027 checkElementText( | |
| 8028 library, | |
| 8029 r''' | |
| 8030 get x {} | |
| 8031 '''); | |
| 8032 } | |
| 3491 } | 8033 } |
| 3492 | 8034 |
| 3493 test_getter_external() { | 8035 test_getter_external() { |
| 3494 checkLibrary('external int get x;'); | 8036 var library = checkLibrary('external int get x;'); |
| 8037 if (isStrongMode) { | |
| 8038 checkElementText( | |
| 8039 library, | |
| 8040 r''' | |
| 8041 external int get x {} | |
| 8042 '''); | |
| 8043 } else { | |
| 8044 checkElementText( | |
| 8045 library, | |
| 8046 r''' | |
| 8047 external int get x {} | |
| 8048 '''); | |
| 8049 } | |
| 3495 } | 8050 } |
| 3496 | 8051 |
| 3497 test_getter_inferred_type_nonStatic_implicit_return() { | 8052 test_getter_inferred_type_nonStatic_implicit_return() { |
| 3498 checkLibrary( | 8053 var library = checkLibrary( |
| 3499 'class C extends D { get f => null; } abstract class D { int get f; }'); | 8054 'class C extends D { get f => null; } abstract class D { int get f; }'); |
| 8055 if (isStrongMode) { | |
| 8056 checkElementText( | |
| 8057 library, | |
| 8058 r''' | |
| 8059 class C extends D { | |
| 8060 int get f {} | |
| 8061 } | |
| 8062 abstract class D { | |
| 8063 int get f; | |
| 8064 } | |
| 8065 '''); | |
| 8066 } else { | |
| 8067 checkElementText( | |
| 8068 library, | |
| 8069 r''' | |
| 8070 class C extends D { | |
| 8071 get f {} | |
| 8072 } | |
| 8073 abstract class D { | |
| 8074 int get f; | |
| 8075 } | |
| 8076 '''); | |
| 8077 } | |
| 3500 } | 8078 } |
| 3501 | 8079 |
| 3502 test_getters() { | 8080 test_getters() { |
| 3503 checkLibrary('int get x => null; get y => null;'); | 8081 var library = checkLibrary('int get x => null; get y => null;'); |
| 8082 if (isStrongMode) { | |
| 8083 checkElementText( | |
| 8084 library, | |
| 8085 r''' | |
| 8086 int get x {} | |
| 8087 get y {} | |
| 8088 '''); | |
| 8089 } else { | |
| 8090 checkElementText( | |
| 8091 library, | |
| 8092 r''' | |
| 8093 int get x {} | |
| 8094 get y {} | |
| 8095 '''); | |
| 8096 } | |
| 3504 } | 8097 } |
| 3505 | 8098 |
| 3506 test_implicitTopLevelVariable_getterFirst() { | 8099 test_implicitTopLevelVariable_getterFirst() { |
| 3507 checkLibrary('int get x => 0; void set x(int value) {}'); | 8100 var library = checkLibrary('int get x => 0; void set x(int value) {}'); |
| 8101 if (isStrongMode) { | |
| 8102 checkElementText( | |
| 8103 library, | |
| 8104 r''' | |
| 8105 int get x {} | |
| 8106 void set x(int value) {} | |
| 8107 '''); | |
| 8108 } else { | |
| 8109 checkElementText( | |
| 8110 library, | |
| 8111 r''' | |
| 8112 int get x {} | |
| 8113 void set x(int value) {} | |
| 8114 '''); | |
| 8115 } | |
| 3508 } | 8116 } |
| 3509 | 8117 |
| 3510 test_implicitTopLevelVariable_setterFirst() { | 8118 test_implicitTopLevelVariable_setterFirst() { |
| 3511 checkLibrary('void set x(int value) {} int get x => 0;'); | 8119 var library = checkLibrary('void set x(int value) {} int get x => 0;'); |
| 8120 if (isStrongMode) { | |
| 8121 checkElementText( | |
| 8122 library, | |
| 8123 r''' | |
| 8124 void set x(int value) {} | |
| 8125 int get x {} | |
| 8126 '''); | |
| 8127 } else { | |
| 8128 checkElementText( | |
| 8129 library, | |
| 8130 r''' | |
| 8131 void set x(int value) {} | |
| 8132 int get x {} | |
| 8133 '''); | |
| 8134 } | |
| 3512 } | 8135 } |
| 3513 | 8136 |
| 3514 test_import_configurations_useDefault() { | 8137 test_import_configurations_useDefault() { |
| 3515 context.declaredVariables.define('dart.library.io', 'false'); | 8138 context.declaredVariables.define('dart.library.io', 'false'); |
| 3516 addLibrarySource('/foo.dart', 'class A {}'); | 8139 addLibrarySource('/foo.dart', 'class A {}'); |
| 3517 addLibrarySource('/foo_io.dart', 'class A {}'); | 8140 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 3518 addLibrarySource('/foo_html.dart', 'class A {}'); | 8141 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 3519 var library = checkLibrary(r''' | 8142 var library = checkLibrary(r''' |
| 3520 import 'foo.dart' | 8143 import 'foo.dart' |
| 3521 if (dart.library.io) 'foo_io.dart' | 8144 if (dart.library.io) 'foo_io.dart' |
| 3522 if (dart.library.html) 'foo_html.dart'; | 8145 if (dart.library.html) 'foo_html.dart'; |
| 3523 | 8146 |
| 3524 class B extends A {} | 8147 class B extends A {} |
| 3525 '''); | 8148 '''); |
| 8149 if (isStrongMode) { | |
| 8150 checkElementText( | |
| 8151 library, | |
| 8152 r''' | |
| 8153 import 'foo.dart'; | |
| 8154 class B extends A { | |
| 8155 } | |
| 8156 '''); | |
| 8157 } else { | |
| 8158 checkElementText( | |
| 8159 library, | |
| 8160 r''' | |
| 8161 import 'foo.dart'; | |
| 8162 class B extends A { | |
| 8163 } | |
| 8164 '''); | |
| 8165 } | |
| 3526 var typeA = library.definingCompilationUnit.getType('B').supertype; | 8166 var typeA = library.definingCompilationUnit.getType('B').supertype; |
| 3527 expect(typeA.element.source.shortName, 'foo.dart'); | 8167 expect(typeA.element.source.shortName, 'foo.dart'); |
| 3528 } | 8168 } |
| 3529 | 8169 |
| 3530 test_import_configurations_useFirst() { | 8170 test_import_configurations_useFirst() { |
| 3531 context.declaredVariables.define('dart.library.io', 'true'); | 8171 context.declaredVariables.define('dart.library.io', 'true'); |
| 3532 context.declaredVariables.define('dart.library.html', 'true'); | 8172 context.declaredVariables.define('dart.library.html', 'true'); |
| 3533 addLibrarySource('/foo.dart', 'class A {}'); | 8173 addLibrarySource('/foo.dart', 'class A {}'); |
| 3534 addLibrarySource('/foo_io.dart', 'class A {}'); | 8174 addLibrarySource('/foo_io.dart', 'class A {}'); |
| 3535 addLibrarySource('/foo_html.dart', 'class A {}'); | 8175 addLibrarySource('/foo_html.dart', 'class A {}'); |
| 3536 var library = checkLibrary(r''' | 8176 var library = checkLibrary(r''' |
| 3537 import 'foo.dart' | 8177 import 'foo.dart' |
| 3538 if (dart.library.io) 'foo_io.dart' | 8178 if (dart.library.io) 'foo_io.dart' |
| 3539 if (dart.library.html) 'foo_html.dart'; | 8179 if (dart.library.html) 'foo_html.dart'; |
| 3540 | 8180 |
| 3541 class B extends A {} | 8181 class B extends A {} |
| 3542 '''); | 8182 '''); |
| 8183 if (isStrongMode) { | |
| 8184 checkElementText( | |
| 8185 library, | |
| 8186 r''' | |
| 8187 import 'foo_io.dart'; | |
| 8188 class B extends A { | |
| 8189 } | |
| 8190 '''); | |
| 8191 } else { | |
| 8192 checkElementText( | |
| 8193 library, | |
| 8194 r''' | |
| 8195 import 'foo_io.dart'; | |
| 8196 class B extends A { | |
| 8197 } | |
| 8198 '''); | |
| 8199 } | |
| 3543 var typeA = library.definingCompilationUnit.getType('B').supertype; | 8200 var typeA = library.definingCompilationUnit.getType('B').supertype; |
| 3544 expect(typeA.element.source.shortName, 'foo_io.dart'); | 8201 expect(typeA.element.source.shortName, 'foo_io.dart'); |
| 3545 } | 8202 } |
| 3546 | 8203 |
| 3547 test_import_deferred() { | 8204 test_import_deferred() { |
| 3548 addLibrarySource('/a.dart', 'f() {}'); | 8205 addLibrarySource('/a.dart', 'f() {}'); |
| 3549 checkLibrary('import "a.dart" deferred as p; main() { p.f(); }'); | 8206 var library = |
| 8207 checkLibrary('import "a.dart" deferred as p; main() { p.f(); }'); | |
| 8208 if (isStrongMode) { | |
| 8209 checkElementText( | |
| 8210 library, | |
| 8211 r''' | |
| 8212 import 'a.dart' deferred as p; | |
| 8213 main() {} | |
| 8214 '''); | |
| 8215 } else { | |
| 8216 checkElementText( | |
| 8217 library, | |
| 8218 r''' | |
| 8219 import 'a.dart' deferred as p; | |
| 8220 main() {} | |
| 8221 '''); | |
| 8222 } | |
| 3550 } | 8223 } |
| 3551 | 8224 |
| 3552 test_import_hide() { | 8225 test_import_hide() { |
| 3553 addLibrary('dart:async'); | 8226 addLibrary('dart:async'); |
| 3554 checkLibrary('import "dart:async" hide Stream, Completer; Future f;'); | 8227 var library = |
| 8228 checkLibrary('import "dart:async" hide Stream, Completer; Future f;'); | |
| 8229 if (isStrongMode) { | |
| 8230 checkElementText( | |
| 8231 library, | |
| 8232 r''' | |
| 8233 import 'dart:async' hide Stream, Completer; | |
| 8234 Future f; | |
| 8235 '''); | |
| 8236 } else { | |
| 8237 checkElementText( | |
| 8238 library, | |
| 8239 r''' | |
| 8240 import 'dart:async' hide Stream, Completer; | |
| 8241 Future f; | |
| 8242 '''); | |
| 8243 } | |
| 3555 } | 8244 } |
| 3556 | 8245 |
| 3557 test_import_multiple_combinators() { | 8246 test_import_multiple_combinators() { |
| 3558 addLibrary('dart:async'); | 8247 addLibrary('dart:async'); |
| 3559 checkLibrary('import "dart:async" hide Stream show Future; Future f;'); | 8248 var library = |
| 8249 checkLibrary('import "dart:async" hide Stream show Future; Future f;'); | |
| 8250 if (isStrongMode) { | |
| 8251 checkElementText( | |
| 8252 library, | |
| 8253 r''' | |
| 8254 import 'dart:async' hide Stream show Future; | |
| 8255 Future f; | |
| 8256 '''); | |
| 8257 } else { | |
| 8258 checkElementText( | |
| 8259 library, | |
| 8260 r''' | |
| 8261 import 'dart:async' hide Stream show Future; | |
| 8262 Future f; | |
| 8263 '''); | |
| 8264 } | |
| 3560 } | 8265 } |
| 3561 | 8266 |
| 3562 test_import_prefixed() { | 8267 test_import_prefixed() { |
| 3563 addLibrarySource('/a.dart', 'library a; class C {}'); | 8268 addLibrarySource('/a.dart', 'library a; class C {}'); |
| 3564 checkLibrary('import "a.dart" as a; a.C c;'); | 8269 var library = checkLibrary('import "a.dart" as a; a.C c;'); |
| 8270 if (isStrongMode) { | |
| 8271 checkElementText( | |
| 8272 library, | |
| 8273 r''' | |
| 8274 import 'a.dart' as a; | |
| 8275 C c; | |
| 8276 '''); | |
| 8277 } else { | |
| 8278 checkElementText( | |
| 8279 library, | |
| 8280 r''' | |
| 8281 import 'a.dart' as a; | |
| 8282 C c; | |
| 8283 '''); | |
| 8284 } | |
| 3565 } | 8285 } |
| 3566 | 8286 |
| 3567 test_import_self() { | 8287 test_import_self() { |
| 3568 LibraryElementImpl resynthesized = checkLibrary(''' | 8288 LibraryElementImpl resynthesized = checkLibrary(''' |
| 3569 import 'test.dart' as p; | 8289 import 'test.dart' as p; |
| 3570 class C {} | 8290 class C {} |
| 3571 class D extends p.C {} // Prevent "unused import" warning | 8291 class D extends p.C {} // Prevent "unused import" warning |
| 3572 '''); | 8292 '''); |
| 3573 expect(resynthesized.imports, hasLength(2)); | 8293 expect(resynthesized.imports, hasLength(2)); |
| 3574 expect(resynthesized.imports[0].importedLibrary.location, | 8294 expect(resynthesized.imports[0].importedLibrary.location, |
| 3575 resynthesized.location); | 8295 resynthesized.location); |
| 3576 expect(resynthesized.imports[1].importedLibrary.isDartCore, true); | 8296 expect(resynthesized.imports[1].importedLibrary.isDartCore, true); |
| 8297 if (isStrongMode) { | |
| 8298 checkElementText( | |
| 8299 resynthesized, | |
| 8300 r''' | |
| 8301 import 'test.dart' as p; | |
| 8302 class C { | |
| 8303 } | |
| 8304 class D extends C { | |
| 8305 } | |
| 8306 '''); | |
| 8307 } else { | |
| 8308 checkElementText( | |
| 8309 resynthesized, | |
| 8310 r''' | |
| 8311 import 'test.dart' as p; | |
| 8312 class C { | |
| 8313 } | |
| 8314 class D extends C { | |
| 8315 } | |
| 8316 '''); | |
| 8317 } | |
| 3577 } | 8318 } |
| 3578 | 8319 |
| 3579 test_import_short_absolute() { | 8320 test_import_short_absolute() { |
| 3580 testFile = '/my/project/bin/test.dart'; | 8321 testFile = '/my/project/bin/test.dart'; |
| 3581 // Note: "/a.dart" resolves differently on Windows vs. Posix. | 8322 // Note: "/a.dart" resolves differently on Windows vs. Posix. |
| 3582 var destinationPath = | 8323 var destinationPath = |
| 3583 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); | 8324 resourceProvider.pathContext.fromUri(Uri.parse('/a.dart')); |
| 3584 addLibrarySource(destinationPath, 'class C {}'); | 8325 addLibrarySource(destinationPath, 'class C {}'); |
| 3585 checkLibrary('import "/a.dart"; C c;'); | 8326 var library = checkLibrary('import "/a.dart"; C c;'); |
| 8327 if (isStrongMode) { | |
| 8328 checkElementText( | |
| 8329 library, | |
| 8330 r''' | |
| 8331 import '/a.dart'; | |
| 8332 C c; | |
| 8333 '''); | |
| 8334 } else { | |
| 8335 checkElementText( | |
| 8336 library, | |
| 8337 r''' | |
| 8338 import '/a.dart'; | |
| 8339 C c; | |
| 8340 '''); | |
| 8341 } | |
| 3586 } | 8342 } |
| 3587 | 8343 |
| 3588 test_import_show() { | 8344 test_import_show() { |
| 3589 addLibrary('dart:async'); | 8345 addLibrary('dart:async'); |
| 3590 checkLibrary(''' | 8346 var library = checkLibrary(''' |
| 3591 import "dart:async" show Future, Stream; | 8347 import "dart:async" show Future, Stream; |
| 3592 Future f; | 8348 Future f; |
| 3593 Stream s; | 8349 Stream s; |
| 3594 '''); | 8350 '''); |
| 8351 if (isStrongMode) { | |
| 8352 checkElementText( | |
| 8353 library, | |
| 8354 r''' | |
| 8355 import 'dart:async' show Future, Stream; | |
| 8356 Future f; | |
| 8357 Stream s; | |
| 8358 '''); | |
| 8359 } else { | |
| 8360 checkElementText( | |
| 8361 library, | |
| 8362 r''' | |
| 8363 import 'dart:async' show Future, Stream; | |
| 8364 Future f; | |
| 8365 Stream s; | |
| 8366 '''); | |
| 8367 } | |
| 3595 } | 8368 } |
| 3596 | 8369 |
| 3597 test_imports() { | 8370 test_imports() { |
| 3598 addLibrarySource('/a.dart', 'library a; class C {}'); | 8371 addLibrarySource('/a.dart', 'library a; class C {}'); |
| 3599 addLibrarySource('/b.dart', 'library b; class D {}'); | 8372 addLibrarySource('/b.dart', 'library b; class D {}'); |
| 3600 checkLibrary('import "a.dart"; import "b.dart"; C c; D d;'); | 8373 var library = checkLibrary('import "a.dart"; import "b.dart"; C c; D d;'); |
| 8374 if (isStrongMode) { | |
| 8375 checkElementText( | |
| 8376 library, | |
| 8377 r''' | |
| 8378 import 'a.dart'; | |
| 8379 import 'b.dart'; | |
| 8380 C c; | |
| 8381 D d; | |
| 8382 '''); | |
| 8383 } else { | |
| 8384 checkElementText( | |
| 8385 library, | |
| 8386 r''' | |
| 8387 import 'a.dart'; | |
| 8388 import 'b.dart'; | |
| 8389 C c; | |
| 8390 D d; | |
| 8391 '''); | |
| 8392 } | |
| 3601 } | 8393 } |
| 3602 | 8394 |
| 3603 test_inferred_function_type_for_variable_in_generic_function() { | 8395 test_inferred_function_type_for_variable_in_generic_function() { |
| 3604 // In the code below, `x` has an inferred type of `() => int`, with 2 | 8396 // In the code below, `x` has an inferred type of `() => int`, with 2 |
| 3605 // (unused) type parameters from the enclosing top level function. | 8397 // (unused) type parameters from the enclosing top level function. |
| 3606 checkLibrary(''' | 8398 var library = checkLibrary(''' |
| 3607 f<U, V>() { | 8399 f<U, V>() { |
| 3608 var x = () => 0; | 8400 var x = () => 0; |
| 3609 } | 8401 } |
| 3610 '''); | 8402 '''); |
| 8403 if (isStrongMode) { | |
| 8404 checkElementText( | |
| 8405 library, | |
| 8406 r''' | |
| 8407 f<U, V>() {} | |
| 8408 '''); | |
| 8409 } else { | |
| 8410 checkElementText( | |
| 8411 library, | |
| 8412 r''' | |
| 8413 f<U, V>() {} | |
| 8414 '''); | |
| 8415 } | |
| 3611 } | 8416 } |
| 3612 | 8417 |
| 3613 test_inferred_function_type_in_generic_class_constructor() { | 8418 test_inferred_function_type_in_generic_class_constructor() { |
| 3614 // In the code below, `() => () => 0` has an inferred return type of | 8419 // In the code below, `() => () => 0` has an inferred return type of |
| 3615 // `() => int`, with 2 (unused) type parameters from the enclosing class. | 8420 // `() => int`, with 2 (unused) type parameters from the enclosing class. |
| 3616 checkLibrary(''' | 8421 var library = checkLibrary(''' |
| 3617 class C<U, V> { | 8422 class C<U, V> { |
| 3618 final x; | 8423 final x; |
| 3619 C() : x = (() => () => 0); | 8424 C() : x = (() => () => 0); |
| 3620 } | 8425 } |
| 3621 '''); | 8426 '''); |
| 8427 if (isStrongMode) { | |
| 8428 checkElementText( | |
| 8429 library, | |
| 8430 r''' | |
| 8431 class C<U, V> { | |
| 8432 final x; | |
| 8433 C(); | |
| 8434 } | |
| 8435 '''); | |
| 8436 } else { | |
| 8437 checkElementText( | |
| 8438 library, | |
| 8439 r''' | |
| 8440 class C<U, V> { | |
| 8441 final x; | |
| 8442 C(); | |
| 8443 } | |
| 8444 '''); | |
| 8445 } | |
| 3622 } | 8446 } |
| 3623 | 8447 |
| 3624 test_inferred_function_type_in_generic_class_getter() { | 8448 test_inferred_function_type_in_generic_class_getter() { |
| 3625 // In the code below, `() => () => 0` has an inferred return type of | 8449 // In the code below, `() => () => 0` has an inferred return type of |
| 3626 // `() => int`, with 2 (unused) type parameters from the enclosing class. | 8450 // `() => int`, with 2 (unused) type parameters from the enclosing class. |
| 3627 checkLibrary(''' | 8451 var library = checkLibrary(''' |
| 3628 class C<U, V> { | 8452 class C<U, V> { |
| 3629 get x => () => () => 0; | 8453 get x => () => () => 0; |
| 3630 } | 8454 } |
| 3631 '''); | 8455 '''); |
| 8456 if (isStrongMode) { | |
| 8457 checkElementText( | |
| 8458 library, | |
| 8459 r''' | |
| 8460 class C<U, V> { | |
| 8461 get x {} | |
| 8462 } | |
| 8463 '''); | |
| 8464 } else { | |
| 8465 checkElementText( | |
| 8466 library, | |
| 8467 r''' | |
| 8468 class C<U, V> { | |
| 8469 get x {} | |
| 8470 } | |
| 8471 '''); | |
| 8472 } | |
| 3632 } | 8473 } |
| 3633 | 8474 |
| 3634 test_inferred_function_type_in_generic_class_in_generic_method() { | 8475 test_inferred_function_type_in_generic_class_in_generic_method() { |
| 3635 // In the code below, `() => () => 0` has an inferred return type of | 8476 // In the code below, `() => () => 0` has an inferred return type of |
| 3636 // `() => int`, with 3 (unused) type parameters from the enclosing class | 8477 // `() => int`, with 3 (unused) type parameters from the enclosing class |
| 3637 // and method. | 8478 // and method. |
| 3638 checkLibrary(''' | 8479 var library = checkLibrary(''' |
| 3639 class C<T> { | 8480 class C<T> { |
| 3640 f<U, V>() { | 8481 f<U, V>() { |
| 3641 print(() => () => 0); | 8482 print(() => () => 0); |
| 3642 } | 8483 } |
| 3643 } | 8484 } |
| 3644 '''); | 8485 '''); |
| 8486 if (isStrongMode) { | |
| 8487 checkElementText( | |
| 8488 library, | |
| 8489 r''' | |
| 8490 class C<T> { | |
| 8491 f<U, V>() {} | |
| 8492 } | |
| 8493 '''); | |
| 8494 } else { | |
| 8495 checkElementText( | |
| 8496 library, | |
| 8497 r''' | |
| 8498 class C<T> { | |
| 8499 f<U, V>() {} | |
| 8500 } | |
| 8501 '''); | |
| 8502 } | |
| 3645 } | 8503 } |
| 3646 | 8504 |
| 3647 test_inferred_function_type_in_generic_class_setter() { | 8505 test_inferred_function_type_in_generic_class_setter() { |
| 3648 // In the code below, `() => () => 0` has an inferred return type of | 8506 // In the code below, `() => () => 0` has an inferred return type of |
| 3649 // `() => int`, with 2 (unused) type parameters from the enclosing class. | 8507 // `() => int`, with 2 (unused) type parameters from the enclosing class. |
| 3650 checkLibrary(''' | 8508 var library = checkLibrary(''' |
| 3651 class C<U, V> { | 8509 class C<U, V> { |
| 3652 void set x(value) { | 8510 void set x(value) { |
| 3653 print(() => () => 0); | 8511 print(() => () => 0); |
| 3654 } | 8512 } |
| 3655 } | 8513 } |
| 3656 '''); | 8514 '''); |
| 8515 if (isStrongMode) { | |
| 8516 checkElementText( | |
| 8517 library, | |
| 8518 r''' | |
| 8519 class C<U, V> { | |
| 8520 void set x(value) {} | |
| 8521 } | |
| 8522 '''); | |
| 8523 } else { | |
| 8524 checkElementText( | |
| 8525 library, | |
| 8526 r''' | |
| 8527 class C<U, V> { | |
| 8528 void set x(value) {} | |
| 8529 } | |
| 8530 '''); | |
| 8531 } | |
| 3657 } | 8532 } |
| 3658 | 8533 |
| 3659 test_inferred_function_type_in_generic_closure() { | 8534 test_inferred_function_type_in_generic_closure() { |
| 3660 if (!createOptions().strongMode) { | 8535 if (!createOptions().strongMode) { |
| 3661 // The test below uses generic comment syntax because proper generic | 8536 // The test below uses generic comment syntax because proper generic |
| 3662 // method syntax doesn't support generic closures. So it can only run in | 8537 // method syntax doesn't support generic closures. So it can only run in |
| 3663 // strong mode. | 8538 // strong mode. |
| 3664 // TODO(paulberry): once proper generic method syntax supports generic | 8539 // TODO(paulberry): once proper generic method syntax supports generic |
| 3665 // closures, rewrite the test below without using generic comment syntax, | 8540 // closures, rewrite the test below without using generic comment syntax, |
| 3666 // and remove this hack. See dartbug.com/25819 | 8541 // and remove this hack. See dartbug.com/25819 |
| 3667 return; | 8542 return; |
| 3668 } | 8543 } |
| 3669 // In the code below, `<U, V>() => () => 0` has an inferred return type of | 8544 // In the code below, `<U, V>() => () => 0` has an inferred return type of |
| 3670 // `() => int`, with 3 (unused) type parameters. | 8545 // `() => int`, with 3 (unused) type parameters. |
| 3671 checkLibrary(''' | 8546 var library = checkLibrary(''' |
| 3672 f<T>() { | 8547 f<T>() { |
| 3673 print(/*<U, V>*/() => () => 0); | 8548 print(/*<U, V>*/() => () => 0); |
| 3674 } | 8549 } |
| 3675 '''); | 8550 '''); |
| 8551 if (isStrongMode) { | |
| 8552 checkElementText( | |
| 8553 library, | |
| 8554 r''' | |
| 8555 f<T>() {} | |
| 8556 '''); | |
| 8557 } else { | |
| 8558 checkElementText( | |
| 8559 library, | |
| 8560 r''' | |
| 8561 '''); | |
| 8562 } | |
| 3676 } | 8563 } |
| 3677 | 8564 |
| 3678 test_inferred_generic_function_type_in_generic_closure() { | 8565 test_inferred_generic_function_type_in_generic_closure() { |
| 3679 if (!createOptions().strongMode) { | 8566 if (!createOptions().strongMode) { |
| 3680 // The test below uses generic comment syntax because proper generic | 8567 // The test below uses generic comment syntax because proper generic |
| 3681 // method syntax doesn't support generic closures. So it can only run in | 8568 // method syntax doesn't support generic closures. So it can only run in |
| 3682 // strong mode. | 8569 // strong mode. |
| 3683 // TODO(paulberry): once proper generic method syntax supports generic | 8570 // TODO(paulberry): once proper generic method syntax supports generic |
| 3684 // closures, rewrite the test below without using generic comment syntax, | 8571 // closures, rewrite the test below without using generic comment syntax, |
| 3685 // and remove this hack. See dartbug.com/25819 | 8572 // and remove this hack. See dartbug.com/25819 |
| 3686 return; | 8573 return; |
| 3687 } | 8574 } |
| 3688 // In the code below, `<U, V>() => <W, X, Y, Z>() => 0` has an inferred | 8575 // In the code below, `<U, V>() => <W, X, Y, Z>() => 0` has an inferred |
| 3689 // return type of `() => int`, with 7 (unused) type parameters. | 8576 // return type of `() => int`, with 7 (unused) type parameters. |
| 3690 checkLibrary(''' | 8577 var library = checkLibrary(''' |
| 3691 f<T>() { | 8578 f<T>() { |
| 3692 print(/*<U, V>*/() => /*<W, X, Y, Z>*/() => 0); | 8579 print(/*<U, V>*/() => /*<W, X, Y, Z>*/() => 0); |
| 3693 } | 8580 } |
| 3694 '''); | 8581 '''); |
| 8582 if (isStrongMode) { | |
| 8583 checkElementText( | |
| 8584 library, | |
| 8585 r''' | |
| 8586 f<T>() {} | |
| 8587 '''); | |
| 8588 } else { | |
| 8589 checkElementText( | |
| 8590 library, | |
| 8591 r''' | |
| 8592 '''); | |
| 8593 } | |
| 3695 } | 8594 } |
| 3696 | 8595 |
| 3697 test_inferred_type_is_typedef() { | 8596 test_inferred_type_is_typedef() { |
| 3698 checkLibrary('typedef int F(String s);' | 8597 var library = checkLibrary('typedef int F(String s);' |
| 3699 ' class C extends D { var v; }' | 8598 ' class C extends D { var v; }' |
| 3700 ' abstract class D { F get v; }'); | 8599 ' abstract class D { F get v; }'); |
| 8600 if (isStrongMode) { | |
| 8601 checkElementText( | |
| 8602 library, | |
| 8603 r''' | |
| 8604 typedef int F(String s); | |
| 8605 class C extends D { | |
| 8606 F v; | |
| 8607 } | |
| 8608 abstract class D { | |
| 8609 F get v; | |
| 8610 } | |
| 8611 '''); | |
| 8612 } else { | |
| 8613 checkElementText( | |
| 8614 library, | |
| 8615 r''' | |
| 8616 typedef int F(String s); | |
| 8617 class C extends D { | |
| 8618 var v; | |
| 8619 } | |
| 8620 abstract class D { | |
| 8621 F get v; | |
| 8622 } | |
| 8623 '''); | |
| 8624 } | |
| 3701 } | 8625 } |
| 3702 | 8626 |
| 3703 test_inferred_type_refers_to_bound_type_param() { | 8627 test_inferred_type_refers_to_bound_type_param() { |
| 3704 checkLibrary('class C<T> extends D<int, T> { var v; }' | 8628 var library = checkLibrary('class C<T> extends D<int, T> { var v; }' |
| 3705 ' abstract class D<U, V> { Map<V, U> get v; }'); | 8629 ' abstract class D<U, V> { Map<V, U> get v; }'); |
| 8630 if (isStrongMode) { | |
| 8631 checkElementText( | |
| 8632 library, | |
| 8633 r''' | |
| 8634 class C<T> extends D<int, T> { | |
| 8635 Map<T, int> v; | |
| 8636 } | |
| 8637 abstract class D<U, V> { | |
| 8638 Map<V, U> get v; | |
| 8639 } | |
| 8640 '''); | |
| 8641 } else { | |
| 8642 checkElementText( | |
| 8643 library, | |
| 8644 r''' | |
| 8645 class C<T> extends D<int, T> { | |
| 8646 var v; | |
| 8647 } | |
| 8648 abstract class D<U, V> { | |
| 8649 Map<V, U> get v; | |
| 8650 } | |
| 8651 '''); | |
| 8652 } | |
| 3706 } | 8653 } |
| 3707 | 8654 |
| 3708 void test_inferred_type_refers_to_function_typed_param_of_typedef() { | 8655 void test_inferred_type_refers_to_function_typed_param_of_typedef() { |
| 3709 checkLibrary(''' | 8656 var library = checkLibrary(''' |
| 3710 typedef void F(int g(String s)); | 8657 typedef void F(int g(String s)); |
| 3711 h(F f) => null; | 8658 h(F f) => null; |
| 3712 var v = h(/*info:INFERRED_TYPE_CLOSURE*/(y) {}); | 8659 var v = h(/*info:INFERRED_TYPE_CLOSURE*/(y) {}); |
| 3713 '''); | 8660 '''); |
| 8661 if (isStrongMode) { | |
| 8662 checkElementText( | |
| 8663 library, | |
| 8664 r''' | |
| 8665 typedef void F((String) → int g); | |
| 8666 var v; | |
| 8667 h(F f) {} | |
| 8668 '''); | |
| 8669 } else { | |
| 8670 checkElementText( | |
| 8671 library, | |
| 8672 r''' | |
| 8673 typedef void F((String) → int g); | |
| 8674 var v; | |
| 8675 h(F f) {} | |
| 8676 '''); | |
| 8677 } | |
| 3714 } | 8678 } |
| 3715 | 8679 |
| 3716 test_inferred_type_refers_to_function_typed_parameter_type_generic_class() { | 8680 test_inferred_type_refers_to_function_typed_parameter_type_generic_class() { |
| 3717 checkLibrary('class C<T, U> extends D<U, int> { void f(int x, g) {} }' | 8681 var library = |
| 3718 ' abstract class D<V, W> { void f(int x, W g(V s)); }'); | 8682 checkLibrary('class C<T, U> extends D<U, int> { void f(int x, g) {} }' |
| 8683 ' abstract class D<V, W> { void f(int x, W g(V s)); }'); | |
| 8684 if (isStrongMode) { | |
| 8685 checkElementText( | |
| 8686 library, | |
| 8687 r''' | |
| 8688 class C<T, U> extends D<U, int> { | |
| 8689 void f(int x, (U) → int g) {} | |
| 8690 } | |
| 8691 abstract class D<V, W> { | |
| 8692 void f(int x, (V) → W g); | |
| 8693 } | |
| 8694 '''); | |
| 8695 } else { | |
| 8696 checkElementText( | |
| 8697 library, | |
| 8698 r''' | |
| 8699 class C<T, U> extends D<U, int> { | |
| 8700 void f(int x, g) {} | |
| 8701 } | |
| 8702 abstract class D<V, W> { | |
| 8703 void f(int x, (V) → W g); | |
| 8704 } | |
| 8705 '''); | |
| 8706 } | |
| 3719 } | 8707 } |
| 3720 | 8708 |
| 3721 test_inferred_type_refers_to_function_typed_parameter_type_other_lib() { | 8709 test_inferred_type_refers_to_function_typed_parameter_type_other_lib() { |
| 3722 addLibrarySource( | 8710 addLibrarySource( |
| 3723 '/a.dart', 'import "b.dart"; abstract class D extends E {}'); | 8711 '/a.dart', 'import "b.dart"; abstract class D extends E {}'); |
| 3724 addLibrarySource( | 8712 addLibrarySource( |
| 3725 '/b.dart', 'abstract class E { void f(int x, int g(String s)); }'); | 8713 '/b.dart', 'abstract class E { void f(int x, int g(String s)); }'); |
| 3726 checkLibrary('import "a.dart"; class C extends D { void f(int x, g) {} }'); | 8714 var library = checkLibrary( |
| 8715 'import "a.dart"; class C extends D { void f(int x, g) {} }'); | |
| 8716 if (isStrongMode) { | |
| 8717 checkElementText( | |
| 8718 library, | |
| 8719 r''' | |
| 8720 import 'a.dart'; | |
| 8721 class C extends D { | |
| 8722 void f(int x, (String) → int g) {} | |
| 8723 } | |
| 8724 '''); | |
| 8725 } else { | |
| 8726 checkElementText( | |
| 8727 library, | |
| 8728 r''' | |
| 8729 import 'a.dart'; | |
| 8730 class C extends D { | |
| 8731 void f(int x, g) {} | |
| 8732 } | |
| 8733 '''); | |
| 8734 } | |
| 3727 } | 8735 } |
| 3728 | 8736 |
| 3729 test_inferred_type_refers_to_method_function_typed_parameter_type() { | 8737 test_inferred_type_refers_to_method_function_typed_parameter_type() { |
| 3730 checkLibrary('class C extends D { void f(int x, g) {} }' | 8738 var library = checkLibrary('class C extends D { void f(int x, g) {} }' |
| 3731 ' abstract class D { void f(int x, int g(String s)); }'); | 8739 ' abstract class D { void f(int x, int g(String s)); }'); |
| 8740 if (isStrongMode) { | |
| 8741 checkElementText( | |
| 8742 library, | |
| 8743 r''' | |
| 8744 class C extends D { | |
| 8745 void f(int x, (String) → int g) {} | |
| 8746 } | |
| 8747 abstract class D { | |
| 8748 void f(int x, (String) → int g); | |
| 8749 } | |
| 8750 '''); | |
| 8751 } else { | |
| 8752 checkElementText( | |
| 8753 library, | |
| 8754 r''' | |
| 8755 class C extends D { | |
| 8756 void f(int x, g) {} | |
| 8757 } | |
| 8758 abstract class D { | |
| 8759 void f(int x, (String) → int g); | |
| 8760 } | |
| 8761 '''); | |
| 8762 } | |
| 3732 } | 8763 } |
| 3733 | 8764 |
| 3734 test_inferred_type_refers_to_nested_function_typed_param() { | 8765 test_inferred_type_refers_to_nested_function_typed_param() { |
| 3735 checkLibrary(''' | 8766 var library = checkLibrary(''' |
| 3736 f(void g(int x, void h())) => null; | 8767 f(void g(int x, void h())) => null; |
| 3737 var v = f((x, y) {}); | 8768 var v = f((x, y) {}); |
| 3738 '''); | 8769 '''); |
| 8770 if (isStrongMode) { | |
| 8771 checkElementText( | |
| 8772 library, | |
| 8773 r''' | |
| 8774 var v; | |
| 8775 f((int, () → void) → void g) {} | |
| 8776 '''); | |
| 8777 } else { | |
| 8778 checkElementText( | |
| 8779 library, | |
| 8780 r''' | |
| 8781 var v; | |
| 8782 f((int, () → void) → void g) {} | |
| 8783 '''); | |
| 8784 } | |
| 3739 } | 8785 } |
| 3740 | 8786 |
| 3741 test_inferred_type_refers_to_nested_function_typed_param_named() { | 8787 test_inferred_type_refers_to_nested_function_typed_param_named() { |
| 3742 checkLibrary(''' | 8788 var library = checkLibrary(''' |
| 3743 f({void g(int x, void h())}) => null; | 8789 f({void g(int x, void h())}) => null; |
| 3744 var v = f(g: (x, y) {}); | 8790 var v = f(g: (x, y) {}); |
| 3745 '''); | 8791 '''); |
| 8792 if (isStrongMode) { | |
| 8793 checkElementText( | |
| 8794 library, | |
| 8795 r''' | |
| 8796 var v; | |
| 8797 f({(int, () → void) → void g}) {} | |
| 8798 '''); | |
| 8799 } else { | |
| 8800 checkElementText( | |
| 8801 library, | |
| 8802 r''' | |
| 8803 var v; | |
| 8804 f({(int, () → void) → void g}) {} | |
| 8805 '''); | |
| 8806 } | |
| 3746 } | 8807 } |
| 3747 | 8808 |
| 3748 test_inferred_type_refers_to_setter_function_typed_parameter_type() { | 8809 test_inferred_type_refers_to_setter_function_typed_parameter_type() { |
| 3749 checkLibrary('class C extends D { void set f(g) {} }' | 8810 var library = checkLibrary('class C extends D { void set f(g) {} }' |
| 3750 ' abstract class D { void set f(int g(String s)); }'); | 8811 ' abstract class D { void set f(int g(String s)); }'); |
| 8812 if (isStrongMode) { | |
| 8813 checkElementText( | |
| 8814 library, | |
| 8815 r''' | |
| 8816 class C extends D { | |
| 8817 void set f((String) → int g) {} | |
| 8818 } | |
| 8819 abstract class D { | |
| 8820 void set f((String) → int g); | |
| 8821 } | |
| 8822 '''); | |
| 8823 } else { | |
| 8824 checkElementText( | |
| 8825 library, | |
| 8826 r''' | |
| 8827 class C extends D { | |
| 8828 void set f(g) {} | |
| 8829 } | |
| 8830 abstract class D { | |
| 8831 void set f((String) → int g); | |
| 8832 } | |
| 8833 '''); | |
| 8834 } | |
| 3751 } | 8835 } |
| 3752 | 8836 |
| 3753 void test_inferredType_definedInSdkLibraryPart() { | 8837 void test_inferredType_definedInSdkLibraryPart() { |
| 3754 addSource( | 8838 addSource( |
| 3755 '/a.dart', | 8839 '/a.dart', |
| 3756 r''' | 8840 r''' |
| 3757 import 'dart:async'; | 8841 import 'dart:async'; |
| 3758 class A { | 8842 class A { |
| 3759 m(Stream p) {} | 8843 m(Stream p) {} |
| 3760 } | 8844 } |
| 3761 '''); | 8845 '''); |
| 3762 LibraryElement library = checkLibrary(r''' | 8846 LibraryElement library = checkLibrary(r''' |
| 3763 import 'a.dart'; | 8847 import 'a.dart'; |
| 3764 class B extends A { | 8848 class B extends A { |
| 3765 m(p) {} | 8849 m(p) {} |
| 3766 } | 8850 } |
| 3767 '''); | 8851 '''); |
| 8852 if (isStrongMode) { | |
| 8853 checkElementText( | |
| 8854 library, | |
| 8855 r''' | |
| 8856 import 'a.dart'; | |
| 8857 class B extends A { | |
| 8858 m(Stream p) {} | |
| 8859 } | |
| 8860 '''); | |
| 8861 } else { | |
| 8862 checkElementText( | |
| 8863 library, | |
| 8864 r''' | |
| 8865 import 'a.dart'; | |
| 8866 class B extends A { | |
| 8867 m(p) {} | |
| 8868 } | |
| 8869 '''); | |
| 8870 } | |
| 3768 ClassElement b = library.definingCompilationUnit.types[0]; | 8871 ClassElement b = library.definingCompilationUnit.types[0]; |
| 3769 ParameterElement p = b.methods[0].parameters[0]; | 8872 ParameterElement p = b.methods[0].parameters[0]; |
| 3770 // This test should verify that we correctly record inferred types, | 8873 // This test should verify that we correctly record inferred types, |
| 3771 // when the type is defined in a part of an SDK library. So, test that | 8874 // when the type is defined in a part of an SDK library. So, test that |
| 3772 // the type is actually in a part. | 8875 // the type is actually in a part. |
| 3773 Element streamElement = p.type.element; | 8876 Element streamElement = p.type.element; |
| 3774 if (streamElement is ClassElement) { | 8877 if (streamElement is ClassElement) { |
| 3775 expect(streamElement.source, isNot(streamElement.library.source)); | 8878 expect(streamElement.source, isNot(streamElement.library.source)); |
| 3776 } | 8879 } |
| 3777 } | 8880 } |
| 3778 | 8881 |
| 3779 void test_inferredType_usesSyntheticFunctionType_functionTypedParam() { | 8882 void test_inferredType_usesSyntheticFunctionType_functionTypedParam() { |
| 3780 checkLibrary(''' | 8883 var library = checkLibrary(''' |
| 3781 int f(int x(String y)) => null; | 8884 int f(int x(String y)) => null; |
| 3782 String g(int x(String y)) => null; | 8885 String g(int x(String y)) => null; |
| 3783 var v = [f, g]; | 8886 var v = [f, g]; |
| 3784 '''); | 8887 '''); |
| 8888 if (isStrongMode) { | |
| 8889 checkElementText( | |
| 8890 library, | |
| 8891 r''' | |
| 8892 List<((String) → int) → Object> v; | |
| 8893 int f((String) → int x) {} | |
| 8894 String g((String) → int x) {} | |
| 8895 '''); | |
| 8896 } else { | |
| 8897 checkElementText( | |
| 8898 library, | |
| 8899 r''' | |
| 8900 var v; | |
| 8901 int f((String) → int x) {} | |
| 8902 String g((String) → int x) {} | |
| 8903 '''); | |
| 8904 } | |
| 3785 } | 8905 } |
| 3786 | 8906 |
| 3787 test_inheritance_errors() { | 8907 test_inheritance_errors() { |
| 3788 checkLibrary(''' | 8908 var library = checkLibrary(''' |
| 3789 abstract class A { | 8909 abstract class A { |
| 3790 int m(); | 8910 int m(); |
| 3791 } | 8911 } |
| 3792 | 8912 |
| 3793 abstract class B { | 8913 abstract class B { |
| 3794 String m(); | 8914 String m(); |
| 3795 } | 8915 } |
| 3796 | 8916 |
| 3797 abstract class C implements A, B {} | 8917 abstract class C implements A, B {} |
| 3798 | 8918 |
| 3799 abstract class D extends C { | 8919 abstract class D extends C { |
| 3800 var f; | 8920 var f; |
| 3801 } | 8921 } |
| 3802 '''); | 8922 '''); |
| 8923 if (isStrongMode) { | |
| 8924 checkElementText( | |
| 8925 library, | |
| 8926 r''' | |
| 8927 abstract class A { | |
| 8928 int m(); | |
| 8929 } | |
| 8930 abstract class B { | |
| 8931 String m(); | |
| 8932 } | |
| 8933 abstract class C implements A, B { | |
| 8934 } | |
| 8935 abstract class D extends C { | |
| 8936 var f; | |
| 8937 } | |
| 8938 '''); | |
| 8939 } else { | |
| 8940 checkElementText( | |
| 8941 library, | |
| 8942 r''' | |
| 8943 abstract class A { | |
| 8944 int m(); | |
| 8945 } | |
| 8946 abstract class B { | |
| 8947 String m(); | |
| 8948 } | |
| 8949 abstract class C implements A, B { | |
| 8950 } | |
| 8951 abstract class D extends C { | |
| 8952 var f; | |
| 8953 } | |
| 8954 '''); | |
| 8955 } | |
| 3803 } | 8956 } |
| 3804 | 8957 |
| 3805 test_initializer_executable_with_return_type_from_closure() { | 8958 test_initializer_executable_with_return_type_from_closure() { |
| 3806 checkLibrary('var v = () => 0;'); | 8959 var library = checkLibrary('var v = () => 0;'); |
| 8960 if (isStrongMode) { | |
| 8961 checkElementText( | |
| 8962 library, | |
| 8963 r''' | |
| 8964 () → int v; | |
| 8965 '''); | |
| 8966 } else { | |
| 8967 checkElementText( | |
| 8968 library, | |
| 8969 r''' | |
| 8970 var v; | |
| 8971 '''); | |
| 8972 } | |
| 3807 } | 8973 } |
| 3808 | 8974 |
| 3809 test_initializer_executable_with_return_type_from_closure_await_dynamic() { | 8975 test_initializer_executable_with_return_type_from_closure_await_dynamic() { |
| 3810 checkLibrary('var v = (f) async => await f;'); | 8976 var library = checkLibrary('var v = (f) async => await f;'); |
| 8977 if (isStrongMode) { | |
| 8978 checkElementText( | |
| 8979 library, | |
| 8980 r''' | |
| 8981 (dynamic) → Future<dynamic> v; | |
| 8982 '''); | |
| 8983 } else { | |
| 8984 checkElementText( | |
| 8985 library, | |
| 8986 r''' | |
| 8987 var v; | |
| 8988 '''); | |
| 8989 } | |
| 3811 } | 8990 } |
| 3812 | 8991 |
| 3813 test_initializer_executable_with_return_type_from_closure_await_future3_int() { | 8992 test_initializer_executable_with_return_type_from_closure_await_future3_int() { |
| 3814 checkLibrary(r''' | 8993 var library = checkLibrary(r''' |
| 3815 import 'dart:async'; | 8994 import 'dart:async'; |
| 3816 var v = (Future<Future<Future<int>>> f) async => await f; | 8995 var v = (Future<Future<Future<int>>> f) async => await f; |
| 3817 '''); | 8996 '''); |
| 8997 if (isStrongMode) { | |
| 8998 checkElementText( | |
| 8999 library, | |
| 9000 r''' | |
| 9001 import 'dart:async'; | |
| 9002 (Future<Future<Future<int>>>) → Future<int> v; | |
| 9003 '''); | |
| 9004 } else { | |
| 9005 checkElementText( | |
| 9006 library, | |
| 9007 r''' | |
| 9008 import 'dart:async'; | |
| 9009 var v; | |
| 9010 '''); | |
| 9011 } | |
| 3818 } | 9012 } |
| 3819 | 9013 |
| 3820 test_initializer_executable_with_return_type_from_closure_await_future_int() { | 9014 test_initializer_executable_with_return_type_from_closure_await_future_int() { |
| 3821 checkLibrary(r''' | 9015 var library = checkLibrary(r''' |
| 3822 import 'dart:async'; | 9016 import 'dart:async'; |
| 3823 var v = (Future<int> f) async => await f; | 9017 var v = (Future<int> f) async => await f; |
| 3824 '''); | 9018 '''); |
| 9019 if (isStrongMode) { | |
| 9020 checkElementText( | |
| 9021 library, | |
| 9022 r''' | |
| 9023 import 'dart:async'; | |
| 9024 (Future<int>) → Future<int> v; | |
| 9025 '''); | |
| 9026 } else { | |
| 9027 checkElementText( | |
| 9028 library, | |
| 9029 r''' | |
| 9030 import 'dart:async'; | |
| 9031 var v; | |
| 9032 '''); | |
| 9033 } | |
| 3825 } | 9034 } |
| 3826 | 9035 |
| 3827 test_initializer_executable_with_return_type_from_closure_await_future_noArg() { | 9036 test_initializer_executable_with_return_type_from_closure_await_future_noArg() { |
| 3828 checkLibrary(r''' | 9037 var library = checkLibrary(r''' |
| 3829 import 'dart:async'; | 9038 import 'dart:async'; |
| 3830 var v = (Future f) async => await f; | 9039 var v = (Future f) async => await f; |
| 3831 '''); | 9040 '''); |
| 9041 if (isStrongMode) { | |
| 9042 checkElementText( | |
| 9043 library, | |
| 9044 r''' | |
| 9045 import 'dart:async'; | |
| 9046 (Future<dynamic>) → Future<dynamic> v; | |
| 9047 '''); | |
| 9048 } else { | |
| 9049 checkElementText( | |
| 9050 library, | |
| 9051 r''' | |
| 9052 import 'dart:async'; | |
| 9053 var v; | |
| 9054 '''); | |
| 9055 } | |
| 3832 } | 9056 } |
| 3833 | 9057 |
| 3834 test_initializer_executable_with_return_type_from_closure_field() { | 9058 test_initializer_executable_with_return_type_from_closure_field() { |
| 3835 checkLibrary(''' | 9059 var library = checkLibrary(''' |
| 3836 class C { | 9060 class C { |
| 3837 var v = () => 0; | 9061 var v = () => 0; |
| 3838 } | 9062 } |
| 3839 '''); | 9063 '''); |
| 9064 if (isStrongMode) { | |
| 9065 checkElementText( | |
| 9066 library, | |
| 9067 r''' | |
| 9068 class C { | |
| 9069 () → int v; | |
| 9070 } | |
| 9071 '''); | |
| 9072 } else { | |
| 9073 checkElementText( | |
| 9074 library, | |
| 9075 r''' | |
| 9076 class C { | |
| 9077 var v; | |
| 9078 } | |
| 9079 '''); | |
| 9080 } | |
| 3840 } | 9081 } |
| 3841 | 9082 |
| 3842 test_initializer_executable_with_return_type_from_closure_local() { | 9083 test_initializer_executable_with_return_type_from_closure_local() { |
| 3843 checkLibrary(''' | 9084 var library = checkLibrary(''' |
| 3844 void f() { | 9085 void f() { |
| 3845 int u = 0; | 9086 int u = 0; |
| 3846 var v = () => 0; | 9087 var v = () => 0; |
| 3847 } | 9088 } |
| 3848 '''); | 9089 '''); |
| 9090 if (isStrongMode) { | |
| 9091 checkElementText( | |
| 9092 library, | |
| 9093 r''' | |
| 9094 void f() {} | |
| 9095 '''); | |
| 9096 } else { | |
| 9097 checkElementText( | |
| 9098 library, | |
| 9099 r''' | |
| 9100 void f() {} | |
| 9101 '''); | |
| 9102 } | |
| 3849 } | 9103 } |
| 3850 | 9104 |
| 3851 test_instantiateToBounds_boundRefersToEarlierTypeArgument() { | 9105 test_instantiateToBounds_boundRefersToEarlierTypeArgument() { |
| 3852 checkLibrary(''' | 9106 var library = checkLibrary(''' |
| 3853 class C<S extends num, T extends C<S, T>> {} | 9107 class C<S extends num, T extends C<S, T>> {} |
| 3854 C c; | 9108 C c; |
| 3855 '''); | 9109 '''); |
| 9110 if (isStrongMode) { | |
| 9111 checkElementText( | |
| 9112 library, | |
| 9113 r''' | |
| 9114 class C<S extends num, T extends C<S, T>> { | |
| 9115 } | |
| 9116 C<num, C<num, dynamic>> c; | |
| 9117 '''); | |
| 9118 } else { | |
| 9119 checkElementText( | |
| 9120 library, | |
| 9121 r''' | |
| 9122 class C<S extends num, T extends C<S, T>> { | |
| 9123 } | |
| 9124 C c; | |
| 9125 '''); | |
| 9126 } | |
| 3856 } | 9127 } |
| 3857 | 9128 |
| 3858 test_instantiateToBounds_boundRefersToItself() { | 9129 test_instantiateToBounds_boundRefersToItself() { |
| 3859 checkLibrary(''' | 9130 var library = checkLibrary(''' |
| 3860 class C<T extends C<T>> {} | 9131 class C<T extends C<T>> {} |
| 3861 C c; | 9132 C c; |
| 3862 var c2 = new C(); | 9133 var c2 = new C(); |
| 3863 class B { | 9134 class B { |
| 3864 var c3 = new C(); | 9135 var c3 = new C(); |
| 3865 } | 9136 } |
| 3866 '''); | 9137 '''); |
| 9138 if (isStrongMode) { | |
| 9139 checkElementText( | |
| 9140 library, | |
| 9141 r''' | |
| 9142 class C<T extends C<T>> { | |
| 9143 } | |
| 9144 class B { | |
| 9145 C<C> c3; | |
| 9146 } | |
| 9147 C<C> c; | |
| 9148 C<C> c2; | |
| 9149 '''); | |
| 9150 } else { | |
| 9151 checkElementText( | |
| 9152 library, | |
| 9153 r''' | |
| 9154 class C<T extends C<T>> { | |
| 9155 } | |
| 9156 class B { | |
| 9157 var c3; | |
| 9158 } | |
| 9159 C c; | |
| 9160 var c2; | |
| 9161 '''); | |
| 9162 } | |
| 3867 } | 9163 } |
| 3868 | 9164 |
| 3869 test_instantiateToBounds_boundRefersToLaterTypeArgument() { | 9165 test_instantiateToBounds_boundRefersToLaterTypeArgument() { |
| 3870 checkLibrary(''' | 9166 var library = checkLibrary(''' |
| 3871 class C<T extends C<T, U>, U extends num> {} | 9167 class C<T extends C<T, U>, U extends num> {} |
| 3872 C c; | 9168 C c; |
| 3873 '''); | 9169 '''); |
| 9170 if (isStrongMode) { | |
| 9171 checkElementText( | |
| 9172 library, | |
| 9173 r''' | |
| 9174 class C<T extends C<T, U>, U extends num> { | |
| 9175 } | |
| 9176 C<C<dynamic, num>, num> c; | |
| 9177 '''); | |
| 9178 } else { | |
| 9179 checkElementText( | |
| 9180 library, | |
| 9181 r''' | |
| 9182 class C<T extends C<T, U>, U extends num> { | |
| 9183 } | |
| 9184 C c; | |
| 9185 '''); | |
| 9186 } | |
| 3874 } | 9187 } |
| 3875 | 9188 |
| 3876 test_instantiateToBounds_functionTypeAlias_simple() { | 9189 test_instantiateToBounds_functionTypeAlias_simple() { |
| 3877 checkLibrary(''' | 9190 var library = checkLibrary(''' |
| 3878 typedef F<T extends num>(T p); | 9191 typedef F<T extends num>(T p); |
| 3879 F f; | 9192 F f; |
| 3880 '''); | 9193 '''); |
| 9194 if (isStrongMode) { | |
| 9195 checkElementText( | |
| 9196 library, | |
| 9197 r''' | |
| 9198 typedef F<T extends num>(T p); | |
| 9199 F f; | |
| 9200 '''); | |
| 9201 } else { | |
| 9202 checkElementText( | |
| 9203 library, | |
| 9204 r''' | |
| 9205 typedef F<T extends num>(T p); | |
| 9206 F f; | |
| 9207 '''); | |
| 9208 } | |
| 3881 } | 9209 } |
| 3882 | 9210 |
| 3883 test_instantiateToBounds_simple() { | 9211 test_instantiateToBounds_simple() { |
| 3884 checkLibrary(''' | 9212 var library = checkLibrary(''' |
| 3885 class C<T extends num> {} | 9213 class C<T extends num> {} |
| 3886 C c; | 9214 C c; |
| 3887 '''); | 9215 '''); |
| 9216 if (isStrongMode) { | |
| 9217 checkElementText( | |
| 9218 library, | |
| 9219 r''' | |
| 9220 class C<T extends num> { | |
| 9221 } | |
| 9222 C<num> c; | |
| 9223 '''); | |
| 9224 } else { | |
| 9225 checkElementText( | |
| 9226 library, | |
| 9227 r''' | |
| 9228 class C<T extends num> { | |
| 9229 } | |
| 9230 C c; | |
| 9231 '''); | |
| 9232 } | |
| 3888 } | 9233 } |
| 3889 | 9234 |
| 3890 test_invalid_annotation_prefixed_constructor() { | 9235 test_invalid_annotation_prefixed_constructor() { |
| 3891 addLibrarySource( | 9236 addLibrarySource( |
| 3892 '/a.dart', | 9237 '/a.dart', |
| 3893 r''' | 9238 r''' |
| 3894 class C { | 9239 class C { |
| 3895 const C.named(); | 9240 const C.named(); |
| 3896 } | 9241 } |
| 3897 '''); | 9242 '''); |
| 3898 checkLibrary(''' | 9243 var library = checkLibrary(''' |
| 3899 import "a.dart" as a; | 9244 import "a.dart" as a; |
| 3900 @a.C.named | 9245 @a.C.named |
| 3901 class D {} | 9246 class D {} |
| 3902 '''); | 9247 '''); |
| 9248 if (isStrongMode) { | |
| 9249 checkElementText( | |
| 9250 library, | |
| 9251 r''' | |
| 9252 import 'a.dart' as a; | |
| 9253 class D { | |
| 9254 } | |
| 9255 '''); | |
| 9256 } else { | |
| 9257 checkElementText( | |
| 9258 library, | |
| 9259 r''' | |
| 9260 import 'a.dart' as a; | |
| 9261 class D { | |
| 9262 } | |
| 9263 '''); | |
| 9264 } | |
| 3903 } | 9265 } |
| 3904 | 9266 |
| 3905 test_invalid_annotation_unprefixed_constructor() { | 9267 test_invalid_annotation_unprefixed_constructor() { |
| 3906 addLibrarySource( | 9268 addLibrarySource( |
| 3907 '/a.dart', | 9269 '/a.dart', |
| 3908 r''' | 9270 r''' |
| 3909 class C { | 9271 class C { |
| 3910 const C.named(); | 9272 const C.named(); |
| 3911 } | 9273 } |
| 3912 '''); | 9274 '''); |
| 3913 checkLibrary(''' | 9275 var library = checkLibrary(''' |
| 3914 import "a.dart"; | 9276 import "a.dart"; |
| 3915 @C.named | 9277 @C.named |
| 3916 class D {} | 9278 class D {} |
| 3917 '''); | 9279 '''); |
| 9280 if (isStrongMode) { | |
| 9281 checkElementText( | |
| 9282 library, | |
| 9283 r''' | |
| 9284 import 'a.dart'; | |
| 9285 class D { | |
| 9286 } | |
| 9287 '''); | |
| 9288 } else { | |
| 9289 checkElementText( | |
| 9290 library, | |
| 9291 r''' | |
| 9292 import 'a.dart'; | |
| 9293 class D { | |
| 9294 } | |
| 9295 '''); | |
| 9296 } | |
| 3918 } | 9297 } |
| 3919 | 9298 |
| 3920 test_invalid_importPrefix_asTypeArgument() { | 9299 test_invalid_importPrefix_asTypeArgument() { |
| 3921 checkLibrary(''' | 9300 var library = checkLibrary(''' |
| 3922 import 'dart:async' as ppp; | 9301 import 'dart:async' as ppp; |
| 3923 class C { | 9302 class C { |
| 3924 List<ppp> v; | 9303 List<ppp> v; |
| 3925 } | 9304 } |
| 3926 '''); | 9305 '''); |
| 9306 if (isStrongMode) { | |
| 9307 checkElementText( | |
| 9308 library, | |
| 9309 r''' | |
| 9310 import 'dart:async' as ppp; | |
| 9311 class C { | |
| 9312 List v; | |
| 9313 } | |
| 9314 '''); | |
| 9315 } else { | |
| 9316 checkElementText( | |
| 9317 library, | |
| 9318 r''' | |
| 9319 import 'dart:async' as ppp; | |
| 9320 class C { | |
| 9321 List v; | |
| 9322 } | |
| 9323 '''); | |
| 9324 } | |
| 3927 } | 9325 } |
| 3928 | 9326 |
| 3929 test_invalid_nameConflict_imported() { | 9327 test_invalid_nameConflict_imported() { |
| 3930 namesThatCannotBeResolved.add('V'); | 9328 namesThatCannotBeResolved.add('V'); |
| 3931 addLibrarySource('/a.dart', 'V() {}'); | 9329 addLibrarySource('/a.dart', 'V() {}'); |
| 3932 addLibrarySource('/b.dart', 'V() {}'); | 9330 addLibrarySource('/b.dart', 'V() {}'); |
| 3933 checkLibrary(''' | 9331 var library = checkLibrary(''' |
| 3934 import 'a.dart'; | 9332 import 'a.dart'; |
| 3935 import 'b.dart'; | 9333 import 'b.dart'; |
| 3936 foo([p = V]) {} | 9334 foo([p = V]) {} |
| 3937 '''); | 9335 '''); |
| 9336 if (isStrongMode) { | |
| 9337 checkElementText( | |
| 9338 library, | |
| 9339 r''' | |
| 9340 import 'a.dart'; | |
| 9341 import 'b.dart'; | |
| 9342 foo([p]) {} | |
| 9343 '''); | |
| 9344 } else { | |
| 9345 checkElementText( | |
| 9346 library, | |
| 9347 r''' | |
| 9348 import 'a.dart'; | |
| 9349 import 'b.dart'; | |
| 9350 foo([p]) {} | |
| 9351 '''); | |
| 9352 } | |
| 3938 } | 9353 } |
| 3939 | 9354 |
| 3940 test_invalid_nameConflict_imported_exported() { | 9355 test_invalid_nameConflict_imported_exported() { |
| 3941 namesThatCannotBeResolved.add('V'); | 9356 namesThatCannotBeResolved.add('V'); |
| 3942 addLibrarySource('/a.dart', 'V() {}'); | 9357 addLibrarySource('/a.dart', 'V() {}'); |
| 3943 addLibrarySource('/b.dart', 'V() {}'); | 9358 addLibrarySource('/b.dart', 'V() {}'); |
| 3944 addLibrarySource( | 9359 addLibrarySource( |
| 3945 '/c.dart', | 9360 '/c.dart', |
| 3946 r''' | 9361 r''' |
| 3947 export 'a.dart'; | 9362 export 'a.dart'; |
| 3948 export 'b.dart'; | 9363 export 'b.dart'; |
| 3949 '''); | 9364 '''); |
| 3950 checkLibrary(''' | 9365 var library = checkLibrary(''' |
| 3951 import 'c.dart'; | 9366 import 'c.dart'; |
| 3952 foo([p = V]) {} | 9367 foo([p = V]) {} |
| 3953 '''); | 9368 '''); |
| 9369 if (isStrongMode) { | |
| 9370 checkElementText( | |
| 9371 library, | |
| 9372 r''' | |
| 9373 import 'c.dart'; | |
| 9374 foo([p]) {} | |
| 9375 '''); | |
| 9376 } else { | |
| 9377 checkElementText( | |
| 9378 library, | |
| 9379 r''' | |
| 9380 import 'c.dart'; | |
| 9381 foo([p]) {} | |
| 9382 '''); | |
| 9383 } | |
| 3954 } | 9384 } |
| 3955 | 9385 |
| 3956 test_invalid_nameConflict_local() { | 9386 test_invalid_nameConflict_local() { |
| 3957 namesThatCannotBeResolved.add('V'); | 9387 namesThatCannotBeResolved.add('V'); |
| 3958 checkLibrary(''' | 9388 var library = checkLibrary(''' |
| 3959 foo([p = V]) {} | 9389 foo([p = V]) {} |
| 3960 V() {} | 9390 V() {} |
| 3961 var V; | 9391 var V; |
| 3962 '''); | 9392 '''); |
| 9393 if (isStrongMode) { | |
| 9394 checkElementText( | |
| 9395 library, | |
| 9396 r''' | |
| 9397 var V; | |
| 9398 foo([p]) {} | |
| 9399 V() {} | |
| 9400 '''); | |
| 9401 } else { | |
| 9402 checkElementText( | |
| 9403 library, | |
| 9404 r''' | |
| 9405 var V; | |
| 9406 foo([p]) {} | |
| 9407 V() {} | |
| 9408 '''); | |
| 9409 } | |
| 3963 } | 9410 } |
| 3964 | 9411 |
| 3965 test_invalid_setterParameter_fieldFormalParameter() { | 9412 test_invalid_setterParameter_fieldFormalParameter() { |
| 3966 checkLibrary(''' | 9413 var library = checkLibrary(''' |
| 3967 class C { | 9414 class C { |
| 3968 int foo; | 9415 int foo; |
| 3969 void set bar(this.foo) {} | 9416 void set bar(this.foo) {} |
| 3970 } | 9417 } |
| 3971 '''); | 9418 '''); |
| 9419 if (isStrongMode) { | |
| 9420 checkElementText( | |
| 9421 library, | |
| 9422 r''' | |
| 9423 class C { | |
| 9424 int foo; | |
| 9425 void set bar(this.foo) {} | |
| 9426 } | |
| 9427 '''); | |
| 9428 } else { | |
| 9429 checkElementText( | |
| 9430 library, | |
| 9431 r''' | |
| 9432 class C { | |
| 9433 int foo; | |
| 9434 void set bar(this.foo) {} | |
| 9435 } | |
| 9436 '''); | |
| 9437 } | |
| 3972 } | 9438 } |
| 3973 | 9439 |
| 3974 test_invalid_setterParameter_fieldFormalParameter_self() { | 9440 test_invalid_setterParameter_fieldFormalParameter_self() { |
| 3975 checkLibrary(''' | 9441 var library = checkLibrary(''' |
| 3976 class C { | 9442 class C { |
| 3977 set x(this.x) {} | 9443 set x(this.x) {} |
| 3978 } | 9444 } |
| 3979 '''); | 9445 '''); |
| 9446 if (isStrongMode) { | |
| 9447 checkElementText( | |
| 9448 library, | |
| 9449 r''' | |
| 9450 class C { | |
| 9451 void set x(this.x) {} | |
| 9452 } | |
| 9453 '''); | |
| 9454 } else { | |
| 9455 checkElementText( | |
| 9456 library, | |
| 9457 r''' | |
| 9458 class C { | |
| 9459 set x(this.x) {} | |
| 9460 } | |
| 9461 '''); | |
| 9462 } | |
| 3980 } | 9463 } |
| 3981 | 9464 |
| 3982 test_invalidUris() { | 9465 test_invalidUris() { |
| 3983 allowMissingFiles = true; | 9466 allowMissingFiles = true; |
| 3984 checkLibrary(r''' | 9467 var library = checkLibrary(r''' |
| 3985 import '[invalid uri]'; | 9468 import '[invalid uri]'; |
| 3986 import '[invalid uri]:foo.dart'; | 9469 import '[invalid uri]:foo.dart'; |
| 3987 import 'a1.dart'; | 9470 import 'a1.dart'; |
| 3988 import '[invalid uri]'; | 9471 import '[invalid uri]'; |
| 3989 import '[invalid uri]:foo.dart'; | 9472 import '[invalid uri]:foo.dart'; |
| 3990 | 9473 |
| 3991 export '[invalid uri]'; | 9474 export '[invalid uri]'; |
| 3992 export '[invalid uri]:foo.dart'; | 9475 export '[invalid uri]:foo.dart'; |
| 3993 export 'a2.dart'; | 9476 export 'a2.dart'; |
| 3994 export '[invalid uri]'; | 9477 export '[invalid uri]'; |
| 3995 export '[invalid uri]:foo.dart'; | 9478 export '[invalid uri]:foo.dart'; |
| 3996 | 9479 |
| 3997 part '[invalid uri]'; | 9480 part '[invalid uri]'; |
| 3998 part 'a3.dart'; | 9481 part 'a3.dart'; |
| 3999 part '[invalid uri]'; | 9482 part '[invalid uri]'; |
| 4000 '''); | 9483 '''); |
| 9484 if (isStrongMode) { | |
| 9485 checkElementText( | |
| 9486 library, | |
| 9487 r''' | |
| 9488 import 'a1.dart'; | |
| 9489 export 'a2.dart'; | |
| 9490 part 'a3.dart'; | |
| 9491 -------------------- | |
| 9492 unit: a3.dart | |
| 9493 | |
| 9494 '''); | |
| 9495 } else { | |
| 9496 checkElementText( | |
| 9497 library, | |
| 9498 r''' | |
| 9499 import 'a1.dart'; | |
| 9500 export 'a2.dart'; | |
| 9501 part 'a3.dart'; | |
| 9502 -------------------- | |
| 9503 unit: a3.dart | |
| 9504 | |
| 9505 '''); | |
| 9506 } | |
| 4001 } | 9507 } |
| 4002 | 9508 |
| 4003 test_library() { | 9509 test_library() { |
| 4004 checkLibrary(''); | 9510 var library = checkLibrary(''); |
| 9511 if (isStrongMode) { | |
| 9512 checkElementText( | |
| 9513 library, | |
| 9514 r''' | |
| 9515 '''); | |
| 9516 } else { | |
| 9517 checkElementText( | |
| 9518 library, | |
| 9519 r''' | |
| 9520 '''); | |
| 9521 } | |
| 4005 } | 9522 } |
| 4006 | 9523 |
| 4007 test_library_documented() { | 9524 test_library_documented() { |
| 4008 checkLibrary(''' | 9525 var library = checkLibrary(''' |
| 4009 // Extra comment so doc comment offset != 0 | 9526 // Extra comment so doc comment offset != 0 |
| 4010 /** | 9527 /** |
| 4011 * Docs | 9528 * Docs |
| 4012 */ | 9529 */ |
| 4013 library foo;'''); | 9530 library foo;'''); |
| 9531 if (isStrongMode) { | |
| 9532 checkElementText( | |
| 9533 library, | |
| 9534 r''' | |
| 9535 library foo; | |
| 9536 '''); | |
| 9537 } else { | |
| 9538 checkElementText( | |
| 9539 library, | |
| 9540 r''' | |
| 9541 library foo; | |
| 9542 '''); | |
| 9543 } | |
| 4014 } | 9544 } |
| 4015 | 9545 |
| 4016 test_library_name_with_spaces() { | 9546 test_library_name_with_spaces() { |
| 4017 checkLibrary('library foo . bar ;'); | 9547 var library = checkLibrary('library foo . bar ;'); |
| 9548 if (isStrongMode) { | |
| 9549 checkElementText( | |
| 9550 library, | |
| 9551 r''' | |
| 9552 library foo.bar; | |
| 9553 '''); | |
| 9554 } else { | |
| 9555 checkElementText( | |
| 9556 library, | |
| 9557 r''' | |
| 9558 library foo.bar; | |
| 9559 '''); | |
| 9560 } | |
| 4018 } | 9561 } |
| 4019 | 9562 |
| 4020 test_library_named() { | 9563 test_library_named() { |
| 4021 checkLibrary('library foo.bar;'); | 9564 var library = checkLibrary('library foo.bar;'); |
| 9565 if (isStrongMode) { | |
| 9566 checkElementText( | |
| 9567 library, | |
| 9568 r''' | |
| 9569 library foo.bar; | |
| 9570 '''); | |
| 9571 } else { | |
| 9572 checkElementText( | |
| 9573 library, | |
| 9574 r''' | |
| 9575 library foo.bar; | |
| 9576 '''); | |
| 9577 } | |
| 4022 } | 9578 } |
| 4023 | 9579 |
| 4024 test_localFunctions() { | 9580 test_localFunctions() { |
| 4025 checkLibrary(r''' | 9581 var library = checkLibrary(r''' |
| 4026 f() { | 9582 f() { |
| 4027 f1() {} | 9583 f1() {} |
| 4028 { | 9584 { |
| 4029 f2() {} | 9585 f2() {} |
| 4030 } | 9586 } |
| 4031 } | 9587 } |
| 4032 '''); | 9588 '''); |
| 9589 if (isStrongMode) { | |
| 9590 checkElementText( | |
| 9591 library, | |
| 9592 r''' | |
| 9593 f() {} | |
| 9594 '''); | |
| 9595 } else { | |
| 9596 checkElementText( | |
| 9597 library, | |
| 9598 r''' | |
| 9599 f() {} | |
| 9600 '''); | |
| 9601 } | |
| 4033 } | 9602 } |
| 4034 | 9603 |
| 4035 test_localFunctions_inConstructor() { | 9604 test_localFunctions_inConstructor() { |
| 4036 checkLibrary(r''' | 9605 var library = checkLibrary(r''' |
| 4037 class C { | 9606 class C { |
| 4038 C() { | 9607 C() { |
| 4039 f() {} | 9608 f() {} |
| 4040 } | 9609 } |
| 4041 } | 9610 } |
| 4042 '''); | 9611 '''); |
| 9612 if (isStrongMode) { | |
| 9613 checkElementText( | |
| 9614 library, | |
| 9615 r''' | |
| 9616 class C { | |
| 9617 C(); | |
| 9618 } | |
| 9619 '''); | |
| 9620 } else { | |
| 9621 checkElementText( | |
| 9622 library, | |
| 9623 r''' | |
| 9624 class C { | |
| 9625 C(); | |
| 9626 } | |
| 9627 '''); | |
| 9628 } | |
| 4043 } | 9629 } |
| 4044 | 9630 |
| 4045 test_localFunctions_inMethod() { | 9631 test_localFunctions_inMethod() { |
| 4046 checkLibrary(r''' | 9632 var library = checkLibrary(r''' |
| 4047 class C { | 9633 class C { |
| 4048 m() { | 9634 m() { |
| 4049 f() {} | 9635 f() {} |
| 4050 } | 9636 } |
| 4051 } | 9637 } |
| 4052 '''); | 9638 '''); |
| 9639 if (isStrongMode) { | |
| 9640 checkElementText( | |
| 9641 library, | |
| 9642 r''' | |
| 9643 class C { | |
| 9644 m() {} | |
| 9645 } | |
| 9646 '''); | |
| 9647 } else { | |
| 9648 checkElementText( | |
| 9649 library, | |
| 9650 r''' | |
| 9651 class C { | |
| 9652 m() {} | |
| 9653 } | |
| 9654 '''); | |
| 9655 } | |
| 4053 } | 9656 } |
| 4054 | 9657 |
| 4055 test_localFunctions_inTopLevelGetter() { | 9658 test_localFunctions_inTopLevelGetter() { |
| 4056 checkLibrary(r''' | 9659 var library = checkLibrary(r''' |
| 4057 get g { | 9660 get g { |
| 4058 f() {} | 9661 f() {} |
| 4059 } | 9662 } |
| 4060 '''); | 9663 '''); |
| 9664 if (isStrongMode) { | |
| 9665 checkElementText( | |
| 9666 library, | |
| 9667 r''' | |
| 9668 get g {} | |
| 9669 '''); | |
| 9670 } else { | |
| 9671 checkElementText( | |
| 9672 library, | |
| 9673 r''' | |
| 9674 get g {} | |
| 9675 '''); | |
| 9676 } | |
| 4061 } | 9677 } |
| 4062 | 9678 |
| 4063 test_localLabels_inConstructor() { | 9679 test_localLabels_inConstructor() { |
| 4064 checkLibrary( | 9680 var library = checkLibrary( |
| 4065 r''' | 9681 r''' |
| 4066 class C { | 9682 class C { |
| 4067 C() { | 9683 C() { |
| 4068 aaa: while (true) {} | 9684 aaa: while (true) {} |
| 4069 bbb: switch (42) { | 9685 bbb: switch (42) { |
| 4070 ccc: case 0: | 9686 ccc: case 0: |
| 4071 break; | 9687 break; |
| 4072 } | 9688 } |
| 4073 } | 9689 } |
| 4074 } | 9690 } |
| 4075 ''', | 9691 ''', |
| 4076 allowErrors: true); | 9692 allowErrors: true); |
| 9693 if (isStrongMode) { | |
| 9694 checkElementText( | |
| 9695 library, | |
| 9696 r''' | |
| 9697 class C { | |
| 9698 C(); | |
| 9699 } | |
| 9700 '''); | |
| 9701 } else { | |
| 9702 checkElementText( | |
| 9703 library, | |
| 9704 r''' | |
| 9705 class C { | |
| 9706 C(); | |
| 9707 } | |
| 9708 '''); | |
| 9709 } | |
| 4077 } | 9710 } |
| 4078 | 9711 |
| 4079 test_localLabels_inMethod() { | 9712 test_localLabels_inMethod() { |
| 4080 checkLibrary( | 9713 var library = checkLibrary( |
| 4081 r''' | 9714 r''' |
| 4082 class C { | 9715 class C { |
| 4083 m() { | 9716 m() { |
| 4084 aaa: while (true) {} | 9717 aaa: while (true) {} |
| 4085 bbb: switch (42) { | 9718 bbb: switch (42) { |
| 4086 ccc: case 0: | 9719 ccc: case 0: |
| 4087 break; | 9720 break; |
| 4088 } | 9721 } |
| 4089 } | 9722 } |
| 4090 } | 9723 } |
| 4091 ''', | 9724 ''', |
| 4092 allowErrors: true); | 9725 allowErrors: true); |
| 9726 if (isStrongMode) { | |
| 9727 checkElementText( | |
| 9728 library, | |
| 9729 r''' | |
| 9730 class C { | |
| 9731 m() {} | |
| 9732 } | |
| 9733 '''); | |
| 9734 } else { | |
| 9735 checkElementText( | |
| 9736 library, | |
| 9737 r''' | |
| 9738 class C { | |
| 9739 m() {} | |
| 9740 } | |
| 9741 '''); | |
| 9742 } | |
| 4093 } | 9743 } |
| 4094 | 9744 |
| 4095 test_localLabels_inTopLevelFunction() { | 9745 test_localLabels_inTopLevelFunction() { |
| 4096 checkLibrary( | 9746 var library = checkLibrary( |
| 4097 r''' | 9747 r''' |
| 4098 main() { | 9748 main() { |
| 4099 aaa: while (true) {} | 9749 aaa: while (true) {} |
| 4100 bbb: switch (42) { | 9750 bbb: switch (42) { |
| 4101 ccc: case 0: | 9751 ccc: case 0: |
| 4102 break; | 9752 break; |
| 4103 } | 9753 } |
| 4104 } | 9754 } |
| 4105 ''', | 9755 ''', |
| 4106 allowErrors: true); | 9756 allowErrors: true); |
| 9757 if (isStrongMode) { | |
| 9758 checkElementText( | |
| 9759 library, | |
| 9760 r''' | |
| 9761 main() {} | |
| 9762 '''); | |
| 9763 } else { | |
| 9764 checkElementText( | |
| 9765 library, | |
| 9766 r''' | |
| 9767 main() {} | |
| 9768 '''); | |
| 9769 } | |
| 4107 } | 9770 } |
| 4108 | 9771 |
| 4109 test_localVariables_inConstructor() { | 9772 test_localVariables_inConstructor() { |
| 4110 checkLibrary(r''' | 9773 var library = checkLibrary(r''' |
| 4111 class C { | 9774 class C { |
| 4112 C() { | 9775 C() { |
| 4113 int v; | 9776 int v; |
| 4114 f() {} | 9777 f() {} |
| 4115 } | 9778 } |
| 4116 } | 9779 } |
| 4117 '''); | 9780 '''); |
| 9781 if (isStrongMode) { | |
| 9782 checkElementText( | |
| 9783 library, | |
| 9784 r''' | |
| 9785 class C { | |
| 9786 C(); | |
| 9787 } | |
| 9788 '''); | |
| 9789 } else { | |
| 9790 checkElementText( | |
| 9791 library, | |
| 9792 r''' | |
| 9793 class C { | |
| 9794 C(); | |
| 9795 } | |
| 9796 '''); | |
| 9797 } | |
| 4118 } | 9798 } |
| 4119 | 9799 |
| 4120 test_localVariables_inLocalFunction() { | 9800 test_localVariables_inLocalFunction() { |
| 4121 checkLibrary(r''' | 9801 var library = checkLibrary(r''' |
| 4122 f() { | 9802 f() { |
| 4123 f1() { | 9803 f1() { |
| 4124 int v1 = 1; | 9804 int v1 = 1; |
| 4125 } // 2 | 9805 } // 2 |
| 4126 f2() { | 9806 f2() { |
| 4127 int v1 = 1; | 9807 int v1 = 1; |
| 4128 f3() { | 9808 f3() { |
| 4129 int v2 = 1; | 9809 int v2 = 1; |
| 4130 } | 9810 } |
| 4131 } | 9811 } |
| 4132 } | 9812 } |
| 4133 '''); | 9813 '''); |
| 9814 if (isStrongMode) { | |
| 9815 checkElementText( | |
| 9816 library, | |
| 9817 r''' | |
| 9818 f() {} | |
| 9819 '''); | |
| 9820 } else { | |
| 9821 checkElementText( | |
| 9822 library, | |
| 9823 r''' | |
| 9824 f() {} | |
| 9825 '''); | |
| 9826 } | |
| 4134 } | 9827 } |
| 4135 | 9828 |
| 4136 test_localVariables_inMethod() { | 9829 test_localVariables_inMethod() { |
| 4137 checkLibrary(r''' | 9830 var library = checkLibrary(r''' |
| 4138 class C { | 9831 class C { |
| 4139 m() { | 9832 m() { |
| 4140 int v; | 9833 int v; |
| 4141 } | 9834 } |
| 4142 } | 9835 } |
| 4143 '''); | 9836 '''); |
| 9837 if (isStrongMode) { | |
| 9838 checkElementText( | |
| 9839 library, | |
| 9840 r''' | |
| 9841 class C { | |
| 9842 m() {} | |
| 9843 } | |
| 9844 '''); | |
| 9845 } else { | |
| 9846 checkElementText( | |
| 9847 library, | |
| 9848 r''' | |
| 9849 class C { | |
| 9850 m() {} | |
| 9851 } | |
| 9852 '''); | |
| 9853 } | |
| 4144 } | 9854 } |
| 4145 | 9855 |
| 4146 test_localVariables_inTopLevelFunction() { | 9856 test_localVariables_inTopLevelFunction() { |
| 4147 checkLibrary(r''' | 9857 var library = checkLibrary(r''' |
| 4148 main() { | 9858 main() { |
| 4149 int v1 = 1; | 9859 int v1 = 1; |
| 4150 { | 9860 { |
| 4151 const String v2 = 'bbb'; | 9861 const String v2 = 'bbb'; |
| 4152 } | 9862 } |
| 4153 Map<int, List<double>> v3; | 9863 Map<int, List<double>> v3; |
| 4154 } | 9864 } |
| 4155 '''); | 9865 '''); |
| 9866 if (isStrongMode) { | |
| 9867 checkElementText( | |
| 9868 library, | |
| 9869 r''' | |
| 9870 main() {} | |
| 9871 '''); | |
| 9872 } else { | |
| 9873 checkElementText( | |
| 9874 library, | |
| 9875 r''' | |
| 9876 main() {} | |
| 9877 '''); | |
| 9878 } | |
| 4156 } | 9879 } |
| 4157 | 9880 |
| 4158 test_localVariables_inTopLevelGetter() { | 9881 test_localVariables_inTopLevelGetter() { |
| 4159 checkLibrary(r''' | 9882 var library = checkLibrary(r''' |
| 4160 get g { | 9883 get g { |
| 4161 int v; | 9884 int v; |
| 4162 } | 9885 } |
| 4163 '''); | 9886 '''); |
| 9887 if (isStrongMode) { | |
| 9888 checkElementText( | |
| 9889 library, | |
| 9890 r''' | |
| 9891 get g {} | |
| 9892 '''); | |
| 9893 } else { | |
| 9894 checkElementText( | |
| 9895 library, | |
| 9896 r''' | |
| 9897 get g {} | |
| 9898 '''); | |
| 9899 } | |
| 4164 } | 9900 } |
| 4165 | 9901 |
| 4166 test_main_class() { | 9902 test_main_class() { |
| 4167 checkLibrary('class main {}'); | 9903 var library = checkLibrary('class main {}'); |
| 9904 if (isStrongMode) { | |
| 9905 checkElementText( | |
| 9906 library, | |
| 9907 r''' | |
| 9908 class main { | |
| 9909 } | |
| 9910 '''); | |
| 9911 } else { | |
| 9912 checkElementText( | |
| 9913 library, | |
| 9914 r''' | |
| 9915 class main { | |
| 9916 } | |
| 9917 '''); | |
| 9918 } | |
| 4168 } | 9919 } |
| 4169 | 9920 |
| 4170 test_main_class_alias() { | 9921 test_main_class_alias() { |
| 4171 checkLibrary('class main = C with D; class C {} class D {}'); | 9922 var library = checkLibrary('class main = C with D; class C {} class D {}'); |
| 9923 if (isStrongMode) { | |
| 9924 checkElementText( | |
| 9925 library, | |
| 9926 r''' | |
| 9927 class main extends C with D { | |
| 9928 synthetic main(); | |
| 9929 } | |
| 9930 class C { | |
| 9931 } | |
| 9932 class D { | |
| 9933 } | |
| 9934 '''); | |
| 9935 } else { | |
| 9936 checkElementText( | |
| 9937 library, | |
| 9938 r''' | |
| 9939 class main extends C with D { | |
| 9940 synthetic main(); | |
| 9941 } | |
| 9942 class C { | |
| 9943 } | |
| 9944 class D { | |
| 9945 } | |
| 9946 '''); | |
| 9947 } | |
| 4172 } | 9948 } |
| 4173 | 9949 |
| 4174 test_main_class_alias_via_export() { | 9950 test_main_class_alias_via_export() { |
| 4175 addLibrarySource('/a.dart', 'class main = C with D; class C {} class D {}'); | 9951 addLibrarySource('/a.dart', 'class main = C with D; class C {} class D {}'); |
| 4176 checkLibrary('export "a.dart";'); | 9952 var library = checkLibrary('export "a.dart";'); |
| 9953 if (isStrongMode) { | |
| 9954 checkElementText( | |
| 9955 library, | |
| 9956 r''' | |
| 9957 export 'a.dart'; | |
| 9958 '''); | |
| 9959 } else { | |
| 9960 checkElementText( | |
| 9961 library, | |
| 9962 r''' | |
| 9963 export 'a.dart'; | |
| 9964 '''); | |
| 9965 } | |
| 4177 } | 9966 } |
| 4178 | 9967 |
| 4179 test_main_class_via_export() { | 9968 test_main_class_via_export() { |
| 4180 addLibrarySource('/a.dart', 'class main {}'); | 9969 addLibrarySource('/a.dart', 'class main {}'); |
| 4181 checkLibrary('export "a.dart";'); | 9970 var library = checkLibrary('export "a.dart";'); |
| 9971 if (isStrongMode) { | |
| 9972 checkElementText( | |
| 9973 library, | |
| 9974 r''' | |
| 9975 export 'a.dart'; | |
| 9976 '''); | |
| 9977 } else { | |
| 9978 checkElementText( | |
| 9979 library, | |
| 9980 r''' | |
| 9981 export 'a.dart'; | |
| 9982 '''); | |
| 9983 } | |
| 4182 } | 9984 } |
| 4183 | 9985 |
| 4184 test_main_getter() { | 9986 test_main_getter() { |
| 4185 checkLibrary('get main => null;'); | 9987 var library = checkLibrary('get main => null;'); |
| 9988 if (isStrongMode) { | |
| 9989 checkElementText( | |
| 9990 library, | |
| 9991 r''' | |
| 9992 get main {} | |
| 9993 '''); | |
| 9994 } else { | |
| 9995 checkElementText( | |
| 9996 library, | |
| 9997 r''' | |
| 9998 get main {} | |
| 9999 '''); | |
| 10000 } | |
| 4186 } | 10001 } |
| 4187 | 10002 |
| 4188 test_main_getter_via_export() { | 10003 test_main_getter_via_export() { |
| 4189 addLibrarySource('/a.dart', 'get main => null;'); | 10004 addLibrarySource('/a.dart', 'get main => null;'); |
| 4190 checkLibrary('export "a.dart";'); | 10005 var library = checkLibrary('export "a.dart";'); |
| 10006 if (isStrongMode) { | |
| 10007 checkElementText( | |
| 10008 library, | |
| 10009 r''' | |
| 10010 export 'a.dart'; | |
| 10011 '''); | |
| 10012 } else { | |
| 10013 checkElementText( | |
| 10014 library, | |
| 10015 r''' | |
| 10016 export 'a.dart'; | |
| 10017 '''); | |
| 10018 } | |
| 4191 } | 10019 } |
| 4192 | 10020 |
| 4193 test_main_typedef() { | 10021 test_main_typedef() { |
| 4194 checkLibrary('typedef main();'); | 10022 var library = checkLibrary('typedef main();'); |
| 10023 if (isStrongMode) { | |
| 10024 checkElementText( | |
| 10025 library, | |
| 10026 r''' | |
| 10027 typedef main(); | |
| 10028 '''); | |
| 10029 } else { | |
| 10030 checkElementText( | |
| 10031 library, | |
| 10032 r''' | |
| 10033 typedef main(); | |
| 10034 '''); | |
| 10035 } | |
| 4195 } | 10036 } |
| 4196 | 10037 |
| 4197 test_main_typedef_via_export() { | 10038 test_main_typedef_via_export() { |
| 4198 addLibrarySource('/a.dart', 'typedef main();'); | 10039 addLibrarySource('/a.dart', 'typedef main();'); |
| 4199 checkLibrary('export "a.dart";'); | 10040 var library = checkLibrary('export "a.dart";'); |
| 10041 if (isStrongMode) { | |
| 10042 checkElementText( | |
| 10043 library, | |
| 10044 r''' | |
| 10045 export 'a.dart'; | |
| 10046 '''); | |
| 10047 } else { | |
| 10048 checkElementText( | |
| 10049 library, | |
| 10050 r''' | |
| 10051 export 'a.dart'; | |
| 10052 '''); | |
| 10053 } | |
| 4200 } | 10054 } |
| 4201 | 10055 |
| 4202 test_main_variable() { | 10056 test_main_variable() { |
| 4203 checkLibrary('var main;'); | 10057 var library = checkLibrary('var main;'); |
| 10058 if (isStrongMode) { | |
| 10059 checkElementText( | |
| 10060 library, | |
| 10061 r''' | |
| 10062 var main; | |
| 10063 '''); | |
| 10064 } else { | |
| 10065 checkElementText( | |
| 10066 library, | |
| 10067 r''' | |
| 10068 var main; | |
| 10069 '''); | |
| 10070 } | |
| 4204 } | 10071 } |
| 4205 | 10072 |
| 4206 test_main_variable_via_export() { | 10073 test_main_variable_via_export() { |
| 4207 addLibrarySource('/a.dart', 'var main;'); | 10074 addLibrarySource('/a.dart', 'var main;'); |
| 4208 checkLibrary('export "a.dart";'); | 10075 var library = checkLibrary('export "a.dart";'); |
| 10076 if (isStrongMode) { | |
| 10077 checkElementText( | |
| 10078 library, | |
| 10079 r''' | |
| 10080 export 'a.dart'; | |
| 10081 '''); | |
| 10082 } else { | |
| 10083 checkElementText( | |
| 10084 library, | |
| 10085 r''' | |
| 10086 export 'a.dart'; | |
| 10087 '''); | |
| 10088 } | |
| 4209 } | 10089 } |
| 4210 | 10090 |
| 4211 test_member_function_async() { | 10091 test_member_function_async() { |
| 4212 checkLibrary(r''' | 10092 var library = checkLibrary(r''' |
| 4213 import 'dart:async'; | 10093 import 'dart:async'; |
| 4214 class C { | 10094 class C { |
| 4215 Future f() async {} | 10095 Future f() async {} |
| 4216 } | 10096 } |
| 4217 '''); | 10097 '''); |
| 10098 if (isStrongMode) { | |
| 10099 checkElementText( | |
| 10100 library, | |
| 10101 r''' | |
| 10102 import 'dart:async'; | |
| 10103 class C { | |
| 10104 Future f() {} | |
| 10105 } | |
| 10106 '''); | |
| 10107 } else { | |
| 10108 checkElementText( | |
| 10109 library, | |
| 10110 r''' | |
| 10111 import 'dart:async'; | |
| 10112 class C { | |
| 10113 Future f() {} | |
| 10114 } | |
| 10115 '''); | |
| 10116 } | |
| 4218 } | 10117 } |
| 4219 | 10118 |
| 4220 test_member_function_asyncStar() { | 10119 test_member_function_asyncStar() { |
| 4221 checkLibrary(r''' | 10120 var library = checkLibrary(r''' |
| 4222 import 'dart:async'; | 10121 import 'dart:async'; |
| 4223 class C { | 10122 class C { |
| 4224 Stream f() async* {} | 10123 Stream f() async* {} |
| 4225 } | 10124 } |
| 4226 '''); | 10125 '''); |
| 10126 if (isStrongMode) { | |
| 10127 checkElementText( | |
| 10128 library, | |
| 10129 r''' | |
| 10130 import 'dart:async'; | |
| 10131 class C { | |
| 10132 Stream f() {} | |
| 10133 } | |
| 10134 '''); | |
| 10135 } else { | |
| 10136 checkElementText( | |
| 10137 library, | |
| 10138 r''' | |
| 10139 import 'dart:async'; | |
| 10140 class C { | |
| 10141 Stream f() {} | |
| 10142 } | |
| 10143 '''); | |
| 10144 } | |
| 4227 } | 10145 } |
| 4228 | 10146 |
| 4229 test_metadata_classDeclaration() { | 10147 test_metadata_classDeclaration() { |
| 4230 checkLibrary('const a = null; @a class C {}'); | 10148 var library = checkLibrary('const a = null; @a class C {}'); |
| 10149 if (isStrongMode) { | |
| 10150 checkElementText( | |
| 10151 library, | |
| 10152 r''' | |
| 10153 class C { | |
| 10154 } | |
| 10155 const a; | |
| 10156 '''); | |
| 10157 } else { | |
| 10158 checkElementText( | |
| 10159 library, | |
| 10160 r''' | |
| 10161 class C { | |
| 10162 } | |
| 10163 const a; | |
| 10164 '''); | |
| 10165 } | |
| 4231 } | 10166 } |
| 4232 | 10167 |
| 4233 test_metadata_classTypeAlias() { | 10168 test_metadata_classTypeAlias() { |
| 4234 checkLibrary( | 10169 var library = checkLibrary( |
| 4235 'const a = null; @a class C = D with E; class D {} class E {}'); | 10170 'const a = null; @a class C = D with E; class D {} class E {}'); |
| 10171 if (isStrongMode) { | |
| 10172 checkElementText( | |
| 10173 library, | |
| 10174 r''' | |
| 10175 class C extends D with E { | |
| 10176 synthetic C(); | |
| 10177 } | |
| 10178 class D { | |
| 10179 } | |
| 10180 class E { | |
| 10181 } | |
| 10182 const a; | |
| 10183 '''); | |
| 10184 } else { | |
| 10185 checkElementText( | |
| 10186 library, | |
| 10187 r''' | |
| 10188 class C extends D with E { | |
| 10189 synthetic C(); | |
| 10190 } | |
| 10191 class D { | |
| 10192 } | |
| 10193 class E { | |
| 10194 } | |
| 10195 const a; | |
| 10196 '''); | |
| 10197 } | |
| 4236 } | 10198 } |
| 4237 | 10199 |
| 4238 test_metadata_constructor_call_named() { | 10200 test_metadata_constructor_call_named() { |
| 4239 checkLibrary('class A { const A.named(); } @A.named() class C {}'); | 10201 var library = |
| 10202 checkLibrary('class A { const A.named(); } @A.named() class C {}'); | |
| 10203 if (isStrongMode) { | |
| 10204 checkElementText( | |
| 10205 library, | |
| 10206 r''' | |
| 10207 class A { | |
| 10208 A.named(); | |
| 10209 } | |
| 10210 class C { | |
| 10211 } | |
| 10212 '''); | |
| 10213 } else { | |
| 10214 checkElementText( | |
| 10215 library, | |
| 10216 r''' | |
| 10217 class A { | |
| 10218 A.named(); | |
| 10219 } | |
| 10220 class C { | |
| 10221 } | |
| 10222 '''); | |
| 10223 } | |
| 4240 } | 10224 } |
| 4241 | 10225 |
| 4242 test_metadata_constructor_call_named_prefixed() { | 10226 test_metadata_constructor_call_named_prefixed() { |
| 4243 addLibrarySource('/foo.dart', 'class A { const A.named(); }'); | 10227 addLibrarySource('/foo.dart', 'class A { const A.named(); }'); |
| 4244 checkLibrary('import "foo.dart" as foo; @foo.A.named() class C {}'); | 10228 var library = |
| 10229 checkLibrary('import "foo.dart" as foo; @foo.A.named() class C {}'); | |
| 10230 if (isStrongMode) { | |
| 10231 checkElementText( | |
| 10232 library, | |
| 10233 r''' | |
| 10234 import 'foo.dart' as foo; | |
| 10235 class C { | |
| 10236 } | |
| 10237 '''); | |
| 10238 } else { | |
| 10239 checkElementText( | |
| 10240 library, | |
| 10241 r''' | |
| 10242 import 'foo.dart' as foo; | |
| 10243 class C { | |
| 10244 } | |
| 10245 '''); | |
| 10246 } | |
| 4245 } | 10247 } |
| 4246 | 10248 |
| 4247 test_metadata_constructor_call_unnamed() { | 10249 test_metadata_constructor_call_unnamed() { |
| 4248 checkLibrary('class A { const A(); } @A() class C {}'); | 10250 var library = checkLibrary('class A { const A(); } @A() class C {}'); |
| 10251 if (isStrongMode) { | |
| 10252 checkElementText( | |
| 10253 library, | |
| 10254 r''' | |
| 10255 class A { | |
| 10256 A(); | |
| 10257 } | |
| 10258 class C { | |
| 10259 } | |
| 10260 '''); | |
| 10261 } else { | |
| 10262 checkElementText( | |
| 10263 library, | |
| 10264 r''' | |
| 10265 class A { | |
| 10266 A(); | |
| 10267 } | |
| 10268 class C { | |
| 10269 } | |
| 10270 '''); | |
| 10271 } | |
| 4249 } | 10272 } |
| 4250 | 10273 |
| 4251 test_metadata_constructor_call_unnamed_prefixed() { | 10274 test_metadata_constructor_call_unnamed_prefixed() { |
| 4252 addLibrarySource('/foo.dart', 'class A { const A(); }'); | 10275 addLibrarySource('/foo.dart', 'class A { const A(); }'); |
| 4253 checkLibrary('import "foo.dart" as foo; @foo.A() class C {}'); | 10276 var library = checkLibrary('import "foo.dart" as foo; @foo.A() class C {}'); |
| 10277 if (isStrongMode) { | |
| 10278 checkElementText( | |
| 10279 library, | |
| 10280 r''' | |
| 10281 import 'foo.dart' as foo; | |
| 10282 class C { | |
| 10283 } | |
| 10284 '''); | |
| 10285 } else { | |
| 10286 checkElementText( | |
| 10287 library, | |
| 10288 r''' | |
| 10289 import 'foo.dart' as foo; | |
| 10290 class C { | |
| 10291 } | |
| 10292 '''); | |
| 10293 } | |
| 4254 } | 10294 } |
| 4255 | 10295 |
| 4256 test_metadata_constructor_call_with_args() { | 10296 test_metadata_constructor_call_with_args() { |
| 4257 checkLibrary('class A { const A(x); } @A(null) class C {}'); | 10297 var library = checkLibrary('class A { const A(x); } @A(null) class C {}'); |
| 10298 if (isStrongMode) { | |
| 10299 checkElementText( | |
| 10300 library, | |
| 10301 r''' | |
| 10302 class A { | |
| 10303 A(x); | |
| 10304 } | |
| 10305 class C { | |
| 10306 } | |
| 10307 '''); | |
| 10308 } else { | |
| 10309 checkElementText( | |
| 10310 library, | |
| 10311 r''' | |
| 10312 class A { | |
| 10313 A(x); | |
| 10314 } | |
| 10315 class C { | |
| 10316 } | |
| 10317 '''); | |
| 10318 } | |
| 4258 } | 10319 } |
| 4259 | 10320 |
| 4260 test_metadata_constructorDeclaration_named() { | 10321 test_metadata_constructorDeclaration_named() { |
| 4261 checkLibrary('const a = null; class C { @a C.named(); }'); | 10322 var library = checkLibrary('const a = null; class C { @a C.named(); }'); |
| 10323 if (isStrongMode) { | |
| 10324 checkElementText( | |
| 10325 library, | |
| 10326 r''' | |
| 10327 class C { | |
| 10328 C.named(); | |
| 10329 } | |
| 10330 const a; | |
| 10331 '''); | |
| 10332 } else { | |
| 10333 checkElementText( | |
| 10334 library, | |
| 10335 r''' | |
| 10336 class C { | |
| 10337 C.named(); | |
| 10338 } | |
| 10339 const a; | |
| 10340 '''); | |
| 10341 } | |
| 4262 } | 10342 } |
| 4263 | 10343 |
| 4264 test_metadata_constructorDeclaration_unnamed() { | 10344 test_metadata_constructorDeclaration_unnamed() { |
| 4265 checkLibrary('const a = null; class C { @a C(); }'); | 10345 var library = checkLibrary('const a = null; class C { @a C(); }'); |
| 10346 if (isStrongMode) { | |
| 10347 checkElementText( | |
| 10348 library, | |
| 10349 r''' | |
| 10350 class C { | |
| 10351 C(); | |
| 10352 } | |
| 10353 const a; | |
| 10354 '''); | |
| 10355 } else { | |
| 10356 checkElementText( | |
| 10357 library, | |
| 10358 r''' | |
| 10359 class C { | |
| 10360 C(); | |
| 10361 } | |
| 10362 const a; | |
| 10363 '''); | |
| 10364 } | |
| 4266 } | 10365 } |
| 4267 | 10366 |
| 4268 test_metadata_enumDeclaration() { | 10367 test_metadata_enumDeclaration() { |
| 4269 checkLibrary('const a = null; @a enum E { v }'); | 10368 var library = checkLibrary('const a = null; @a enum E { v }'); |
| 10369 if (isStrongMode) { | |
| 10370 checkElementText( | |
| 10371 library, | |
| 10372 r''' | |
| 10373 enum E { v } | |
| 10374 const a; | |
| 10375 '''); | |
| 10376 } else { | |
| 10377 checkElementText( | |
| 10378 library, | |
| 10379 r''' | |
| 10380 enum E { v } | |
| 10381 const a; | |
| 10382 '''); | |
| 10383 } | |
| 4270 } | 10384 } |
| 4271 | 10385 |
| 4272 test_metadata_exportDirective() { | 10386 test_metadata_exportDirective() { |
| 4273 addLibrarySource('/foo.dart', ''); | 10387 addLibrarySource('/foo.dart', ''); |
| 4274 checkLibrary('@a export "foo.dart"; const a = null;'); | 10388 var library = checkLibrary('@a export "foo.dart"; const a = null;'); |
| 10389 if (isStrongMode) { | |
| 10390 checkElementText( | |
| 10391 library, | |
| 10392 r''' | |
| 10393 export 'foo.dart'; | |
| 10394 const a; | |
| 10395 '''); | |
| 10396 } else { | |
| 10397 checkElementText( | |
| 10398 library, | |
| 10399 r''' | |
| 10400 export 'foo.dart'; | |
| 10401 const a; | |
| 10402 '''); | |
| 10403 } | |
| 4275 } | 10404 } |
| 4276 | 10405 |
| 4277 test_metadata_fieldDeclaration() { | 10406 test_metadata_fieldDeclaration() { |
| 4278 checkLibrary('const a = null; class C { @a int x; }'); | 10407 var library = checkLibrary('const a = null; class C { @a int x; }'); |
| 10408 if (isStrongMode) { | |
| 10409 checkElementText( | |
| 10410 library, | |
| 10411 r''' | |
| 10412 class C { | |
| 10413 int x; | |
| 10414 } | |
| 10415 const a; | |
| 10416 '''); | |
| 10417 } else { | |
| 10418 checkElementText( | |
| 10419 library, | |
| 10420 r''' | |
| 10421 class C { | |
| 10422 int x; | |
| 10423 } | |
| 10424 const a; | |
| 10425 '''); | |
| 10426 } | |
| 4279 } | 10427 } |
| 4280 | 10428 |
| 4281 test_metadata_fieldFormalParameter() { | 10429 test_metadata_fieldFormalParameter() { |
| 4282 checkLibrary('const a = null; class C { var x; C(@a this.x); }'); | 10430 var library = |
| 10431 checkLibrary('const a = null; class C { var x; C(@a this.x); }'); | |
| 10432 if (isStrongMode) { | |
| 10433 checkElementText( | |
| 10434 library, | |
| 10435 r''' | |
| 10436 class C { | |
| 10437 var x; | |
| 10438 C(this.x); | |
| 10439 } | |
| 10440 const a; | |
| 10441 '''); | |
| 10442 } else { | |
| 10443 checkElementText( | |
| 10444 library, | |
| 10445 r''' | |
| 10446 class C { | |
| 10447 var x; | |
| 10448 C(this.x); | |
| 10449 } | |
| 10450 const a; | |
| 10451 '''); | |
| 10452 } | |
| 4283 } | 10453 } |
| 4284 | 10454 |
| 4285 test_metadata_fieldFormalParameter_withDefault() { | 10455 test_metadata_fieldFormalParameter_withDefault() { |
| 4286 checkLibrary('const a = null; class C { var x; C([@a this.x = null]); }'); | 10456 var library = checkLibrary( |
| 10457 'const a = null; class C { var x; C([@a this.x = null]); }'); | |
| 10458 if (isStrongMode) { | |
| 10459 checkElementText( | |
| 10460 library, | |
| 10461 r''' | |
| 10462 class C { | |
| 10463 var x; | |
| 10464 C([this.x]); | |
| 10465 } | |
| 10466 const a; | |
| 10467 '''); | |
| 10468 } else { | |
| 10469 checkElementText( | |
| 10470 library, | |
| 10471 r''' | |
| 10472 class C { | |
| 10473 var x; | |
| 10474 C([this.x]); | |
| 10475 } | |
| 10476 const a; | |
| 10477 '''); | |
| 10478 } | |
| 4287 } | 10479 } |
| 4288 | 10480 |
| 4289 test_metadata_functionDeclaration_function() { | 10481 test_metadata_functionDeclaration_function() { |
| 4290 checkLibrary('const a = null; @a f() {}'); | 10482 var library = checkLibrary('const a = null; @a f() {}'); |
| 10483 if (isStrongMode) { | |
| 10484 checkElementText( | |
| 10485 library, | |
| 10486 r''' | |
| 10487 const a; | |
| 10488 f() {} | |
| 10489 '''); | |
| 10490 } else { | |
| 10491 checkElementText( | |
| 10492 library, | |
| 10493 r''' | |
| 10494 const a; | |
| 10495 f() {} | |
| 10496 '''); | |
| 10497 } | |
| 4291 } | 10498 } |
| 4292 | 10499 |
| 4293 test_metadata_functionDeclaration_getter() { | 10500 test_metadata_functionDeclaration_getter() { |
| 4294 checkLibrary('const a = null; @a get f => null;'); | 10501 var library = checkLibrary('const a = null; @a get f => null;'); |
| 10502 if (isStrongMode) { | |
| 10503 checkElementText( | |
| 10504 library, | |
| 10505 r''' | |
| 10506 const a; | |
| 10507 get f {} | |
| 10508 '''); | |
| 10509 } else { | |
| 10510 checkElementText( | |
| 10511 library, | |
| 10512 r''' | |
| 10513 const a; | |
| 10514 get f {} | |
| 10515 '''); | |
| 10516 } | |
| 4295 } | 10517 } |
| 4296 | 10518 |
| 4297 test_metadata_functionDeclaration_setter() { | 10519 test_metadata_functionDeclaration_setter() { |
| 4298 checkLibrary('const a = null; @a set f(value) {}'); | 10520 var library = checkLibrary('const a = null; @a set f(value) {}'); |
| 10521 if (isStrongMode) { | |
| 10522 checkElementText( | |
| 10523 library, | |
| 10524 r''' | |
| 10525 const a; | |
| 10526 void set f(value) {} | |
| 10527 '''); | |
| 10528 } else { | |
| 10529 checkElementText( | |
| 10530 library, | |
| 10531 r''' | |
| 10532 const a; | |
| 10533 set f(value) {} | |
| 10534 '''); | |
| 10535 } | |
| 4299 } | 10536 } |
| 4300 | 10537 |
| 4301 test_metadata_functionTypeAlias() { | 10538 test_metadata_functionTypeAlias() { |
| 4302 checkLibrary('const a = null; @a typedef F();'); | 10539 var library = checkLibrary('const a = null; @a typedef F();'); |
| 10540 if (isStrongMode) { | |
| 10541 checkElementText( | |
| 10542 library, | |
| 10543 r''' | |
| 10544 typedef F(); | |
| 10545 const a; | |
| 10546 '''); | |
| 10547 } else { | |
| 10548 checkElementText( | |
| 10549 library, | |
| 10550 r''' | |
| 10551 typedef F(); | |
| 10552 const a; | |
| 10553 '''); | |
| 10554 } | |
| 4303 } | 10555 } |
| 4304 | 10556 |
| 4305 test_metadata_functionTypedFormalParameter() { | 10557 test_metadata_functionTypedFormalParameter() { |
| 4306 checkLibrary('const a = null; f(@a g()) {}'); | 10558 var library = checkLibrary('const a = null; f(@a g()) {}'); |
| 10559 if (isStrongMode) { | |
| 10560 checkElementText( | |
| 10561 library, | |
| 10562 r''' | |
| 10563 const a; | |
| 10564 f(() → dynamic g) {} | |
| 10565 '''); | |
| 10566 } else { | |
| 10567 checkElementText( | |
| 10568 library, | |
| 10569 r''' | |
| 10570 const a; | |
| 10571 f(() → dynamic g) {} | |
| 10572 '''); | |
| 10573 } | |
| 4307 } | 10574 } |
| 4308 | 10575 |
| 4309 test_metadata_functionTypedFormalParameter_withDefault() { | 10576 test_metadata_functionTypedFormalParameter_withDefault() { |
| 4310 checkLibrary('const a = null; f([@a g() = null]) {}'); | 10577 var library = checkLibrary('const a = null; f([@a g() = null]) {}'); |
| 10578 if (isStrongMode) { | |
| 10579 checkElementText( | |
| 10580 library, | |
| 10581 r''' | |
| 10582 const a; | |
| 10583 f([() → dynamic g]) {} | |
| 10584 '''); | |
| 10585 } else { | |
| 10586 checkElementText( | |
| 10587 library, | |
| 10588 r''' | |
| 10589 const a; | |
| 10590 f([() → dynamic g]) {} | |
| 10591 '''); | |
| 10592 } | |
| 4311 } | 10593 } |
| 4312 | 10594 |
| 4313 test_metadata_importDirective() { | 10595 test_metadata_importDirective() { |
| 4314 addLibrarySource('/foo.dart', 'const b = null;'); | 10596 addLibrarySource('/foo.dart', 'const b = null;'); |
| 4315 checkLibrary('@a import "foo.dart"; const a = b;'); | 10597 var library = checkLibrary('@a import "foo.dart"; const a = b;'); |
| 10598 if (isStrongMode) { | |
| 10599 checkElementText( | |
| 10600 library, | |
| 10601 r''' | |
| 10602 import 'foo.dart'; | |
| 10603 const a; | |
| 10604 '''); | |
| 10605 } else { | |
| 10606 checkElementText( | |
| 10607 library, | |
| 10608 r''' | |
| 10609 import 'foo.dart'; | |
| 10610 const a; | |
| 10611 '''); | |
| 10612 } | |
| 4316 } | 10613 } |
| 4317 | 10614 |
| 4318 test_metadata_invalid_classDeclaration() { | 10615 test_metadata_invalid_classDeclaration() { |
| 4319 checkLibrary('f(_) {} @f(42) class C {}'); | 10616 var library = checkLibrary('f(_) {} @f(42) class C {}'); |
| 10617 if (isStrongMode) { | |
| 10618 checkElementText( | |
| 10619 library, | |
| 10620 r''' | |
| 10621 class C { | |
| 10622 } | |
| 10623 f(_) {} | |
| 10624 '''); | |
| 10625 } else { | |
| 10626 checkElementText( | |
| 10627 library, | |
| 10628 r''' | |
| 10629 class C { | |
| 10630 } | |
| 10631 f(_) {} | |
| 10632 '''); | |
| 10633 } | |
| 4320 } | 10634 } |
| 4321 | 10635 |
| 4322 test_metadata_libraryDirective() { | 10636 test_metadata_libraryDirective() { |
| 4323 checkLibrary('@a library L; const a = null;'); | 10637 var library = checkLibrary('@a library L; const a = null;'); |
| 10638 if (isStrongMode) { | |
| 10639 checkElementText( | |
| 10640 library, | |
| 10641 r''' | |
| 10642 library L; | |
| 10643 const a; | |
| 10644 '''); | |
| 10645 } else { | |
| 10646 checkElementText( | |
| 10647 library, | |
| 10648 r''' | |
| 10649 library L; | |
| 10650 const a; | |
| 10651 '''); | |
| 10652 } | |
| 4324 } | 10653 } |
| 4325 | 10654 |
| 4326 test_metadata_methodDeclaration_getter() { | 10655 test_metadata_methodDeclaration_getter() { |
| 4327 checkLibrary('const a = null; class C { @a get m => null; }'); | 10656 var library = checkLibrary('const a = null; class C { @a get m => null; }'); |
| 10657 if (isStrongMode) { | |
| 10658 checkElementText( | |
| 10659 library, | |
| 10660 r''' | |
| 10661 class C { | |
| 10662 get m {} | |
| 10663 } | |
| 10664 const a; | |
| 10665 '''); | |
| 10666 } else { | |
| 10667 checkElementText( | |
| 10668 library, | |
| 10669 r''' | |
| 10670 class C { | |
| 10671 get m {} | |
| 10672 } | |
| 10673 const a; | |
| 10674 '''); | |
| 10675 } | |
| 4328 } | 10676 } |
| 4329 | 10677 |
| 4330 test_metadata_methodDeclaration_method() { | 10678 test_metadata_methodDeclaration_method() { |
| 4331 checkLibrary('const a = null; class C { @a m() {} }'); | 10679 var library = checkLibrary('const a = null; class C { @a m() {} }'); |
| 10680 if (isStrongMode) { | |
| 10681 checkElementText( | |
| 10682 library, | |
| 10683 r''' | |
| 10684 class C { | |
| 10685 m() {} | |
| 10686 } | |
| 10687 const a; | |
| 10688 '''); | |
| 10689 } else { | |
| 10690 checkElementText( | |
| 10691 library, | |
| 10692 r''' | |
| 10693 class C { | |
| 10694 m() {} | |
| 10695 } | |
| 10696 const a; | |
| 10697 '''); | |
| 10698 } | |
| 4332 } | 10699 } |
| 4333 | 10700 |
| 4334 test_metadata_methodDeclaration_setter() { | 10701 test_metadata_methodDeclaration_setter() { |
| 4335 checkLibrary('const a = null; class C { @a set m(value) {} }'); | 10702 var library = |
| 10703 checkLibrary('const a = null; class C { @a set m(value) {} }'); | |
| 10704 if (isStrongMode) { | |
| 10705 checkElementText( | |
| 10706 library, | |
| 10707 r''' | |
| 10708 class C { | |
| 10709 void set m(value) {} | |
| 10710 } | |
| 10711 const a; | |
| 10712 '''); | |
| 10713 } else { | |
| 10714 checkElementText( | |
| 10715 library, | |
| 10716 r''' | |
| 10717 class C { | |
| 10718 set m(value) {} | |
| 10719 } | |
| 10720 const a; | |
| 10721 '''); | |
| 10722 } | |
| 4336 } | 10723 } |
| 4337 | 10724 |
| 4338 test_metadata_partDirective() { | 10725 test_metadata_partDirective() { |
| 4339 addSource('/foo.dart', 'part of L;'); | 10726 addSource('/foo.dart', 'part of L;'); |
| 4340 checkLibrary('library L; @a part "foo.dart"; const a = null;'); | 10727 var library = |
| 10728 checkLibrary('library L; @a part "foo.dart"; const a = null;'); | |
| 10729 if (isStrongMode) { | |
| 10730 checkElementText( | |
| 10731 library, | |
| 10732 r''' | |
| 10733 library L; | |
| 10734 part 'foo.dart'; | |
| 10735 const a; | |
| 10736 -------------------- | |
| 10737 unit: foo.dart | |
| 10738 | |
| 10739 '''); | |
| 10740 } else { | |
| 10741 checkElementText( | |
| 10742 library, | |
| 10743 r''' | |
| 10744 library L; | |
| 10745 part 'foo.dart'; | |
| 10746 const a; | |
| 10747 -------------------- | |
| 10748 unit: foo.dart | |
| 10749 | |
| 10750 '''); | |
| 10751 } | |
| 4341 } | 10752 } |
| 4342 | 10753 |
| 4343 test_metadata_prefixed_variable() { | 10754 test_metadata_prefixed_variable() { |
| 4344 addLibrarySource('/a.dart', 'const b = null;'); | 10755 addLibrarySource('/a.dart', 'const b = null;'); |
| 4345 checkLibrary('import "a.dart" as a; @a.b class C {}'); | 10756 var library = checkLibrary('import "a.dart" as a; @a.b class C {}'); |
| 10757 if (isStrongMode) { | |
| 10758 checkElementText( | |
| 10759 library, | |
| 10760 r''' | |
| 10761 import 'a.dart' as a; | |
| 10762 class C { | |
| 10763 } | |
| 10764 '''); | |
| 10765 } else { | |
| 10766 checkElementText( | |
| 10767 library, | |
| 10768 r''' | |
| 10769 import 'a.dart' as a; | |
| 10770 class C { | |
| 10771 } | |
| 10772 '''); | |
| 10773 } | |
| 4346 } | 10774 } |
| 4347 | 10775 |
| 4348 test_metadata_simpleFormalParameter() { | 10776 test_metadata_simpleFormalParameter() { |
| 4349 checkLibrary('const a = null; f(@a x) {}'); | 10777 var library = checkLibrary('const a = null; f(@a x) {}'); |
| 10778 if (isStrongMode) { | |
| 10779 checkElementText( | |
| 10780 library, | |
| 10781 r''' | |
| 10782 const a; | |
| 10783 f(x) {} | |
| 10784 '''); | |
| 10785 } else { | |
| 10786 checkElementText( | |
| 10787 library, | |
| 10788 r''' | |
| 10789 const a; | |
| 10790 f(x) {} | |
| 10791 '''); | |
| 10792 } | |
| 4350 } | 10793 } |
| 4351 | 10794 |
| 4352 test_metadata_simpleFormalParameter_withDefault() { | 10795 test_metadata_simpleFormalParameter_withDefault() { |
| 4353 checkLibrary('const a = null; f([@a x = null]) {}'); | 10796 var library = checkLibrary('const a = null; f([@a x = null]) {}'); |
| 10797 if (isStrongMode) { | |
| 10798 checkElementText( | |
| 10799 library, | |
| 10800 r''' | |
| 10801 const a; | |
| 10802 f([x]) {} | |
| 10803 '''); | |
| 10804 } else { | |
| 10805 checkElementText( | |
| 10806 library, | |
| 10807 r''' | |
| 10808 const a; | |
| 10809 f([x]) {} | |
| 10810 '''); | |
| 10811 } | |
| 4354 } | 10812 } |
| 4355 | 10813 |
| 4356 test_metadata_topLevelVariableDeclaration() { | 10814 test_metadata_topLevelVariableDeclaration() { |
| 4357 checkLibrary('const a = null; @a int v;'); | 10815 var library = checkLibrary('const a = null; @a int v;'); |
| 10816 if (isStrongMode) { | |
| 10817 checkElementText( | |
| 10818 library, | |
| 10819 r''' | |
| 10820 const a; | |
| 10821 int v; | |
| 10822 '''); | |
| 10823 } else { | |
| 10824 checkElementText( | |
| 10825 library, | |
| 10826 r''' | |
| 10827 const a; | |
| 10828 int v; | |
| 10829 '''); | |
| 10830 } | |
| 4358 } | 10831 } |
| 4359 | 10832 |
| 4360 test_metadata_typeParameter_ofClass() { | 10833 test_metadata_typeParameter_ofClass() { |
| 4361 checkLibrary('const a = null; class C<@a T> {}'); | 10834 var library = checkLibrary('const a = null; class C<@a T> {}'); |
| 10835 if (isStrongMode) { | |
| 10836 checkElementText( | |
| 10837 library, | |
| 10838 r''' | |
| 10839 class C<T> { | |
| 10840 } | |
| 10841 const a; | |
| 10842 '''); | |
| 10843 } else { | |
| 10844 checkElementText( | |
| 10845 library, | |
| 10846 r''' | |
| 10847 class C<T> { | |
| 10848 } | |
| 10849 const a; | |
| 10850 '''); | |
| 10851 } | |
| 4362 } | 10852 } |
| 4363 | 10853 |
| 4364 test_metadata_typeParameter_ofClassTypeAlias() { | 10854 test_metadata_typeParameter_ofClassTypeAlias() { |
| 4365 checkLibrary( | 10855 var library = checkLibrary( |
| 4366 'const a = null; class C<@a T> = D with E; class D {} class E {}'); | 10856 'const a = null; class C<@a T> = D with E; class D {} class E {}'); |
| 10857 if (isStrongMode) { | |
| 10858 checkElementText( | |
| 10859 library, | |
| 10860 r''' | |
| 10861 class C<T> extends D with E { | |
| 10862 synthetic C(); | |
| 10863 } | |
| 10864 class D { | |
| 10865 } | |
| 10866 class E { | |
| 10867 } | |
| 10868 const a; | |
| 10869 '''); | |
| 10870 } else { | |
| 10871 checkElementText( | |
| 10872 library, | |
| 10873 r''' | |
| 10874 class C<T> extends D with E { | |
| 10875 synthetic C(); | |
| 10876 } | |
| 10877 class D { | |
| 10878 } | |
| 10879 class E { | |
| 10880 } | |
| 10881 const a; | |
| 10882 '''); | |
| 10883 } | |
| 4367 } | 10884 } |
| 4368 | 10885 |
| 4369 test_metadata_typeParameter_ofFunction() { | 10886 test_metadata_typeParameter_ofFunction() { |
| 4370 checkLibrary('const a = null; f<@a T>() {}'); | 10887 var library = checkLibrary('const a = null; f<@a T>() {}'); |
| 10888 if (isStrongMode) { | |
| 10889 checkElementText( | |
| 10890 library, | |
| 10891 r''' | |
| 10892 const a; | |
| 10893 f<T>() {} | |
| 10894 '''); | |
| 10895 } else { | |
| 10896 checkElementText( | |
| 10897 library, | |
| 10898 r''' | |
| 10899 const a; | |
| 10900 f<T>() {} | |
| 10901 '''); | |
| 10902 } | |
| 4371 } | 10903 } |
| 4372 | 10904 |
| 4373 test_metadata_typeParameter_ofTypedef() { | 10905 test_metadata_typeParameter_ofTypedef() { |
| 4374 checkLibrary('const a = null; typedef F<@a T>();'); | 10906 var library = checkLibrary('const a = null; typedef F<@a T>();'); |
| 10907 if (isStrongMode) { | |
| 10908 checkElementText( | |
| 10909 library, | |
| 10910 r''' | |
| 10911 typedef F<T>(); | |
| 10912 const a; | |
| 10913 '''); | |
| 10914 } else { | |
| 10915 checkElementText( | |
| 10916 library, | |
| 10917 r''' | |
| 10918 typedef F<T>(); | |
| 10919 const a; | |
| 10920 '''); | |
| 10921 } | |
| 4375 } | 10922 } |
| 4376 | 10923 |
| 4377 test_method_documented() { | 10924 test_method_documented() { |
| 4378 checkLibrary(''' | 10925 var library = checkLibrary(''' |
| 4379 class C { | 10926 class C { |
| 4380 /** | 10927 /** |
| 4381 * Docs | 10928 * Docs |
| 4382 */ | 10929 */ |
| 4383 f() {} | 10930 f() {} |
| 4384 }'''); | 10931 }'''); |
| 10932 if (isStrongMode) { | |
| 10933 checkElementText( | |
| 10934 library, | |
| 10935 r''' | |
| 10936 class C { | |
| 10937 f() {} | |
| 10938 } | |
| 10939 '''); | |
| 10940 } else { | |
| 10941 checkElementText( | |
| 10942 library, | |
| 10943 r''' | |
| 10944 class C { | |
| 10945 f() {} | |
| 10946 } | |
| 10947 '''); | |
| 10948 } | |
| 4385 } | 10949 } |
| 4386 | 10950 |
| 4387 test_method_inferred_type_nonStatic_implicit_param() { | 10951 test_method_inferred_type_nonStatic_implicit_param() { |
| 4388 checkLibrary('class C extends D { void f(value) {} }' | 10952 var library = checkLibrary('class C extends D { void f(value) {} }' |
| 4389 ' abstract class D { void f(int value); }'); | 10953 ' abstract class D { void f(int value); }'); |
| 10954 if (isStrongMode) { | |
| 10955 checkElementText( | |
| 10956 library, | |
| 10957 r''' | |
| 10958 class C extends D { | |
| 10959 void f(int value) {} | |
| 10960 } | |
| 10961 abstract class D { | |
| 10962 void f(int value); | |
| 10963 } | |
| 10964 '''); | |
| 10965 } else { | |
| 10966 checkElementText( | |
| 10967 library, | |
| 10968 r''' | |
| 10969 class C extends D { | |
| 10970 void f(value) {} | |
| 10971 } | |
| 10972 abstract class D { | |
| 10973 void f(int value); | |
| 10974 } | |
| 10975 '''); | |
| 10976 } | |
| 4390 } | 10977 } |
| 4391 | 10978 |
| 4392 test_method_inferred_type_nonStatic_implicit_return() { | 10979 test_method_inferred_type_nonStatic_implicit_return() { |
| 4393 checkLibrary( | 10980 var library = checkLibrary( |
| 4394 'class C extends D { f() => null; } abstract class D { int f(); }'); | 10981 'class C extends D { f() => null; } abstract class D { int f(); }'); |
| 10982 if (isStrongMode) { | |
| 10983 checkElementText( | |
| 10984 library, | |
| 10985 r''' | |
| 10986 class C extends D { | |
| 10987 int f() {} | |
| 10988 } | |
| 10989 abstract class D { | |
| 10990 int f(); | |
| 10991 } | |
| 10992 '''); | |
| 10993 } else { | |
| 10994 checkElementText( | |
| 10995 library, | |
| 10996 r''' | |
| 10997 class C extends D { | |
| 10998 f() {} | |
| 10999 } | |
| 11000 abstract class D { | |
| 11001 int f(); | |
| 11002 } | |
| 11003 '''); | |
| 11004 } | |
| 4395 } | 11005 } |
| 4396 | 11006 |
| 4397 test_method_type_parameter() { | 11007 test_method_type_parameter() { |
| 4398 prepareAnalysisContext(createOptions()); | 11008 prepareAnalysisContext(createOptions()); |
| 4399 checkLibrary('class C { T f<T, U>(U u) => null; }'); | 11009 var library = checkLibrary('class C { T f<T, U>(U u) => null; }'); |
| 11010 if (isStrongMode) { | |
| 11011 checkElementText( | |
| 11012 library, | |
| 11013 r''' | |
| 11014 class C { | |
| 11015 T f<T, U>(U u) {} | |
| 11016 } | |
| 11017 '''); | |
| 11018 } else { | |
| 11019 checkElementText( | |
| 11020 library, | |
| 11021 r''' | |
| 11022 class C { | |
| 11023 T f<T, U>(U u) {} | |
| 11024 } | |
| 11025 '''); | |
| 11026 } | |
| 4400 } | 11027 } |
| 4401 | 11028 |
| 4402 test_method_type_parameter_in_generic_class() { | 11029 test_method_type_parameter_in_generic_class() { |
| 4403 prepareAnalysisContext(createOptions()); | 11030 prepareAnalysisContext(createOptions()); |
| 4404 checkLibrary('class C<T, U> { V f<V, W>(T t, U u, W w) => null; }'); | 11031 var library = |
| 11032 checkLibrary('class C<T, U> { V f<V, W>(T t, U u, W w) => null; }'); | |
| 11033 if (isStrongMode) { | |
| 11034 checkElementText( | |
| 11035 library, | |
| 11036 r''' | |
| 11037 class C<T, U> { | |
| 11038 V f<V, W>(T t, U u, W w) {} | |
| 11039 } | |
| 11040 '''); | |
| 11041 } else { | |
| 11042 checkElementText( | |
| 11043 library, | |
| 11044 r''' | |
| 11045 class C<T, U> { | |
| 11046 V f<V, W>(T t, U u, W w) {} | |
| 11047 } | |
| 11048 '''); | |
| 11049 } | |
| 4405 } | 11050 } |
| 4406 | 11051 |
| 4407 test_method_type_parameter_with_function_typed_parameter() { | 11052 test_method_type_parameter_with_function_typed_parameter() { |
| 4408 prepareAnalysisContext(createOptions()); | 11053 prepareAnalysisContext(createOptions()); |
| 4409 checkLibrary('class C { void f<T, U>(T x(U u)) {} }'); | 11054 var library = checkLibrary('class C { void f<T, U>(T x(U u)) {} }'); |
| 11055 if (isStrongMode) { | |
| 11056 checkElementText( | |
| 11057 library, | |
| 11058 r''' | |
| 11059 class C { | |
| 11060 void f<T, U>((U) → T x) {} | |
| 11061 } | |
| 11062 '''); | |
| 11063 } else { | |
| 11064 checkElementText( | |
| 11065 library, | |
| 11066 r''' | |
| 11067 class C { | |
| 11068 void f<T, U>((U) → T x) {} | |
| 11069 } | |
| 11070 '''); | |
| 11071 } | |
| 4410 } | 11072 } |
| 4411 | 11073 |
| 4412 test_nameConflict_exportedAndLocal() { | 11074 test_nameConflict_exportedAndLocal() { |
| 4413 namesThatCannotBeResolved.add('V'); | 11075 namesThatCannotBeResolved.add('V'); |
| 4414 addLibrarySource('/a.dart', 'class C {}'); | 11076 addLibrarySource('/a.dart', 'class C {}'); |
| 4415 addLibrarySource( | 11077 addLibrarySource( |
| 4416 '/c.dart', | 11078 '/c.dart', |
| 4417 ''' | 11079 ''' |
| 4418 export 'a.dart'; | 11080 export 'a.dart'; |
| 4419 class C {} | 11081 class C {} |
| 4420 '''); | 11082 '''); |
| 4421 checkLibrary(''' | 11083 var library = checkLibrary(''' |
| 4422 import 'c.dart'; | 11084 import 'c.dart'; |
| 4423 C v = null; | 11085 C v = null; |
| 4424 '''); | 11086 '''); |
| 11087 if (isStrongMode) { | |
| 11088 checkElementText( | |
| 11089 library, | |
| 11090 r''' | |
| 11091 import 'c.dart'; | |
| 11092 C v; | |
| 11093 '''); | |
| 11094 } else { | |
| 11095 checkElementText( | |
| 11096 library, | |
| 11097 r''' | |
| 11098 import 'c.dart'; | |
| 11099 C v; | |
| 11100 '''); | |
| 11101 } | |
| 4425 } | 11102 } |
| 4426 | 11103 |
| 4427 test_nameConflict_exportedAndLocal_exported() { | 11104 test_nameConflict_exportedAndLocal_exported() { |
| 4428 namesThatCannotBeResolved.add('V'); | 11105 namesThatCannotBeResolved.add('V'); |
| 4429 addLibrarySource('/a.dart', 'class C {}'); | 11106 addLibrarySource('/a.dart', 'class C {}'); |
| 4430 addLibrarySource( | 11107 addLibrarySource( |
| 4431 '/c.dart', | 11108 '/c.dart', |
| 4432 ''' | 11109 ''' |
| 4433 export 'a.dart'; | 11110 export 'a.dart'; |
| 4434 class C {} | 11111 class C {} |
| 4435 '''); | 11112 '''); |
| 4436 addLibrarySource('/d.dart', 'export "c.dart";'); | 11113 addLibrarySource('/d.dart', 'export "c.dart";'); |
| 4437 checkLibrary(''' | 11114 var library = checkLibrary(''' |
| 4438 import 'd.dart'; | 11115 import 'd.dart'; |
| 4439 C v = null; | 11116 C v = null; |
| 4440 '''); | 11117 '''); |
| 11118 if (isStrongMode) { | |
| 11119 checkElementText( | |
| 11120 library, | |
| 11121 r''' | |
| 11122 import 'd.dart'; | |
| 11123 C v; | |
| 11124 '''); | |
| 11125 } else { | |
| 11126 checkElementText( | |
| 11127 library, | |
| 11128 r''' | |
| 11129 import 'd.dart'; | |
| 11130 C v; | |
| 11131 '''); | |
| 11132 } | |
| 4441 } | 11133 } |
| 4442 | 11134 |
| 4443 test_nameConflict_exportedAndParted() { | 11135 test_nameConflict_exportedAndParted() { |
| 4444 namesThatCannotBeResolved.add('V'); | 11136 namesThatCannotBeResolved.add('V'); |
| 4445 addLibrarySource('/a.dart', 'class C {}'); | 11137 addLibrarySource('/a.dart', 'class C {}'); |
| 4446 addLibrarySource( | 11138 addLibrarySource( |
| 4447 '/b.dart', | 11139 '/b.dart', |
| 4448 ''' | 11140 ''' |
| 4449 part of lib; | 11141 part of lib; |
| 4450 class C {} | 11142 class C {} |
| 4451 '''); | 11143 '''); |
| 4452 addLibrarySource( | 11144 addLibrarySource( |
| 4453 '/c.dart', | 11145 '/c.dart', |
| 4454 ''' | 11146 ''' |
| 4455 library lib; | 11147 library lib; |
| 4456 export 'a.dart'; | 11148 export 'a.dart'; |
| 4457 part 'b.dart'; | 11149 part 'b.dart'; |
| 4458 '''); | 11150 '''); |
| 4459 checkLibrary(''' | 11151 var library = checkLibrary(''' |
| 4460 import 'c.dart'; | 11152 import 'c.dart'; |
| 4461 C v = null; | 11153 C v = null; |
| 4462 '''); | 11154 '''); |
| 11155 if (isStrongMode) { | |
| 11156 checkElementText( | |
| 11157 library, | |
| 11158 r''' | |
| 11159 import 'c.dart'; | |
| 11160 C v; | |
| 11161 '''); | |
| 11162 } else { | |
| 11163 checkElementText( | |
| 11164 library, | |
| 11165 r''' | |
| 11166 import 'c.dart'; | |
| 11167 C v; | |
| 11168 '''); | |
| 11169 } | |
| 4463 } | 11170 } |
| 4464 | 11171 |
| 4465 test_nameConflict_importWithRelativeUri_exportWithAbsolute() { | 11172 test_nameConflict_importWithRelativeUri_exportWithAbsolute() { |
| 4466 if (resourceProvider.pathContext.separator != '/') { | 11173 if (resourceProvider.pathContext.separator != '/') { |
| 4467 return; | 11174 return; |
| 4468 } | 11175 } |
| 4469 | 11176 |
| 4470 addLibrarySource('/a.dart', 'class A {}'); | 11177 addLibrarySource('/a.dart', 'class A {}'); |
| 4471 addLibrarySource('/b.dart', 'export "/a.dart";'); | 11178 addLibrarySource('/b.dart', 'export "/a.dart";'); |
| 4472 checkLibrary(''' | 11179 var library = checkLibrary(''' |
| 4473 import 'a.dart'; | 11180 import 'a.dart'; |
| 4474 import 'b.dart'; | 11181 import 'b.dart'; |
| 4475 A v = null; | 11182 A v = null; |
| 4476 '''); | 11183 '''); |
| 11184 if (isStrongMode) { | |
| 11185 checkElementText( | |
| 11186 library, | |
| 11187 r''' | |
| 11188 import 'a.dart'; | |
| 11189 import 'b.dart'; | |
| 11190 A v; | |
| 11191 '''); | |
| 11192 } else { | |
| 11193 checkElementText( | |
| 11194 library, | |
| 11195 r''' | |
| 11196 import 'a.dart'; | |
| 11197 import 'b.dart'; | |
| 11198 A v; | |
| 11199 '''); | |
| 11200 } | |
| 4477 } | 11201 } |
| 4478 | 11202 |
| 4479 test_nested_generic_functions_in_generic_class_with_function_typed_params() { | 11203 test_nested_generic_functions_in_generic_class_with_function_typed_params() { |
| 4480 checkLibrary(''' | 11204 var library = checkLibrary(''' |
| 4481 class C<T, U> { | 11205 class C<T, U> { |
| 4482 void g<V, W>() { | 11206 void g<V, W>() { |
| 4483 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) { | 11207 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) { |
| 4484 } | 11208 } |
| 4485 } | 11209 } |
| 4486 } | 11210 } |
| 4487 '''); | 11211 '''); |
| 11212 if (isStrongMode) { | |
| 11213 checkElementText( | |
| 11214 library, | |
| 11215 r''' | |
| 11216 class C<T, U> { | |
| 11217 void g<V, W>() {} | |
| 11218 } | |
| 11219 '''); | |
| 11220 } else { | |
| 11221 checkElementText( | |
| 11222 library, | |
| 11223 r''' | |
| 11224 class C<T, U> { | |
| 11225 void g<V, W>() {} | |
| 11226 } | |
| 11227 '''); | |
| 11228 } | |
| 4488 } | 11229 } |
| 4489 | 11230 |
| 4490 test_nested_generic_functions_in_generic_class_with_local_variables() { | 11231 test_nested_generic_functions_in_generic_class_with_local_variables() { |
| 4491 checkLibrary(''' | 11232 var library = checkLibrary(''' |
| 4492 class C<T, U> { | 11233 class C<T, U> { |
| 4493 void g<V, W>() { | 11234 void g<V, W>() { |
| 4494 void h<X, Y>() { | 11235 void h<X, Y>() { |
| 4495 T t; | 11236 T t; |
| 4496 U u; | 11237 U u; |
| 4497 V v; | 11238 V v; |
| 4498 W w; | 11239 W w; |
| 4499 X x; | 11240 X x; |
| 4500 Y y; | 11241 Y y; |
| 4501 } | 11242 } |
| 4502 } | 11243 } |
| 4503 } | 11244 } |
| 4504 '''); | 11245 '''); |
| 11246 if (isStrongMode) { | |
| 11247 checkElementText( | |
| 11248 library, | |
| 11249 r''' | |
| 11250 class C<T, U> { | |
| 11251 void g<V, W>() {} | |
| 11252 } | |
| 11253 '''); | |
| 11254 } else { | |
| 11255 checkElementText( | |
| 11256 library, | |
| 11257 r''' | |
| 11258 class C<T, U> { | |
| 11259 void g<V, W>() {} | |
| 11260 } | |
| 11261 '''); | |
| 11262 } | |
| 4505 } | 11263 } |
| 4506 | 11264 |
| 4507 test_nested_generic_functions_with_function_typed_param() { | 11265 test_nested_generic_functions_with_function_typed_param() { |
| 4508 checkLibrary(''' | 11266 var library = checkLibrary(''' |
| 4509 void f<T, U>() { | 11267 void f<T, U>() { |
| 4510 void g<V, W>() { | 11268 void g<V, W>() { |
| 4511 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) { | 11269 void h<X, Y>(void p(T t, U u, V v, W w, X x, Y y)) { |
| 4512 } | 11270 } |
| 4513 } | 11271 } |
| 4514 } | 11272 } |
| 4515 '''); | 11273 '''); |
| 11274 if (isStrongMode) { | |
| 11275 checkElementText( | |
| 11276 library, | |
| 11277 r''' | |
| 11278 void f<T, U>() {} | |
| 11279 '''); | |
| 11280 } else { | |
| 11281 checkElementText( | |
| 11282 library, | |
| 11283 r''' | |
| 11284 void f<T, U>() {} | |
| 11285 '''); | |
| 11286 } | |
| 4516 } | 11287 } |
| 4517 | 11288 |
| 4518 test_nested_generic_functions_with_local_variables() { | 11289 test_nested_generic_functions_with_local_variables() { |
| 4519 checkLibrary(''' | 11290 var library = checkLibrary(''' |
| 4520 void f<T, U>() { | 11291 void f<T, U>() { |
| 4521 void g<V, W>() { | 11292 void g<V, W>() { |
| 4522 void h<X, Y>() { | 11293 void h<X, Y>() { |
| 4523 T t; | 11294 T t; |
| 4524 U u; | 11295 U u; |
| 4525 V v; | 11296 V v; |
| 4526 W w; | 11297 W w; |
| 4527 X x; | 11298 X x; |
| 4528 Y y; | 11299 Y y; |
| 4529 } | 11300 } |
| 4530 } | 11301 } |
| 4531 } | 11302 } |
| 4532 '''); | 11303 '''); |
| 11304 if (isStrongMode) { | |
| 11305 checkElementText( | |
| 11306 library, | |
| 11307 r''' | |
| 11308 void f<T, U>() {} | |
| 11309 '''); | |
| 11310 } else { | |
| 11311 checkElementText( | |
| 11312 library, | |
| 11313 r''' | |
| 11314 void f<T, U>() {} | |
| 11315 '''); | |
| 11316 } | |
| 4533 } | 11317 } |
| 4534 | 11318 |
| 4535 test_operator() { | 11319 test_operator() { |
| 4536 checkLibrary('class C { C operator+(C other) => null; }'); | 11320 var library = checkLibrary('class C { C operator+(C other) => null; }'); |
| 11321 if (isStrongMode) { | |
| 11322 checkElementText( | |
| 11323 library, | |
| 11324 r''' | |
| 11325 class C { | |
| 11326 C +(C other) {} | |
| 11327 } | |
| 11328 '''); | |
| 11329 } else { | |
| 11330 checkElementText( | |
| 11331 library, | |
| 11332 r''' | |
| 11333 class C { | |
| 11334 C +(C other) {} | |
| 11335 } | |
| 11336 '''); | |
| 11337 } | |
| 4537 } | 11338 } |
| 4538 | 11339 |
| 4539 test_operator_equal() { | 11340 test_operator_equal() { |
| 4540 checkLibrary('class C { bool operator==(Object other) => false; }'); | 11341 var library = |
| 11342 checkLibrary('class C { bool operator==(Object other) => false; }'); | |
| 11343 if (isStrongMode) { | |
| 11344 checkElementText( | |
| 11345 library, | |
| 11346 r''' | |
| 11347 class C { | |
| 11348 bool ==(Object other) {} | |
| 11349 } | |
| 11350 '''); | |
| 11351 } else { | |
| 11352 checkElementText( | |
| 11353 library, | |
| 11354 r''' | |
| 11355 class C { | |
| 11356 bool ==(Object other) {} | |
| 11357 } | |
| 11358 '''); | |
| 11359 } | |
| 4541 } | 11360 } |
| 4542 | 11361 |
| 4543 test_operator_external() { | 11362 test_operator_external() { |
| 4544 checkLibrary('class C { external C operator+(C other); }'); | 11363 var library = checkLibrary('class C { external C operator+(C other); }'); |
| 11364 if (isStrongMode) { | |
| 11365 checkElementText( | |
| 11366 library, | |
| 11367 r''' | |
| 11368 class C { | |
| 11369 external C +(C other) {} | |
| 11370 } | |
| 11371 '''); | |
| 11372 } else { | |
| 11373 checkElementText( | |
| 11374 library, | |
| 11375 r''' | |
| 11376 class C { | |
| 11377 external C +(C other) {} | |
| 11378 } | |
| 11379 '''); | |
| 11380 } | |
| 4545 } | 11381 } |
| 4546 | 11382 |
| 4547 test_operator_greater_equal() { | 11383 test_operator_greater_equal() { |
| 4548 checkLibrary('class C { bool operator>=(C other) => false; }'); | 11384 var library = |
| 11385 checkLibrary('class C { bool operator>=(C other) => false; }'); | |
| 11386 if (isStrongMode) { | |
| 11387 checkElementText( | |
| 11388 library, | |
| 11389 r''' | |
| 11390 class C { | |
| 11391 bool >=(C other) {} | |
| 11392 } | |
| 11393 '''); | |
| 11394 } else { | |
| 11395 checkElementText( | |
| 11396 library, | |
| 11397 r''' | |
| 11398 class C { | |
| 11399 bool >=(C other) {} | |
| 11400 } | |
| 11401 '''); | |
| 11402 } | |
| 4549 } | 11403 } |
| 4550 | 11404 |
| 4551 test_operator_index() { | 11405 test_operator_index() { |
| 4552 checkLibrary('class C { bool operator[](int i) => null; }'); | 11406 var library = checkLibrary('class C { bool operator[](int i) => null; }'); |
| 11407 if (isStrongMode) { | |
| 11408 checkElementText( | |
| 11409 library, | |
| 11410 r''' | |
| 11411 class C { | |
| 11412 bool [](int i) {} | |
| 11413 } | |
| 11414 '''); | |
| 11415 } else { | |
| 11416 checkElementText( | |
| 11417 library, | |
| 11418 r''' | |
| 11419 class C { | |
| 11420 bool [](int i) {} | |
| 11421 } | |
| 11422 '''); | |
| 11423 } | |
| 4553 } | 11424 } |
| 4554 | 11425 |
| 4555 test_operator_index_set() { | 11426 test_operator_index_set() { |
| 4556 checkLibrary('class C { void operator[]=(int i, bool v) {} }'); | 11427 var library = |
| 11428 checkLibrary('class C { void operator[]=(int i, bool v) {} }'); | |
| 11429 if (isStrongMode) { | |
| 11430 checkElementText( | |
| 11431 library, | |
| 11432 r''' | |
| 11433 class C { | |
| 11434 void []=(int i, bool v) {} | |
| 11435 } | |
| 11436 '''); | |
| 11437 } else { | |
| 11438 checkElementText( | |
| 11439 library, | |
| 11440 r''' | |
| 11441 class C { | |
| 11442 void []=(int i, bool v) {} | |
| 11443 } | |
| 11444 '''); | |
| 11445 } | |
| 4557 } | 11446 } |
| 4558 | 11447 |
| 4559 test_operator_less_equal() { | 11448 test_operator_less_equal() { |
| 4560 checkLibrary('class C { bool operator<=(C other) => false; }'); | 11449 var library = |
| 11450 checkLibrary('class C { bool operator<=(C other) => false; }'); | |
| 11451 if (isStrongMode) { | |
| 11452 checkElementText( | |
| 11453 library, | |
| 11454 r''' | |
| 11455 class C { | |
| 11456 bool <=(C other) {} | |
| 11457 } | |
| 11458 '''); | |
| 11459 } else { | |
| 11460 checkElementText( | |
| 11461 library, | |
| 11462 r''' | |
| 11463 class C { | |
| 11464 bool <=(C other) {} | |
| 11465 } | |
| 11466 '''); | |
| 11467 } | |
| 4561 } | 11468 } |
| 4562 | 11469 |
| 4563 void test_parameter_checked() { | 11470 void test_parameter_checked() { |
| 4564 // Note: due to dartbug.com/27393, the keyword "checked" is identified by | 11471 // Note: due to dartbug.com/27393, the keyword "checked" is identified by |
| 4565 // its presence in a library called "meta". If that bug is fixed, this test | 11472 // its presence in a library called "meta". If that bug is fixed, this test |
| 4566 // my need to be changed. | 11473 // my need to be changed. |
| 4567 checkLibrary(r''' | 11474 var library = checkLibrary(r''' |
| 4568 library meta; | 11475 library meta; |
| 4569 const checked = null; | 11476 const checked = null; |
| 4570 class A<T> { | 11477 class A<T> { |
| 4571 void f(@checked T t) {} | 11478 void f(@checked T t) {} |
| 4572 } | 11479 } |
| 4573 '''); | 11480 '''); |
| 11481 if (isStrongMode) { | |
| 11482 checkElementText( | |
| 11483 library, | |
| 11484 r''' | |
| 11485 library meta; | |
| 11486 class A<T> { | |
| 11487 void f(convariant T t) {} | |
| 11488 } | |
| 11489 const checked; | |
| 11490 '''); | |
| 11491 } else { | |
| 11492 checkElementText( | |
| 11493 library, | |
| 11494 r''' | |
| 11495 library meta; | |
| 11496 class A<T> { | |
| 11497 void f(convariant T t) {} | |
| 11498 } | |
| 11499 const checked; | |
| 11500 '''); | |
| 11501 } | |
| 4574 } | 11502 } |
| 4575 | 11503 |
| 4576 void test_parameter_checked_inherited() { | 11504 void test_parameter_checked_inherited() { |
| 4577 // Note: due to dartbug.com/27393, the keyword "checked" is identified by | 11505 // Note: due to dartbug.com/27393, the keyword "checked" is identified by |
| 4578 // its presence in a library called "meta". If that bug is fixed, this test | 11506 // its presence in a library called "meta". If that bug is fixed, this test |
| 4579 // my need to be changed. | 11507 // my need to be changed. |
| 4580 checkLibrary(r''' | 11508 var library = checkLibrary(r''' |
| 4581 library meta; | 11509 library meta; |
| 4582 const checked = null; | 11510 const checked = null; |
| 4583 class A<T> { | 11511 class A<T> { |
| 4584 void f(@checked T t) {} | 11512 void f(@checked T t) {} |
| 4585 } | 11513 } |
| 4586 class B<T> extends A<T> { | 11514 class B<T> extends A<T> { |
| 4587 void f(T t) {} | 11515 void f(T t) {} |
| 4588 } | 11516 } |
| 4589 '''); | 11517 '''); |
| 11518 if (isStrongMode) { | |
| 11519 checkElementText( | |
| 11520 library, | |
| 11521 r''' | |
| 11522 library meta; | |
| 11523 class A<T> { | |
| 11524 void f(convariant T t) {} | |
| 11525 } | |
| 11526 class B<T> extends A<T> { | |
| 11527 void f(convariant T t) {} | |
| 11528 } | |
| 11529 const checked; | |
| 11530 '''); | |
| 11531 } else { | |
| 11532 checkElementText( | |
| 11533 library, | |
| 11534 r''' | |
| 11535 library meta; | |
| 11536 class A<T> { | |
| 11537 void f(convariant T t) {} | |
| 11538 } | |
| 11539 class B<T> extends A<T> { | |
| 11540 void f(T t) {} | |
| 11541 } | |
| 11542 const checked; | |
| 11543 '''); | |
| 11544 } | |
| 4590 } | 11545 } |
| 4591 | 11546 |
| 4592 test_parameter_covariant() { | 11547 test_parameter_covariant() { |
| 4593 prepareAnalysisContext(createOptions()); | 11548 prepareAnalysisContext(createOptions()); |
| 4594 checkLibrary('class C { void m(covariant C c) {} }'); | 11549 var library = checkLibrary('class C { void m(covariant C c) {} }'); |
| 11550 if (isStrongMode) { | |
| 11551 checkElementText( | |
| 11552 library, | |
| 11553 r''' | |
| 11554 class C { | |
| 11555 void m(convariant C c) {} | |
| 11556 } | |
| 11557 '''); | |
| 11558 } else { | |
| 11559 checkElementText( | |
| 11560 library, | |
| 11561 r''' | |
| 11562 class C { | |
| 11563 void m(convariant C c) {} | |
| 11564 } | |
| 11565 '''); | |
| 11566 } | |
| 4595 } | 11567 } |
| 4596 | 11568 |
| 4597 void test_parameter_covariant_inherited() { | 11569 void test_parameter_covariant_inherited() { |
| 4598 checkLibrary(r''' | 11570 var library = checkLibrary(r''' |
| 4599 class A<T> { | 11571 class A<T> { |
| 4600 void f(covariant T t) {} | 11572 void f(covariant T t) {} |
| 4601 } | 11573 } |
| 4602 class B<T> extends A<T> { | 11574 class B<T> extends A<T> { |
| 4603 void f(T t) {} | 11575 void f(T t) {} |
| 4604 } | 11576 } |
| 4605 '''); | 11577 '''); |
| 11578 if (isStrongMode) { | |
| 11579 checkElementText( | |
| 11580 library, | |
| 11581 r''' | |
| 11582 class A<T> { | |
| 11583 void f(convariant T t) {} | |
| 11584 } | |
| 11585 class B<T> extends A<T> { | |
| 11586 void f(convariant T t) {} | |
| 11587 } | |
| 11588 '''); | |
| 11589 } else { | |
| 11590 checkElementText( | |
| 11591 library, | |
| 11592 r''' | |
| 11593 class A<T> { | |
| 11594 void f(convariant T t) {} | |
| 11595 } | |
| 11596 class B<T> extends A<T> { | |
| 11597 void f(T t) {} | |
| 11598 } | |
| 11599 '''); | |
| 11600 } | |
| 4606 } | 11601 } |
| 4607 | 11602 |
| 4608 test_parameter_parameters() { | 11603 test_parameter_parameters() { |
| 4609 checkLibrary('class C { f(g(x, y)) {} }'); | 11604 var library = checkLibrary('class C { f(g(x, y)) {} }'); |
| 11605 if (isStrongMode) { | |
| 11606 checkElementText( | |
| 11607 library, | |
| 11608 r''' | |
| 11609 class C { | |
| 11610 f((dynamic, dynamic) → dynamic g) {} | |
| 11611 } | |
| 11612 '''); | |
| 11613 } else { | |
| 11614 checkElementText( | |
| 11615 library, | |
| 11616 r''' | |
| 11617 class C { | |
| 11618 f((dynamic, dynamic) → dynamic g) {} | |
| 11619 } | |
| 11620 '''); | |
| 11621 } | |
| 4610 } | 11622 } |
| 4611 | 11623 |
| 4612 test_parameter_parameters_in_generic_class() { | 11624 test_parameter_parameters_in_generic_class() { |
| 4613 checkLibrary('class C<A, B> { f(A g(B x)) {} }'); | 11625 var library = checkLibrary('class C<A, B> { f(A g(B x)) {} }'); |
| 11626 if (isStrongMode) { | |
| 11627 checkElementText( | |
| 11628 library, | |
| 11629 r''' | |
| 11630 class C<A, B> { | |
| 11631 f((B) → A g) {} | |
| 11632 } | |
| 11633 '''); | |
| 11634 } else { | |
| 11635 checkElementText( | |
| 11636 library, | |
| 11637 r''' | |
| 11638 class C<A, B> { | |
| 11639 f((B) → A g) {} | |
| 11640 } | |
| 11641 '''); | |
| 11642 } | |
| 4614 } | 11643 } |
| 4615 | 11644 |
| 4616 test_parameter_return_type() { | 11645 test_parameter_return_type() { |
| 4617 checkLibrary('class C { f(int g()) {} }'); | 11646 var library = checkLibrary('class C { f(int g()) {} }'); |
| 11647 if (isStrongMode) { | |
| 11648 checkElementText( | |
| 11649 library, | |
| 11650 r''' | |
| 11651 class C { | |
| 11652 f(() → int g) {} | |
| 11653 } | |
| 11654 '''); | |
| 11655 } else { | |
| 11656 checkElementText( | |
| 11657 library, | |
| 11658 r''' | |
| 11659 class C { | |
| 11660 f(() → int g) {} | |
| 11661 } | |
| 11662 '''); | |
| 11663 } | |
| 4618 } | 11664 } |
| 4619 | 11665 |
| 4620 test_parameter_return_type_void() { | 11666 test_parameter_return_type_void() { |
| 4621 checkLibrary('class C { f(void g()) {} }'); | 11667 var library = checkLibrary('class C { f(void g()) {} }'); |
| 11668 if (isStrongMode) { | |
| 11669 checkElementText( | |
| 11670 library, | |
| 11671 r''' | |
| 11672 class C { | |
| 11673 f(() → void g) {} | |
| 11674 } | |
| 11675 '''); | |
| 11676 } else { | |
| 11677 checkElementText( | |
| 11678 library, | |
| 11679 r''' | |
| 11680 class C { | |
| 11681 f(() → void g) {} | |
| 11682 } | |
| 11683 '''); | |
| 11684 } | |
| 4622 } | 11685 } |
| 4623 | 11686 |
| 4624 test_parameterTypeNotInferred_constructor() { | 11687 test_parameterTypeNotInferred_constructor() { |
| 4625 // Strong mode doesn't do type inference on constructor parameters, so it's | 11688 // Strong mode doesn't do type inference on constructor parameters, so it's |
| 4626 // ok that we don't store inferred type info for them in summaries. | 11689 // ok that we don't store inferred type info for them in summaries. |
| 4627 checkLibrary(''' | 11690 var library = checkLibrary(''' |
| 4628 class C { | 11691 class C { |
| 4629 C.positional([x = 1]); | 11692 C.positional([x = 1]); |
| 4630 C.named({x: 1}); | 11693 C.named({x: 1}); |
| 4631 } | 11694 } |
| 4632 '''); | 11695 '''); |
| 11696 if (isStrongMode) { | |
| 11697 checkElementText( | |
| 11698 library, | |
| 11699 r''' | |
| 11700 class C { | |
| 11701 C.positional([x]); | |
| 11702 C.named({x}); | |
| 11703 } | |
| 11704 '''); | |
| 11705 } else { | |
| 11706 checkElementText( | |
| 11707 library, | |
| 11708 r''' | |
| 11709 class C { | |
| 11710 C.positional([x]); | |
| 11711 C.named({x}); | |
| 11712 } | |
| 11713 '''); | |
| 11714 } | |
| 4633 } | 11715 } |
| 4634 | 11716 |
| 4635 test_parameterTypeNotInferred_initializingFormal() { | 11717 test_parameterTypeNotInferred_initializingFormal() { |
| 4636 // Strong mode doesn't do type inference on initializing formals, so it's | 11718 // Strong mode doesn't do type inference on initializing formals, so it's |
| 4637 // ok that we don't store inferred type info for them in summaries. | 11719 // ok that we don't store inferred type info for them in summaries. |
| 4638 checkLibrary(''' | 11720 var library = checkLibrary(''' |
| 4639 class C { | 11721 class C { |
| 4640 var x; | 11722 var x; |
| 4641 C.positional([this.x = 1]); | 11723 C.positional([this.x = 1]); |
| 4642 C.named({this.x: 1}); | 11724 C.named({this.x: 1}); |
| 4643 } | 11725 } |
| 4644 '''); | 11726 '''); |
| 11727 if (isStrongMode) { | |
| 11728 checkElementText( | |
| 11729 library, | |
| 11730 r''' | |
| 11731 class C { | |
| 11732 var x; | |
| 11733 C.positional([this.x]); | |
| 11734 C.named({this.x}); | |
| 11735 } | |
| 11736 '''); | |
| 11737 } else { | |
| 11738 checkElementText( | |
| 11739 library, | |
| 11740 r''' | |
| 11741 class C { | |
| 11742 var x; | |
| 11743 C.positional([this.x]); | |
| 11744 C.named({this.x}); | |
| 11745 } | |
| 11746 '''); | |
| 11747 } | |
| 4645 } | 11748 } |
| 4646 | 11749 |
| 4647 test_parameterTypeNotInferred_staticMethod() { | 11750 test_parameterTypeNotInferred_staticMethod() { |
| 4648 // Strong mode doesn't do type inference on parameters of static methods, | 11751 // Strong mode doesn't do type inference on parameters of static methods, |
| 4649 // so it's ok that we don't store inferred type info for them in summaries. | 11752 // so it's ok that we don't store inferred type info for them in summaries. |
| 4650 checkLibrary(''' | 11753 var library = checkLibrary(''' |
| 4651 class C { | 11754 class C { |
| 4652 static void positional([x = 1]) {} | 11755 static void positional([x = 1]) {} |
| 4653 static void named({x: 1}) {} | 11756 static void named({x: 1}) {} |
| 4654 } | 11757 } |
| 4655 '''); | 11758 '''); |
| 11759 if (isStrongMode) { | |
| 11760 checkElementText( | |
| 11761 library, | |
| 11762 r''' | |
| 11763 class C { | |
| 11764 static void positional([x]) {} | |
| 11765 static void named({x}) {} | |
| 11766 } | |
| 11767 '''); | |
| 11768 } else { | |
| 11769 checkElementText( | |
| 11770 library, | |
| 11771 r''' | |
| 11772 class C { | |
| 11773 static void positional([x]) {} | |
| 11774 static void named({x}) {} | |
| 11775 } | |
| 11776 '''); | |
| 11777 } | |
| 4656 } | 11778 } |
| 4657 | 11779 |
| 4658 test_parameterTypeNotInferred_topLevelFunction() { | 11780 test_parameterTypeNotInferred_topLevelFunction() { |
| 4659 // Strong mode doesn't do type inference on parameters of top level | 11781 // Strong mode doesn't do type inference on parameters of top level |
| 4660 // functions, so it's ok that we don't store inferred type info for them in | 11782 // functions, so it's ok that we don't store inferred type info for them in |
| 4661 // summaries. | 11783 // summaries. |
| 4662 checkLibrary(''' | 11784 var library = checkLibrary(''' |
| 4663 void positional([x = 1]) {} | 11785 void positional([x = 1]) {} |
| 4664 void named({x: 1}) {} | 11786 void named({x: 1}) {} |
| 4665 '''); | 11787 '''); |
| 11788 if (isStrongMode) { | |
| 11789 checkElementText( | |
| 11790 library, | |
| 11791 r''' | |
| 11792 void positional([x]) {} | |
| 11793 void named({x}) {} | |
| 11794 '''); | |
| 11795 } else { | |
| 11796 checkElementText( | |
| 11797 library, | |
| 11798 r''' | |
| 11799 void positional([x]) {} | |
| 11800 void named({x}) {} | |
| 11801 '''); | |
| 11802 } | |
| 4666 } | 11803 } |
| 4667 | 11804 |
| 4668 test_parts() { | 11805 test_parts() { |
| 4669 addSource('/a.dart', 'part of my.lib;'); | 11806 addSource('/a.dart', 'part of my.lib;'); |
| 4670 addSource('/b.dart', 'part of my.lib;'); | 11807 addSource('/b.dart', 'part of my.lib;'); |
| 4671 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); | 11808 var library = checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); |
| 11809 if (isStrongMode) { | |
| 11810 checkElementText( | |
| 11811 library, | |
| 11812 r''' | |
| 11813 library my.lib; | |
| 11814 part 'a.dart'; | |
| 11815 part 'b.dart'; | |
| 11816 -------------------- | |
| 11817 unit: a.dart | |
| 11818 | |
| 11819 -------------------- | |
| 11820 unit: b.dart | |
| 11821 | |
| 11822 '''); | |
| 11823 } else { | |
| 11824 checkElementText( | |
| 11825 library, | |
| 11826 r''' | |
| 11827 library my.lib; | |
| 11828 part 'a.dart'; | |
| 11829 part 'b.dart'; | |
| 11830 -------------------- | |
| 11831 unit: a.dart | |
| 11832 | |
| 11833 -------------------- | |
| 11834 unit: b.dart | |
| 11835 | |
| 11836 '''); | |
| 11837 } | |
| 4672 } | 11838 } |
| 4673 | 11839 |
| 4674 test_parts_invalidUri() { | 11840 test_parts_invalidUri() { |
| 4675 allowMissingFiles = true; | 11841 allowMissingFiles = true; |
| 4676 addSource('/foo/bar.dart', 'part of my.lib;'); | 11842 addSource('/foo/bar.dart', 'part of my.lib;'); |
| 4677 checkLibrary('library my.lib; part "foo/";'); | 11843 var library = checkLibrary('library my.lib; part "foo/";'); |
| 11844 if (isStrongMode) { | |
| 11845 checkElementText( | |
| 11846 library, | |
| 11847 r''' | |
| 11848 library my.lib; | |
| 11849 '''); | |
| 11850 } else { | |
| 11851 checkElementText( | |
| 11852 library, | |
| 11853 r''' | |
| 11854 library my.lib; | |
| 11855 '''); | |
| 11856 } | |
| 4678 } | 11857 } |
| 4679 | 11858 |
| 4680 test_parts_invalidUri_nullStringValue() { | 11859 test_parts_invalidUri_nullStringValue() { |
| 4681 allowMissingFiles = true; | 11860 allowMissingFiles = true; |
| 4682 addSource('/foo/bar.dart', 'part of my.lib;'); | 11861 addSource('/foo/bar.dart', 'part of my.lib;'); |
| 4683 checkLibrary(r''' | 11862 var library = checkLibrary(r''' |
| 4684 library my.lib; | 11863 library my.lib; |
| 4685 part "${foo}/bar.dart"; | 11864 part "${foo}/bar.dart"; |
| 4686 '''); | 11865 '''); |
| 11866 if (isStrongMode) { | |
| 11867 checkElementText( | |
| 11868 library, | |
| 11869 r''' | |
| 11870 library my.lib; | |
| 11871 '''); | |
| 11872 } else { | |
| 11873 checkElementText( | |
| 11874 library, | |
| 11875 r''' | |
| 11876 library my.lib; | |
| 11877 '''); | |
| 11878 } | |
| 4687 } | 11879 } |
| 4688 | 11880 |
| 4689 test_propagated_type_refers_to_closure() { | 11881 test_propagated_type_refers_to_closure() { |
| 4690 checkLibrary(''' | 11882 var library = checkLibrary(''' |
| 4691 void f() { | 11883 void f() { |
| 4692 var x = () => 0; | 11884 var x = () => 0; |
| 4693 var y = x; | 11885 var y = x; |
| 4694 } | 11886 } |
| 4695 '''); | 11887 '''); |
| 11888 if (isStrongMode) { | |
| 11889 checkElementText( | |
| 11890 library, | |
| 11891 r''' | |
| 11892 void f() {} | |
| 11893 '''); | |
| 11894 } else { | |
| 11895 checkElementText( | |
| 11896 library, | |
| 11897 r''' | |
| 11898 void f() {} | |
| 11899 '''); | |
| 11900 } | |
| 4696 } | 11901 } |
| 4697 | 11902 |
| 4698 test_setter_covariant() { | 11903 test_setter_covariant() { |
| 4699 checkLibrary('class C { void set x(covariant int value); }'); | 11904 var library = checkLibrary('class C { void set x(covariant int value); }'); |
| 11905 if (isStrongMode) { | |
| 11906 checkElementText( | |
| 11907 library, | |
| 11908 r''' | |
| 11909 class C { | |
| 11910 void set x(convariant int value); | |
| 11911 } | |
| 11912 '''); | |
| 11913 } else { | |
| 11914 checkElementText( | |
| 11915 library, | |
| 11916 r''' | |
| 11917 class C { | |
| 11918 void set x(convariant int value); | |
| 11919 } | |
| 11920 '''); | |
| 11921 } | |
| 4700 } | 11922 } |
| 4701 | 11923 |
| 4702 test_setter_documented() { | 11924 test_setter_documented() { |
| 4703 checkLibrary(''' | 11925 var library = checkLibrary(''' |
| 4704 // Extra comment so doc comment offset != 0 | 11926 // Extra comment so doc comment offset != 0 |
| 4705 /** | 11927 /** |
| 4706 * Docs | 11928 * Docs |
| 4707 */ | 11929 */ |
| 4708 void set x(value) {}'''); | 11930 void set x(value) {}'''); |
| 11931 if (isStrongMode) { | |
| 11932 checkElementText( | |
| 11933 library, | |
| 11934 r''' | |
| 11935 void set x(value) {} | |
| 11936 '''); | |
| 11937 } else { | |
| 11938 checkElementText( | |
| 11939 library, | |
| 11940 r''' | |
| 11941 void set x(value) {} | |
| 11942 '''); | |
| 11943 } | |
| 4709 } | 11944 } |
| 4710 | 11945 |
| 4711 test_setter_external() { | 11946 test_setter_external() { |
| 4712 checkLibrary('external void set x(int value);'); | 11947 var library = checkLibrary('external void set x(int value);'); |
| 11948 if (isStrongMode) { | |
| 11949 checkElementText( | |
| 11950 library, | |
| 11951 r''' | |
| 11952 external void set x(int value) {} | |
| 11953 '''); | |
| 11954 } else { | |
| 11955 checkElementText( | |
| 11956 library, | |
| 11957 r''' | |
| 11958 external void set x(int value) {} | |
| 11959 '''); | |
| 11960 } | |
| 4713 } | 11961 } |
| 4714 | 11962 |
| 4715 test_setter_inferred_type_nonStatic_implicit_param() { | 11963 test_setter_inferred_type_nonStatic_implicit_param() { |
| 4716 checkLibrary('class C extends D { void set f(value) {} }' | 11964 var library = checkLibrary('class C extends D { void set f(value) {} }' |
| 4717 ' abstract class D { void set f(int value); }'); | 11965 ' abstract class D { void set f(int value); }'); |
| 11966 if (isStrongMode) { | |
| 11967 checkElementText( | |
| 11968 library, | |
| 11969 r''' | |
| 11970 class C extends D { | |
| 11971 void set f(int value) {} | |
| 11972 } | |
| 11973 abstract class D { | |
| 11974 void set f(int value); | |
| 11975 } | |
| 11976 '''); | |
| 11977 } else { | |
| 11978 checkElementText( | |
| 11979 library, | |
| 11980 r''' | |
| 11981 class C extends D { | |
| 11982 void set f(value) {} | |
| 11983 } | |
| 11984 abstract class D { | |
| 11985 void set f(int value); | |
| 11986 } | |
| 11987 '''); | |
| 11988 } | |
| 4718 } | 11989 } |
| 4719 | 11990 |
| 4720 test_setter_inferred_type_static_implicit_return() { | 11991 test_setter_inferred_type_static_implicit_return() { |
| 4721 checkLibrary('class C { static set f(int value) {} }'); | 11992 var library = checkLibrary('class C { static set f(int value) {} }'); |
| 11993 if (isStrongMode) { | |
| 11994 checkElementText( | |
| 11995 library, | |
| 11996 r''' | |
| 11997 class C { | |
| 11998 static void set f(int value) {} | |
| 11999 } | |
| 12000 '''); | |
| 12001 } else { | |
| 12002 checkElementText( | |
| 12003 library, | |
| 12004 r''' | |
| 12005 class C { | |
| 12006 static set f(int value) {} | |
| 12007 } | |
| 12008 '''); | |
| 12009 } | |
| 4722 } | 12010 } |
| 4723 | 12011 |
| 4724 test_setter_inferred_type_top_level_implicit_return() { | 12012 test_setter_inferred_type_top_level_implicit_return() { |
| 4725 checkLibrary('set f(int value) {}'); | 12013 var library = checkLibrary('set f(int value) {}'); |
| 12014 if (isStrongMode) { | |
| 12015 checkElementText( | |
| 12016 library, | |
| 12017 r''' | |
| 12018 void set f(int value) {} | |
| 12019 '''); | |
| 12020 } else { | |
| 12021 checkElementText( | |
| 12022 library, | |
| 12023 r''' | |
| 12024 set f(int value) {} | |
| 12025 '''); | |
| 12026 } | |
| 4726 } | 12027 } |
| 4727 | 12028 |
| 4728 test_setters() { | 12029 test_setters() { |
| 4729 checkLibrary('void set x(int value) {} set y(value) {}'); | 12030 var library = checkLibrary('void set x(int value) {} set y(value) {}'); |
| 12031 if (isStrongMode) { | |
| 12032 checkElementText( | |
| 12033 library, | |
| 12034 r''' | |
| 12035 void set x(int value) {} | |
| 12036 void set y(value) {} | |
| 12037 '''); | |
| 12038 } else { | |
| 12039 checkElementText( | |
| 12040 library, | |
| 12041 r''' | |
| 12042 void set x(int value) {} | |
| 12043 set y(value) {} | |
| 12044 '''); | |
| 12045 } | |
| 4730 } | 12046 } |
| 4731 | 12047 |
| 4732 test_syntheticFunctionType_genericClosure() { | 12048 test_syntheticFunctionType_genericClosure() { |
| 4733 if (!createOptions().strongMode) { | 12049 if (!createOptions().strongMode) { |
| 4734 // The test below uses generic comment syntax because proper generic | 12050 // The test below uses generic comment syntax because proper generic |
| 4735 // method syntax doesn't support generic closures. So it can only run in | 12051 // method syntax doesn't support generic closures. So it can only run in |
| 4736 // strong mode. | 12052 // strong mode. |
| 4737 // TODO(paulberry): once proper generic method syntax supports generic | 12053 // TODO(paulberry): once proper generic method syntax supports generic |
| 4738 // closures, rewrite the test below without using generic comment syntax, | 12054 // closures, rewrite the test below without using generic comment syntax, |
| 4739 // and remove this hack. See dartbug.com/25819 | 12055 // and remove this hack. See dartbug.com/25819 |
| 4740 return; | 12056 return; |
| 4741 } | 12057 } |
| 4742 checkLibrary(''' | 12058 var library = checkLibrary(''' |
| 4743 final v = f() ? /*<T>*/(T t) => 0 : /*<T>*/(T t) => 1; | 12059 final v = f() ? /*<T>*/(T t) => 0 : /*<T>*/(T t) => 1; |
| 4744 bool f() => true; | 12060 bool f() => true; |
| 4745 '''); | 12061 '''); |
| 12062 if (isStrongMode) { | |
| 12063 checkElementText( | |
| 12064 library, | |
| 12065 r''' | |
| 12066 '''); | |
| 12067 } else { | |
| 12068 checkElementText( | |
| 12069 library, | |
| 12070 r''' | |
| 12071 '''); | |
| 12072 } | |
| 4746 } | 12073 } |
| 4747 | 12074 |
| 4748 test_syntheticFunctionType_genericClosure_inGenericFunction() { | 12075 test_syntheticFunctionType_genericClosure_inGenericFunction() { |
| 4749 if (!createOptions().strongMode) { | 12076 if (!createOptions().strongMode) { |
| 4750 // The test below uses generic comment syntax because proper generic | 12077 // The test below uses generic comment syntax because proper generic |
| 4751 // method syntax doesn't support generic closures. So it can only run in | 12078 // method syntax doesn't support generic closures. So it can only run in |
| 4752 // strong mode. | 12079 // strong mode. |
| 4753 // TODO(paulberry): once proper generic method syntax supports generic | 12080 // TODO(paulberry): once proper generic method syntax supports generic |
| 4754 // closures, rewrite the test below without using generic comment syntax, | 12081 // closures, rewrite the test below without using generic comment syntax, |
| 4755 // and remove this hack. See dartbug.com/25819 | 12082 // and remove this hack. See dartbug.com/25819 |
| 4756 return; | 12083 return; |
| 4757 } | 12084 } |
| 4758 checkLibrary(''' | 12085 var library = checkLibrary(''' |
| 4759 void f<T, U>(bool b) { | 12086 void f<T, U>(bool b) { |
| 4760 final v = b ? /*<V>*/(T t, U u, V v) => 0 : /*<V>*/(T t, U u, V v) => 1; | 12087 final v = b ? /*<V>*/(T t, U u, V v) => 0 : /*<V>*/(T t, U u, V v) => 1; |
| 4761 } | 12088 } |
| 4762 '''); | 12089 '''); |
| 12090 if (isStrongMode) { | |
| 12091 checkElementText( | |
| 12092 library, | |
| 12093 r''' | |
| 12094 void f<T, U>(bool b) {} | |
| 12095 '''); | |
| 12096 } else { | |
| 12097 checkElementText( | |
| 12098 library, | |
| 12099 r''' | |
| 12100 '''); | |
| 12101 } | |
| 4763 } | 12102 } |
| 4764 | 12103 |
| 4765 test_syntheticFunctionType_inGenericClass() { | 12104 test_syntheticFunctionType_inGenericClass() { |
| 4766 checkLibrary(''' | 12105 var library = checkLibrary(''' |
| 4767 class C<T, U> { | 12106 class C<T, U> { |
| 4768 var v = f() ? (T t, U u) => 0 : (T t, U u) => 1; | 12107 var v = f() ? (T t, U u) => 0 : (T t, U u) => 1; |
| 4769 } | 12108 } |
| 4770 bool f() => false; | 12109 bool f() => false; |
| 4771 '''); | 12110 '''); |
| 12111 if (isStrongMode) { | |
| 12112 checkElementText( | |
| 12113 library, | |
| 12114 r''' | |
| 12115 class C { | |
| 12116 synthetic C(); | |
| 12117 } | |
| 12118 '''); | |
| 12119 } else { | |
| 12120 checkElementText( | |
| 12121 library, | |
| 12122 r''' | |
| 12123 class C<T, U> { | |
| 12124 var v; | |
| 12125 } | |
| 12126 bool f() {} | |
| 12127 '''); | |
| 12128 } | |
| 4772 } | 12129 } |
| 4773 | 12130 |
| 4774 test_syntheticFunctionType_inGenericFunction() { | 12131 test_syntheticFunctionType_inGenericFunction() { |
| 4775 checkLibrary(''' | 12132 var library = checkLibrary(''' |
| 4776 void f<T, U>(bool b) { | 12133 void f<T, U>(bool b) { |
| 4777 var v = b ? (T t, U u) => 0 : (T t, U u) => 1; | 12134 var v = b ? (T t, U u) => 0 : (T t, U u) => 1; |
| 4778 } | 12135 } |
| 4779 '''); | 12136 '''); |
| 12137 if (isStrongMode) { | |
| 12138 checkElementText( | |
| 12139 library, | |
| 12140 r''' | |
| 12141 void f<T, U>(bool b) {} | |
| 12142 '''); | |
| 12143 } else { | |
| 12144 checkElementText( | |
| 12145 library, | |
| 12146 r''' | |
| 12147 void f<T, U>(bool b) {} | |
| 12148 '''); | |
| 12149 } | |
| 4780 } | 12150 } |
| 4781 | 12151 |
| 4782 test_syntheticFunctionType_noArguments() { | 12152 test_syntheticFunctionType_noArguments() { |
| 4783 checkLibrary(''' | 12153 var library = checkLibrary(''' |
| 4784 final v = f() ? () => 0 : () => 1; | 12154 final v = f() ? () => 0 : () => 1; |
| 4785 bool f() => true; | 12155 bool f() => true; |
| 4786 '''); | 12156 '''); |
| 12157 if (isStrongMode) { | |
| 12158 checkElementText( | |
| 12159 library, | |
| 12160 r''' | |
| 12161 '''); | |
| 12162 } else { | |
| 12163 checkElementText( | |
| 12164 library, | |
| 12165 r''' | |
| 12166 final v; | |
| 12167 bool f() {} | |
| 12168 '''); | |
| 12169 } | |
| 4787 } | 12170 } |
| 4788 | 12171 |
| 4789 test_syntheticFunctionType_withArguments() { | 12172 test_syntheticFunctionType_withArguments() { |
| 4790 checkLibrary(''' | 12173 var library = checkLibrary(''' |
| 4791 final v = f() ? (int x, String y) => 0 : (int x, String y) => 1; | 12174 final v = f() ? (int x, String y) => 0 : (int x, String y) => 1; |
| 4792 bool f() => true; | 12175 bool f() => true; |
| 4793 '''); | 12176 '''); |
| 12177 if (isStrongMode) { | |
| 12178 checkElementText( | |
| 12179 library, | |
| 12180 r''' | |
| 12181 '''); | |
| 12182 } else { | |
| 12183 checkElementText( | |
| 12184 library, | |
| 12185 r''' | |
| 12186 final v; | |
| 12187 bool f() {} | |
| 12188 '''); | |
| 12189 } | |
| 4794 } | 12190 } |
| 4795 | 12191 |
| 4796 test_type_arguments_explicit_dynamic_dynamic() { | 12192 test_type_arguments_explicit_dynamic_dynamic() { |
| 4797 checkLibrary('Map<dynamic, dynamic> m;'); | 12193 var library = checkLibrary('Map<dynamic, dynamic> m;'); |
| 12194 if (isStrongMode) { | |
| 12195 checkElementText( | |
| 12196 library, | |
| 12197 r''' | |
| 12198 Map m; | |
| 12199 '''); | |
| 12200 } else { | |
| 12201 checkElementText( | |
| 12202 library, | |
| 12203 r''' | |
| 12204 Map m; | |
| 12205 '''); | |
| 12206 } | |
| 4798 } | 12207 } |
| 4799 | 12208 |
| 4800 test_type_arguments_explicit_dynamic_int() { | 12209 test_type_arguments_explicit_dynamic_int() { |
| 4801 checkLibrary('Map<dynamic, int> m;'); | 12210 var library = checkLibrary('Map<dynamic, int> m;'); |
| 12211 if (isStrongMode) { | |
| 12212 checkElementText( | |
| 12213 library, | |
| 12214 r''' | |
| 12215 Map<dynamic, int> m; | |
| 12216 '''); | |
| 12217 } else { | |
| 12218 checkElementText( | |
| 12219 library, | |
| 12220 r''' | |
| 12221 Map<dynamic, int> m; | |
| 12222 '''); | |
| 12223 } | |
| 4802 } | 12224 } |
| 4803 | 12225 |
| 4804 test_type_arguments_explicit_String_dynamic() { | 12226 test_type_arguments_explicit_String_dynamic() { |
| 4805 checkLibrary('Map<String, dynamic> m;'); | 12227 var library = checkLibrary('Map<String, dynamic> m;'); |
| 12228 if (isStrongMode) { | |
| 12229 checkElementText( | |
| 12230 library, | |
| 12231 r''' | |
| 12232 Map<String, dynamic> m; | |
| 12233 '''); | |
| 12234 } else { | |
| 12235 checkElementText( | |
| 12236 library, | |
| 12237 r''' | |
| 12238 Map<String, dynamic> m; | |
| 12239 '''); | |
| 12240 } | |
| 4806 } | 12241 } |
| 4807 | 12242 |
| 4808 test_type_arguments_explicit_String_int() { | 12243 test_type_arguments_explicit_String_int() { |
| 4809 checkLibrary('Map<String, int> m;'); | 12244 var library = checkLibrary('Map<String, int> m;'); |
| 12245 if (isStrongMode) { | |
| 12246 checkElementText( | |
| 12247 library, | |
| 12248 r''' | |
| 12249 Map<String, int> m; | |
| 12250 '''); | |
| 12251 } else { | |
| 12252 checkElementText( | |
| 12253 library, | |
| 12254 r''' | |
| 12255 Map<String, int> m; | |
| 12256 '''); | |
| 12257 } | |
| 4810 } | 12258 } |
| 4811 | 12259 |
| 4812 test_type_arguments_implicit() { | 12260 test_type_arguments_implicit() { |
| 4813 checkLibrary('Map m;'); | 12261 var library = checkLibrary('Map m;'); |
| 12262 if (isStrongMode) { | |
| 12263 checkElementText( | |
| 12264 library, | |
| 12265 r''' | |
| 12266 Map m; | |
| 12267 '''); | |
| 12268 } else { | |
| 12269 checkElementText( | |
| 12270 library, | |
| 12271 r''' | |
| 12272 Map m; | |
| 12273 '''); | |
| 12274 } | |
| 4814 } | 12275 } |
| 4815 | 12276 |
| 4816 test_type_dynamic() { | 12277 test_type_dynamic() { |
| 4817 checkLibrary('dynamic d;'); | 12278 var library = checkLibrary('dynamic d;'); |
| 12279 if (isStrongMode) { | |
| 12280 checkElementText( | |
| 12281 library, | |
| 12282 r''' | |
| 12283 var d; | |
| 12284 '''); | |
| 12285 } else { | |
| 12286 checkElementText( | |
| 12287 library, | |
| 12288 r''' | |
| 12289 var d; | |
| 12290 '''); | |
| 12291 } | |
| 4818 } | 12292 } |
| 4819 | 12293 |
| 4820 test_type_invalid_topLevelVariableElement_asType() { | 12294 test_type_invalid_topLevelVariableElement_asType() { |
| 4821 checkLibrary( | 12295 var library = checkLibrary( |
| 4822 ''' | 12296 ''' |
| 4823 class C<T extends V> {} | 12297 class C<T extends V> {} |
| 4824 typedef V F(V p); | 12298 typedef V F(V p); |
| 4825 V f(V p) {} | 12299 V f(V p) {} |
| 4826 V V2 = null; | 12300 V V2 = null; |
| 4827 int V = 0; | 12301 int V = 0; |
| 4828 ''', | 12302 ''', |
| 4829 allowErrors: true); | 12303 allowErrors: true); |
| 12304 if (isStrongMode) { | |
| 12305 checkElementText( | |
| 12306 library, | |
| 12307 r''' | |
| 12308 typedef F(p); | |
| 12309 class C<T extends dynamic> { | |
| 12310 } | |
| 12311 var V2; | |
| 12312 int V; | |
| 12313 f(p) {} | |
| 12314 '''); | |
| 12315 } else { | |
| 12316 checkElementText( | |
| 12317 library, | |
| 12318 r''' | |
| 12319 typedef F(p); | |
| 12320 class C<T extends dynamic> { | |
| 12321 } | |
| 12322 var V2; | |
| 12323 int V; | |
| 12324 f(p) {} | |
| 12325 '''); | |
| 12326 } | |
| 4830 } | 12327 } |
| 4831 | 12328 |
| 4832 test_type_invalid_topLevelVariableElement_asTypeArgument() { | 12329 test_type_invalid_topLevelVariableElement_asTypeArgument() { |
| 4833 checkLibrary( | 12330 var library = checkLibrary( |
| 4834 ''' | 12331 ''' |
| 4835 var V; | 12332 var V; |
| 4836 static List<V> V2; | 12333 static List<V> V2; |
| 4837 ''', | 12334 ''', |
| 4838 allowErrors: true); | 12335 allowErrors: true); |
| 12336 if (isStrongMode) { | |
| 12337 checkElementText( | |
| 12338 library, | |
| 12339 r''' | |
| 12340 var V; | |
| 12341 List V2; | |
| 12342 '''); | |
| 12343 } else { | |
| 12344 checkElementText( | |
| 12345 library, | |
| 12346 r''' | |
| 12347 var V; | |
| 12348 List V2; | |
| 12349 '''); | |
| 12350 } | |
| 4839 } | 12351 } |
| 4840 | 12352 |
| 4841 test_type_invalid_typeParameter_asPrefix() { | 12353 test_type_invalid_typeParameter_asPrefix() { |
| 4842 checkLibrary( | 12354 var library = checkLibrary( |
| 4843 ''' | 12355 ''' |
| 4844 class C<T> { | 12356 class C<T> { |
| 4845 m(T.K p) {} | 12357 m(T.K p) {} |
| 4846 } | 12358 } |
| 4847 ''', | 12359 ''', |
| 4848 allowErrors: true); | 12360 allowErrors: true); |
| 12361 if (isStrongMode) { | |
| 12362 checkElementText( | |
| 12363 library, | |
| 12364 r''' | |
| 12365 class C<T> { | |
| 12366 m(p) {} | |
| 12367 } | |
| 12368 '''); | |
| 12369 } else { | |
| 12370 checkElementText( | |
| 12371 library, | |
| 12372 r''' | |
| 12373 class C<T> { | |
| 12374 m(p) {} | |
| 12375 } | |
| 12376 '''); | |
| 12377 } | |
| 4849 } | 12378 } |
| 4850 | 12379 |
| 4851 test_type_reference_lib_to_lib() { | 12380 test_type_reference_lib_to_lib() { |
| 4852 checkLibrary('class C {} enum E { v } typedef F(); C c; E e; F f;'); | 12381 var library = |
| 12382 checkLibrary('class C {} enum E { v } typedef F(); C c; E e; F f;'); | |
| 12383 if (isStrongMode) { | |
| 12384 checkElementText( | |
| 12385 library, | |
| 12386 r''' | |
| 12387 typedef F(); | |
| 12388 enum E { v } | |
| 12389 class C { | |
| 12390 } | |
| 12391 C c; | |
| 12392 E e; | |
| 12393 F f; | |
| 12394 '''); | |
| 12395 } else { | |
| 12396 checkElementText( | |
| 12397 library, | |
| 12398 r''' | |
| 12399 typedef F(); | |
| 12400 enum E { v } | |
| 12401 class C { | |
| 12402 } | |
| 12403 C c; | |
| 12404 E e; | |
| 12405 F f; | |
| 12406 '''); | |
| 12407 } | |
| 4853 } | 12408 } |
| 4854 | 12409 |
| 4855 test_type_reference_lib_to_part() { | 12410 test_type_reference_lib_to_part() { |
| 4856 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); | 12411 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 4857 checkLibrary('library l; part "a.dart"; C c; E e; F f;'); | 12412 var library = checkLibrary('library l; part "a.dart"; C c; E e; F f;'); |
| 12413 if (isStrongMode) { | |
| 12414 checkElementText( | |
| 12415 library, | |
| 12416 r''' | |
| 12417 library l; | |
| 12418 part 'a.dart'; | |
| 12419 C c; | |
| 12420 E e; | |
| 12421 F f; | |
| 12422 -------------------- | |
| 12423 unit: a.dart | |
| 12424 | |
| 12425 typedef F(); | |
| 12426 enum E { v } | |
| 12427 class C { | |
| 12428 } | |
| 12429 '''); | |
| 12430 } else { | |
| 12431 checkElementText( | |
| 12432 library, | |
| 12433 r''' | |
| 12434 library l; | |
| 12435 part 'a.dart'; | |
| 12436 C c; | |
| 12437 E e; | |
| 12438 F f; | |
| 12439 -------------------- | |
| 12440 unit: a.dart | |
| 12441 | |
| 12442 typedef F(); | |
| 12443 enum E { v } | |
| 12444 class C { | |
| 12445 } | |
| 12446 '''); | |
| 12447 } | |
| 4858 } | 12448 } |
| 4859 | 12449 |
| 4860 test_type_reference_part_to_lib() { | 12450 test_type_reference_part_to_lib() { |
| 4861 addSource('/a.dart', 'part of l; C c; E e; F f;'); | 12451 addSource('/a.dart', 'part of l; C c; E e; F f;'); |
| 4862 checkLibrary( | 12452 var library = checkLibrary( |
| 4863 'library l; part "a.dart"; class C {} enum E { v } typedef F();'); | 12453 'library l; part "a.dart"; class C {} enum E { v } typedef F();'); |
| 12454 if (isStrongMode) { | |
| 12455 checkElementText( | |
| 12456 library, | |
| 12457 r''' | |
| 12458 library l; | |
| 12459 part 'a.dart'; | |
| 12460 typedef F(); | |
| 12461 enum E { v } | |
| 12462 class C { | |
| 12463 } | |
| 12464 -------------------- | |
| 12465 unit: a.dart | |
| 12466 | |
| 12467 C c; | |
| 12468 E e; | |
| 12469 F f; | |
| 12470 '''); | |
| 12471 } else { | |
| 12472 checkElementText( | |
| 12473 library, | |
| 12474 r''' | |
| 12475 library l; | |
| 12476 part 'a.dart'; | |
| 12477 typedef F(); | |
| 12478 enum E { v } | |
| 12479 class C { | |
| 12480 } | |
| 12481 -------------------- | |
| 12482 unit: a.dart | |
| 12483 | |
| 12484 C c; | |
| 12485 E e; | |
| 12486 F f; | |
| 12487 '''); | |
| 12488 } | |
| 4864 } | 12489 } |
| 4865 | 12490 |
| 4866 test_type_reference_part_to_other_part() { | 12491 test_type_reference_part_to_other_part() { |
| 4867 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); | 12492 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 4868 addSource('/b.dart', 'part of l; C c; E e; F f;'); | 12493 addSource('/b.dart', 'part of l; C c; E e; F f;'); |
| 4869 checkLibrary('library l; part "a.dart"; part "b.dart";'); | 12494 var library = checkLibrary('library l; part "a.dart"; part "b.dart";'); |
| 12495 if (isStrongMode) { | |
| 12496 checkElementText( | |
| 12497 library, | |
| 12498 r''' | |
| 12499 library l; | |
| 12500 part 'a.dart'; | |
| 12501 part 'b.dart'; | |
| 12502 -------------------- | |
| 12503 unit: a.dart | |
| 12504 | |
| 12505 typedef F(); | |
| 12506 enum E { v } | |
| 12507 class C { | |
| 12508 } | |
| 12509 -------------------- | |
| 12510 unit: b.dart | |
| 12511 | |
| 12512 C c; | |
| 12513 E e; | |
| 12514 F f; | |
| 12515 '''); | |
| 12516 } else { | |
| 12517 checkElementText( | |
| 12518 library, | |
| 12519 r''' | |
| 12520 library l; | |
| 12521 part 'a.dart'; | |
| 12522 part 'b.dart'; | |
| 12523 -------------------- | |
| 12524 unit: a.dart | |
| 12525 | |
| 12526 typedef F(); | |
| 12527 enum E { v } | |
| 12528 class C { | |
| 12529 } | |
| 12530 -------------------- | |
| 12531 unit: b.dart | |
| 12532 | |
| 12533 C c; | |
| 12534 E e; | |
| 12535 F f; | |
| 12536 '''); | |
| 12537 } | |
| 4870 } | 12538 } |
| 4871 | 12539 |
| 4872 test_type_reference_part_to_part() { | 12540 test_type_reference_part_to_part() { |
| 4873 addSource('/a.dart', | 12541 addSource('/a.dart', |
| 4874 'part of l; class C {} enum E { v } typedef F(); C c; E e; F f;'); | 12542 'part of l; class C {} enum E { v } typedef F(); C c; E e; F f;'); |
| 4875 checkLibrary('library l; part "a.dart";'); | 12543 var library = checkLibrary('library l; part "a.dart";'); |
| 12544 if (isStrongMode) { | |
| 12545 checkElementText( | |
| 12546 library, | |
| 12547 r''' | |
| 12548 library l; | |
| 12549 part 'a.dart'; | |
| 12550 -------------------- | |
| 12551 unit: a.dart | |
| 12552 | |
| 12553 typedef F(); | |
| 12554 enum E { v } | |
| 12555 class C { | |
| 12556 } | |
| 12557 C c; | |
| 12558 E e; | |
| 12559 F f; | |
| 12560 '''); | |
| 12561 } else { | |
| 12562 checkElementText( | |
| 12563 library, | |
| 12564 r''' | |
| 12565 library l; | |
| 12566 part 'a.dart'; | |
| 12567 -------------------- | |
| 12568 unit: a.dart | |
| 12569 | |
| 12570 typedef F(); | |
| 12571 enum E { v } | |
| 12572 class C { | |
| 12573 } | |
| 12574 C c; | |
| 12575 E e; | |
| 12576 F f; | |
| 12577 '''); | |
| 12578 } | |
| 4876 } | 12579 } |
| 4877 | 12580 |
| 4878 test_type_reference_to_class() { | 12581 test_type_reference_to_class() { |
| 4879 checkLibrary('class C {} C c;'); | 12582 var library = checkLibrary('class C {} C c;'); |
| 12583 if (isStrongMode) { | |
| 12584 checkElementText( | |
| 12585 library, | |
| 12586 r''' | |
| 12587 class C { | |
| 12588 } | |
| 12589 C c; | |
| 12590 '''); | |
| 12591 } else { | |
| 12592 checkElementText( | |
| 12593 library, | |
| 12594 r''' | |
| 12595 class C { | |
| 12596 } | |
| 12597 C c; | |
| 12598 '''); | |
| 12599 } | |
| 4880 } | 12600 } |
| 4881 | 12601 |
| 4882 test_type_reference_to_class_with_type_arguments() { | 12602 test_type_reference_to_class_with_type_arguments() { |
| 4883 checkLibrary('class C<T, U> {} C<int, String> c;'); | 12603 var library = checkLibrary('class C<T, U> {} C<int, String> c;'); |
| 12604 if (isStrongMode) { | |
| 12605 checkElementText( | |
| 12606 library, | |
| 12607 r''' | |
| 12608 class C<T, U> { | |
| 12609 } | |
| 12610 C<int, String> c; | |
| 12611 '''); | |
| 12612 } else { | |
| 12613 checkElementText( | |
| 12614 library, | |
| 12615 r''' | |
| 12616 class C<T, U> { | |
| 12617 } | |
| 12618 C<int, String> c; | |
| 12619 '''); | |
| 12620 } | |
| 4884 } | 12621 } |
| 4885 | 12622 |
| 4886 test_type_reference_to_class_with_type_arguments_implicit() { | 12623 test_type_reference_to_class_with_type_arguments_implicit() { |
| 4887 checkLibrary('class C<T, U> {} C c;'); | 12624 var library = checkLibrary('class C<T, U> {} C c;'); |
| 12625 if (isStrongMode) { | |
| 12626 checkElementText( | |
| 12627 library, | |
| 12628 r''' | |
| 12629 class C<T, U> { | |
| 12630 } | |
| 12631 C c; | |
| 12632 '''); | |
| 12633 } else { | |
| 12634 checkElementText( | |
| 12635 library, | |
| 12636 r''' | |
| 12637 class C<T, U> { | |
| 12638 } | |
| 12639 C c; | |
| 12640 '''); | |
| 12641 } | |
| 4888 } | 12642 } |
| 4889 | 12643 |
| 4890 test_type_reference_to_enum() { | 12644 test_type_reference_to_enum() { |
| 4891 checkLibrary('enum E { v } E e;'); | 12645 var library = checkLibrary('enum E { v } E e;'); |
| 12646 if (isStrongMode) { | |
| 12647 checkElementText( | |
| 12648 library, | |
| 12649 r''' | |
| 12650 enum E { v } | |
| 12651 E e; | |
| 12652 '''); | |
| 12653 } else { | |
| 12654 checkElementText( | |
| 12655 library, | |
| 12656 r''' | |
| 12657 enum E { v } | |
| 12658 E e; | |
| 12659 '''); | |
| 12660 } | |
| 4892 } | 12661 } |
| 4893 | 12662 |
| 4894 test_type_reference_to_import() { | 12663 test_type_reference_to_import() { |
| 4895 addLibrarySource('/a.dart', 'class C {} enum E { v }; typedef F();'); | 12664 addLibrarySource('/a.dart', 'class C {} enum E { v }; typedef F();'); |
| 4896 checkLibrary('import "a.dart"; C c; E e; F f;'); | 12665 var library = checkLibrary('import "a.dart"; C c; E e; F f;'); |
| 12666 if (isStrongMode) { | |
| 12667 checkElementText( | |
| 12668 library, | |
| 12669 r''' | |
| 12670 import 'a.dart'; | |
| 12671 C c; | |
| 12672 E e; | |
| 12673 F f; | |
| 12674 '''); | |
| 12675 } else { | |
| 12676 checkElementText( | |
| 12677 library, | |
| 12678 r''' | |
| 12679 import 'a.dart'; | |
| 12680 C c; | |
| 12681 E e; | |
| 12682 F f; | |
| 12683 '''); | |
| 12684 } | |
| 4897 } | 12685 } |
| 4898 | 12686 |
| 4899 test_type_reference_to_import_export() { | 12687 test_type_reference_to_import_export() { |
| 4900 addLibrarySource('/a.dart', 'export "b.dart";'); | 12688 addLibrarySource('/a.dart', 'export "b.dart";'); |
| 4901 addLibrarySource('/b.dart', 'class C {} enum E { v } typedef F();'); | 12689 addLibrarySource('/b.dart', 'class C {} enum E { v } typedef F();'); |
| 4902 checkLibrary('import "a.dart"; C c; E e; F f;'); | 12690 var library = checkLibrary('import "a.dart"; C c; E e; F f;'); |
| 12691 if (isStrongMode) { | |
| 12692 checkElementText( | |
| 12693 library, | |
| 12694 r''' | |
| 12695 import 'a.dart'; | |
| 12696 C c; | |
| 12697 E e; | |
| 12698 F f; | |
| 12699 '''); | |
| 12700 } else { | |
| 12701 checkElementText( | |
| 12702 library, | |
| 12703 r''' | |
| 12704 import 'a.dart'; | |
| 12705 C c; | |
| 12706 E e; | |
| 12707 F f; | |
| 12708 '''); | |
| 12709 } | |
| 4903 } | 12710 } |
| 4904 | 12711 |
| 4905 test_type_reference_to_import_export_export() { | 12712 test_type_reference_to_import_export_export() { |
| 4906 addLibrarySource('/a.dart', 'export "b.dart";'); | 12713 addLibrarySource('/a.dart', 'export "b.dart";'); |
| 4907 addLibrarySource('/b.dart', 'export "c.dart";'); | 12714 addLibrarySource('/b.dart', 'export "c.dart";'); |
| 4908 addLibrarySource('/c.dart', 'class C {} enum E { v } typedef F();'); | 12715 addLibrarySource('/c.dart', 'class C {} enum E { v } typedef F();'); |
| 4909 checkLibrary('import "a.dart"; C c; E e; F f;'); | 12716 var library = checkLibrary('import "a.dart"; C c; E e; F f;'); |
| 12717 if (isStrongMode) { | |
| 12718 checkElementText( | |
| 12719 library, | |
| 12720 r''' | |
| 12721 import 'a.dart'; | |
| 12722 C c; | |
| 12723 E e; | |
| 12724 F f; | |
| 12725 '''); | |
| 12726 } else { | |
| 12727 checkElementText( | |
| 12728 library, | |
| 12729 r''' | |
| 12730 import 'a.dart'; | |
| 12731 C c; | |
| 12732 E e; | |
| 12733 F f; | |
| 12734 '''); | |
| 12735 } | |
| 4910 } | 12736 } |
| 4911 | 12737 |
| 4912 test_type_reference_to_import_export_export_in_subdirs() { | 12738 test_type_reference_to_import_export_export_in_subdirs() { |
| 4913 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); | 12739 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); |
| 4914 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";'); | 12740 addLibrarySource('/a/b/b.dart', 'export "../c/c.dart";'); |
| 4915 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();'); | 12741 addLibrarySource('/a/c/c.dart', 'class C {} enum E { v } typedef F();'); |
| 4916 checkLibrary('import "a/a.dart"; C c; E e; F f;'); | 12742 var library = checkLibrary('import "a/a.dart"; C c; E e; F f;'); |
| 12743 if (isStrongMode) { | |
| 12744 checkElementText( | |
| 12745 library, | |
| 12746 r''' | |
| 12747 import 'a/a.dart'; | |
| 12748 C c; | |
| 12749 E e; | |
| 12750 F f; | |
| 12751 '''); | |
| 12752 } else { | |
| 12753 checkElementText( | |
| 12754 library, | |
| 12755 r''' | |
| 12756 import 'a/a.dart'; | |
| 12757 C c; | |
| 12758 E e; | |
| 12759 F f; | |
| 12760 '''); | |
| 12761 } | |
| 4917 } | 12762 } |
| 4918 | 12763 |
| 4919 test_type_reference_to_import_export_in_subdirs() { | 12764 test_type_reference_to_import_export_in_subdirs() { |
| 4920 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); | 12765 addLibrarySource('/a/a.dart', 'export "b/b.dart";'); |
| 4921 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();'); | 12766 addLibrarySource('/a/b/b.dart', 'class C {} enum E { v } typedef F();'); |
| 4922 checkLibrary('import "a/a.dart"; C c; E e; F f;'); | 12767 var library = checkLibrary('import "a/a.dart"; C c; E e; F f;'); |
| 12768 if (isStrongMode) { | |
| 12769 checkElementText( | |
| 12770 library, | |
| 12771 r''' | |
| 12772 import 'a/a.dart'; | |
| 12773 C c; | |
| 12774 E e; | |
| 12775 F f; | |
| 12776 '''); | |
| 12777 } else { | |
| 12778 checkElementText( | |
| 12779 library, | |
| 12780 r''' | |
| 12781 import 'a/a.dart'; | |
| 12782 C c; | |
| 12783 E e; | |
| 12784 F f; | |
| 12785 '''); | |
| 12786 } | |
| 4923 } | 12787 } |
| 4924 | 12788 |
| 4925 test_type_reference_to_import_part() { | 12789 test_type_reference_to_import_part() { |
| 4926 addLibrarySource('/a.dart', 'library l; part "b.dart";'); | 12790 addLibrarySource('/a.dart', 'library l; part "b.dart";'); |
| 4927 addSource('/b.dart', 'part of l; class C {} enum E { v } typedef F();'); | 12791 addSource('/b.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 4928 checkLibrary('import "a.dart"; C c; E e; F f;'); | 12792 var library = checkLibrary('import "a.dart"; C c; E e; F f;'); |
| 12793 if (isStrongMode) { | |
| 12794 checkElementText( | |
| 12795 library, | |
| 12796 r''' | |
| 12797 import 'a.dart'; | |
| 12798 C c; | |
| 12799 E e; | |
| 12800 F f; | |
| 12801 '''); | |
| 12802 } else { | |
| 12803 checkElementText( | |
| 12804 library, | |
| 12805 r''' | |
| 12806 import 'a.dart'; | |
| 12807 C c; | |
| 12808 E e; | |
| 12809 F f; | |
| 12810 '''); | |
| 12811 } | |
| 4929 } | 12812 } |
| 4930 | 12813 |
| 4931 test_type_reference_to_import_part2() { | 12814 test_type_reference_to_import_part2() { |
| 4932 addLibrarySource('/a.dart', 'library l; part "p1.dart"; part "p2.dart";'); | 12815 addLibrarySource('/a.dart', 'library l; part "p1.dart"; part "p2.dart";'); |
| 4933 addSource('/p1.dart', 'part of l; class C1 {}'); | 12816 addSource('/p1.dart', 'part of l; class C1 {}'); |
| 4934 addSource('/p2.dart', 'part of l; class C2 {}'); | 12817 addSource('/p2.dart', 'part of l; class C2 {}'); |
| 4935 checkLibrary('import "a.dart"; C1 c1; C2 c2;'); | 12818 var library = checkLibrary('import "a.dart"; C1 c1; C2 c2;'); |
| 12819 if (isStrongMode) { | |
| 12820 checkElementText( | |
| 12821 library, | |
| 12822 r''' | |
| 12823 import 'a.dart'; | |
| 12824 C1 c1; | |
| 12825 C2 c2; | |
| 12826 '''); | |
| 12827 } else { | |
| 12828 checkElementText( | |
| 12829 library, | |
| 12830 r''' | |
| 12831 import 'a.dart'; | |
| 12832 C1 c1; | |
| 12833 C2 c2; | |
| 12834 '''); | |
| 12835 } | |
| 4936 } | 12836 } |
| 4937 | 12837 |
| 4938 test_type_reference_to_import_part_in_subdir() { | 12838 test_type_reference_to_import_part_in_subdir() { |
| 4939 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); | 12839 addLibrarySource('/a/b.dart', 'library l; part "c.dart";'); |
| 4940 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); | 12840 addSource('/a/c.dart', 'part of l; class C {} enum E { v } typedef F();'); |
| 4941 checkLibrary('import "a/b.dart"; C c; E e; F f;'); | 12841 var library = checkLibrary('import "a/b.dart"; C c; E e; F f;'); |
| 12842 if (isStrongMode) { | |
| 12843 checkElementText( | |
| 12844 library, | |
| 12845 r''' | |
| 12846 import 'a/b.dart'; | |
| 12847 C c; | |
| 12848 E e; | |
| 12849 F f; | |
| 12850 '''); | |
| 12851 } else { | |
| 12852 checkElementText( | |
| 12853 library, | |
| 12854 r''' | |
| 12855 import 'a/b.dart'; | |
| 12856 C c; | |
| 12857 E e; | |
| 12858 F f; | |
| 12859 '''); | |
| 12860 } | |
| 4942 } | 12861 } |
| 4943 | 12862 |
| 4944 test_type_reference_to_import_relative() { | 12863 test_type_reference_to_import_relative() { |
| 4945 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); | 12864 addLibrarySource('/a.dart', 'class C {} enum E { v } typedef F();'); |
| 4946 checkLibrary('import "a.dart"; C c; E e; F f;'); | 12865 var library = checkLibrary('import "a.dart"; C c; E e; F f;'); |
| 12866 if (isStrongMode) { | |
| 12867 checkElementText( | |
| 12868 library, | |
| 12869 r''' | |
| 12870 import 'a.dart'; | |
| 12871 C c; | |
| 12872 E e; | |
| 12873 F f; | |
| 12874 '''); | |
| 12875 } else { | |
| 12876 checkElementText( | |
| 12877 library, | |
| 12878 r''' | |
| 12879 import 'a.dart'; | |
| 12880 C c; | |
| 12881 E e; | |
| 12882 F f; | |
| 12883 '''); | |
| 12884 } | |
| 4947 } | 12885 } |
| 4948 | 12886 |
| 4949 test_type_reference_to_typedef() { | 12887 test_type_reference_to_typedef() { |
| 4950 checkLibrary('typedef F(); F f;'); | 12888 var library = checkLibrary('typedef F(); F f;'); |
| 12889 if (isStrongMode) { | |
| 12890 checkElementText( | |
| 12891 library, | |
| 12892 r''' | |
| 12893 typedef F(); | |
| 12894 F f; | |
| 12895 '''); | |
| 12896 } else { | |
| 12897 checkElementText( | |
| 12898 library, | |
| 12899 r''' | |
| 12900 typedef F(); | |
| 12901 F f; | |
| 12902 '''); | |
| 12903 } | |
| 4951 } | 12904 } |
| 4952 | 12905 |
| 4953 test_type_reference_to_typedef_with_type_arguments() { | 12906 test_type_reference_to_typedef_with_type_arguments() { |
| 4954 checkLibrary('typedef U F<T, U>(T t); F<int, String> f;'); | 12907 var library = checkLibrary('typedef U F<T, U>(T t); F<int, String> f;'); |
| 12908 if (isStrongMode) { | |
| 12909 checkElementText( | |
| 12910 library, | |
| 12911 r''' | |
| 12912 typedef U F<T, U>(T t); | |
| 12913 F f; | |
| 12914 '''); | |
| 12915 } else { | |
| 12916 checkElementText( | |
| 12917 library, | |
| 12918 r''' | |
| 12919 typedef U F<T, U>(T t); | |
| 12920 F f; | |
| 12921 '''); | |
| 12922 } | |
| 4955 } | 12923 } |
| 4956 | 12924 |
| 4957 test_type_reference_to_typedef_with_type_arguments_implicit() { | 12925 test_type_reference_to_typedef_with_type_arguments_implicit() { |
| 4958 checkLibrary('typedef U F<T, U>(T t); F f;'); | 12926 var library = checkLibrary('typedef U F<T, U>(T t); F f;'); |
| 12927 if (isStrongMode) { | |
| 12928 checkElementText( | |
| 12929 library, | |
| 12930 r''' | |
| 12931 typedef U F<T, U>(T t); | |
| 12932 F f; | |
| 12933 '''); | |
| 12934 } else { | |
| 12935 checkElementText( | |
| 12936 library, | |
| 12937 r''' | |
| 12938 typedef U F<T, U>(T t); | |
| 12939 F f; | |
| 12940 '''); | |
| 12941 } | |
| 4959 } | 12942 } |
| 4960 | 12943 |
| 4961 test_type_unresolved() { | 12944 test_type_unresolved() { |
| 4962 checkLibrary('C c;', allowErrors: true); | 12945 var library = checkLibrary('C c;', allowErrors: true); |
| 12946 if (isStrongMode) { | |
| 12947 checkElementText( | |
| 12948 library, | |
| 12949 r''' | |
| 12950 dynamic c; | |
| 12951 '''); | |
| 12952 } else { | |
| 12953 checkElementText( | |
| 12954 library, | |
| 12955 r''' | |
| 12956 dynamic c; | |
| 12957 '''); | |
| 12958 } | |
| 4963 } | 12959 } |
| 4964 | 12960 |
| 4965 test_type_unresolved_prefixed() { | 12961 test_type_unresolved_prefixed() { |
| 4966 checkLibrary('import "dart:core" as core; core.C c;', allowErrors: true); | 12962 var library = checkLibrary('import "dart:core" as core; core.C c;', |
| 12963 allowErrors: true); | |
| 12964 if (isStrongMode) { | |
| 12965 checkElementText( | |
| 12966 library, | |
| 12967 r''' | |
| 12968 import 'dart:core' as core; | |
| 12969 dynamic c; | |
| 12970 '''); | |
| 12971 } else { | |
| 12972 checkElementText( | |
| 12973 library, | |
| 12974 r''' | |
| 12975 import 'dart:core' as core; | |
| 12976 dynamic c; | |
| 12977 '''); | |
| 12978 } | |
| 4967 } | 12979 } |
| 4968 | 12980 |
| 4969 test_typedef_documented() { | 12981 test_typedef_documented() { |
| 4970 checkLibrary(''' | 12982 var library = checkLibrary(''' |
| 4971 // Extra comment so doc comment offset != 0 | 12983 // Extra comment so doc comment offset != 0 |
| 4972 /** | 12984 /** |
| 4973 * Docs | 12985 * Docs |
| 4974 */ | 12986 */ |
| 4975 typedef F();'''); | 12987 typedef F();'''); |
| 12988 if (isStrongMode) { | |
| 12989 checkElementText( | |
| 12990 library, | |
| 12991 r''' | |
| 12992 typedef F(); | |
| 12993 '''); | |
| 12994 } else { | |
| 12995 checkElementText( | |
| 12996 library, | |
| 12997 r''' | |
| 12998 typedef F(); | |
| 12999 '''); | |
| 13000 } | |
| 4976 } | 13001 } |
| 4977 | 13002 |
| 4978 test_typedef_parameter_parameters() { | 13003 test_typedef_parameter_parameters() { |
| 4979 checkLibrary('typedef F(g(x, y));'); | 13004 var library = checkLibrary('typedef F(g(x, y));'); |
| 13005 if (isStrongMode) { | |
| 13006 checkElementText( | |
| 13007 library, | |
| 13008 r''' | |
| 13009 typedef F((dynamic, dynamic) → dynamic g); | |
| 13010 '''); | |
| 13011 } else { | |
| 13012 checkElementText( | |
| 13013 library, | |
| 13014 r''' | |
| 13015 typedef F((dynamic, dynamic) → dynamic g); | |
| 13016 '''); | |
| 13017 } | |
| 4980 } | 13018 } |
| 4981 | 13019 |
| 4982 test_typedef_parameter_parameters_in_generic_class() { | 13020 test_typedef_parameter_parameters_in_generic_class() { |
| 4983 checkLibrary('typedef F<A, B>(A g(B x));'); | 13021 var library = checkLibrary('typedef F<A, B>(A g(B x));'); |
| 13022 if (isStrongMode) { | |
| 13023 checkElementText( | |
| 13024 library, | |
| 13025 r''' | |
| 13026 typedef F<A, B>((B) → A g); | |
| 13027 '''); | |
| 13028 } else { | |
| 13029 checkElementText( | |
| 13030 library, | |
| 13031 r''' | |
| 13032 typedef F<A, B>((B) → A g); | |
| 13033 '''); | |
| 13034 } | |
| 4984 } | 13035 } |
| 4985 | 13036 |
| 4986 test_typedef_parameter_return_type() { | 13037 test_typedef_parameter_return_type() { |
| 4987 checkLibrary('typedef F(int g());'); | 13038 var library = checkLibrary('typedef F(int g());'); |
| 13039 if (isStrongMode) { | |
| 13040 checkElementText( | |
| 13041 library, | |
| 13042 r''' | |
| 13043 typedef F(() → int g); | |
| 13044 '''); | |
| 13045 } else { | |
| 13046 checkElementText( | |
| 13047 library, | |
| 13048 r''' | |
| 13049 typedef F(() → int g); | |
| 13050 '''); | |
| 13051 } | |
| 4988 } | 13052 } |
| 4989 | 13053 |
| 4990 test_typedef_parameter_type() { | 13054 test_typedef_parameter_type() { |
| 4991 checkLibrary('typedef F(int i);'); | 13055 var library = checkLibrary('typedef F(int i);'); |
| 13056 if (isStrongMode) { | |
| 13057 checkElementText( | |
| 13058 library, | |
| 13059 r''' | |
| 13060 typedef F(int i); | |
| 13061 '''); | |
| 13062 } else { | |
| 13063 checkElementText( | |
| 13064 library, | |
| 13065 r''' | |
| 13066 typedef F(int i); | |
| 13067 '''); | |
| 13068 } | |
| 4992 } | 13069 } |
| 4993 | 13070 |
| 4994 test_typedef_parameter_type_generic() { | 13071 test_typedef_parameter_type_generic() { |
| 4995 checkLibrary('typedef F<T>(T t);'); | 13072 var library = checkLibrary('typedef F<T>(T t);'); |
| 13073 if (isStrongMode) { | |
| 13074 checkElementText( | |
| 13075 library, | |
| 13076 r''' | |
| 13077 typedef F<T>(T t); | |
| 13078 '''); | |
| 13079 } else { | |
| 13080 checkElementText( | |
| 13081 library, | |
| 13082 r''' | |
| 13083 typedef F<T>(T t); | |
| 13084 '''); | |
| 13085 } | |
| 4996 } | 13086 } |
| 4997 | 13087 |
| 4998 test_typedef_parameters() { | 13088 test_typedef_parameters() { |
| 4999 checkLibrary('typedef F(x, y);'); | 13089 var library = checkLibrary('typedef F(x, y);'); |
| 13090 if (isStrongMode) { | |
| 13091 checkElementText( | |
| 13092 library, | |
| 13093 r''' | |
| 13094 typedef F(x, y); | |
| 13095 '''); | |
| 13096 } else { | |
| 13097 checkElementText( | |
| 13098 library, | |
| 13099 r''' | |
| 13100 typedef F(x, y); | |
| 13101 '''); | |
| 13102 } | |
| 5000 } | 13103 } |
| 5001 | 13104 |
| 5002 test_typedef_return_type() { | 13105 test_typedef_return_type() { |
| 5003 checkLibrary('typedef int F();'); | 13106 var library = checkLibrary('typedef int F();'); |
| 13107 if (isStrongMode) { | |
| 13108 checkElementText( | |
| 13109 library, | |
| 13110 r''' | |
| 13111 typedef int F(); | |
| 13112 '''); | |
| 13113 } else { | |
| 13114 checkElementText( | |
| 13115 library, | |
| 13116 r''' | |
| 13117 typedef int F(); | |
| 13118 '''); | |
| 13119 } | |
| 5004 } | 13120 } |
| 5005 | 13121 |
| 5006 test_typedef_return_type_generic() { | 13122 test_typedef_return_type_generic() { |
| 5007 checkLibrary('typedef T F<T>();'); | 13123 var library = checkLibrary('typedef T F<T>();'); |
| 13124 if (isStrongMode) { | |
| 13125 checkElementText( | |
| 13126 library, | |
| 13127 r''' | |
| 13128 typedef T F<T>(); | |
| 13129 '''); | |
| 13130 } else { | |
| 13131 checkElementText( | |
| 13132 library, | |
| 13133 r''' | |
| 13134 typedef T F<T>(); | |
| 13135 '''); | |
| 13136 } | |
| 5008 } | 13137 } |
| 5009 | 13138 |
| 5010 test_typedef_return_type_implicit() { | 13139 test_typedef_return_type_implicit() { |
| 5011 checkLibrary('typedef F();'); | 13140 var library = checkLibrary('typedef F();'); |
| 13141 if (isStrongMode) { | |
| 13142 checkElementText( | |
| 13143 library, | |
| 13144 r''' | |
| 13145 typedef F(); | |
| 13146 '''); | |
| 13147 } else { | |
| 13148 checkElementText( | |
| 13149 library, | |
| 13150 r''' | |
| 13151 typedef F(); | |
| 13152 '''); | |
| 13153 } | |
| 5012 } | 13154 } |
| 5013 | 13155 |
| 5014 test_typedef_return_type_void() { | 13156 test_typedef_return_type_void() { |
| 5015 checkLibrary('typedef void F();'); | 13157 var library = checkLibrary('typedef void F();'); |
| 13158 if (isStrongMode) { | |
| 13159 checkElementText( | |
| 13160 library, | |
| 13161 r''' | |
| 13162 typedef void F(); | |
| 13163 '''); | |
| 13164 } else { | |
| 13165 checkElementText( | |
| 13166 library, | |
| 13167 r''' | |
| 13168 typedef void F(); | |
| 13169 '''); | |
| 13170 } | |
| 5016 } | 13171 } |
| 5017 | 13172 |
| 5018 test_typedef_type_parameters() { | 13173 test_typedef_type_parameters() { |
| 5019 checkLibrary('typedef U F<T, U>(T t);'); | 13174 var library = checkLibrary('typedef U F<T, U>(T t);'); |
| 13175 if (isStrongMode) { | |
| 13176 checkElementText( | |
| 13177 library, | |
| 13178 r''' | |
| 13179 typedef U F<T, U>(T t); | |
| 13180 '''); | |
| 13181 } else { | |
| 13182 checkElementText( | |
| 13183 library, | |
| 13184 r''' | |
| 13185 typedef U F<T, U>(T t); | |
| 13186 '''); | |
| 13187 } | |
| 5020 } | 13188 } |
| 5021 | 13189 |
| 5022 test_typedef_type_parameters_bound() { | 13190 test_typedef_type_parameters_bound() { |
| 5023 checkLibrary('typedef U F<T extends Object, U extends D>(T t); class D {}'); | 13191 var library = checkLibrary( |
| 13192 'typedef U F<T extends Object, U extends D>(T t); class D {}'); | |
| 13193 if (isStrongMode) { | |
| 13194 checkElementText( | |
| 13195 library, | |
| 13196 r''' | |
| 13197 typedef U F<T extends Object, U extends D>(T t); | |
| 13198 class D { | |
| 13199 } | |
| 13200 '''); | |
| 13201 } else { | |
| 13202 checkElementText( | |
| 13203 library, | |
| 13204 r''' | |
| 13205 typedef U F<T extends Object, U extends D>(T t); | |
| 13206 class D { | |
| 13207 } | |
| 13208 '''); | |
| 13209 } | |
| 5024 } | 13210 } |
| 5025 | 13211 |
| 5026 test_typedef_type_parameters_f_bound_complex() { | 13212 test_typedef_type_parameters_f_bound_complex() { |
| 5027 checkLibrary('typedef U F<T extends List<U>, U>(T t);'); | 13213 var library = checkLibrary('typedef U F<T extends List<U>, U>(T t);'); |
| 13214 if (isStrongMode) { | |
| 13215 checkElementText( | |
| 13216 library, | |
| 13217 r''' | |
| 13218 typedef U F<T extends List<U>, U>(T t); | |
| 13219 '''); | |
| 13220 } else { | |
| 13221 checkElementText( | |
| 13222 library, | |
| 13223 r''' | |
| 13224 typedef U F<T extends List<U>, U>(T t); | |
| 13225 '''); | |
| 13226 } | |
| 5028 } | 13227 } |
| 5029 | 13228 |
| 5030 test_typedef_type_parameters_f_bound_simple() { | 13229 test_typedef_type_parameters_f_bound_simple() { |
| 5031 checkLibrary('typedef U F<T extends U, U>(T t);'); | 13230 var library = checkLibrary('typedef U F<T extends U, U>(T t);'); |
| 13231 if (isStrongMode) { | |
| 13232 checkElementText( | |
| 13233 library, | |
| 13234 r''' | |
| 13235 typedef U F<T extends U, U>(T t); | |
| 13236 '''); | |
| 13237 } else { | |
| 13238 checkElementText( | |
| 13239 library, | |
| 13240 r''' | |
| 13241 typedef U F<T extends U, U>(T t); | |
| 13242 '''); | |
| 13243 } | |
| 5032 } | 13244 } |
| 5033 | 13245 |
| 5034 test_typedefs() { | 13246 test_typedefs() { |
| 5035 checkLibrary('f() {} g() {}'); | 13247 var library = checkLibrary('f() {} g() {}'); |
| 13248 if (isStrongMode) { | |
| 13249 checkElementText( | |
| 13250 library, | |
| 13251 r''' | |
| 13252 f() {} | |
| 13253 g() {} | |
| 13254 '''); | |
| 13255 } else { | |
| 13256 checkElementText( | |
| 13257 library, | |
| 13258 r''' | |
| 13259 f() {} | |
| 13260 g() {} | |
| 13261 '''); | |
| 13262 } | |
| 5036 } | 13263 } |
| 5037 | 13264 |
| 5038 @failingTest | 13265 @failingTest |
| 5039 test_unresolved_annotation_instanceCreation_argument_super() { | 13266 test_unresolved_annotation_instanceCreation_argument_super() { |
| 5040 // TODO(scheglov) fix https://github.com/dart-lang/sdk/issues/28553 | 13267 // TODO(scheglov) fix https://github.com/dart-lang/sdk/issues/28553 |
| 5041 checkLibrary( | 13268 var library = checkLibrary( |
| 5042 ''' | 13269 ''' |
| 5043 class A { | 13270 class A { |
| 5044 const A(_); | 13271 const A(_); |
| 5045 } | 13272 } |
| 5046 | 13273 |
| 5047 @A(super) | 13274 @A(super) |
| 5048 class C {} | 13275 class C {} |
| 5049 ''', | 13276 ''', |
| 5050 allowErrors: true); | 13277 allowErrors: true); |
| 13278 if (isStrongMode) { | |
| 13279 checkElementText( | |
| 13280 library, | |
| 13281 r''' | |
| 13282 class A { | |
| 13283 A(_); | |
| 13284 } | |
| 13285 | |
| 13286 class C { | |
| 13287 synthetic C(); | |
| 13288 } | |
| 13289 '''); | |
| 13290 } else { | |
| 13291 checkElementText( | |
| 13292 library, | |
| 13293 r''' | |
| 13294 class A { | |
| 13295 A(_); | |
| 13296 } | |
| 13297 | |
| 13298 class C { | |
| 13299 synthetic C(); | |
| 13300 } | |
| 13301 '''); | |
| 13302 } | |
| 5051 } | 13303 } |
| 5052 | 13304 |
| 5053 test_unresolved_annotation_instanceCreation_argument_this() { | 13305 test_unresolved_annotation_instanceCreation_argument_this() { |
| 5054 checkLibrary( | 13306 var library = checkLibrary( |
| 5055 ''' | 13307 ''' |
| 5056 class A { | 13308 class A { |
| 5057 const A(_); | 13309 const A(_); |
| 5058 } | 13310 } |
| 5059 | 13311 |
| 5060 @A(this) | 13312 @A(this) |
| 5061 class C {} | 13313 class C {} |
| 5062 ''', | 13314 ''', |
| 5063 allowErrors: true); | 13315 allowErrors: true); |
| 13316 if (isStrongMode) { | |
| 13317 checkElementText( | |
| 13318 library, | |
| 13319 r''' | |
| 13320 class A { | |
| 13321 A(_); | |
| 13322 } | |
| 13323 class C { | |
| 13324 } | |
| 13325 '''); | |
| 13326 } else { | |
| 13327 checkElementText( | |
| 13328 library, | |
| 13329 r''' | |
| 13330 class A { | |
| 13331 A(_); | |
| 13332 } | |
| 13333 class C { | |
| 13334 } | |
| 13335 '''); | |
| 13336 } | |
| 5064 } | 13337 } |
| 5065 | 13338 |
| 5066 test_unresolved_annotation_namedConstructorCall_noClass() { | 13339 test_unresolved_annotation_namedConstructorCall_noClass() { |
| 5067 checkLibrary('@foo.bar() class C {}', allowErrors: true); | 13340 var library = checkLibrary('@foo.bar() class C {}', allowErrors: true); |
| 13341 if (isStrongMode) { | |
| 13342 checkElementText( | |
| 13343 library, | |
| 13344 r''' | |
| 13345 class C { | |
| 13346 } | |
| 13347 '''); | |
| 13348 } else { | |
| 13349 checkElementText( | |
| 13350 library, | |
| 13351 r''' | |
| 13352 class C { | |
| 13353 } | |
| 13354 '''); | |
| 13355 } | |
| 5068 } | 13356 } |
| 5069 | 13357 |
| 5070 test_unresolved_annotation_namedConstructorCall_noConstructor() { | 13358 test_unresolved_annotation_namedConstructorCall_noConstructor() { |
| 5071 checkLibrary('@String.foo() class C {}', allowErrors: true); | 13359 var library = checkLibrary('@String.foo() class C {}', allowErrors: true); |
| 13360 if (isStrongMode) { | |
| 13361 checkElementText( | |
| 13362 library, | |
| 13363 r''' | |
| 13364 class C { | |
| 13365 } | |
| 13366 '''); | |
| 13367 } else { | |
| 13368 checkElementText( | |
| 13369 library, | |
| 13370 r''' | |
| 13371 class C { | |
| 13372 } | |
| 13373 '''); | |
| 13374 } | |
| 5072 } | 13375 } |
| 5073 | 13376 |
| 5074 test_unresolved_annotation_prefixedIdentifier_badPrefix() { | 13377 test_unresolved_annotation_prefixedIdentifier_badPrefix() { |
| 5075 checkLibrary('@foo.bar class C {}', allowErrors: true); | 13378 var library = checkLibrary('@foo.bar class C {}', allowErrors: true); |
| 13379 if (isStrongMode) { | |
| 13380 checkElementText( | |
| 13381 library, | |
| 13382 r''' | |
| 13383 class C { | |
| 13384 } | |
| 13385 '''); | |
| 13386 } else { | |
| 13387 checkElementText( | |
| 13388 library, | |
| 13389 r''' | |
| 13390 class C { | |
| 13391 } | |
| 13392 '''); | |
| 13393 } | |
| 5076 } | 13394 } |
| 5077 | 13395 |
| 5078 test_unresolved_annotation_prefixedIdentifier_noDeclaration() { | 13396 test_unresolved_annotation_prefixedIdentifier_noDeclaration() { |
| 5079 checkLibrary('import "dart:async" as foo; @foo.bar class C {}', | 13397 var library = checkLibrary( |
| 5080 allowErrors: true); | 13398 'import "dart:async" as foo; @foo.bar class C {}', |
| 13399 allowErrors: true); | |
| 13400 if (isStrongMode) { | |
| 13401 checkElementText( | |
| 13402 library, | |
| 13403 r''' | |
| 13404 import 'dart:async' as foo; | |
| 13405 class C { | |
| 13406 } | |
| 13407 '''); | |
| 13408 } else { | |
| 13409 checkElementText( | |
| 13410 library, | |
| 13411 r''' | |
| 13412 import 'dart:async' as foo; | |
| 13413 class C { | |
| 13414 } | |
| 13415 '''); | |
| 13416 } | |
| 5081 } | 13417 } |
| 5082 | 13418 |
| 5083 test_unresolved_annotation_prefixedNamedConstructorCall_badPrefix() { | 13419 test_unresolved_annotation_prefixedNamedConstructorCall_badPrefix() { |
| 5084 checkLibrary('@foo.bar.baz() class C {}', allowErrors: true); | 13420 var library = checkLibrary('@foo.bar.baz() class C {}', allowErrors: true); |
| 13421 if (isStrongMode) { | |
| 13422 checkElementText( | |
| 13423 library, | |
| 13424 r''' | |
| 13425 class C { | |
| 13426 } | |
| 13427 '''); | |
| 13428 } else { | |
| 13429 checkElementText( | |
| 13430 library, | |
| 13431 r''' | |
| 13432 class C { | |
| 13433 } | |
| 13434 '''); | |
| 13435 } | |
| 5085 } | 13436 } |
| 5086 | 13437 |
| 5087 test_unresolved_annotation_prefixedNamedConstructorCall_noClass() { | 13438 test_unresolved_annotation_prefixedNamedConstructorCall_noClass() { |
| 5088 checkLibrary('import "dart:async" as foo; @foo.bar.baz() class C {}', | 13439 var library = checkLibrary( |
| 5089 allowErrors: true); | 13440 'import "dart:async" as foo; @foo.bar.baz() class C {}', |
| 13441 allowErrors: true); | |
| 13442 if (isStrongMode) { | |
| 13443 checkElementText( | |
| 13444 library, | |
| 13445 r''' | |
| 13446 import 'dart:async' as foo; | |
| 13447 class C { | |
| 13448 } | |
| 13449 '''); | |
| 13450 } else { | |
| 13451 checkElementText( | |
| 13452 library, | |
| 13453 r''' | |
| 13454 import 'dart:async' as foo; | |
| 13455 class C { | |
| 13456 } | |
| 13457 '''); | |
| 13458 } | |
| 5090 } | 13459 } |
| 5091 | 13460 |
| 5092 test_unresolved_annotation_prefixedNamedConstructorCall_noConstructor() { | 13461 test_unresolved_annotation_prefixedNamedConstructorCall_noConstructor() { |
| 5093 checkLibrary('import "dart:async" as foo; @foo.Future.bar() class C {}', | 13462 var library = checkLibrary( |
| 5094 allowErrors: true); | 13463 'import "dart:async" as foo; @foo.Future.bar() class C {}', |
| 13464 allowErrors: true); | |
| 13465 if (isStrongMode) { | |
| 13466 checkElementText( | |
| 13467 library, | |
| 13468 r''' | |
| 13469 import 'dart:async' as foo; | |
| 13470 class C { | |
| 13471 } | |
| 13472 '''); | |
| 13473 } else { | |
| 13474 checkElementText( | |
| 13475 library, | |
| 13476 r''' | |
| 13477 import 'dart:async' as foo; | |
| 13478 class C { | |
| 13479 } | |
| 13480 '''); | |
| 13481 } | |
| 5095 } | 13482 } |
| 5096 | 13483 |
| 5097 test_unresolved_annotation_prefixedUnnamedConstructorCall_badPrefix() { | 13484 test_unresolved_annotation_prefixedUnnamedConstructorCall_badPrefix() { |
| 5098 checkLibrary('@foo.bar() class C {}', allowErrors: true); | 13485 var library = checkLibrary('@foo.bar() class C {}', allowErrors: true); |
| 13486 if (isStrongMode) { | |
| 13487 checkElementText( | |
| 13488 library, | |
| 13489 r''' | |
| 13490 class C { | |
| 13491 } | |
| 13492 '''); | |
| 13493 } else { | |
| 13494 checkElementText( | |
| 13495 library, | |
| 13496 r''' | |
| 13497 class C { | |
| 13498 } | |
| 13499 '''); | |
| 13500 } | |
| 5099 } | 13501 } |
| 5100 | 13502 |
| 5101 test_unresolved_annotation_prefixedUnnamedConstructorCall_noClass() { | 13503 test_unresolved_annotation_prefixedUnnamedConstructorCall_noClass() { |
| 5102 checkLibrary('import "dart:async" as foo; @foo.bar() class C {}', | 13504 var library = checkLibrary( |
| 5103 allowErrors: true); | 13505 'import "dart:async" as foo; @foo.bar() class C {}', |
| 13506 allowErrors: true); | |
| 13507 if (isStrongMode) { | |
| 13508 checkElementText( | |
| 13509 library, | |
| 13510 r''' | |
| 13511 import 'dart:async' as foo; | |
| 13512 class C { | |
| 13513 } | |
| 13514 '''); | |
| 13515 } else { | |
| 13516 checkElementText( | |
| 13517 library, | |
| 13518 r''' | |
| 13519 import 'dart:async' as foo; | |
| 13520 class C { | |
| 13521 } | |
| 13522 '''); | |
| 13523 } | |
| 5104 } | 13524 } |
| 5105 | 13525 |
| 5106 test_unresolved_annotation_simpleIdentifier() { | 13526 test_unresolved_annotation_simpleIdentifier() { |
| 5107 checkLibrary('@foo class C {}', allowErrors: true); | 13527 var library = checkLibrary('@foo class C {}', allowErrors: true); |
| 13528 if (isStrongMode) { | |
| 13529 checkElementText( | |
| 13530 library, | |
| 13531 r''' | |
| 13532 class C { | |
| 13533 } | |
| 13534 '''); | |
| 13535 } else { | |
| 13536 checkElementText( | |
| 13537 library, | |
| 13538 r''' | |
| 13539 class C { | |
| 13540 } | |
| 13541 '''); | |
| 13542 } | |
| 5108 } | 13543 } |
| 5109 | 13544 |
| 5110 test_unresolved_annotation_unnamedConstructorCall_noClass() { | 13545 test_unresolved_annotation_unnamedConstructorCall_noClass() { |
| 5111 checkLibrary('@foo() class C {}', allowErrors: true); | 13546 var library = checkLibrary('@foo() class C {}', allowErrors: true); |
| 13547 if (isStrongMode) { | |
| 13548 checkElementText( | |
| 13549 library, | |
| 13550 r''' | |
| 13551 class C { | |
| 13552 } | |
| 13553 '''); | |
| 13554 } else { | |
| 13555 checkElementText( | |
| 13556 library, | |
| 13557 r''' | |
| 13558 class C { | |
| 13559 } | |
| 13560 '''); | |
| 13561 } | |
| 5112 } | 13562 } |
| 5113 | 13563 |
| 5114 test_unresolved_export() { | 13564 test_unresolved_export() { |
| 5115 allowMissingFiles = true; | 13565 allowMissingFiles = true; |
| 5116 checkLibrary("export 'foo.dart';", allowErrors: true); | 13566 var library = checkLibrary("export 'foo.dart';", allowErrors: true); |
| 13567 if (isStrongMode) { | |
| 13568 checkElementText( | |
| 13569 library, | |
| 13570 r''' | |
| 13571 export 'foo.dart'; | |
| 13572 '''); | |
| 13573 } else { | |
| 13574 checkElementText( | |
| 13575 library, | |
| 13576 r''' | |
| 13577 export 'foo.dart'; | |
| 13578 '''); | |
| 13579 } | |
| 5117 } | 13580 } |
| 5118 | 13581 |
| 5119 test_unresolved_import() { | 13582 test_unresolved_import() { |
| 5120 allowMissingFiles = true; | 13583 allowMissingFiles = true; |
| 5121 LibraryElementImpl library = | 13584 LibraryElementImpl library = |
| 5122 checkLibrary("import 'foo.dart';", allowErrors: true); | 13585 checkLibrary("import 'foo.dart';", allowErrors: true); |
| 5123 LibraryElement importedLibrary = library.imports[0].importedLibrary; | 13586 LibraryElement importedLibrary = library.imports[0].importedLibrary; |
| 5124 expect(importedLibrary.loadLibraryFunction, isNotNull); | 13587 expect(importedLibrary.loadLibraryFunction, isNotNull); |
| 5125 expect(importedLibrary.publicNamespace, isNotNull); | 13588 expect(importedLibrary.publicNamespace, isNotNull); |
| 5126 expect(importedLibrary.exportNamespace, isNotNull); | 13589 expect(importedLibrary.exportNamespace, isNotNull); |
| 13590 if (isStrongMode) { | |
| 13591 checkElementText( | |
| 13592 library, | |
| 13593 r''' | |
| 13594 import 'foo.dart'; | |
| 13595 '''); | |
| 13596 } else { | |
| 13597 checkElementText( | |
| 13598 library, | |
| 13599 r''' | |
| 13600 import 'foo.dart'; | |
| 13601 '''); | |
| 13602 } | |
| 5127 } | 13603 } |
| 5128 | 13604 |
| 5129 test_unresolved_part() { | 13605 test_unresolved_part() { |
| 5130 allowMissingFiles = true; | 13606 allowMissingFiles = true; |
| 5131 checkLibrary("part 'foo.dart';", allowErrors: true); | 13607 var library = checkLibrary("part 'foo.dart';", allowErrors: true); |
| 13608 if (isStrongMode) { | |
| 13609 checkElementText( | |
| 13610 library, | |
| 13611 r''' | |
| 13612 part 'foo.dart'; | |
| 13613 -------------------- | |
| 13614 unit: foo.dart | |
| 13615 | |
| 13616 '''); | |
| 13617 } else { | |
| 13618 checkElementText( | |
| 13619 library, | |
| 13620 r''' | |
| 13621 part 'foo.dart'; | |
| 13622 -------------------- | |
| 13623 unit: foo.dart | |
| 13624 | |
| 13625 '''); | |
| 13626 } | |
| 5132 } | 13627 } |
| 5133 | 13628 |
| 5134 test_unused_type_parameter() { | 13629 test_unused_type_parameter() { |
| 5135 checkLibrary(''' | 13630 var library = checkLibrary(''' |
| 5136 class C<T> { | 13631 class C<T> { |
| 5137 void f() {} | 13632 void f() {} |
| 5138 } | 13633 } |
| 5139 C<int> c; | 13634 C<int> c; |
| 5140 var v = c.f; | 13635 var v = c.f; |
| 5141 '''); | 13636 '''); |
| 13637 if (isStrongMode) { | |
| 13638 checkElementText( | |
| 13639 library, | |
| 13640 r''' | |
| 13641 class C<T> { | |
| 13642 void f() {} | |
| 13643 } | |
| 13644 C<int> c; | |
| 13645 () → void v; | |
| 13646 '''); | |
| 13647 } else { | |
| 13648 checkElementText( | |
| 13649 library, | |
| 13650 r''' | |
| 13651 class C<T> { | |
| 13652 void f() {} | |
| 13653 } | |
| 13654 C<int> c; | |
| 13655 var v; | |
| 13656 '''); | |
| 13657 } | |
| 5142 } | 13658 } |
| 5143 | 13659 |
| 5144 test_variable_const() { | 13660 test_variable_const() { |
| 5145 checkLibrary('const int i = 0;'); | 13661 var library = checkLibrary('const int i = 0;'); |
| 13662 if (isStrongMode) { | |
| 13663 checkElementText( | |
| 13664 library, | |
| 13665 r''' | |
| 13666 const int i; | |
| 13667 '''); | |
| 13668 } else { | |
| 13669 checkElementText( | |
| 13670 library, | |
| 13671 r''' | |
| 13672 const int i; | |
| 13673 '''); | |
| 13674 } | |
| 5146 } | 13675 } |
| 5147 | 13676 |
| 5148 test_variable_documented() { | 13677 test_variable_documented() { |
| 5149 checkLibrary(''' | 13678 var library = checkLibrary(''' |
| 5150 // Extra comment so doc comment offset != 0 | 13679 // Extra comment so doc comment offset != 0 |
| 5151 /** | 13680 /** |
| 5152 * Docs | 13681 * Docs |
| 5153 */ | 13682 */ |
| 5154 var x;'''); | 13683 var x;'''); |
| 13684 if (isStrongMode) { | |
| 13685 checkElementText( | |
| 13686 library, | |
| 13687 r''' | |
| 13688 var x; | |
| 13689 '''); | |
| 13690 } else { | |
| 13691 checkElementText( | |
| 13692 library, | |
| 13693 r''' | |
| 13694 var x; | |
| 13695 '''); | |
| 13696 } | |
| 5155 } | 13697 } |
| 5156 | 13698 |
| 5157 test_variable_final() { | 13699 test_variable_final() { |
| 5158 checkLibrary('final int x = 0;'); | 13700 var library = checkLibrary('final int x = 0;'); |
| 13701 if (isStrongMode) { | |
| 13702 checkElementText( | |
| 13703 library, | |
| 13704 r''' | |
| 13705 final int x; | |
| 13706 '''); | |
| 13707 } else { | |
| 13708 checkElementText( | |
| 13709 library, | |
| 13710 r''' | |
| 13711 final int x; | |
| 13712 '''); | |
| 13713 } | |
| 5159 } | 13714 } |
| 5160 | 13715 |
| 5161 test_variable_final_top_level_untyped() { | 13716 test_variable_final_top_level_untyped() { |
| 5162 checkLibrary('final v = 0;'); | 13717 var library = checkLibrary('final v = 0;'); |
| 13718 if (isStrongMode) { | |
| 13719 checkElementText( | |
| 13720 library, | |
| 13721 r''' | |
| 13722 final int v; | |
| 13723 '''); | |
| 13724 } else { | |
| 13725 checkElementText( | |
| 13726 library, | |
| 13727 r''' | |
| 13728 final v; | |
| 13729 '''); | |
| 13730 } | |
| 5163 } | 13731 } |
| 5164 | 13732 |
| 5165 test_variable_getterInLib_setterInPart() { | 13733 test_variable_getterInLib_setterInPart() { |
| 5166 addSource('/a.dart', 'part of my.lib; void set x(int _) {}'); | 13734 addSource('/a.dart', 'part of my.lib; void set x(int _) {}'); |
| 5167 checkLibrary('library my.lib; part "a.dart"; int get x => 42;'); | 13735 var library = |
| 13736 checkLibrary('library my.lib; part "a.dart"; int get x => 42;'); | |
| 13737 if (isStrongMode) { | |
| 13738 checkElementText( | |
| 13739 library, | |
| 13740 r''' | |
| 13741 library my.lib; | |
| 13742 part 'a.dart'; | |
| 13743 int get x {} | |
| 13744 -------------------- | |
| 13745 unit: a.dart | |
| 13746 | |
| 13747 void set x(int _) {} | |
| 13748 '''); | |
| 13749 } else { | |
| 13750 checkElementText( | |
| 13751 library, | |
| 13752 r''' | |
| 13753 library my.lib; | |
| 13754 part 'a.dart'; | |
| 13755 int get x {} | |
| 13756 -------------------- | |
| 13757 unit: a.dart | |
| 13758 | |
| 13759 void set x(int _) {} | |
| 13760 '''); | |
| 13761 } | |
| 5168 } | 13762 } |
| 5169 | 13763 |
| 5170 test_variable_getterInPart_setterInLib() { | 13764 test_variable_getterInPart_setterInLib() { |
| 5171 addSource('/a.dart', 'part of my.lib; int get x => 42;'); | 13765 addSource('/a.dart', 'part of my.lib; int get x => 42;'); |
| 5172 checkLibrary('library my.lib; part "a.dart"; void set x(int _) {}'); | 13766 var library = |
| 13767 checkLibrary('library my.lib; part "a.dart"; void set x(int _) {}'); | |
| 13768 if (isStrongMode) { | |
| 13769 checkElementText( | |
| 13770 library, | |
| 13771 r''' | |
| 13772 library my.lib; | |
| 13773 part 'a.dart'; | |
| 13774 void set x(int _) {} | |
| 13775 -------------------- | |
| 13776 unit: a.dart | |
| 13777 | |
| 13778 int get x {} | |
| 13779 '''); | |
| 13780 } else { | |
| 13781 checkElementText( | |
| 13782 library, | |
| 13783 r''' | |
| 13784 library my.lib; | |
| 13785 part 'a.dart'; | |
| 13786 void set x(int _) {} | |
| 13787 -------------------- | |
| 13788 unit: a.dart | |
| 13789 | |
| 13790 int get x {} | |
| 13791 '''); | |
| 13792 } | |
| 5173 } | 13793 } |
| 5174 | 13794 |
| 5175 test_variable_getterInPart_setterInPart() { | 13795 test_variable_getterInPart_setterInPart() { |
| 5176 addSource('/a.dart', 'part of my.lib; int get x => 42;'); | 13796 addSource('/a.dart', 'part of my.lib; int get x => 42;'); |
| 5177 addSource('/b.dart', 'part of my.lib; void set x(int _) {}'); | 13797 addSource('/b.dart', 'part of my.lib; void set x(int _) {}'); |
| 5178 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); | 13798 var library = checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); |
| 13799 if (isStrongMode) { | |
| 13800 checkElementText( | |
| 13801 library, | |
| 13802 r''' | |
| 13803 library my.lib; | |
| 13804 part 'a.dart'; | |
| 13805 part 'b.dart'; | |
| 13806 -------------------- | |
| 13807 unit: a.dart | |
| 13808 | |
| 13809 int get x {} | |
| 13810 -------------------- | |
| 13811 unit: b.dart | |
| 13812 | |
| 13813 void set x(int _) {} | |
| 13814 '''); | |
| 13815 } else { | |
| 13816 checkElementText( | |
| 13817 library, | |
| 13818 r''' | |
| 13819 library my.lib; | |
| 13820 part 'a.dart'; | |
| 13821 part 'b.dart'; | |
| 13822 -------------------- | |
| 13823 unit: a.dart | |
| 13824 | |
| 13825 int get x {} | |
| 13826 -------------------- | |
| 13827 unit: b.dart | |
| 13828 | |
| 13829 void set x(int _) {} | |
| 13830 '''); | |
| 13831 } | |
| 5179 } | 13832 } |
| 5180 | 13833 |
| 5181 test_variable_implicit_type() { | 13834 test_variable_implicit_type() { |
| 5182 checkLibrary('var x;'); | 13835 var library = checkLibrary('var x;'); |
| 13836 if (isStrongMode) { | |
| 13837 checkElementText( | |
| 13838 library, | |
| 13839 r''' | |
| 13840 var x; | |
| 13841 '''); | |
| 13842 } else { | |
| 13843 checkElementText( | |
| 13844 library, | |
| 13845 r''' | |
| 13846 var x; | |
| 13847 '''); | |
| 13848 } | |
| 5183 } | 13849 } |
| 5184 | 13850 |
| 5185 test_variable_inferred_type_implicit_initialized() { | 13851 test_variable_inferred_type_implicit_initialized() { |
| 5186 checkLibrary('var v = 0;'); | 13852 var library = checkLibrary('var v = 0;'); |
| 13853 if (isStrongMode) { | |
| 13854 checkElementText( | |
| 13855 library, | |
| 13856 r''' | |
| 13857 int v; | |
| 13858 '''); | |
| 13859 } else { | |
| 13860 checkElementText( | |
| 13861 library, | |
| 13862 r''' | |
| 13863 var v; | |
| 13864 '''); | |
| 13865 } | |
| 5187 } | 13866 } |
| 5188 | 13867 |
| 5189 test_variable_propagatedType_const_noDep() { | 13868 test_variable_propagatedType_const_noDep() { |
| 5190 checkLibrary('const i = 0;'); | 13869 var library = checkLibrary('const i = 0;'); |
| 13870 if (isStrongMode) { | |
| 13871 checkElementText( | |
| 13872 library, | |
| 13873 r''' | |
| 13874 const int i; | |
| 13875 '''); | |
| 13876 } else { | |
| 13877 checkElementText( | |
| 13878 library, | |
| 13879 r''' | |
| 13880 const i; | |
| 13881 '''); | |
| 13882 } | |
| 5191 } | 13883 } |
| 5192 | 13884 |
| 5193 test_variable_propagatedType_final_dep_inLib() { | 13885 test_variable_propagatedType_final_dep_inLib() { |
| 5194 addLibrarySource('/a.dart', 'final a = 1;'); | 13886 addLibrarySource('/a.dart', 'final a = 1;'); |
| 5195 checkLibrary('import "a.dart"; final b = a / 2;'); | 13887 var library = checkLibrary('import "a.dart"; final b = a / 2;'); |
| 13888 if (isStrongMode) { | |
| 13889 checkElementText( | |
| 13890 library, | |
| 13891 r''' | |
| 13892 import 'a.dart'; | |
| 13893 final num b; | |
| 13894 '''); | |
| 13895 } else { | |
| 13896 checkElementText( | |
| 13897 library, | |
| 13898 r''' | |
| 13899 import 'a.dart'; | |
| 13900 final b; | |
| 13901 '''); | |
| 13902 } | |
| 5196 } | 13903 } |
| 5197 | 13904 |
| 5198 test_variable_propagatedType_final_dep_inPart() { | 13905 test_variable_propagatedType_final_dep_inPart() { |
| 5199 addSource('/a.dart', 'part of lib; final a = 1;'); | 13906 addSource('/a.dart', 'part of lib; final a = 1;'); |
| 5200 checkLibrary('library lib; part "a.dart"; final b = a / 2;'); | 13907 var library = checkLibrary('library lib; part "a.dart"; final b = a / 2;'); |
| 13908 if (isStrongMode) { | |
| 13909 checkElementText( | |
| 13910 library, | |
| 13911 r''' | |
| 13912 library lib; | |
| 13913 part 'a.dart'; | |
| 13914 final num b; | |
| 13915 -------------------- | |
| 13916 unit: a.dart | |
| 13917 | |
| 13918 final int a; | |
| 13919 '''); | |
| 13920 } else { | |
| 13921 checkElementText( | |
| 13922 library, | |
| 13923 r''' | |
| 13924 library lib; | |
| 13925 part 'a.dart'; | |
| 13926 final b; | |
| 13927 -------------------- | |
| 13928 unit: a.dart | |
| 13929 | |
| 13930 final a; | |
| 13931 '''); | |
| 13932 } | |
| 5201 } | 13933 } |
| 5202 | 13934 |
| 5203 test_variable_propagatedType_final_noDep() { | 13935 test_variable_propagatedType_final_noDep() { |
| 5204 checkLibrary('final i = 0;'); | 13936 var library = checkLibrary('final i = 0;'); |
| 13937 if (isStrongMode) { | |
| 13938 checkElementText( | |
| 13939 library, | |
| 13940 r''' | |
| 13941 final int i; | |
| 13942 '''); | |
| 13943 } else { | |
| 13944 checkElementText( | |
| 13945 library, | |
| 13946 r''' | |
| 13947 final i; | |
| 13948 '''); | |
| 13949 } | |
| 5205 } | 13950 } |
| 5206 | 13951 |
| 5207 test_variable_propagatedType_implicit_dep() { | 13952 test_variable_propagatedType_implicit_dep() { |
| 5208 // The propagated type is defined in a library that is not imported. | 13953 // The propagated type is defined in a library that is not imported. |
| 5209 addLibrarySource('/a.dart', 'class C {}'); | 13954 addLibrarySource('/a.dart', 'class C {}'); |
| 5210 addLibrarySource('/b.dart', 'import "a.dart"; C f() => null;'); | 13955 addLibrarySource('/b.dart', 'import "a.dart"; C f() => null;'); |
| 5211 checkLibrary('import "b.dart"; final x = f();'); | 13956 var library = checkLibrary('import "b.dart"; final x = f();'); |
| 13957 if (isStrongMode) { | |
| 13958 checkElementText( | |
| 13959 library, | |
| 13960 r''' | |
| 13961 import 'b.dart'; | |
| 13962 final C x; | |
| 13963 '''); | |
| 13964 } else { | |
| 13965 checkElementText( | |
| 13966 library, | |
| 13967 r''' | |
| 13968 import 'b.dart'; | |
| 13969 final x; | |
| 13970 '''); | |
| 13971 } | |
| 5212 } | 13972 } |
| 5213 | 13973 |
| 5214 test_variable_setterInPart_getterInPart() { | 13974 test_variable_setterInPart_getterInPart() { |
| 5215 addSource('/a.dart', 'part of my.lib; void set x(int _) {}'); | 13975 addSource('/a.dart', 'part of my.lib; void set x(int _) {}'); |
| 5216 addSource('/b.dart', 'part of my.lib; int get x => 42;'); | 13976 addSource('/b.dart', 'part of my.lib; int get x => 42;'); |
| 5217 checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); | 13977 var library = checkLibrary('library my.lib; part "a.dart"; part "b.dart";'); |
| 13978 if (isStrongMode) { | |
| 13979 checkElementText( | |
| 13980 library, | |
| 13981 r''' | |
| 13982 library my.lib; | |
| 13983 part 'a.dart'; | |
| 13984 part 'b.dart'; | |
| 13985 -------------------- | |
| 13986 unit: a.dart | |
| 13987 | |
| 13988 void set x(int _) {} | |
| 13989 -------------------- | |
| 13990 unit: b.dart | |
| 13991 | |
| 13992 int get x {} | |
| 13993 '''); | |
| 13994 } else { | |
| 13995 checkElementText( | |
| 13996 library, | |
| 13997 r''' | |
| 13998 library my.lib; | |
| 13999 part 'a.dart'; | |
| 14000 part 'b.dart'; | |
| 14001 -------------------- | |
| 14002 unit: a.dart | |
| 14003 | |
| 14004 void set x(int _) {} | |
| 14005 -------------------- | |
| 14006 unit: b.dart | |
| 14007 | |
| 14008 int get x {} | |
| 14009 '''); | |
| 14010 } | |
| 5218 } | 14011 } |
| 5219 | 14012 |
| 5220 test_variables() { | 14013 test_variables() { |
| 5221 checkLibrary('int i; int j;'); | 14014 var library = checkLibrary('int i; int j;'); |
| 14015 if (isStrongMode) { | |
| 14016 checkElementText( | |
| 14017 library, | |
| 14018 r''' | |
| 14019 int i; | |
| 14020 int j; | |
| 14021 '''); | |
| 14022 } else { | |
| 14023 checkElementText( | |
| 14024 library, | |
| 14025 r''' | |
| 14026 int i; | |
| 14027 int j; | |
| 14028 '''); | |
| 14029 } | |
| 5222 } | 14030 } |
| 5223 | 14031 |
| 5224 /** | 14032 /** |
| 5225 * Encode the library containing [original] into a summary and then use | 14033 * Encode the library containing [original] into a summary and then use |
| 5226 * [TestSummaryResynthesizer.getElement] to retrieve just the original | 14034 * [TestSummaryResynthesizer.getElement] to retrieve just the original |
| 5227 * element from the resynthesized summary. | 14035 * element from the resynthesized summary. |
| 5228 */ | 14036 */ |
| 5229 Element validateGetElement(String text, Element original) { | 14037 Element validateGetElement(String text, Element original) { |
| 5230 SummaryResynthesizer resynthesizer = | 14038 SummaryResynthesizer resynthesizer = |
| 5231 encodeDecodeLibrarySource(original.library.source); | 14039 encodeDecodeLibrarySource(original.library.source); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5284 fail('Unexpectedly tried to get unlinked summary for $uri'); | 14092 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 5285 } | 14093 } |
| 5286 return serializedUnit; | 14094 return serializedUnit; |
| 5287 } | 14095 } |
| 5288 | 14096 |
| 5289 @override | 14097 @override |
| 5290 bool hasLibrarySummary(String uri) { | 14098 bool hasLibrarySummary(String uri) { |
| 5291 return true; | 14099 return true; |
| 5292 } | 14100 } |
| 5293 } | 14101 } |
| OLD | NEW |