| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.resolver_test; | 4 library engine.resolver_test; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'package:analyzer-experimental/src/generated/java_core.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 8 import 'package:analyzer-experimental/src/generated/java_engine.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 9 import 'package:analyzer-experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 10 import 'package:analyzer-experimental/src/generated/source_io.dart'; | 10 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 11 import 'package:analyzer-experimental/src/generated/error.dart'; | 11 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 12 import 'package:analyzer-experimental/src/generated/scanner.dart'; | 12 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 13 import 'package:analyzer-experimental/src/generated/element.dart'; | 13 import 'package:analyzer_experimental/src/generated/element.dart'; |
| 14 import 'package:analyzer-experimental/src/generated/resolver.dart'; | 14 import 'package:analyzer_experimental/src/generated/resolver.dart'; |
| 15 import 'package:analyzer-experimental/src/generated/engine.dart'; | 15 import 'package:analyzer_experimental/src/generated/engine.dart'; |
| 16 import 'package:analyzer-experimental/src/generated/java_engine_io.dart'; | 16 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; |
| 17 import 'package:analyzer-experimental/src/generated/ast.dart' hide Annotation; | 17 import 'package:analyzer_experimental/src/generated/ast.dart' hide Annotation; |
| 18 import 'package:analyzer-experimental/src/generated/sdk.dart' show DartSdk; | 18 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; |
| 19 import 'package:unittest/unittest.dart' as _ut; | 19 import 'package:unittest/unittest.dart' as _ut; |
| 20 import 'test_support.dart'; | 20 import 'test_support.dart'; |
| 21 import 'ast_test.dart' show ASTFactory; | 21 import 'ast_test.dart' show ASTFactory; |
| 22 import 'element_test.dart' show ElementFactory; | 22 import 'element_test.dart' show ElementFactory; |
| 23 | 23 |
| 24 class LibraryTest extends EngineTestCase { | 24 class LibraryTest extends EngineTestCase { |
| 25 /** | 25 /** |
| 26 * The error listener to which all errors will be reported. | 26 * The error listener to which all errors will be reported. |
| 27 */ | 27 */ |
| 28 GatheringErrorListener _errorListener; | 28 GatheringErrorListener _errorListener; |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 verify([source]); | 908 verify([source]); |
| 909 } | 909 } |
| 910 void fail_ambiguousImport_typeAnnotation() { | 910 void fail_ambiguousImport_typeAnnotation() { |
| 911 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "import 'lib1.dart';", "import 'lib2.dart';", "class A extends N {}"])); | 911 Source source = addSource("/test.dart", EngineTestCase.createSource(["librar
y L;", "import 'lib1.dart';", "import 'lib2.dart';", "class A extends N {}"])); |
| 912 addSource("/lib1.dart", EngineTestCase.createSource(["class N {}"])); | 912 addSource("/lib1.dart", EngineTestCase.createSource(["class N {}"])); |
| 913 addSource("/lib2.dart", EngineTestCase.createSource(["class N {}"])); | 913 addSource("/lib2.dart", EngineTestCase.createSource(["class N {}"])); |
| 914 resolve(source, []); | 914 resolve(source, []); |
| 915 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 915 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); |
| 916 verify([source]); | 916 verify([source]); |
| 917 } | 917 } |
| 918 void fail_caseExpressionTypeImplementsEquals() { | |
| 919 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", " bool
operator ==(IntWrapper x) {", " return value == x.value;", " }", "}", "", "f
(IntWrapper a) {", " switch(a) {", " case(const IntWrapper(1)) : return 1;",
" default: return 0;", " }", "}"])); | |
| 920 resolve(source, []); | |
| 921 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); | |
| 922 verify([source]); | |
| 923 } | |
| 924 void fail_compileTimeConstantRaisesException() { | 918 void fail_compileTimeConstantRaisesException() { |
| 925 Source source = addSource("/test.dart", EngineTestCase.createSource([])); | 919 Source source = addSource("/test.dart", EngineTestCase.createSource([])); |
| 926 resolve(source, []); | 920 resolve(source, []); |
| 927 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION]); | 921 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION]); |
| 928 verify([source]); | 922 verify([source]); |
| 929 } | 923 } |
| 930 void fail_constEvalThrowsException() { | 924 void fail_constEvalThrowsException() { |
| 931 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {", " const C() { throw null; }", "}", "f() { return const C(); }"])); | 925 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {", " const C() { throw null; }", "}", "f() { return const C(); }"])); |
| 932 resolve(source, []); | 926 resolve(source, []); |
| 933 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); | 927 assertErrors([CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]); |
| 934 verify([source]); | 928 verify([source]); |
| 935 } | 929 } |
| 936 void fail_constWithNonConst() { | |
| 937 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {", " T(a, b, {c, d}) {};", "}", "f() { return const T(0, 1, c: 2, d: 3); }"]
)); | |
| 938 resolve(source, []); | |
| 939 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONST]); | |
| 940 verify([source]); | |
| 941 } | |
| 942 void fail_constWithNonConstantArgument() { | 930 void fail_constWithNonConstantArgument() { |
| 943 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {", " T(a) {};", "}", "f(p) { return const T(p); }"])); | 931 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {", " T(a) {};", "}", "f(p) { return const T(p); }"])); |
| 944 resolve(source, []); | 932 resolve(source, []); |
| 945 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); | 933 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]); |
| 946 verify([source]); | 934 verify([source]); |
| 947 } | 935 } |
| 948 void fail_constWithNonType() { | 936 void fail_constWithNonType() { |
| 949 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "f() {", " return const A();", "}"])); | 937 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "f() {", " return const A();", "}"])); |
| 950 resolve(source, []); | 938 resolve(source, []); |
| 951 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); | 939 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_TYPE]); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 resolve(source, []); | 1308 resolve(source, []); |
| 1321 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); | 1309 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| 1322 verify([source]); | 1310 verify([source]); |
| 1323 } | 1311 } |
| 1324 void fail_nonConstantDefaultValue_positional() { | 1312 void fail_nonConstantDefaultValue_positional() { |
| 1325 Source source = addSource("/test.dart", EngineTestCase.createSource(["f([x =
2 + 3]) {}"])); | 1313 Source source = addSource("/test.dart", EngineTestCase.createSource(["f([x =
2 + 3]) {}"])); |
| 1326 resolve(source, []); | 1314 resolve(source, []); |
| 1327 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); | 1315 assertErrors([CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]); |
| 1328 verify([source]); | 1316 verify([source]); |
| 1329 } | 1317 } |
| 1330 void fail_nonConstCaseExpression() { | |
| 1331 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p) {", " switch (p) {", " case 3 + 4:", " break;", " }", "}"])); | |
| 1332 resolve(source, []); | |
| 1333 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); | |
| 1334 verify([source]); | |
| 1335 } | |
| 1336 void fail_nonConstMapAsExpressionStatement() { | 1318 void fail_nonConstMapAsExpressionStatement() { |
| 1337 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " {'a' : 0, 'b' : 1};", "}"])); | 1319 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " {'a' : 0, 'b' : 1};", "}"])); |
| 1338 resolve(source, []); | 1320 resolve(source, []); |
| 1339 assertErrors([CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]); | 1321 assertErrors([CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]); |
| 1340 verify([source]); | 1322 verify([source]); |
| 1341 } | 1323 } |
| 1342 void fail_nonConstMapKey() { | 1324 void fail_nonConstMapKey() { |
| 1343 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {a : 0};", "}"])); | 1325 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {a : 0};", "}"])); |
| 1344 resolve(source, []); | 1326 resolve(source, []); |
| 1345 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]); | 1327 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 resolve(source, []); | 1615 resolve(source, []); |
| 1634 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]); | 1616 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]); |
| 1635 verify([source]); | 1617 verify([source]); |
| 1636 } | 1618 } |
| 1637 void test_builtInIdentifierAsTypeVariableName() { | 1619 void test_builtInIdentifierAsTypeVariableName() { |
| 1638 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<as> {}"])); | 1620 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A<as> {}"])); |
| 1639 resolve(source, []); | 1621 resolve(source, []); |
| 1640 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); | 1622 assertErrors([CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME
]); |
| 1641 verify([source]); | 1623 verify([source]); |
| 1642 } | 1624 } |
| 1625 void test_caseExpressionTypeImplementsEquals() { |
| 1626 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", " bool
operator ==(IntWrapper x) {", " return value == x.value;", " }", "}", "", "f
(IntWrapper a) {", " switch(a) {", " case(const IntWrapper(1)) : return 1;",
" default: return 0;", " }", "}"])); |
| 1627 resolve(source, []); |
| 1628 assertErrors([CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]); |
| 1629 verify([source]); |
| 1630 } |
| 1643 void test_compileTimeConstantRaisesExceptionDivideByZero() { | 1631 void test_compileTimeConstantRaisesExceptionDivideByZero() { |
| 1644 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
int INF = 0 / 0;"])); | 1632 Source source = addSource("/test.dart", EngineTestCase.createSource(["const
int INF = 0 / 0;"])); |
| 1645 resolve(source, []); | 1633 resolve(source, []); |
| 1646 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DI
VIDE_BY_ZERO]); | 1634 assertErrors([CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DI
VIDE_BY_ZERO]); |
| 1647 verify([source]); | 1635 verify([source]); |
| 1648 } | 1636 } |
| 1649 void test_conflictingConstructorNameAndMember_field() { | 1637 void test_conflictingConstructorNameAndMember_field() { |
| 1650 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A.x() {}", "}"])); | 1638 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " int x;", " A.x() {}", "}"])); |
| 1651 resolve(source, []); | 1639 resolve(source, []); |
| 1652 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); | 1640 assertErrors([CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1681 resolve(source, []); | 1669 resolve(source, []); |
| 1682 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); | 1670 assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]); |
| 1683 verify([source]); | 1671 verify([source]); |
| 1684 } | 1672 } |
| 1685 void test_constWithInvalidTypeParameters() { | 1673 void test_constWithInvalidTypeParameters() { |
| 1686 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A() {}", "}", "f() { return const A<A>(); }"])); | 1674 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A() {}", "}", "f() { return const A<A>(); }"])); |
| 1687 resolve(source, []); | 1675 resolve(source, []); |
| 1688 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); | 1676 assertErrors([CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]); |
| 1689 verify([source]); | 1677 verify([source]); |
| 1690 } | 1678 } |
| 1679 void test_constWithNonConst() { |
| 1680 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
T {", " T(a, b, {c, d}) {}", "}", "f() { return const T(0, 1, c: 2, d: 3); }"])
); |
| 1681 resolve(source, []); |
| 1682 assertErrors([CompileTimeErrorCode.CONST_WITH_NON_CONST]); |
| 1683 verify([source]); |
| 1684 } |
| 1691 void test_duplicateMemberError() { | 1685 void test_duplicateMemberError() { |
| 1692 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';", "part 'b.dart';"])); | 1686 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part 'a.dart';", "part 'b.dart';"])); |
| 1693 Source sourceA = addSource("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 1687 Source sourceA = addSource("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 1694 Source sourceB = addSource("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 1688 Source sourceB = addSource("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 1695 resolve(librarySource, [sourceA, sourceB]); | 1689 resolve(librarySource, [sourceA, sourceB]); |
| 1696 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 1690 assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 1697 verify([librarySource, sourceA, sourceB]); | 1691 verify([librarySource, sourceA, sourceB]); |
| 1698 } | 1692 } |
| 1699 void test_extendsNonClass() { | 1693 void test_extendsNonClass() { |
| 1700 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B extends A {}"])); | 1694 Source source = addSource("/test.dart", EngineTestCase.createSource(["int A;
", "class B extends A {}"])); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1722 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " continue y;", " }", "}"])); | 1716 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " x: while (true) {", " continue y;", " }", "}"])); |
| 1723 resolve(source, []); | 1717 resolve(source, []); |
| 1724 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); | 1718 assertErrors([CompileTimeErrorCode.LABEL_UNDEFINED]); |
| 1725 } | 1719 } |
| 1726 void test_newWithInvalidTypeParameters() { | 1720 void test_newWithInvalidTypeParameters() { |
| 1727 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { return new A<A>(); }"])); | 1721 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {}", "f() { return new A<A>(); }"])); |
| 1728 resolve(source, []); | 1722 resolve(source, []); |
| 1729 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); | 1723 assertErrors([CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); |
| 1730 verify([source]); | 1724 verify([source]); |
| 1731 } | 1725 } |
| 1726 void test_nonConstCaseExpression() { |
| 1727 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
p, int q) {", " switch (p) {", " case 3 + q:", " break;", " }", "}"]))
; |
| 1728 resolve(source, []); |
| 1729 assertErrors([CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]); |
| 1730 verify([source]); |
| 1731 } |
| 1732 void test_nonConstListElement() { | 1732 void test_nonConstListElement() { |
| 1733 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const [a];", "}"])); | 1733 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const [a];", "}"])); |
| 1734 resolve(source, []); | 1734 resolve(source, []); |
| 1735 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); | 1735 assertErrors([CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]); |
| 1736 verify([source]); | 1736 verify([source]); |
| 1737 } | 1737 } |
| 1738 void test_nonConstMapValue() { | 1738 void test_nonConstMapValue() { |
| 1739 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {'a' : a};", "}"])); | 1739 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(a) {
", " return const {'a' : a};", "}"])); |
| 1740 resolve(source, []); | 1740 resolve(source, []); |
| 1741 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); | 1741 assertErrors([CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1770 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeVariableName); | 1770 runJUnitTest(__test, __test.test_builtInIdentifierAsTypeVariableName); |
| 1771 }); | 1771 }); |
| 1772 _ut.test('test_builtInIdentifierAsTypedefName_classTypeAlias', () { | 1772 _ut.test('test_builtInIdentifierAsTypedefName_classTypeAlias', () { |
| 1773 final __test = new CompileTimeErrorCodeTest(); | 1773 final __test = new CompileTimeErrorCodeTest(); |
| 1774 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_classTyp
eAlias); | 1774 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_classTyp
eAlias); |
| 1775 }); | 1775 }); |
| 1776 _ut.test('test_builtInIdentifierAsTypedefName_functionTypeAlias', () { | 1776 _ut.test('test_builtInIdentifierAsTypedefName_functionTypeAlias', () { |
| 1777 final __test = new CompileTimeErrorCodeTest(); | 1777 final __test = new CompileTimeErrorCodeTest(); |
| 1778 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_function
TypeAlias); | 1778 runJUnitTest(__test, __test.test_builtInIdentifierAsTypedefName_function
TypeAlias); |
| 1779 }); | 1779 }); |
| 1780 _ut.test('test_caseExpressionTypeImplementsEquals', () { |
| 1781 final __test = new CompileTimeErrorCodeTest(); |
| 1782 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals); |
| 1783 }); |
| 1780 _ut.test('test_compileTimeConstantRaisesExceptionDivideByZero', () { | 1784 _ut.test('test_compileTimeConstantRaisesExceptionDivideByZero', () { |
| 1781 final __test = new CompileTimeErrorCodeTest(); | 1785 final __test = new CompileTimeErrorCodeTest(); |
| 1782 runJUnitTest(__test, __test.test_compileTimeConstantRaisesExceptionDivid
eByZero); | 1786 runJUnitTest(__test, __test.test_compileTimeConstantRaisesExceptionDivid
eByZero); |
| 1783 }); | 1787 }); |
| 1784 _ut.test('test_conflictingConstructorNameAndMember_field', () { | 1788 _ut.test('test_conflictingConstructorNameAndMember_field', () { |
| 1785 final __test = new CompileTimeErrorCodeTest(); | 1789 final __test = new CompileTimeErrorCodeTest(); |
| 1786 runJUnitTest(__test, __test.test_conflictingConstructorNameAndMember_fie
ld); | 1790 runJUnitTest(__test, __test.test_conflictingConstructorNameAndMember_fie
ld); |
| 1787 }); | 1791 }); |
| 1788 _ut.test('test_conflictingConstructorNameAndMember_method', () { | 1792 _ut.test('test_conflictingConstructorNameAndMember_method', () { |
| 1789 final __test = new CompileTimeErrorCodeTest(); | 1793 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1802 runJUnitTest(__test, __test.test_constFormalParameter_simpleFormalParame
ter); | 1806 runJUnitTest(__test, __test.test_constFormalParameter_simpleFormalParame
ter); |
| 1803 }); | 1807 }); |
| 1804 _ut.test('test_constInitializedWithNonConstValue', () { | 1808 _ut.test('test_constInitializedWithNonConstValue', () { |
| 1805 final __test = new CompileTimeErrorCodeTest(); | 1809 final __test = new CompileTimeErrorCodeTest(); |
| 1806 runJUnitTest(__test, __test.test_constInitializedWithNonConstValue); | 1810 runJUnitTest(__test, __test.test_constInitializedWithNonConstValue); |
| 1807 }); | 1811 }); |
| 1808 _ut.test('test_constWithInvalidTypeParameters', () { | 1812 _ut.test('test_constWithInvalidTypeParameters', () { |
| 1809 final __test = new CompileTimeErrorCodeTest(); | 1813 final __test = new CompileTimeErrorCodeTest(); |
| 1810 runJUnitTest(__test, __test.test_constWithInvalidTypeParameters); | 1814 runJUnitTest(__test, __test.test_constWithInvalidTypeParameters); |
| 1811 }); | 1815 }); |
| 1816 _ut.test('test_constWithNonConst', () { |
| 1817 final __test = new CompileTimeErrorCodeTest(); |
| 1818 runJUnitTest(__test, __test.test_constWithNonConst); |
| 1819 }); |
| 1812 _ut.test('test_duplicateMemberError', () { | 1820 _ut.test('test_duplicateMemberError', () { |
| 1813 final __test = new CompileTimeErrorCodeTest(); | 1821 final __test = new CompileTimeErrorCodeTest(); |
| 1814 runJUnitTest(__test, __test.test_duplicateMemberError); | 1822 runJUnitTest(__test, __test.test_duplicateMemberError); |
| 1815 }); | 1823 }); |
| 1816 _ut.test('test_extendsNonClass', () { | 1824 _ut.test('test_extendsNonClass', () { |
| 1817 final __test = new CompileTimeErrorCodeTest(); | 1825 final __test = new CompileTimeErrorCodeTest(); |
| 1818 runJUnitTest(__test, __test.test_extendsNonClass); | 1826 runJUnitTest(__test, __test.test_extendsNonClass); |
| 1819 }); | 1827 }); |
| 1820 _ut.test('test_implementsNonClass', () { | 1828 _ut.test('test_implementsNonClass', () { |
| 1821 final __test = new CompileTimeErrorCodeTest(); | 1829 final __test = new CompileTimeErrorCodeTest(); |
| 1822 runJUnitTest(__test, __test.test_implementsNonClass); | 1830 runJUnitTest(__test, __test.test_implementsNonClass); |
| 1823 }); | 1831 }); |
| 1824 _ut.test('test_labelInOuterScope', () { | 1832 _ut.test('test_labelInOuterScope', () { |
| 1825 final __test = new CompileTimeErrorCodeTest(); | 1833 final __test = new CompileTimeErrorCodeTest(); |
| 1826 runJUnitTest(__test, __test.test_labelInOuterScope); | 1834 runJUnitTest(__test, __test.test_labelInOuterScope); |
| 1827 }); | 1835 }); |
| 1828 _ut.test('test_labelUndefined_break', () { | 1836 _ut.test('test_labelUndefined_break', () { |
| 1829 final __test = new CompileTimeErrorCodeTest(); | 1837 final __test = new CompileTimeErrorCodeTest(); |
| 1830 runJUnitTest(__test, __test.test_labelUndefined_break); | 1838 runJUnitTest(__test, __test.test_labelUndefined_break); |
| 1831 }); | 1839 }); |
| 1832 _ut.test('test_labelUndefined_continue', () { | 1840 _ut.test('test_labelUndefined_continue', () { |
| 1833 final __test = new CompileTimeErrorCodeTest(); | 1841 final __test = new CompileTimeErrorCodeTest(); |
| 1834 runJUnitTest(__test, __test.test_labelUndefined_continue); | 1842 runJUnitTest(__test, __test.test_labelUndefined_continue); |
| 1835 }); | 1843 }); |
| 1836 _ut.test('test_newWithInvalidTypeParameters', () { | 1844 _ut.test('test_newWithInvalidTypeParameters', () { |
| 1837 final __test = new CompileTimeErrorCodeTest(); | 1845 final __test = new CompileTimeErrorCodeTest(); |
| 1838 runJUnitTest(__test, __test.test_newWithInvalidTypeParameters); | 1846 runJUnitTest(__test, __test.test_newWithInvalidTypeParameters); |
| 1839 }); | 1847 }); |
| 1848 _ut.test('test_nonConstCaseExpression', () { |
| 1849 final __test = new CompileTimeErrorCodeTest(); |
| 1850 runJUnitTest(__test, __test.test_nonConstCaseExpression); |
| 1851 }); |
| 1840 _ut.test('test_nonConstListElement', () { | 1852 _ut.test('test_nonConstListElement', () { |
| 1841 final __test = new CompileTimeErrorCodeTest(); | 1853 final __test = new CompileTimeErrorCodeTest(); |
| 1842 runJUnitTest(__test, __test.test_nonConstListElement); | 1854 runJUnitTest(__test, __test.test_nonConstListElement); |
| 1843 }); | 1855 }); |
| 1844 _ut.test('test_nonConstMapValue', () { | 1856 _ut.test('test_nonConstMapValue', () { |
| 1845 final __test = new CompileTimeErrorCodeTest(); | 1857 final __test = new CompileTimeErrorCodeTest(); |
| 1846 runJUnitTest(__test, __test.test_nonConstMapValue); | 1858 runJUnitTest(__test, __test.test_nonConstMapValue); |
| 1847 }); | 1859 }); |
| 1848 _ut.test('test_uriWithInterpolation_constant', () { | 1860 _ut.test('test_uriWithInterpolation_constant', () { |
| 1849 final __test = new CompileTimeErrorCodeTest(); | 1861 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2321 void test_visitSimpleIdentifier_lexicalScope_field_setter() { | 2333 void test_visitSimpleIdentifier_lexicalScope_field_setter() { |
| 2322 InterfaceType intType5 = _typeProvider.intType; | 2334 InterfaceType intType5 = _typeProvider.intType; |
| 2323 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2335 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2324 String fieldName = "a"; | 2336 String fieldName = "a"; |
| 2325 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType5); | 2337 FieldElement field = ElementFactory.fieldElement(fieldName, false, false, fa
lse, intType5); |
| 2326 classA.fields = <FieldElement> [field]; | 2338 classA.fields = <FieldElement> [field]; |
| 2327 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; | 2339 classA.accessors = <PropertyAccessorElement> [field.getter, field.setter]; |
| 2328 SimpleIdentifier node = ASTFactory.identifier2(fieldName); | 2340 SimpleIdentifier node = ASTFactory.identifier2(fieldName); |
| 2329 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); | 2341 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); |
| 2330 resolveInClass(node, classA); | 2342 resolveInClass(node, classA); |
| 2331 Element element47 = node.element; | 2343 Element element50 = node.element; |
| 2332 EngineTestCase.assertInstanceOf(PropertyAccessorElement, element47); | 2344 EngineTestCase.assertInstanceOf(PropertyAccessorElement, element50); |
| 2333 JUnitTestCase.assertTrue(((element47 as PropertyAccessorElement)).isSetter()
); | 2345 JUnitTestCase.assertTrue(((element50 as PropertyAccessorElement)).isSetter()
); |
| 2334 _listener.assertNoErrors(); | 2346 _listener.assertNoErrors(); |
| 2335 } | 2347 } |
| 2336 void test_visitSuperConstructorInvocation() { | 2348 void test_visitSuperConstructorInvocation() { |
| 2337 ClassElementImpl superclass = ElementFactory.classElement2("A", []); | 2349 ClassElementImpl superclass = ElementFactory.classElement2("A", []); |
| 2338 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
null); | 2350 ConstructorElementImpl superConstructor = ElementFactory.constructorElement(
null); |
| 2339 superclass.constructors = <ConstructorElement> [superConstructor]; | 2351 superclass.constructors = <ConstructorElement> [superConstructor]; |
| 2340 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); | 2352 ClassElementImpl subclass = ElementFactory.classElement("B", superclass.type
, []); |
| 2341 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(nu
ll); | 2353 ConstructorElementImpl subConstructor = ElementFactory.constructorElement(nu
ll); |
| 2342 subclass.constructors = <ConstructorElement> [subConstructor]; | 2354 subclass.constructors = <ConstructorElement> [subConstructor]; |
| 2343 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([]); | 2355 SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocatio
n([]); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2902 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | 2914 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 2903 verify([source]); | 2915 verify([source]); |
| 2904 } | 2916 } |
| 2905 void fail_undefinedStaticMethodOrGetter_method() { | 2917 void fail_undefinedStaticMethodOrGetter_method() { |
| 2906 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " f(C.m());", "}"])); | 2918 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
C {}", "f(var p) {", " f(C.m());", "}"])); |
| 2907 resolve(source, []); | 2919 resolve(source, []); |
| 2908 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | 2920 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 2909 verify([source]); | 2921 verify([source]); |
| 2910 } | 2922 } |
| 2911 void test_constWithAbstractClass() { | 2923 void test_constWithAbstractClass() { |
| 2912 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class A {}", "void f() {", " A a = const A();", "}"])); | 2924 Source source = addSource("/test.dart", EngineTestCase.createSource(["abstra
ct class A {", " const A() {}", "}", "void f() {", " A a = const A();", "}"]))
; |
| 2913 resolve(source, []); | 2925 resolve(source, []); |
| 2914 assertErrors([StaticWarningCode.CONST_WITH_ABSTRACT_CLASS]); | 2926 assertErrors([StaticWarningCode.CONST_WITH_ABSTRACT_CLASS]); |
| 2915 verify([source]); | 2927 verify([source]); |
| 2916 } | 2928 } |
| 2917 void test_equalKeysInMap() { | 2929 void test_equalKeysInMap() { |
| 2918 Source source = addSource("/test.dart", EngineTestCase.createSource(["var m
= {'a' : 0, 'b' : 1, 'a' : 2};"])); | 2930 Source source = addSource("/test.dart", EngineTestCase.createSource(["var m
= {'a' : 0, 'b' : 1, 'a' : 2};"])); |
| 2919 resolve(source, []); | 2931 resolve(source, []); |
| 2920 assertErrors([StaticWarningCode.EQUAL_KEYS_IN_MAP]); | 2932 assertErrors([StaticWarningCode.EQUAL_KEYS_IN_MAP]); |
| 2921 verify([source]); | 2933 verify([source]); |
| 2922 } | 2934 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3108 if (_intType == null) { | 3120 if (_intType == null) { |
| 3109 initializeNumericTypes(); | 3121 initializeNumericTypes(); |
| 3110 } | 3122 } |
| 3111 return _intType; | 3123 return _intType; |
| 3112 } | 3124 } |
| 3113 InterfaceType get listType { | 3125 InterfaceType get listType { |
| 3114 if (_listType == null) { | 3126 if (_listType == null) { |
| 3115 ClassElementImpl listElement = ElementFactory.classElement2("List", ["E"])
; | 3127 ClassElementImpl listElement = ElementFactory.classElement2("List", ["E"])
; |
| 3116 _listType = listElement.type; | 3128 _listType = listElement.type; |
| 3117 Type2 eType = listElement.typeVariables[0].type; | 3129 Type2 eType = listElement.typeVariables[0].type; |
| 3130 listElement.accessors = <PropertyAccessorElement> [ElementFactory.getterEl
ement("last", false, eType)]; |
| 3118 listElement.methods = <MethodElement> [ElementFactory.methodElement("[]",
eType, [_intType]), ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [
_intType, eType])]; | 3131 listElement.methods = <MethodElement> [ElementFactory.methodElement("[]",
eType, [_intType]), ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [
_intType, eType])]; |
| 3119 } | 3132 } |
| 3120 return _listType; | 3133 return _listType; |
| 3121 } | 3134 } |
| 3122 InterfaceType get mapType { | 3135 InterfaceType get mapType { |
| 3123 if (_mapType == null) { | 3136 if (_mapType == null) { |
| 3124 _mapType = ElementFactory.classElement2("Map", ["K", "V"]).type; | 3137 _mapType = ElementFactory.classElement2("Map", ["K", "V"]).type; |
| 3125 } | 3138 } |
| 3126 return _mapType; | 3139 return _mapType; |
| 3127 } | 3140 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3294 List<ASTNode> _unresolvedNodes = new List<ASTNode>(); | 3307 List<ASTNode> _unresolvedNodes = new List<ASTNode>(); |
| 3295 /** | 3308 /** |
| 3296 * A list containing all of the AST nodes that were resolved to an element of
the wrong type. | 3309 * A list containing all of the AST nodes that were resolved to an element of
the wrong type. |
| 3297 */ | 3310 */ |
| 3298 List<ASTNode> _wrongTypedNodes = new List<ASTNode>(); | 3311 List<ASTNode> _wrongTypedNodes = new List<ASTNode>(); |
| 3299 /** | 3312 /** |
| 3300 * Initialize a newly created verifier to verify that all of the nodes in the
visited AST | 3313 * Initialize a newly created verifier to verify that all of the nodes in the
visited AST |
| 3301 * structures that are expected to have been resolved have an element associat
ed with them. | 3314 * structures that are expected to have been resolved have an element associat
ed with them. |
| 3302 */ | 3315 */ |
| 3303 ResolutionVerifier() { | 3316 ResolutionVerifier() { |
| 3304 _jtd_constructor_306_impl(); | 3317 _jtd_constructor_317_impl(); |
| 3305 } | 3318 } |
| 3306 _jtd_constructor_306_impl() { | 3319 _jtd_constructor_317_impl() { |
| 3307 _jtd_constructor_307_impl(null); | 3320 _jtd_constructor_318_impl(null); |
| 3308 } | 3321 } |
| 3309 /** | 3322 /** |
| 3310 * Initialize a newly created verifier to verify that all of the identifiers i
n the visited AST | 3323 * Initialize a newly created verifier to verify that all of the identifiers i
n the visited AST |
| 3311 * structures that are expected to have been resolved have an element associat
ed with them. Nodes | 3324 * structures that are expected to have been resolved have an element associat
ed with them. Nodes |
| 3312 * in the set of known exceptions are not expected to have been resolved, even
if they normally | 3325 * in the set of known exceptions are not expected to have been resolved, even
if they normally |
| 3313 * would have been expected to have been resolved. | 3326 * would have been expected to have been resolved. |
| 3314 * @param knownExceptions a set containing nodes that are known to not be reso
lvable and should | 3327 * @param knownExceptions a set containing nodes that are known to not be reso
lvable and should |
| 3315 * therefore not cause the test to fail | 3328 * therefore not cause the test to fail |
| 3316 */ | 3329 */ |
| 3317 ResolutionVerifier.con1(Set<ASTNode> knownExceptions2) { | 3330 ResolutionVerifier.con1(Set<ASTNode> knownExceptions2) { |
| 3318 _jtd_constructor_307_impl(knownExceptions2); | 3331 _jtd_constructor_318_impl(knownExceptions2); |
| 3319 } | 3332 } |
| 3320 _jtd_constructor_307_impl(Set<ASTNode> knownExceptions2) { | 3333 _jtd_constructor_318_impl(Set<ASTNode> knownExceptions2) { |
| 3321 this._knownExceptions = knownExceptions2; | 3334 this._knownExceptions = knownExceptions2; |
| 3322 } | 3335 } |
| 3323 /** | 3336 /** |
| 3324 * Assert that all of the visited identifiers were resolved. | 3337 * Assert that all of the visited identifiers were resolved. |
| 3325 */ | 3338 */ |
| 3326 void assertResolved() { | 3339 void assertResolved() { |
| 3327 if (!_unresolvedNodes.isEmpty || !_wrongTypedNodes.isEmpty) { | 3340 if (!_unresolvedNodes.isEmpty || !_wrongTypedNodes.isEmpty) { |
| 3328 PrintStringWriter writer = new PrintStringWriter(); | 3341 PrintStringWriter writer = new PrintStringWriter(); |
| 3329 if (!_unresolvedNodes.isEmpty) { | 3342 if (!_unresolvedNodes.isEmpty) { |
| 3330 writer.print("Failed to resolve "); | 3343 writer.print("Failed to resolve "); |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4145 SimpleStringLiteral string = ASTFactory.string2(value); | 4158 SimpleStringLiteral string = ASTFactory.string2(value); |
| 4146 string.staticType = _typeProvider.stringType; | 4159 string.staticType = _typeProvider.stringType; |
| 4147 return string; | 4160 return string; |
| 4148 } | 4161 } |
| 4149 /** | 4162 /** |
| 4150 * Return a simple identifier that has been resolved to a variable element wit
h the given type. | 4163 * Return a simple identifier that has been resolved to a variable element wit
h the given type. |
| 4151 * @param type the type of the variable being represented | 4164 * @param type the type of the variable being represented |
| 4152 * @param variableName the name of the variable | 4165 * @param variableName the name of the variable |
| 4153 * @return a simple identifier that has been resolved to a variable element wi
th the given type | 4166 * @return a simple identifier that has been resolved to a variable element wi
th the given type |
| 4154 */ | 4167 */ |
| 4155 SimpleIdentifier resolvedVariable(InterfaceType type36, String variableName) { | 4168 SimpleIdentifier resolvedVariable(InterfaceType type37, String variableName) { |
| 4156 SimpleIdentifier identifier = ASTFactory.identifier2(variableName); | 4169 SimpleIdentifier identifier = ASTFactory.identifier2(variableName); |
| 4157 VariableElementImpl element = ElementFactory.localVariableElement(identifier
); | 4170 VariableElementImpl element = ElementFactory.localVariableElement(identifier
); |
| 4158 element.type = type36; | 4171 element.type = type37; |
| 4159 identifier.element = element; | 4172 identifier.element = element; |
| 4160 identifier.staticType = type36; | 4173 identifier.staticType = type37; |
| 4161 return identifier; | 4174 return identifier; |
| 4162 } | 4175 } |
| 4163 /** | 4176 /** |
| 4164 * Set the type of the given parameter to the given type. | 4177 * Set the type of the given parameter to the given type. |
| 4165 * @param parameter the parameter whose type is to be set | 4178 * @param parameter the parameter whose type is to be set |
| 4166 * @param type the new type of the given parameter | 4179 * @param type the new type of the given parameter |
| 4167 */ | 4180 */ |
| 4168 void setType(FormalParameter parameter, Type2 type37) { | 4181 void setType(FormalParameter parameter, Type2 type38) { |
| 4169 SimpleIdentifier identifier17 = parameter.identifier; | 4182 SimpleIdentifier identifier17 = parameter.identifier; |
| 4170 Element element48 = identifier17.element; | 4183 Element element51 = identifier17.element; |
| 4171 if (element48 is! ParameterElement) { | 4184 if (element51 is! ParameterElement) { |
| 4172 element48 = new ParameterElementImpl(identifier17); | 4185 element51 = new ParameterElementImpl(identifier17); |
| 4173 identifier17.element = element48; | 4186 identifier17.element = element51; |
| 4174 } | 4187 } |
| 4175 ((element48 as ParameterElementImpl)).type = type37; | 4188 ((element51 as ParameterElementImpl)).type = type38; |
| 4176 } | 4189 } |
| 4177 static dartSuite() { | 4190 static dartSuite() { |
| 4178 _ut.group('StaticTypeAnalyzerTest', () { | 4191 _ut.group('StaticTypeAnalyzerTest', () { |
| 4179 _ut.test('test_visitAdjacentStrings', () { | 4192 _ut.test('test_visitAdjacentStrings', () { |
| 4180 final __test = new StaticTypeAnalyzerTest(); | 4193 final __test = new StaticTypeAnalyzerTest(); |
| 4181 runJUnitTest(__test, __test.test_visitAdjacentStrings); | 4194 runJUnitTest(__test, __test.test_visitAdjacentStrings); |
| 4182 }); | 4195 }); |
| 4183 _ut.test('test_visitArgumentDefinitionTest', () { | 4196 _ut.test('test_visitArgumentDefinitionTest', () { |
| 4184 final __test = new StaticTypeAnalyzerTest(); | 4197 final __test = new StaticTypeAnalyzerTest(); |
| 4185 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest); | 4198 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4490 EngineTestCase.assertLength(0, element.imports); | 4503 EngineTestCase.assertLength(0, element.imports); |
| 4491 JUnitTestCase.assertNull(element.library); | 4504 JUnitTestCase.assertNull(element.library); |
| 4492 EngineTestCase.assertLength(0, element.prefixes); | 4505 EngineTestCase.assertLength(0, element.prefixes); |
| 4493 EngineTestCase.assertLength(0, element.parts); | 4506 EngineTestCase.assertLength(0, element.parts); |
| 4494 CompilationUnitElement unit = element.definingCompilationUnit; | 4507 CompilationUnitElement unit = element.definingCompilationUnit; |
| 4495 JUnitTestCase.assertNotNull(unit); | 4508 JUnitTestCase.assertNotNull(unit); |
| 4496 JUnitTestCase.assertEquals("lib.dart", unit.name); | 4509 JUnitTestCase.assertEquals("lib.dart", unit.name); |
| 4497 JUnitTestCase.assertEquals(element, unit.library); | 4510 JUnitTestCase.assertEquals(element, unit.library); |
| 4498 EngineTestCase.assertLength(0, unit.accessors); | 4511 EngineTestCase.assertLength(0, unit.accessors); |
| 4499 EngineTestCase.assertLength(0, unit.functions); | 4512 EngineTestCase.assertLength(0, unit.functions); |
| 4500 EngineTestCase.assertLength(0, unit.typeAliases); | 4513 EngineTestCase.assertLength(0, unit.functionTypeAliases); |
| 4501 EngineTestCase.assertLength(0, unit.types); | 4514 EngineTestCase.assertLength(0, unit.types); |
| 4502 EngineTestCase.assertLength(0, unit.topLevelVariables); | 4515 EngineTestCase.assertLength(0, unit.topLevelVariables); |
| 4503 } | 4516 } |
| 4504 void test_invalidUri_part() { | 4517 void test_invalidUri_part() { |
| 4505 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part '\${'a'}.dart';"])); | 4518 Source librarySource = addSource("/lib.dart", EngineTestCase.createSource(["
library lib;", "", "part '\${'a'}.dart';"])); |
| 4506 LibraryElement element = buildLibrary(librarySource, [CompileTimeErrorCode.U
RI_WITH_INTERPOLATION]); | 4519 LibraryElement element = buildLibrary(librarySource, [CompileTimeErrorCode.U
RI_WITH_INTERPOLATION]); |
| 4507 JUnitTestCase.assertNotNull(element); | 4520 JUnitTestCase.assertNotNull(element); |
| 4508 } | 4521 } |
| 4509 void test_missingLibraryDirectiveWithPart() { | 4522 void test_missingLibraryDirectiveWithPart() { |
| 4510 addSource("/a.dart", EngineTestCase.createSource(["part of lib;"])); | 4523 addSource("/a.dart", EngineTestCase.createSource(["part of lib;"])); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4704 AnalysisErrorListener _errorListener; | 4717 AnalysisErrorListener _errorListener; |
| 4705 ScopeTest_TestScope(LibraryElement definingLibrary, AnalysisErrorListener erro
rListener) { | 4718 ScopeTest_TestScope(LibraryElement definingLibrary, AnalysisErrorListener erro
rListener) { |
| 4706 this._definingLibrary = definingLibrary; | 4719 this._definingLibrary = definingLibrary; |
| 4707 this._errorListener = errorListener; | 4720 this._errorListener = errorListener; |
| 4708 } | 4721 } |
| 4709 LibraryElement get definingLibrary => _definingLibrary; | 4722 LibraryElement get definingLibrary => _definingLibrary; |
| 4710 AnalysisErrorListener get errorListener => _errorListener; | 4723 AnalysisErrorListener get errorListener => _errorListener; |
| 4711 Element lookup3(String name, LibraryElement referencingLibrary) => localLookup
(name, referencingLibrary); | 4724 Element lookup3(String name, LibraryElement referencingLibrary) => localLookup
(name, referencingLibrary); |
| 4712 } | 4725 } |
| 4713 class SimpleResolverTest extends ResolverTestCase { | 4726 class SimpleResolverTest extends ResolverTestCase { |
| 4714 void fail_caseExpressionTypeImplementsEquals_Object() { | |
| 4715 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", "}", "",
"f(IntWrapper intWrapper) {", " switch(intWrapper) {", " case(const IntWrap
per(1)) : return 1;", " default: return 0;", " }", "}"])); | |
| 4716 resolve(source, []); | |
| 4717 assertNoErrors(); | |
| 4718 verify([source]); | |
| 4719 } | |
| 4720 void fail_staticInvocation() { | 4727 void fail_staticInvocation() { |
| 4721 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => (a,b) => 0;", "}", "class B {", " f() {", " A.g
(1,0);", " }", "}"])); | 4728 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " static int get g => (a,b) => 0;", "}", "class B {", " f() {", " A.g
(1,0);", " }", "}"])); |
| 4722 resolve(source, []); | 4729 resolve(source, []); |
| 4723 assertNoErrors(); | 4730 assertNoErrors(); |
| 4724 verify([source]); | 4731 verify([source]); |
| 4725 } | 4732 } |
| 4726 void test_argumentDefinitionTestNonParameter_formalParameter() { | 4733 void test_argumentDefinitionTestNonParameter_formalParameter() { |
| 4727 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
v) {", " return ?v;", "}"])); | 4734 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(var
v) {", " return ?v;", "}"])); |
| 4728 resolve(source, []); | 4735 resolve(source, []); |
| 4729 assertNoErrors(); | 4736 assertNoErrors(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4752 resolve(source, []); | 4759 resolve(source, []); |
| 4753 assertNoErrors(); | 4760 assertNoErrors(); |
| 4754 verify([source]); | 4761 verify([source]); |
| 4755 } | 4762 } |
| 4756 void test_caseExpressionTypeImplementsEquals_int() { | 4763 void test_caseExpressionTypeImplementsEquals_int() { |
| 4757 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
i) {", " switch(i) {", " case(1) : return 1;", " default: return 0;", "
}", "}"])); | 4764 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(int
i) {", " switch(i) {", " case(1) : return 1;", " default: return 0;", "
}", "}"])); |
| 4758 resolve(source, []); | 4765 resolve(source, []); |
| 4759 assertNoErrors(); | 4766 assertNoErrors(); |
| 4760 verify([source]); | 4767 verify([source]); |
| 4761 } | 4768 } |
| 4769 void test_caseExpressionTypeImplementsEquals_Object() { |
| 4770 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
IntWrapper {", " final int value;", " const IntWrapper(this.value);", "}", "",
"f(IntWrapper intWrapper) {", " switch(intWrapper) {", " case(const IntWrap
per(1)) : return 1;", " default: return 0;", " }", "}"])); |
| 4771 resolve(source, []); |
| 4772 assertNoErrors(); |
| 4773 verify([source]); |
| 4774 } |
| 4762 void test_caseExpressionTypeImplementsEquals_String() { | 4775 void test_caseExpressionTypeImplementsEquals_String() { |
| 4763 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(Stri
ng s) {", " switch(s) {", " case('1') : return 1;", " default: return 0;"
, " }", "}"])); | 4776 Source source = addSource("/test.dart", EngineTestCase.createSource(["f(Stri
ng s) {", " switch(s) {", " case('1') : return 1;", " default: return 0;"
, " }", "}"])); |
| 4764 resolve(source, []); | 4777 resolve(source, []); |
| 4765 assertNoErrors(); | 4778 assertNoErrors(); |
| 4766 verify([source]); | 4779 verify([source]); |
| 4767 } | 4780 } |
| 4768 void test_class_extends_implements() { | 4781 void test_class_extends_implements() { |
| 4769 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B implements C {}", "class B {}", "class C {}"])); | 4782 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B implements C {}", "class B {}", "class C {}"])); |
| 4770 resolve(source, []); | 4783 resolve(source, []); |
| 4771 assertNoErrors(); | 4784 assertNoErrors(); |
| 4772 verify([source]); | 4785 verify([source]); |
| 4773 } | 4786 } |
| 4774 void test_constConstructorWithNonFinalField_const() { | 4787 void test_constConstructorWithNonFinalField_const() { |
| 4775 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x;", " const A() {}", "}"])); | 4788 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const int x;", " const A() {}", "}"])); |
| 4776 resolve(source, []); | 4789 resolve(source, []); |
| 4777 assertNoErrors(); | 4790 assertNoErrors(); |
| 4778 verify([source]); | 4791 verify([source]); |
| 4779 } | 4792 } |
| 4780 void test_constConstructorWithNonFinalField_final() { | 4793 void test_constConstructorWithNonFinalField_final() { |
| 4781 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " const A() {}", "}"])); | 4794 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " final int x;", " const A() {}", "}"])); |
| 4782 resolve(source, []); | 4795 resolve(source, []); |
| 4783 assertNoErrors(); | 4796 assertNoErrors(); |
| 4784 verify([source]); | 4797 verify([source]); |
| 4785 } | 4798 } |
| 4799 void test_constConstructorWithNonFinalField_syntheticField() { |
| 4800 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " const A();", " set x(value) {}", " get x {return 0;}", "}"])); |
| 4801 resolve(source, []); |
| 4802 assertNoErrors(); |
| 4803 verify([source]); |
| 4804 } |
| 4786 void test_duplicateDefinition_getter() { | 4805 void test_duplicateDefinition_getter() { |
| 4787 Source source = addSource("/test.dart", EngineTestCase.createSource(["bool g
et a => true;"])); | 4806 Source source = addSource("/test.dart", EngineTestCase.createSource(["bool g
et a => true;"])); |
| 4788 resolve(source, []); | 4807 resolve(source, []); |
| 4789 assertNoErrors(); | 4808 assertNoErrors(); |
| 4790 verify([source]); | 4809 verify([source]); |
| 4791 } | 4810 } |
| 4792 void test_empty() { | 4811 void test_empty() { |
| 4793 Source source = addSource("/test.dart", ""); | 4812 Source source = addSource("/test.dart", ""); |
| 4794 resolve(source, []); | 4813 resolve(source, []); |
| 4795 assertNoErrors(); | 4814 assertNoErrors(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4842 resolve(source, []); | 4861 resolve(source, []); |
| 4843 assertNoErrors(); | 4862 assertNoErrors(); |
| 4844 verify([source]); | 4863 verify([source]); |
| 4845 } | 4864 } |
| 4846 void test_invocationOfNonFunction_localVariable() { | 4865 void test_invocationOfNonFunction_localVariable() { |
| 4847 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var g;", " g();", "}"])); | 4866 Source source = addSource("/test.dart", EngineTestCase.createSource(["f() {"
, " var g;", " g();", "}"])); |
| 4848 resolve(source, []); | 4867 resolve(source, []); |
| 4849 assertNoErrors(); | 4868 assertNoErrors(); |
| 4850 verify([source]); | 4869 verify([source]); |
| 4851 } | 4870 } |
| 4871 void test_invoke_dynamicThroughGetter() { |
| 4872 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A {", " List get X => [() => 0];", " m(A a) {", " X.last();", " }", "}"]))
; |
| 4873 resolve(source, []); |
| 4874 assertNoErrors(); |
| 4875 verify([source]); |
| 4876 } |
| 4852 void test_isValidMixin_badSuperclass() { | 4877 void test_isValidMixin_badSuperclass() { |
| 4853 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B {}", "class B {}"])); | 4878 Source source = addSource("/test.dart", EngineTestCase.createSource(["class
A extends B {}", "class B {}"])); |
| 4854 LibraryElement library = resolve(source, []); | 4879 LibraryElement library = resolve(source, []); |
| 4855 JUnitTestCase.assertNotNull(library); | 4880 JUnitTestCase.assertNotNull(library); |
| 4856 CompilationUnitElement unit = library.definingCompilationUnit; | 4881 CompilationUnitElement unit = library.definingCompilationUnit; |
| 4857 JUnitTestCase.assertNotNull(unit); | 4882 JUnitTestCase.assertNotNull(unit); |
| 4858 List<ClassElement> classes = unit.types; | 4883 List<ClassElement> classes = unit.types; |
| 4859 EngineTestCase.assertLength(2, classes); | 4884 EngineTestCase.assertLength(2, classes); |
| 4860 JUnitTestCase.assertFalse(classes[0].isValidMixin()); | 4885 JUnitTestCase.assertFalse(classes[0].isValidMixin()); |
| 4861 assertNoErrors(); | 4886 assertNoErrors(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4978 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_opti
onalParameter); | 5003 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter_opti
onalParameter); |
| 4979 }); | 5004 }); |
| 4980 _ut.test('test_breakWithoutLabelInSwitch', () { | 5005 _ut.test('test_breakWithoutLabelInSwitch', () { |
| 4981 final __test = new SimpleResolverTest(); | 5006 final __test = new SimpleResolverTest(); |
| 4982 runJUnitTest(__test, __test.test_breakWithoutLabelInSwitch); | 5007 runJUnitTest(__test, __test.test_breakWithoutLabelInSwitch); |
| 4983 }); | 5008 }); |
| 4984 _ut.test('test_builtInIdentifierAsType_dynamic', () { | 5009 _ut.test('test_builtInIdentifierAsType_dynamic', () { |
| 4985 final __test = new SimpleResolverTest(); | 5010 final __test = new SimpleResolverTest(); |
| 4986 runJUnitTest(__test, __test.test_builtInIdentifierAsType_dynamic); | 5011 runJUnitTest(__test, __test.test_builtInIdentifierAsType_dynamic); |
| 4987 }); | 5012 }); |
| 5013 _ut.test('test_caseExpressionTypeImplementsEquals_Object', () { |
| 5014 final __test = new SimpleResolverTest(); |
| 5015 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Obje
ct); |
| 5016 }); |
| 4988 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { | 5017 _ut.test('test_caseExpressionTypeImplementsEquals_String', () { |
| 4989 final __test = new SimpleResolverTest(); | 5018 final __test = new SimpleResolverTest(); |
| 4990 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); | 5019 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_Stri
ng); |
| 4991 }); | 5020 }); |
| 4992 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { | 5021 _ut.test('test_caseExpressionTypeImplementsEquals_int', () { |
| 4993 final __test = new SimpleResolverTest(); | 5022 final __test = new SimpleResolverTest(); |
| 4994 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; | 5023 runJUnitTest(__test, __test.test_caseExpressionTypeImplementsEquals_int)
; |
| 4995 }); | 5024 }); |
| 4996 _ut.test('test_class_extends_implements', () { | 5025 _ut.test('test_class_extends_implements', () { |
| 4997 final __test = new SimpleResolverTest(); | 5026 final __test = new SimpleResolverTest(); |
| 4998 runJUnitTest(__test, __test.test_class_extends_implements); | 5027 runJUnitTest(__test, __test.test_class_extends_implements); |
| 4999 }); | 5028 }); |
| 5000 _ut.test('test_constConstructorWithNonFinalField_const', () { | 5029 _ut.test('test_constConstructorWithNonFinalField_const', () { |
| 5001 final __test = new SimpleResolverTest(); | 5030 final __test = new SimpleResolverTest(); |
| 5002 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_const
); | 5031 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_const
); |
| 5003 }); | 5032 }); |
| 5004 _ut.test('test_constConstructorWithNonFinalField_final', () { | 5033 _ut.test('test_constConstructorWithNonFinalField_final', () { |
| 5005 final __test = new SimpleResolverTest(); | 5034 final __test = new SimpleResolverTest(); |
| 5006 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_final
); | 5035 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_final
); |
| 5007 }); | 5036 }); |
| 5037 _ut.test('test_constConstructorWithNonFinalField_syntheticField', () { |
| 5038 final __test = new SimpleResolverTest(); |
| 5039 runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_synth
eticField); |
| 5040 }); |
| 5008 _ut.test('test_duplicateDefinition_getter', () { | 5041 _ut.test('test_duplicateDefinition_getter', () { |
| 5009 final __test = new SimpleResolverTest(); | 5042 final __test = new SimpleResolverTest(); |
| 5010 runJUnitTest(__test, __test.test_duplicateDefinition_getter); | 5043 runJUnitTest(__test, __test.test_duplicateDefinition_getter); |
| 5011 }); | 5044 }); |
| 5012 _ut.test('test_empty', () { | 5045 _ut.test('test_empty', () { |
| 5013 final __test = new SimpleResolverTest(); | 5046 final __test = new SimpleResolverTest(); |
| 5014 runJUnitTest(__test, __test.test_empty); | 5047 runJUnitTest(__test, __test.test_empty); |
| 5015 }); | 5048 }); |
| 5016 _ut.test('test_forEachLoops_nonConflicting', () { | 5049 _ut.test('test_forEachLoops_nonConflicting', () { |
| 5017 final __test = new SimpleResolverTest(); | 5050 final __test = new SimpleResolverTest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5042 runJUnitTest(__test, __test.test_invocationOfNonFunction_dynamic); | 5075 runJUnitTest(__test, __test.test_invocationOfNonFunction_dynamic); |
| 5043 }); | 5076 }); |
| 5044 _ut.test('test_invocationOfNonFunction_getter', () { | 5077 _ut.test('test_invocationOfNonFunction_getter', () { |
| 5045 final __test = new SimpleResolverTest(); | 5078 final __test = new SimpleResolverTest(); |
| 5046 runJUnitTest(__test, __test.test_invocationOfNonFunction_getter); | 5079 runJUnitTest(__test, __test.test_invocationOfNonFunction_getter); |
| 5047 }); | 5080 }); |
| 5048 _ut.test('test_invocationOfNonFunction_localVariable', () { | 5081 _ut.test('test_invocationOfNonFunction_localVariable', () { |
| 5049 final __test = new SimpleResolverTest(); | 5082 final __test = new SimpleResolverTest(); |
| 5050 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable); | 5083 runJUnitTest(__test, __test.test_invocationOfNonFunction_localVariable); |
| 5051 }); | 5084 }); |
| 5085 _ut.test('test_invoke_dynamicThroughGetter', () { |
| 5086 final __test = new SimpleResolverTest(); |
| 5087 runJUnitTest(__test, __test.test_invoke_dynamicThroughGetter); |
| 5088 }); |
| 5052 _ut.test('test_isValidMixin_badSuperclass', () { | 5089 _ut.test('test_isValidMixin_badSuperclass', () { |
| 5053 final __test = new SimpleResolverTest(); | 5090 final __test = new SimpleResolverTest(); |
| 5054 runJUnitTest(__test, __test.test_isValidMixin_badSuperclass); | 5091 runJUnitTest(__test, __test.test_isValidMixin_badSuperclass); |
| 5055 }); | 5092 }); |
| 5056 _ut.test('test_isValidMixin_constructor', () { | 5093 _ut.test('test_isValidMixin_constructor', () { |
| 5057 final __test = new SimpleResolverTest(); | 5094 final __test = new SimpleResolverTest(); |
| 5058 runJUnitTest(__test, __test.test_isValidMixin_constructor); | 5095 runJUnitTest(__test, __test.test_isValidMixin_constructor); |
| 5059 }); | 5096 }); |
| 5060 _ut.test('test_isValidMixin_super', () { | 5097 _ut.test('test_isValidMixin_super', () { |
| 5061 final __test = new SimpleResolverTest(); | 5098 final __test = new SimpleResolverTest(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5106 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); | 5143 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); |
| 5107 }); | 5144 }); |
| 5108 _ut.test('test_typeArgumentNotMatchingBounds_new', () { | 5145 _ut.test('test_typeArgumentNotMatchingBounds_new', () { |
| 5109 final __test = new SimpleResolverTest(); | 5146 final __test = new SimpleResolverTest(); |
| 5110 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); | 5147 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); |
| 5111 }); | 5148 }); |
| 5112 }); | 5149 }); |
| 5113 } | 5150 } |
| 5114 } | 5151 } |
| 5115 main() { | 5152 main() { |
| 5116 /*ElementResolverTest.dartSuite(); | 5153 // ElementResolverTest.dartSuite(); |
| 5117 LibraryElementBuilderTest.dartSuite(); | 5154 // LibraryElementBuilderTest.dartSuite(); |
| 5118 LibraryTest.dartSuite(); | 5155 // LibraryTest.dartSuite(); |
| 5119 StaticTypeAnalyzerTest.dartSuite(); | 5156 // StaticTypeAnalyzerTest.dartSuite(); |
| 5120 TypeProviderImplTest.dartSuite(); | 5157 // TypeProviderImplTest.dartSuite(); |
| 5121 TypeResolverVisitorTest.dartSuite(); | 5158 // TypeResolverVisitorTest.dartSuite(); |
| 5122 EnclosedScopeTest.dartSuite(); | 5159 // EnclosedScopeTest.dartSuite(); |
| 5123 LibraryImportScopeTest.dartSuite(); | 5160 // LibraryImportScopeTest.dartSuite(); |
| 5124 LibraryScopeTest.dartSuite(); | 5161 // LibraryScopeTest.dartSuite(); |
| 5125 ScopeTest.dartSuite(); | 5162 // ScopeTest.dartSuite(); |
| 5126 CompileTimeErrorCodeTest.dartSuite(); | 5163 // CompileTimeErrorCodeTest.dartSuite(); |
| 5127 ErrorResolverTest.dartSuite(); | 5164 // ErrorResolverTest.dartSuite(); |
| 5128 SimpleResolverTest.dartSuite(); | 5165 // SimpleResolverTest.dartSuite(); |
| 5129 StaticTypeWarningCodeTest.dartSuite(); | 5166 // StaticTypeWarningCodeTest.dartSuite(); |
| 5130 StaticWarningCodeTest.dartSuite();*/ | 5167 // StaticWarningCodeTest.dartSuite(); |
| 5131 } | 5168 } |
| OLD | NEW |