| 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 library engine.resolver_test; | 3 library engine.resolver_test; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 8 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/error.dart'; | 9 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 assertNoErrors(); | 1458 assertNoErrors(); |
| 1459 verify([source]); | 1459 verify([source]); |
| 1460 } | 1460 } |
| 1461 void test_finalNotInitialized_hasNativeClause_hasConstructor() { | 1461 void test_finalNotInitialized_hasNativeClause_hasConstructor() { |
| 1462 Source source = addSource(EngineTestCase.createSource([ | 1462 Source source = addSource(EngineTestCase.createSource([ |
| 1463 "class A native 'something' {", | 1463 "class A native 'something' {", |
| 1464 " final int x;", | 1464 " final int x;", |
| 1465 " A() {}", | 1465 " A() {}", |
| 1466 "}"])); | 1466 "}"])); |
| 1467 resolve(source); | 1467 resolve(source); |
| 1468 assertNoErrors(); | 1468 assertErrors([ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]); |
| 1469 verify([source]); | 1469 verify([source]); |
| 1470 } | 1470 } |
| 1471 void test_finalNotInitialized_hasNativeClause_noConstructor() { | 1471 void test_finalNotInitialized_hasNativeClause_noConstructor() { |
| 1472 Source source = addSource(EngineTestCase.createSource(["class A native 'some
thing' {", " final int x;", "}"])); | 1472 Source source = addSource(EngineTestCase.createSource(["class A native 'some
thing' {", " final int x;", "}"])); |
| 1473 resolve(source); | 1473 resolve(source); |
| 1474 assertNoErrors(); | 1474 assertErrors([ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]); |
| 1475 verify([source]); | 1475 verify([source]); |
| 1476 } | 1476 } |
| 1477 void test_finalNotInitialized_initializer() { | 1477 void test_finalNotInitialized_initializer() { |
| 1478 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 0 {}", "}"])); | 1478 Source source = addSource(EngineTestCase.createSource(["class A {", " final
int x;", " A() : x = 0 {}", "}"])); |
| 1479 resolve(source); | 1479 resolve(source); |
| 1480 assertNoErrors(); | 1480 assertNoErrors(); |
| 1481 verify([source]); | 1481 verify([source]); |
| 1482 } | 1482 } |
| 1483 void test_finalNotInitialized_redirectingConstructor() { | 1483 void test_finalNotInitialized_redirectingConstructor() { |
| 1484 Source source = addSource(EngineTestCase.createSource([ | 1484 Source source = addSource(EngineTestCase.createSource([ |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 assertNoErrors(); | 1628 assertNoErrors(); |
| 1629 verify([source]); | 1629 verify([source]); |
| 1630 } | 1630 } |
| 1631 void test_importDuplicatedLibraryName() { | 1631 void test_importDuplicatedLibraryName() { |
| 1632 Source source = addSource(EngineTestCase.createSource([ | 1632 Source source = addSource(EngineTestCase.createSource([ |
| 1633 "library test;", | 1633 "library test;", |
| 1634 "import 'lib.dart';", | 1634 "import 'lib.dart';", |
| 1635 "import 'lib.dart';"])); | 1635 "import 'lib.dart';"])); |
| 1636 addSource2("/lib.dart", "library lib;"); | 1636 addSource2("/lib.dart", "library lib;"); |
| 1637 resolve(source); | 1637 resolve(source); |
| 1638 assertNoErrors(); | 1638 assertErrors([HintCode.UNUSED_IMPORT, HintCode.UNUSED_IMPORT]); |
| 1639 verify([source]); | 1639 verify([source]); |
| 1640 } | 1640 } |
| 1641 void test_importOfNonLibrary_libraryDeclared() { | 1641 void test_importOfNonLibrary_libraryDeclared() { |
| 1642 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); | 1642 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';", "A a;"])); |
| 1643 addSource2("/part.dart", EngineTestCase.createSource(["library lib1;"])); | 1643 addSource2("/part.dart", EngineTestCase.createSource(["library lib1;", "clas
s A {}"])); |
| 1644 resolve(source); | 1644 resolve(source); |
| 1645 assertNoErrors(); | 1645 assertNoErrors(); |
| 1646 verify([source]); | 1646 verify([source]); |
| 1647 } | 1647 } |
| 1648 void test_importOfNonLibrary_libraryNotDeclared() { | 1648 void test_importOfNonLibrary_libraryNotDeclared() { |
| 1649 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); | 1649 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';", "A a;"])); |
| 1650 addSource2("/part.dart", EngineTestCase.createSource([""])); | 1650 addSource2("/part.dart", EngineTestCase.createSource(["class A {}"])); |
| 1651 resolve(source); | 1651 resolve(source); |
| 1652 assertNoErrors(); | 1652 assertNoErrors(); |
| 1653 verify([source]); | 1653 verify([source]); |
| 1654 } | 1654 } |
| 1655 void test_inconsistentCaseExpressionTypes() { | 1655 void test_inconsistentCaseExpressionTypes() { |
| 1656 Source source = addSource(EngineTestCase.createSource([ | 1656 Source source = addSource(EngineTestCase.createSource([ |
| 1657 "f(var p) {", | 1657 "f(var p) {", |
| 1658 " switch (p) {", | 1658 " switch (p) {", |
| 1659 " case 1:", | 1659 " case 1:", |
| 1660 " break;", | 1660 " break;", |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 resolve(source); | 2135 resolve(source); |
| 2136 assertNoErrors(); | 2136 assertNoErrors(); |
| 2137 verify([source]); | 2137 verify([source]); |
| 2138 } | 2138 } |
| 2139 void test_newWithUndefinedConstructorDefault() { | 2139 void test_newWithUndefinedConstructorDefault() { |
| 2140 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "f() {", " new A();", "}"])); | 2140 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", "}", "f() {", " new A();", "}"])); |
| 2141 resolve(source); | 2141 resolve(source); |
| 2142 assertNoErrors(); | 2142 assertNoErrors(); |
| 2143 verify([source]); | 2143 verify([source]); |
| 2144 } | 2144 } |
| 2145 void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_
accessor() { |
| 2146 Source source = addSource(EngineTestCase.createSource([ |
| 2147 "class A {", |
| 2148 " int get g => 0;", |
| 2149 "}", |
| 2150 "abstract class B extends A {", |
| 2151 " int get g;", |
| 2152 "}", |
| 2153 "class C extends B {", |
| 2154 "}"])); |
| 2155 resolve(source); |
| 2156 assertNoErrors(); |
| 2157 verify([source]); |
| 2158 } |
| 2159 void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_
method() { |
| 2160 Source source = addSource(EngineTestCase.createSource([ |
| 2161 "class A {", |
| 2162 " m(p) {}", |
| 2163 "}", |
| 2164 "abstract class B extends A {", |
| 2165 " m(p);", |
| 2166 "}", |
| 2167 "class C extends B {", |
| 2168 "}"])); |
| 2169 resolve(source); |
| 2170 assertNoErrors(); |
| 2171 verify([source]); |
| 2172 } |
| 2173 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod() { |
| 2174 Source source = addSource(EngineTestCase.createSource([ |
| 2175 "abstract class A {", |
| 2176 " m(p);", |
| 2177 "}", |
| 2178 "class B extends A {", |
| 2179 " noSuchMethod(invocation) {}", |
| 2180 "}"])); |
| 2181 resolve(source); |
| 2182 assertNoErrors(); |
| 2183 verify([source]); |
| 2184 } |
| 2145 void test_nonBoolExpression_functionType() { | 2185 void test_nonBoolExpression_functionType() { |
| 2146 Source source = addSource(EngineTestCase.createSource([ | 2186 Source source = addSource(EngineTestCase.createSource([ |
| 2147 "bool makeAssertion() => true;", | 2187 "bool makeAssertion() => true;", |
| 2148 "f() {", | 2188 "f() {", |
| 2149 " assert(makeAssertion);", | 2189 " assert(makeAssertion);", |
| 2150 "}"])); | 2190 "}"])); |
| 2151 resolve(source); | 2191 resolve(source); |
| 2152 assertNoErrors(); | 2192 assertNoErrors(); |
| 2153 verify([source]); | 2193 verify([source]); |
| 2154 } | 2194 } |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 assertNoErrors(); | 2491 assertNoErrors(); |
| 2452 verify([source]); | 2492 verify([source]); |
| 2453 } | 2493 } |
| 2454 void test_optionalParameterInOperator_required() { | 2494 void test_optionalParameterInOperator_required() { |
| 2455 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(p) {}", "}"])); | 2495 Source source = addSource(EngineTestCase.createSource(["class A {", " opera
tor +(p) {}", "}"])); |
| 2456 resolve(source); | 2496 resolve(source); |
| 2457 assertNoErrors(); | 2497 assertNoErrors(); |
| 2458 verify([source]); | 2498 verify([source]); |
| 2459 } | 2499 } |
| 2460 void test_prefixCollidesWithTopLevelMembers() { | 2500 void test_prefixCollidesWithTopLevelMembers() { |
| 2461 addSource2("/lib.dart", "library lib;"); | 2501 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A {}"])); |
| 2462 Source source = addSource(EngineTestCase.createSource([ | 2502 Source source = addSource(EngineTestCase.createSource([ |
| 2463 "import '/lib.dart' as p;", | 2503 "import 'lib.dart' as p;", |
| 2464 "typedef P();", | 2504 "typedef P();", |
| 2465 "p2() {}", | 2505 "p2() {}", |
| 2466 "var p3;", | 2506 "var p3;", |
| 2467 "class p4 {}"])); | 2507 "class p4 {}", |
| 2508 "p.A a;"])); |
| 2468 resolve(source); | 2509 resolve(source); |
| 2469 assertNoErrors(); | 2510 assertNoErrors(); |
| 2470 verify([source]); | 2511 verify([source]); |
| 2471 } | 2512 } |
| 2472 void test_recursiveConstructorRedirect() { | 2513 void test_recursiveConstructorRedirect() { |
| 2473 Source source = addSource(EngineTestCase.createSource([ | 2514 Source source = addSource(EngineTestCase.createSource([ |
| 2474 "class A {", | 2515 "class A {", |
| 2475 " A.a() : this.b();", | 2516 " A.a() : this.b();", |
| 2476 " A.b() : this.c();", | 2517 " A.b() : this.c();", |
| 2477 " A.c() {}", | 2518 " A.c() {}", |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2711 resolve(source); | 2752 resolve(source); |
| 2712 assertNoErrors(); | 2753 assertNoErrors(); |
| 2713 verify([source]); | 2754 verify([source]); |
| 2714 } | 2755 } |
| 2715 void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() { | 2756 void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() { |
| 2716 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "cl
ass B {", " A a;", "}"])); | 2757 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "cl
ass B {", " A a;", "}"])); |
| 2717 resolve(source); | 2758 resolve(source); |
| 2718 assertNoErrors(); | 2759 assertNoErrors(); |
| 2719 verify([source]); | 2760 verify([source]); |
| 2720 } | 2761 } |
| 2762 void test_typeAliasCannotReferenceItself_typeVariableBounds() { |
| 2763 Source source = addSource(EngineTestCase.createSource(["typedef A<T extends
A>();"])); |
| 2764 resolve(source); |
| 2765 assertNoErrors(); |
| 2766 verify([source]); |
| 2767 } |
| 2721 void test_typeArgumentNotMatchingBounds_const() { | 2768 void test_typeArgumentNotMatchingBounds_const() { |
| 2722 Source source = addSource(EngineTestCase.createSource([ | 2769 Source source = addSource(EngineTestCase.createSource([ |
| 2723 "class A {}", | 2770 "class A {}", |
| 2724 "class B extends A {}", | 2771 "class B extends A {}", |
| 2725 "class G<E extends A> {", | 2772 "class G<E extends A> {", |
| 2726 " const G();", | 2773 " const G();", |
| 2727 "}", | 2774 "}", |
| 2728 "f() { return const G<B>(); }"])); | 2775 "f() { return const G<B>(); }"])); |
| 2729 resolve(source); | 2776 resolve(source); |
| 2730 assertNoErrors(); | 2777 assertNoErrors(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2823 " Foo.ctor();", | 2870 " Foo.ctor();", |
| 2824 "}", | 2871 "}", |
| 2825 "class Bar extends Foo {", | 2872 "class Bar extends Foo {", |
| 2826 " Bar() : this.ctor();", | 2873 " Bar() : this.ctor();", |
| 2827 " Bar.ctor() : super.ctor();", | 2874 " Bar.ctor() : super.ctor();", |
| 2828 "}"])); | 2875 "}"])); |
| 2829 resolve(source); | 2876 resolve(source); |
| 2830 assertNoErrors(); | 2877 assertNoErrors(); |
| 2831 verify([source]); | 2878 verify([source]); |
| 2832 } | 2879 } |
| 2833 void test_undefinedGetter_noSuchMethod_getter() { | |
| 2834 Source source = addSource(EngineTestCase.createSource([ | |
| 2835 "class A {", | |
| 2836 " noSuchMethod(invocation) {}", | |
| 2837 "}", | |
| 2838 "f() {", | |
| 2839 " (new A()).g;", | |
| 2840 "}"])); | |
| 2841 resolve(source); | |
| 2842 assertNoErrors(); | |
| 2843 } | |
| 2844 void test_undefinedGetter_noSuchMethod_getter2() { | |
| 2845 Source source = addSource(EngineTestCase.createSource([ | |
| 2846 "class A {", | |
| 2847 " noSuchMethod(invocation) {}", | |
| 2848 "}", | |
| 2849 "class B {", | |
| 2850 " A a = new A();", | |
| 2851 " m() {", | |
| 2852 " a.g;", | |
| 2853 " }", | |
| 2854 "}"])); | |
| 2855 resolve(source); | |
| 2856 assertNoErrors(); | |
| 2857 } | |
| 2858 void test_undefinedGetter_typeSubstitution() { | 2880 void test_undefinedGetter_typeSubstitution() { |
| 2859 Source source = addSource(EngineTestCase.createSource([ | 2881 Source source = addSource(EngineTestCase.createSource([ |
| 2860 "class A<E> {", | 2882 "class A<E> {", |
| 2861 " E element;", | 2883 " E element;", |
| 2862 "}", | 2884 "}", |
| 2863 "class B extends A<List> {", | 2885 "class B extends A<List> {", |
| 2864 " m() {", | 2886 " m() {", |
| 2865 " element.last;", | 2887 " element.last;", |
| 2866 " }", | 2888 " }", |
| 2867 "}"])); | 2889 "}"])); |
| 2868 resolve(source); | 2890 resolve(source); |
| 2869 assertNoErrors(); | 2891 assertNoErrors(); |
| 2870 verify([source]); | 2892 verify([source]); |
| 2871 } | 2893 } |
| 2872 void test_undefinedIdentifier_hide() { | 2894 void test_undefinedIdentifier_hide() { |
| 2873 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' hide a;"])); | 2895 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' hide a;"])); |
| 2874 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); | 2896 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 2875 resolve(source); | 2897 resolve(source); |
| 2876 assertNoErrors(); | 2898 assertNoErrors(); |
| 2877 verify([source]); | 2899 verify([source]); |
| 2878 } | 2900 } |
| 2879 void test_undefinedIdentifier_noSuchMethod() { | |
| 2880 Source source = addSource(EngineTestCase.createSource([ | |
| 2881 "class A {", | |
| 2882 " noSuchMethod(invocation) {}", | |
| 2883 " f() {", | |
| 2884 " var v = a;", | |
| 2885 " }", | |
| 2886 "}"])); | |
| 2887 resolve(source); | |
| 2888 assertNoErrors(); | |
| 2889 } | |
| 2890 void test_undefinedIdentifier_show() { | 2901 void test_undefinedIdentifier_show() { |
| 2891 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' show a;"])); | 2902 Source source = addSource(EngineTestCase.createSource(["library L;", "export
'lib1.dart' show a;"])); |
| 2892 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); | 2903 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 2893 resolve(source); | 2904 resolve(source); |
| 2894 assertNoErrors(); | 2905 assertNoErrors(); |
| 2895 verify([source]); | 2906 verify([source]); |
| 2896 } | 2907 } |
| 2897 void test_undefinedMethod_functionExpression_callMethod() { | 2908 void test_undefinedMethod_functionExpression_callMethod() { |
| 2898 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null).call();", "}"])); | 2909 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null).call();", "}"])); |
| 2899 resolve(source); | 2910 resolve(source); |
| 2900 assertNoErrors(); | 2911 assertNoErrors(); |
| 2901 } | 2912 } |
| 2902 void test_undefinedMethod_functionExpression_directCall() { | 2913 void test_undefinedMethod_functionExpression_directCall() { |
| 2903 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null)();", "}"])); | 2914 Source source = addSource(EngineTestCase.createSource(["main() {", " (() =>
null)();", "}"])); |
| 2904 resolve(source); | 2915 resolve(source); |
| 2905 assertNoErrors(); | 2916 assertNoErrors(); |
| 2906 } | 2917 } |
| 2907 void test_undefinedMethod_noSuchMethod() { | |
| 2908 Source source = addSource(EngineTestCase.createSource([ | |
| 2909 "class A {", | |
| 2910 " noSuchMethod(invocation) {}", | |
| 2911 "}", | |
| 2912 "f() {", | |
| 2913 " (new A()).m();", | |
| 2914 "}"])); | |
| 2915 resolve(source); | |
| 2916 assertNoErrors(); | |
| 2917 } | |
| 2918 void test_undefinedOperator_index() { | 2918 void test_undefinedOperator_index() { |
| 2919 Source source = addSource(EngineTestCase.createSource([ | 2919 Source source = addSource(EngineTestCase.createSource([ |
| 2920 "class A {", | 2920 "class A {", |
| 2921 " operator [](a) {}", | 2921 " operator [](a) {}", |
| 2922 " operator []=(a, b) {}", | 2922 " operator []=(a, b) {}", |
| 2923 "}", | 2923 "}", |
| 2924 "f(A a) {", | 2924 "f(A a) {", |
| 2925 " a[0];", | 2925 " a[0];", |
| 2926 " a[0] = 1;", | 2926 " a[0] = 1;", |
| 2927 "}"])); | 2927 "}"])); |
| 2928 resolve(source); | 2928 resolve(source); |
| 2929 assertNoErrors(); | 2929 assertNoErrors(); |
| 2930 verify([source]); | 2930 verify([source]); |
| 2931 } | 2931 } |
| 2932 void test_undefinedOperator_tilde() { | 2932 void test_undefinedOperator_tilde() { |
| 2933 Source source = addSource(EngineTestCase.createSource(["const A = 3;", "cons
t B = ~((1 << A) - 1);"])); | 2933 Source source = addSource(EngineTestCase.createSource(["const A = 3;", "cons
t B = ~((1 << A) - 1);"])); |
| 2934 resolve(source); | 2934 resolve(source); |
| 2935 assertNoErrors(); | 2935 assertNoErrors(); |
| 2936 verify([source]); | 2936 verify([source]); |
| 2937 } | 2937 } |
| 2938 void test_undefinedSetter_noSuchMethod() { | |
| 2939 Source source = addSource(EngineTestCase.createSource([ | |
| 2940 "class A {", | |
| 2941 " noSuchMethod(invocation) {}", | |
| 2942 "}", | |
| 2943 "f() {", | |
| 2944 " (new A()).s = 1;", | |
| 2945 "}"])); | |
| 2946 resolve(source); | |
| 2947 assertNoErrors(); | |
| 2948 } | |
| 2949 void test_undefinedSuperMethod_field() { | 2938 void test_undefinedSuperMethod_field() { |
| 2950 Source source = addSource(EngineTestCase.createSource([ | 2939 Source source = addSource(EngineTestCase.createSource([ |
| 2951 "class A {", | 2940 "class A {", |
| 2952 " var m;", | 2941 " var m;", |
| 2953 "}", | 2942 "}", |
| 2954 "class B extends A {", | 2943 "class B extends A {", |
| 2955 " f() {", | 2944 " f() {", |
| 2956 " super.m();", | 2945 " super.m();", |
| 2957 " }", | 2946 " }", |
| 2958 "}"])); | 2947 "}"])); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3520 runJUnitTest(__test, __test.test_newWithAbstractClass_factory); | 3509 runJUnitTest(__test, __test.test_newWithAbstractClass_factory); |
| 3521 }); | 3510 }); |
| 3522 _ut.test('test_newWithUndefinedConstructor', () { | 3511 _ut.test('test_newWithUndefinedConstructor', () { |
| 3523 final __test = new NonErrorResolverTest(); | 3512 final __test = new NonErrorResolverTest(); |
| 3524 runJUnitTest(__test, __test.test_newWithUndefinedConstructor); | 3513 runJUnitTest(__test, __test.test_newWithUndefinedConstructor); |
| 3525 }); | 3514 }); |
| 3526 _ut.test('test_newWithUndefinedConstructorDefault', () { | 3515 _ut.test('test_newWithUndefinedConstructorDefault', () { |
| 3527 final __test = new NonErrorResolverTest(); | 3516 final __test = new NonErrorResolverTest(); |
| 3528 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); | 3517 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); |
| 3529 }); | 3518 }); |
| 3519 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_accessor', () { |
| 3520 final __test = new NonErrorResolverTest(); |
| 3521 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_accessor); |
| 3522 }); |
| 3523 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_method', () { |
| 3524 final __test = new NonErrorResolverTest(); |
| 3525 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_method); |
| 3526 }); |
| 3527 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod', ()
{ |
| 3528 final __test = new NonErrorResolverTest(); |
| 3529 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod); |
| 3530 }); |
| 3530 _ut.test('test_nonBoolExpression_functionType', () { | 3531 _ut.test('test_nonBoolExpression_functionType', () { |
| 3531 final __test = new NonErrorResolverTest(); | 3532 final __test = new NonErrorResolverTest(); |
| 3532 runJUnitTest(__test, __test.test_nonBoolExpression_functionType); | 3533 runJUnitTest(__test, __test.test_nonBoolExpression_functionType); |
| 3533 }); | 3534 }); |
| 3534 _ut.test('test_nonBoolExpression_interfaceType', () { | 3535 _ut.test('test_nonBoolExpression_interfaceType', () { |
| 3535 final __test = new NonErrorResolverTest(); | 3536 final __test = new NonErrorResolverTest(); |
| 3536 runJUnitTest(__test, __test.test_nonBoolExpression_interfaceType); | 3537 runJUnitTest(__test, __test.test_nonBoolExpression_interfaceType); |
| 3537 }); | 3538 }); |
| 3538 _ut.test('test_nonConstCaseExpression', () { | 3539 _ut.test('test_nonConstCaseExpression', () { |
| 3539 final __test = new NonErrorResolverTest(); | 3540 final __test = new NonErrorResolverTest(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3740 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_propertyAc
cess_propertyAccessor); | 3741 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_propertyAc
cess_propertyAccessor); |
| 3741 }); | 3742 }); |
| 3742 _ut.test('test_superInInvalidContext', () { | 3743 _ut.test('test_superInInvalidContext', () { |
| 3743 final __test = new NonErrorResolverTest(); | 3744 final __test = new NonErrorResolverTest(); |
| 3744 runJUnitTest(__test, __test.test_superInInvalidContext); | 3745 runJUnitTest(__test, __test.test_superInInvalidContext); |
| 3745 }); | 3746 }); |
| 3746 _ut.test('test_typeAliasCannotReferenceItself_returnClass_withTypeAlias',
() { | 3747 _ut.test('test_typeAliasCannotReferenceItself_returnClass_withTypeAlias',
() { |
| 3747 final __test = new NonErrorResolverTest(); | 3748 final __test = new NonErrorResolverTest(); |
| 3748 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnCl
ass_withTypeAlias); | 3749 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnCl
ass_withTypeAlias); |
| 3749 }); | 3750 }); |
| 3751 _ut.test('test_typeAliasCannotReferenceItself_typeVariableBounds', () { |
| 3752 final __test = new NonErrorResolverTest(); |
| 3753 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_typeVari
ableBounds); |
| 3754 }); |
| 3750 _ut.test('test_typeArgumentNotMatchingBounds_const', () { | 3755 _ut.test('test_typeArgumentNotMatchingBounds_const', () { |
| 3751 final __test = new NonErrorResolverTest(); | 3756 final __test = new NonErrorResolverTest(); |
| 3752 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); | 3757 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); |
| 3753 }); | 3758 }); |
| 3754 _ut.test('test_typeArgumentNotMatchingBounds_new', () { | 3759 _ut.test('test_typeArgumentNotMatchingBounds_new', () { |
| 3755 final __test = new NonErrorResolverTest(); | 3760 final __test = new NonErrorResolverTest(); |
| 3756 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); | 3761 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); |
| 3757 }); | 3762 }); |
| 3758 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_0', () { | 3763 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_0', () { |
| 3759 final __test = new NonErrorResolverTest(); | 3764 final __test = new NonErrorResolverTest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3784 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_impli
cit); | 3789 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_impli
cit); |
| 3785 }); | 3790 }); |
| 3786 _ut.test('test_undefinedConstructorInInitializer_implicit_typedef', () { | 3791 _ut.test('test_undefinedConstructorInInitializer_implicit_typedef', () { |
| 3787 final __test = new NonErrorResolverTest(); | 3792 final __test = new NonErrorResolverTest(); |
| 3788 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_impli
cit_typedef); | 3793 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_impli
cit_typedef); |
| 3789 }); | 3794 }); |
| 3790 _ut.test('test_undefinedConstructorInInitializer_redirecting', () { | 3795 _ut.test('test_undefinedConstructorInInitializer_redirecting', () { |
| 3791 final __test = new NonErrorResolverTest(); | 3796 final __test = new NonErrorResolverTest(); |
| 3792 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_redir
ecting); | 3797 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_redir
ecting); |
| 3793 }); | 3798 }); |
| 3794 _ut.test('test_undefinedGetter_noSuchMethod_getter', () { | |
| 3795 final __test = new NonErrorResolverTest(); | |
| 3796 runJUnitTest(__test, __test.test_undefinedGetter_noSuchMethod_getter); | |
| 3797 }); | |
| 3798 _ut.test('test_undefinedGetter_noSuchMethod_getter2', () { | |
| 3799 final __test = new NonErrorResolverTest(); | |
| 3800 runJUnitTest(__test, __test.test_undefinedGetter_noSuchMethod_getter2); | |
| 3801 }); | |
| 3802 _ut.test('test_undefinedGetter_typeSubstitution', () { | 3799 _ut.test('test_undefinedGetter_typeSubstitution', () { |
| 3803 final __test = new NonErrorResolverTest(); | 3800 final __test = new NonErrorResolverTest(); |
| 3804 runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution); | 3801 runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution); |
| 3805 }); | 3802 }); |
| 3806 _ut.test('test_undefinedIdentifier_hide', () { | 3803 _ut.test('test_undefinedIdentifier_hide', () { |
| 3807 final __test = new NonErrorResolverTest(); | 3804 final __test = new NonErrorResolverTest(); |
| 3808 runJUnitTest(__test, __test.test_undefinedIdentifier_hide); | 3805 runJUnitTest(__test, __test.test_undefinedIdentifier_hide); |
| 3809 }); | 3806 }); |
| 3810 _ut.test('test_undefinedIdentifier_noSuchMethod', () { | |
| 3811 final __test = new NonErrorResolverTest(); | |
| 3812 runJUnitTest(__test, __test.test_undefinedIdentifier_noSuchMethod); | |
| 3813 }); | |
| 3814 _ut.test('test_undefinedIdentifier_show', () { | 3807 _ut.test('test_undefinedIdentifier_show', () { |
| 3815 final __test = new NonErrorResolverTest(); | 3808 final __test = new NonErrorResolverTest(); |
| 3816 runJUnitTest(__test, __test.test_undefinedIdentifier_show); | 3809 runJUnitTest(__test, __test.test_undefinedIdentifier_show); |
| 3817 }); | 3810 }); |
| 3818 _ut.test('test_undefinedMethod_functionExpression_callMethod', () { | 3811 _ut.test('test_undefinedMethod_functionExpression_callMethod', () { |
| 3819 final __test = new NonErrorResolverTest(); | 3812 final __test = new NonErrorResolverTest(); |
| 3820 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_call
Method); | 3813 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_call
Method); |
| 3821 }); | 3814 }); |
| 3822 _ut.test('test_undefinedMethod_functionExpression_directCall', () { | 3815 _ut.test('test_undefinedMethod_functionExpression_directCall', () { |
| 3823 final __test = new NonErrorResolverTest(); | 3816 final __test = new NonErrorResolverTest(); |
| 3824 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_dire
ctCall); | 3817 runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_dire
ctCall); |
| 3825 }); | 3818 }); |
| 3826 _ut.test('test_undefinedMethod_noSuchMethod', () { | |
| 3827 final __test = new NonErrorResolverTest(); | |
| 3828 runJUnitTest(__test, __test.test_undefinedMethod_noSuchMethod); | |
| 3829 }); | |
| 3830 _ut.test('test_undefinedOperator_index', () { | 3819 _ut.test('test_undefinedOperator_index', () { |
| 3831 final __test = new NonErrorResolverTest(); | 3820 final __test = new NonErrorResolverTest(); |
| 3832 runJUnitTest(__test, __test.test_undefinedOperator_index); | 3821 runJUnitTest(__test, __test.test_undefinedOperator_index); |
| 3833 }); | 3822 }); |
| 3834 _ut.test('test_undefinedOperator_tilde', () { | 3823 _ut.test('test_undefinedOperator_tilde', () { |
| 3835 final __test = new NonErrorResolverTest(); | 3824 final __test = new NonErrorResolverTest(); |
| 3836 runJUnitTest(__test, __test.test_undefinedOperator_tilde); | 3825 runJUnitTest(__test, __test.test_undefinedOperator_tilde); |
| 3837 }); | 3826 }); |
| 3838 _ut.test('test_undefinedSetter_noSuchMethod', () { | |
| 3839 final __test = new NonErrorResolverTest(); | |
| 3840 runJUnitTest(__test, __test.test_undefinedSetter_noSuchMethod); | |
| 3841 }); | |
| 3842 _ut.test('test_undefinedSuperMethod_field', () { | 3827 _ut.test('test_undefinedSuperMethod_field', () { |
| 3843 final __test = new NonErrorResolverTest(); | 3828 final __test = new NonErrorResolverTest(); |
| 3844 runJUnitTest(__test, __test.test_undefinedSuperMethod_field); | 3829 runJUnitTest(__test, __test.test_undefinedSuperMethod_field); |
| 3845 }); | 3830 }); |
| 3846 _ut.test('test_undefinedSuperMethod_method', () { | 3831 _ut.test('test_undefinedSuperMethod_method', () { |
| 3847 final __test = new NonErrorResolverTest(); | 3832 final __test = new NonErrorResolverTest(); |
| 3848 runJUnitTest(__test, __test.test_undefinedSuperMethod_method); | 3833 runJUnitTest(__test, __test.test_undefinedSuperMethod_method); |
| 3849 }); | 3834 }); |
| 3850 _ut.test('test_wrongNumberOfParametersForOperator1', () { | 3835 _ut.test('test_wrongNumberOfParametersForOperator1', () { |
| 3851 final __test = new NonErrorResolverTest(); | 3836 final __test = new NonErrorResolverTest(); |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5037 " var one = 1;", | 5022 " var one = 1;", |
| 5038 " return;", | 5023 " return;", |
| 5039 " var two = 2;", | 5024 " var two = 2;", |
| 5040 " return;", | 5025 " return;", |
| 5041 " var three = 3;", | 5026 " var three = 3;", |
| 5042 "}"])); | 5027 "}"])); |
| 5043 resolve(source); | 5028 resolve(source); |
| 5044 assertErrors([HintCode.DEAD_CODE]); | 5029 assertErrors([HintCode.DEAD_CODE]); |
| 5045 verify([source]); | 5030 verify([source]); |
| 5046 } | 5031 } |
| 5032 void test_unusedImport() { |
| 5033 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'lib1.dart';"])); |
| 5034 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"])); |
| 5035 resolve(source); |
| 5036 assertErrors([HintCode.UNUSED_IMPORT]); |
| 5037 verify([source]); |
| 5038 } |
| 5039 void test_unusedImport_as() { |
| 5040 Source source = addSource(EngineTestCase.createSource([ |
| 5041 "library L;", |
| 5042 "import 'lib1.dart';", |
| 5043 "import 'lib1.dart' as one;", |
| 5044 "one.A a;"])); |
| 5045 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s A {}"])); |
| 5046 resolve(source); |
| 5047 assertErrors([HintCode.UNUSED_IMPORT]); |
| 5048 verify([source]); |
| 5049 } |
| 5050 void test_unusedImport_hide() { |
| 5051 Source source = addSource(EngineTestCase.createSource([ |
| 5052 "library L;", |
| 5053 "import 'lib1.dart';", |
| 5054 "import 'lib1.dart' hide A;", |
| 5055 "A a;"])); |
| 5056 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s A {}"])); |
| 5057 resolve(source); |
| 5058 assertErrors([HintCode.UNUSED_IMPORT]); |
| 5059 verify([source]); |
| 5060 } |
| 5061 void test_unusedImport_show() { |
| 5062 Source source = addSource(EngineTestCase.createSource([ |
| 5063 "library L;", |
| 5064 "import 'lib1.dart' show A;", |
| 5065 "import 'lib1.dart' show B;", |
| 5066 "A a;"])); |
| 5067 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s A {}", "class B {}"])); |
| 5068 resolve(source); |
| 5069 assertErrors([HintCode.UNUSED_IMPORT]); |
| 5070 verify([source]); |
| 5071 } |
| 5047 static dartSuite() { | 5072 static dartSuite() { |
| 5048 _ut.group('HintCodeTest', () { | 5073 _ut.group('HintCodeTest', () { |
| 5049 _ut.test('test_deadCode_deadBlock_conditionalElse', () { | 5074 _ut.test('test_deadCode_deadBlock_conditionalElse', () { |
| 5050 final __test = new HintCodeTest(); | 5075 final __test = new HintCodeTest(); |
| 5051 runJUnitTest(__test, __test.test_deadCode_deadBlock_conditionalElse); | 5076 runJUnitTest(__test, __test.test_deadCode_deadBlock_conditionalElse); |
| 5052 }); | 5077 }); |
| 5053 _ut.test('test_deadCode_deadBlock_conditionalElse_nested', () { | 5078 _ut.test('test_deadCode_deadBlock_conditionalElse_nested', () { |
| 5054 final __test = new HintCodeTest(); | 5079 final __test = new HintCodeTest(); |
| 5055 runJUnitTest(__test, __test.test_deadCode_deadBlock_conditionalElse_nest
ed); | 5080 runJUnitTest(__test, __test.test_deadCode_deadBlock_conditionalElse_nest
ed); |
| 5056 }); | 5081 }); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5139 runJUnitTest(__test, __test.test_deadCode_statementAfterReturn_method); | 5164 runJUnitTest(__test, __test.test_deadCode_statementAfterReturn_method); |
| 5140 }); | 5165 }); |
| 5141 _ut.test('test_deadCode_statementAfterReturn_nested', () { | 5166 _ut.test('test_deadCode_statementAfterReturn_nested', () { |
| 5142 final __test = new HintCodeTest(); | 5167 final __test = new HintCodeTest(); |
| 5143 runJUnitTest(__test, __test.test_deadCode_statementAfterReturn_nested); | 5168 runJUnitTest(__test, __test.test_deadCode_statementAfterReturn_nested); |
| 5144 }); | 5169 }); |
| 5145 _ut.test('test_deadCode_statementAfterReturn_twoReturns', () { | 5170 _ut.test('test_deadCode_statementAfterReturn_twoReturns', () { |
| 5146 final __test = new HintCodeTest(); | 5171 final __test = new HintCodeTest(); |
| 5147 runJUnitTest(__test, __test.test_deadCode_statementAfterReturn_twoReturn
s); | 5172 runJUnitTest(__test, __test.test_deadCode_statementAfterReturn_twoReturn
s); |
| 5148 }); | 5173 }); |
| 5174 _ut.test('test_unusedImport', () { |
| 5175 final __test = new HintCodeTest(); |
| 5176 runJUnitTest(__test, __test.test_unusedImport); |
| 5177 }); |
| 5178 _ut.test('test_unusedImport_as', () { |
| 5179 final __test = new HintCodeTest(); |
| 5180 runJUnitTest(__test, __test.test_unusedImport_as); |
| 5181 }); |
| 5182 _ut.test('test_unusedImport_hide', () { |
| 5183 final __test = new HintCodeTest(); |
| 5184 runJUnitTest(__test, __test.test_unusedImport_hide); |
| 5185 }); |
| 5186 _ut.test('test_unusedImport_show', () { |
| 5187 final __test = new HintCodeTest(); |
| 5188 runJUnitTest(__test, __test.test_unusedImport_show); |
| 5189 }); |
| 5149 }); | 5190 }); |
| 5150 } | 5191 } |
| 5151 } | 5192 } |
| 5152 class TypeResolverVisitorTest extends EngineTestCase { | 5193 class TypeResolverVisitorTest extends EngineTestCase { |
| 5153 | 5194 |
| 5154 /** | 5195 /** |
| 5155 * The error listener to which errors will be reported. | 5196 * The error listener to which errors will be reported. |
| 5156 */ | 5197 */ |
| 5157 GatheringErrorListener _listener; | 5198 GatheringErrorListener _listener; |
| 5158 | 5199 |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5778 LibraryElementImpl _definingLibrary; | 5819 LibraryElementImpl _definingLibrary; |
| 5779 | 5820 |
| 5780 /** | 5821 /** |
| 5781 * The inheritance manager being tested. | 5822 * The inheritance manager being tested. |
| 5782 */ | 5823 */ |
| 5783 InheritanceManager _inheritanceManager; | 5824 InheritanceManager _inheritanceManager; |
| 5784 void setUp() { | 5825 void setUp() { |
| 5785 _typeProvider = new TestTypeProvider(); | 5826 _typeProvider = new TestTypeProvider(); |
| 5786 _inheritanceManager = createInheritanceManager(); | 5827 _inheritanceManager = createInheritanceManager(); |
| 5787 } | 5828 } |
| 5829 void test_getMapOfMembersInheritedFromClasses_accessor_extends() { |
| 5830 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5831 String getterName = "g"; |
| 5832 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 5833 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 5834 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5835 classB.supertype = classA.type; |
| 5836 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromClasses(classB); |
| 5837 JUnitTestCase.assertSame(getterG, map[getterName]); |
| 5838 assertNoErrors(classA); |
| 5839 assertNoErrors(classB); |
| 5840 } |
| 5841 void test_getMapOfMembersInheritedFromClasses_accessor_implements() { |
| 5842 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5843 String getterName = "g"; |
| 5844 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 5845 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 5846 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5847 classB.interfaces = <InterfaceType> [classA.type]; |
| 5848 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromClasses(classB); |
| 5849 JUnitTestCase.assertNull(map[getterName]); |
| 5850 assertNoErrors(classA); |
| 5851 assertNoErrors(classB); |
| 5852 } |
| 5853 void test_getMapOfMembersInheritedFromClasses_accessor_with() { |
| 5854 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5855 String getterName = "g"; |
| 5856 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 5857 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 5858 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5859 classB.mixins = <InterfaceType> [classA.type]; |
| 5860 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromClasses(classB); |
| 5861 JUnitTestCase.assertSame(getterG, map[getterName]); |
| 5862 assertNoErrors(classA); |
| 5863 assertNoErrors(classB); |
| 5864 } |
| 5865 void test_getMapOfMembersInheritedFromClasses_method_extends() { |
| 5866 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5867 String methodName = "m"; |
| 5868 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 5869 classA.methods = <MethodElement> [methodM]; |
| 5870 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5871 classB.supertype = classA.type; |
| 5872 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromClasses(classB); |
| 5873 JUnitTestCase.assertSame(methodM, map[methodName]); |
| 5874 assertNoErrors(classA); |
| 5875 assertNoErrors(classB); |
| 5876 } |
| 5877 void test_getMapOfMembersInheritedFromClasses_method_implements() { |
| 5878 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5879 String methodName = "m"; |
| 5880 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 5881 classA.methods = <MethodElement> [methodM]; |
| 5882 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5883 classB.interfaces = <InterfaceType> [classA.type]; |
| 5884 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromClasses(classB); |
| 5885 JUnitTestCase.assertNull(map[methodName]); |
| 5886 assertNoErrors(classA); |
| 5887 assertNoErrors(classB); |
| 5888 } |
| 5889 void test_getMapOfMembersInheritedFromClasses_method_with() { |
| 5890 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5891 String methodName = "m"; |
| 5892 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 5893 classA.methods = <MethodElement> [methodM]; |
| 5894 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5895 classB.mixins = <InterfaceType> [classA.type]; |
| 5896 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromClasses(classB); |
| 5897 JUnitTestCase.assertSame(methodM, map[methodName]); |
| 5898 assertNoErrors(classA); |
| 5899 assertNoErrors(classB); |
| 5900 } |
| 5901 void test_getMapOfMembersInheritedFromInterfaces_accessor_extends() { |
| 5902 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5903 String getterName = "g"; |
| 5904 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 5905 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 5906 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5907 classB.supertype = classA.type; |
| 5908 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromInterfaces(classB); |
| 5909 JUnitTestCase.assertSame(getterG, map[getterName]); |
| 5910 assertNoErrors(classA); |
| 5911 assertNoErrors(classB); |
| 5912 } |
| 5913 void test_getMapOfMembersInheritedFromInterfaces_accessor_implements() { |
| 5914 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5915 String getterName = "g"; |
| 5916 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 5917 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 5918 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5919 classB.interfaces = <InterfaceType> [classA.type]; |
| 5920 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromInterfaces(classB); |
| 5921 JUnitTestCase.assertSame(getterG, map[getterName]); |
| 5922 assertNoErrors(classA); |
| 5923 assertNoErrors(classB); |
| 5924 } |
| 5925 void test_getMapOfMembersInheritedFromInterfaces_accessor_with() { |
| 5926 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5927 String getterName = "g"; |
| 5928 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 5929 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 5930 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5931 classB.mixins = <InterfaceType> [classA.type]; |
| 5932 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromInterfaces(classB); |
| 5933 JUnitTestCase.assertSame(getterG, map[getterName]); |
| 5934 assertNoErrors(classA); |
| 5935 assertNoErrors(classB); |
| 5936 } |
| 5937 void test_getMapOfMembersInheritedFromInterfaces_method_extends() { |
| 5938 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5939 String methodName = "m"; |
| 5940 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 5941 classA.methods = <MethodElement> [methodM]; |
| 5942 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5943 classB.supertype = classA.type; |
| 5944 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromInterfaces(classB); |
| 5945 JUnitTestCase.assertSame(methodM, map[methodName]); |
| 5946 assertNoErrors(classA); |
| 5947 assertNoErrors(classB); |
| 5948 } |
| 5949 void test_getMapOfMembersInheritedFromInterfaces_method_implements() { |
| 5950 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5951 String methodName = "m"; |
| 5952 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 5953 classA.methods = <MethodElement> [methodM]; |
| 5954 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5955 classB.interfaces = <InterfaceType> [classA.type]; |
| 5956 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromInterfaces(classB); |
| 5957 JUnitTestCase.assertSame(methodM, map[methodName]); |
| 5958 assertNoErrors(classA); |
| 5959 assertNoErrors(classB); |
| 5960 } |
| 5961 void test_getMapOfMembersInheritedFromInterfaces_method_with() { |
| 5962 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5963 String methodName = "m"; |
| 5964 MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvid
er.intType, []); |
| 5965 classA.methods = <MethodElement> [methodM]; |
| 5966 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5967 classB.mixins = <InterfaceType> [classA.type]; |
| 5968 Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInhe
ritedFromInterfaces(classB); |
| 5969 JUnitTestCase.assertSame(methodM, map[methodName]); |
| 5970 assertNoErrors(classA); |
| 5971 assertNoErrors(classB); |
| 5972 } |
| 5788 void test_lookupInheritance_interface_getter() { | 5973 void test_lookupInheritance_interface_getter() { |
| 5789 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 5974 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 5790 String getterName = "g"; | 5975 String getterName = "g"; |
| 5791 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); | 5976 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, _typeProvider.intType); |
| 5792 classA.accessors = <PropertyAccessorElement> [getterG]; | 5977 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 5793 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 5978 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 5794 classB.interfaces = <InterfaceType> [classA.type]; | 5979 classB.interfaces = <InterfaceType> [classA.type]; |
| 5795 JUnitTestCase.assertSame(getterG, _inheritanceManager.lookupInheritance(clas
sB, getterName)); | 5980 JUnitTestCase.assertSame(getterG, _inheritanceManager.lookupInheritance(clas
sB, getterName)); |
| 5796 assertNoErrors(classA); | 5981 assertNoErrors(classA); |
| 5797 assertNoErrors(classB); | 5982 assertNoErrors(classB); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6093 AnalysisContextImpl context = AnalysisContextFactory.contextWithCore(); | 6278 AnalysisContextImpl context = AnalysisContextFactory.contextWithCore(); |
| 6094 FileBasedSource source = new FileBasedSource.con1(new ContentCache(), FileUt
ilities2.createFile("/test.dart")); | 6279 FileBasedSource source = new FileBasedSource.con1(new ContentCache(), FileUt
ilities2.createFile("/test.dart")); |
| 6095 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("test.dart"); | 6280 CompilationUnitElementImpl definingCompilationUnit = new CompilationUnitElem
entImpl("test.dart"); |
| 6096 definingCompilationUnit.source = source; | 6281 definingCompilationUnit.source = source; |
| 6097 _definingLibrary = ElementFactory.library(context, "test"); | 6282 _definingLibrary = ElementFactory.library(context, "test"); |
| 6098 _definingLibrary.definingCompilationUnit = definingCompilationUnit; | 6283 _definingLibrary.definingCompilationUnit = definingCompilationUnit; |
| 6099 return new InheritanceManager(_definingLibrary); | 6284 return new InheritanceManager(_definingLibrary); |
| 6100 } | 6285 } |
| 6101 static dartSuite() { | 6286 static dartSuite() { |
| 6102 _ut.group('InheritanceManagerTest', () { | 6287 _ut.group('InheritanceManagerTest', () { |
| 6288 _ut.test('test_getMapOfMembersInheritedFromClasses_accessor_extends', () { |
| 6289 final __test = new InheritanceManagerTest(); |
| 6290 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_acc
essor_extends); |
| 6291 }); |
| 6292 _ut.test('test_getMapOfMembersInheritedFromClasses_accessor_implements', (
) { |
| 6293 final __test = new InheritanceManagerTest(); |
| 6294 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_acc
essor_implements); |
| 6295 }); |
| 6296 _ut.test('test_getMapOfMembersInheritedFromClasses_accessor_with', () { |
| 6297 final __test = new InheritanceManagerTest(); |
| 6298 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_acc
essor_with); |
| 6299 }); |
| 6300 _ut.test('test_getMapOfMembersInheritedFromClasses_method_extends', () { |
| 6301 final __test = new InheritanceManagerTest(); |
| 6302 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_met
hod_extends); |
| 6303 }); |
| 6304 _ut.test('test_getMapOfMembersInheritedFromClasses_method_implements', ()
{ |
| 6305 final __test = new InheritanceManagerTest(); |
| 6306 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_met
hod_implements); |
| 6307 }); |
| 6308 _ut.test('test_getMapOfMembersInheritedFromClasses_method_with', () { |
| 6309 final __test = new InheritanceManagerTest(); |
| 6310 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_met
hod_with); |
| 6311 }); |
| 6312 _ut.test('test_getMapOfMembersInheritedFromInterfaces_accessor_extends', (
) { |
| 6313 final __test = new InheritanceManagerTest(); |
| 6314 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_
accessor_extends); |
| 6315 }); |
| 6316 _ut.test('test_getMapOfMembersInheritedFromInterfaces_accessor_implements'
, () { |
| 6317 final __test = new InheritanceManagerTest(); |
| 6318 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_
accessor_implements); |
| 6319 }); |
| 6320 _ut.test('test_getMapOfMembersInheritedFromInterfaces_accessor_with', () { |
| 6321 final __test = new InheritanceManagerTest(); |
| 6322 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_
accessor_with); |
| 6323 }); |
| 6324 _ut.test('test_getMapOfMembersInheritedFromInterfaces_method_extends', ()
{ |
| 6325 final __test = new InheritanceManagerTest(); |
| 6326 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_
method_extends); |
| 6327 }); |
| 6328 _ut.test('test_getMapOfMembersInheritedFromInterfaces_method_implements',
() { |
| 6329 final __test = new InheritanceManagerTest(); |
| 6330 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_
method_implements); |
| 6331 }); |
| 6332 _ut.test('test_getMapOfMembersInheritedFromInterfaces_method_with', () { |
| 6333 final __test = new InheritanceManagerTest(); |
| 6334 runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_
method_with); |
| 6335 }); |
| 6103 _ut.test('test_lookupInheritance_interface_getter', () { | 6336 _ut.test('test_lookupInheritance_interface_getter', () { |
| 6104 final __test = new InheritanceManagerTest(); | 6337 final __test = new InheritanceManagerTest(); |
| 6105 runJUnitTest(__test, __test.test_lookupInheritance_interface_getter); | 6338 runJUnitTest(__test, __test.test_lookupInheritance_interface_getter); |
| 6106 }); | 6339 }); |
| 6107 _ut.test('test_lookupInheritance_interface_method', () { | 6340 _ut.test('test_lookupInheritance_interface_method', () { |
| 6108 final __test = new InheritanceManagerTest(); | 6341 final __test = new InheritanceManagerTest(); |
| 6109 runJUnitTest(__test, __test.test_lookupInheritance_interface_method); | 6342 runJUnitTest(__test, __test.test_lookupInheritance_interface_method); |
| 6110 }); | 6343 }); |
| 6111 _ut.test('test_lookupInheritance_interface_setter', () { | 6344 _ut.test('test_lookupInheritance_interface_setter', () { |
| 6112 final __test = new InheritanceManagerTest(); | 6345 final __test = new InheritanceManagerTest(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6292 Source source = addSource(EngineTestCase.createSource([ | 6525 Source source = addSource(EngineTestCase.createSource([ |
| 6293 "library L;", | 6526 "library L;", |
| 6294 "export 'lib1.dart';", | 6527 "export 'lib1.dart';", |
| 6295 "export 'lib2.dart';"])); | 6528 "export 'lib2.dart';"])); |
| 6296 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 6529 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 6297 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 6530 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 6298 resolve(source); | 6531 resolve(source); |
| 6299 assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]); | 6532 assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]); |
| 6300 verify([source]); | 6533 verify([source]); |
| 6301 } | 6534 } |
| 6302 void test_ambiguousImport_as() { | |
| 6303 Source source = addSource(EngineTestCase.createSource([ | |
| 6304 "import 'lib1.dart';", | |
| 6305 "import 'lib2.dart';", | |
| 6306 "f(p) {p as N;}"])); | |
| 6307 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | |
| 6308 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | |
| 6309 resolve(source); | |
| 6310 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | |
| 6311 } | |
| 6312 void test_ambiguousImport_extends() { | |
| 6313 Source source = addSource(EngineTestCase.createSource([ | |
| 6314 "import 'lib1.dart';", | |
| 6315 "import 'lib2.dart';", | |
| 6316 "class A extends N {}"])); | |
| 6317 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | |
| 6318 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | |
| 6319 resolve(source); | |
| 6320 assertErrors([ | |
| 6321 CompileTimeErrorCode.AMBIGUOUS_IMPORT, | |
| 6322 CompileTimeErrorCode.EXTENDS_NON_CLASS]); | |
| 6323 } | |
| 6324 void test_ambiguousImport_function() { | |
| 6325 Source source = addSource(EngineTestCase.createSource([ | |
| 6326 "import 'lib1.dart';", | |
| 6327 "import 'lib2.dart';", | |
| 6328 "g() { return f(); }"])); | |
| 6329 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f()
{}"])); | |
| 6330 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f()
{}"])); | |
| 6331 resolve(source); | |
| 6332 assertErrors([ | |
| 6333 CompileTimeErrorCode.AMBIGUOUS_IMPORT, | |
| 6334 StaticTypeWarningCode.UNDEFINED_FUNCTION]); | |
| 6335 } | |
| 6336 void test_ambiguousImport_implements() { | |
| 6337 Source source = addSource(EngineTestCase.createSource([ | |
| 6338 "import 'lib1.dart';", | |
| 6339 "import 'lib2.dart';", | |
| 6340 "class A implements N {}"])); | |
| 6341 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | |
| 6342 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | |
| 6343 resolve(source); | |
| 6344 assertErrors([ | |
| 6345 CompileTimeErrorCode.AMBIGUOUS_IMPORT, | |
| 6346 CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); | |
| 6347 } | |
| 6348 void test_ambiguousImport_instanceCreation() { | |
| 6349 Source source = addSource(EngineTestCase.createSource([ | |
| 6350 "library L;", | |
| 6351 "import 'lib1.dart';", | |
| 6352 "import 'lib2.dart';", | |
| 6353 "f() {new N();}"])); | |
| 6354 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | |
| 6355 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | |
| 6356 resolve(source); | |
| 6357 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | |
| 6358 } | |
| 6359 void test_ambiguousImport_is() { | |
| 6360 Source source = addSource(EngineTestCase.createSource([ | |
| 6361 "import 'lib1.dart';", | |
| 6362 "import 'lib2.dart';", | |
| 6363 "f(p) {p is N;}"])); | |
| 6364 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | |
| 6365 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | |
| 6366 resolve(source); | |
| 6367 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | |
| 6368 } | |
| 6369 void test_ambiguousImport_qualifier() { | |
| 6370 Source source = addSource(EngineTestCase.createSource([ | |
| 6371 "import 'lib1.dart';", | |
| 6372 "import 'lib2.dart';", | |
| 6373 "g() { N.FOO; }"])); | |
| 6374 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | |
| 6375 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | |
| 6376 resolve(source); | |
| 6377 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | |
| 6378 } | |
| 6379 void test_ambiguousImport_typeArgument_instanceCreation() { | |
| 6380 Source source = addSource(EngineTestCase.createSource([ | |
| 6381 "import 'lib1.dart';", | |
| 6382 "import 'lib2.dart';", | |
| 6383 "class A<T> {}", | |
| 6384 "f() {new A<N>();}"])); | |
| 6385 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | |
| 6386 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | |
| 6387 resolve(source); | |
| 6388 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | |
| 6389 } | |
| 6390 void test_ambiguousImport_varRead() { | |
| 6391 Source source = addSource(EngineTestCase.createSource([ | |
| 6392 "import 'lib1.dart';", | |
| 6393 "import 'lib2.dart';", | |
| 6394 "f() { g(v); }", | |
| 6395 "g(p) {}"])); | |
| 6396 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); | |
| 6397 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); | |
| 6398 resolve(source); | |
| 6399 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | |
| 6400 } | |
| 6401 void test_ambiguousImport_varWrite() { | |
| 6402 Source source = addSource(EngineTestCase.createSource([ | |
| 6403 "import 'lib1.dart';", | |
| 6404 "import 'lib2.dart';", | |
| 6405 "f() { v = 0; }"])); | |
| 6406 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); | |
| 6407 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); | |
| 6408 resolve(source); | |
| 6409 assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | |
| 6410 } | |
| 6411 void test_argumentDefinitionTestNonParameter() { | 6535 void test_argumentDefinitionTestNonParameter() { |
| 6412 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); | 6536 Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;
", " return ?v;", "}"])); |
| 6413 resolve(source); | 6537 resolve(source); |
| 6414 assertErrors([ | 6538 assertErrors([ |
| 6415 ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, | 6539 ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, |
| 6416 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); | 6540 CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER]); |
| 6417 verify([source]); | 6541 verify([source]); |
| 6418 } | 6542 } |
| 6419 void test_argumentTypeNotAssignable_const() { | 6543 void test_argumentTypeNotAssignable_const() { |
| 6420 Source source = addSource(EngineTestCase.createSource([ | 6544 Source source = addSource(EngineTestCase.createSource([ |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7392 " B() : super(f);", | 7516 " B() : super(f);", |
| 7393 " var f;", | 7517 " var f;", |
| 7394 "}"])); | 7518 "}"])); |
| 7395 resolve(source); | 7519 resolve(source); |
| 7396 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); | 7520 assertErrors([CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]); |
| 7397 verify([source]); | 7521 verify([source]); |
| 7398 } | 7522 } |
| 7399 void test_importInternalLibrary() { | 7523 void test_importInternalLibrary() { |
| 7400 Source source = addSource(EngineTestCase.createSource(["import 'dart:_interc
eptors';"])); | 7524 Source source = addSource(EngineTestCase.createSource(["import 'dart:_interc
eptors';"])); |
| 7401 resolve(source); | 7525 resolve(source); |
| 7402 assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]); | 7526 assertErrors([ |
| 7527 CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, |
| 7528 HintCode.UNUSED_IMPORT]); |
| 7403 verify([source]); | 7529 verify([source]); |
| 7404 } | 7530 } |
| 7405 void test_importInternalLibrary_collection() { | 7531 void test_importInternalLibrary_collection() { |
| 7406 Source source = addSource(EngineTestCase.createSource(["import 'dart:_collec
tion-dev';"])); | 7532 Source source = addSource(EngineTestCase.createSource(["import 'dart:_collec
tion-dev';"])); |
| 7407 resolve(source); | 7533 resolve(source); |
| 7408 assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]); | 7534 assertErrors([ |
| 7535 CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, |
| 7536 HintCode.UNUSED_IMPORT]); |
| 7409 verify([source]); | 7537 verify([source]); |
| 7410 } | 7538 } |
| 7411 void test_importOfNonLibrary() { | 7539 void test_importOfNonLibrary() { |
| 7412 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';"])); | 7540 Source source = addSource(EngineTestCase.createSource(["library lib;", "impo
rt 'part.dart';", "A a;"])); |
| 7413 addSource2("/part.dart", EngineTestCase.createSource(["part of lib;"])); | 7541 addSource2("/part.dart", EngineTestCase.createSource(["part of lib;", "class
A{}"])); |
| 7414 resolve(source); | 7542 resolve(source); |
| 7415 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); | 7543 assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]); |
| 7416 verify([source]); | 7544 verify([source]); |
| 7417 } | 7545 } |
| 7418 void test_inconsistentCaseExpressionTypes() { | 7546 void test_inconsistentCaseExpressionTypes() { |
| 7419 Source source = addSource(EngineTestCase.createSource([ | 7547 Source source = addSource(EngineTestCase.createSource([ |
| 7420 "f(var p) {", | 7548 "f(var p) {", |
| 7421 " switch (p) {", | 7549 " switch (p) {", |
| 7422 " case 1:", | 7550 " case 1:", |
| 7423 " break;", | 7551 " break;", |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7919 void test_multipleSuperInitializers() { | 8047 void test_multipleSuperInitializers() { |
| 7920 Source source = addSource(EngineTestCase.createSource([ | 8048 Source source = addSource(EngineTestCase.createSource([ |
| 7921 "class A {}", | 8049 "class A {}", |
| 7922 "class B extends A {", | 8050 "class B extends A {", |
| 7923 " B() : super(), super() {}", | 8051 " B() : super(), super() {}", |
| 7924 "}"])); | 8052 "}"])); |
| 7925 resolve(source); | 8053 resolve(source); |
| 7926 assertErrors([CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]); | 8054 assertErrors([CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]); |
| 7927 verify([source]); | 8055 verify([source]); |
| 7928 } | 8056 } |
| 8057 void test_nativeClauseInNonSDKCode() { |
| 8058 Source source = addSource(EngineTestCase.createSource(["class A native 'stri
ng' {}"])); |
| 8059 resolve(source); |
| 8060 assertErrors([ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]); |
| 8061 verify([source]); |
| 8062 } |
| 7929 void test_nativeFunctionBodyInNonSDKCode_function() { | 8063 void test_nativeFunctionBodyInNonSDKCode_function() { |
| 7930 Source source = addSource(EngineTestCase.createSource(["int m(a) native 'str
ing';"])); | 8064 Source source = addSource(EngineTestCase.createSource(["int m(a) native 'str
ing';"])); |
| 7931 resolve(source); | 8065 resolve(source); |
| 7932 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); | 8066 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| 7933 verify([source]); | 8067 verify([source]); |
| 7934 } | 8068 } |
| 7935 void test_nativeFunctionBodyInNonSDKCode_method() { | 8069 void test_nativeFunctionBodyInNonSDKCode_method() { |
| 7936 Source source = addSource(EngineTestCase.createSource(["class A{", " static
int m(a) native 'string';", "}"])); | 8070 Source source = addSource(EngineTestCase.createSource(["class A{", " static
int m(a) native 'string';", "}"])); |
| 7937 resolve(source); | 8071 resolve(source); |
| 7938 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); | 8072 assertErrors([ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8215 verify([source]); | 8349 verify([source]); |
| 8216 } | 8350 } |
| 8217 void test_partOfNonPart() { | 8351 void test_partOfNonPart() { |
| 8218 Source source = addSource(EngineTestCase.createSource(["library l1;", "part
'l2.dart';"])); | 8352 Source source = addSource(EngineTestCase.createSource(["library l1;", "part
'l2.dart';"])); |
| 8219 addSource2("/l2.dart", EngineTestCase.createSource(["library l2;"])); | 8353 addSource2("/l2.dart", EngineTestCase.createSource(["library l2;"])); |
| 8220 resolve(source); | 8354 resolve(source); |
| 8221 assertErrors([CompileTimeErrorCode.PART_OF_NON_PART]); | 8355 assertErrors([CompileTimeErrorCode.PART_OF_NON_PART]); |
| 8222 verify([source]); | 8356 verify([source]); |
| 8223 } | 8357 } |
| 8224 void test_prefixCollidesWithTopLevelMembers_functionTypeAlias() { | 8358 void test_prefixCollidesWithTopLevelMembers_functionTypeAlias() { |
| 8225 addSource2("/lib.dart", "library lib;"); | 8359 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A{}"])); |
| 8226 Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' a
s p;", "typedef p();"])); | 8360 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "typedef p();", "p.A a;"])); |
| 8227 resolve(source); | 8361 resolve(source); |
| 8228 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); | 8362 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| 8229 verify([source]); | 8363 verify([source]); |
| 8230 } | 8364 } |
| 8231 void test_prefixCollidesWithTopLevelMembers_topLevelFunction() { | 8365 void test_prefixCollidesWithTopLevelMembers_topLevelFunction() { |
| 8232 addSource2("/lib.dart", "library lib;"); | 8366 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A{}"])); |
| 8233 Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' a
s p;", "p() {}"])); | 8367 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "p() {}", "p.A a;"])); |
| 8234 resolve(source); | 8368 resolve(source); |
| 8235 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); | 8369 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| 8236 verify([source]); | 8370 verify([source]); |
| 8237 } | 8371 } |
| 8238 void test_prefixCollidesWithTopLevelMembers_topLevelVariable() { | 8372 void test_prefixCollidesWithTopLevelMembers_topLevelVariable() { |
| 8239 addSource2("/lib.dart", "library lib;"); | 8373 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A{}"])); |
| 8240 Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' a
s p;", "var p = null;"])); | 8374 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "var p = null;", "p.A a;"])); |
| 8241 resolve(source); | 8375 resolve(source); |
| 8242 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); | 8376 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| 8243 verify([source]); | 8377 verify([source]); |
| 8244 } | 8378 } |
| 8245 void test_prefixCollidesWithTopLevelMembers_type() { | 8379 void test_prefixCollidesWithTopLevelMembers_type() { |
| 8246 addSource2("/lib.dart", "library lib;"); | 8380 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
A{}"])); |
| 8247 Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' a
s p;", "class p {}"])); | 8381 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
p;", "class p {}", "p.A a;"])); |
| 8248 resolve(source); | 8382 resolve(source); |
| 8249 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); | 8383 assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]); |
| 8250 verify([source]); | 8384 verify([source]); |
| 8251 } | 8385 } |
| 8252 void test_privateOptionalParameter() { | 8386 void test_privateOptionalParameter() { |
| 8253 Source source = addSource(EngineTestCase.createSource(["f({var _p}) {}"])); | 8387 Source source = addSource(EngineTestCase.createSource(["f({var _p}) {}"])); |
| 8254 resolve(source); | 8388 resolve(source); |
| 8255 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); | 8389 assertErrors([CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
| 8256 verify([source]); | 8390 verify([source]); |
| 8257 } | 8391 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8613 resolve(source); | 8747 resolve(source); |
| 8614 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8748 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 8615 verify([source]); | 8749 verify([source]); |
| 8616 } | 8750 } |
| 8617 void test_typeAliasCannotReferenceItself_parameterType_required() { | 8751 void test_typeAliasCannotReferenceItself_parameterType_required() { |
| 8618 Source source = addSource(EngineTestCase.createSource(["typedef A(A a);"])); | 8752 Source source = addSource(EngineTestCase.createSource(["typedef A(A a);"])); |
| 8619 resolve(source); | 8753 resolve(source); |
| 8620 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8754 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 8621 verify([source]); | 8755 verify([source]); |
| 8622 } | 8756 } |
| 8757 void test_typeAliasCannotReferenceItself_parameterType_typeArgument() { |
| 8758 Source source = addSource(EngineTestCase.createSource(["typedef A(List<A> a)
;"])); |
| 8759 resolve(source); |
| 8760 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 8761 verify([source]); |
| 8762 } |
| 8763 void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() { |
| 8764 Source source = addSource(EngineTestCase.createSource([ |
| 8765 "typedef C A();", |
| 8766 "typedef A B();", |
| 8767 "class C {", |
| 8768 " B a;", |
| 8769 "}"])); |
| 8770 resolve(source); |
| 8771 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 8772 verify([source]); |
| 8773 } |
| 8623 void test_typeAliasCannotReferenceItself_returnType() { | 8774 void test_typeAliasCannotReferenceItself_returnType() { |
| 8624 Source source = addSource(EngineTestCase.createSource(["typedef A A();"])); | 8775 Source source = addSource(EngineTestCase.createSource(["typedef A A();"])); |
| 8625 resolve(source); | 8776 resolve(source); |
| 8626 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8777 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 8627 verify([source]); | 8778 verify([source]); |
| 8628 } | 8779 } |
| 8629 void test_typeAliasCannotReferenceItself_returnType_indirect() { | 8780 void test_typeAliasCannotReferenceItself_returnType_indirect() { |
| 8630 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "ty
pedef A B();"])); | 8781 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "ty
pedef A B();"])); |
| 8631 resolve(source); | 8782 resolve(source); |
| 8632 assertErrors([ | 8783 assertErrors([ |
| 8633 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, | 8784 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
| 8634 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8785 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 8635 verify([source]); | 8786 verify([source]); |
| 8636 } | 8787 } |
| 8637 void test_typeAliasCannotReferenceItself_typeVariableBounds() { | |
| 8638 Source source = addSource(EngineTestCase.createSource(["typedef A<T extends
A>();"])); | |
| 8639 resolve(source); | |
| 8640 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | |
| 8641 verify([source]); | |
| 8642 } | |
| 8643 void test_typeAliasCannotRereferenceItself_mixin_direct() { | 8788 void test_typeAliasCannotRereferenceItself_mixin_direct() { |
| 8644 Source source = addSource(EngineTestCase.createSource(["typedef M = Object w
ith M;"])); | 8789 Source source = addSource(EngineTestCase.createSource(["typedef M = Object w
ith M;"])); |
| 8645 resolve(source); | 8790 resolve(source); |
| 8646 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 8791 assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 8647 verify([source]); | 8792 verify([source]); |
| 8648 } | 8793 } |
| 8649 void test_typeAliasCannotRereferenceItself_mixin_indirect() { | 8794 void test_typeAliasCannotRereferenceItself_mixin_indirect() { |
| 8650 Source source = addSource(EngineTestCase.createSource([ | 8795 Source source = addSource(EngineTestCase.createSource([ |
| 8651 "typedef M1 = Object with M2;", | 8796 "typedef M1 = Object with M2;", |
| 8652 "typedef M2 = Object with M1;"])); | 8797 "typedef M2 = Object with M1;"])); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8881 void check_wrongNumberOfParametersForOperator1(String name) { | 9026 void check_wrongNumberOfParametersForOperator1(String name) { |
| 8882 check_wrongNumberOfParametersForOperator(name, ""); | 9027 check_wrongNumberOfParametersForOperator(name, ""); |
| 8883 check_wrongNumberOfParametersForOperator(name, "a, b"); | 9028 check_wrongNumberOfParametersForOperator(name, "a, b"); |
| 8884 } | 9029 } |
| 8885 static dartSuite() { | 9030 static dartSuite() { |
| 8886 _ut.group('CompileTimeErrorCodeTest', () { | 9031 _ut.group('CompileTimeErrorCodeTest', () { |
| 8887 _ut.test('test_ambiguousExport', () { | 9032 _ut.test('test_ambiguousExport', () { |
| 8888 final __test = new CompileTimeErrorCodeTest(); | 9033 final __test = new CompileTimeErrorCodeTest(); |
| 8889 runJUnitTest(__test, __test.test_ambiguousExport); | 9034 runJUnitTest(__test, __test.test_ambiguousExport); |
| 8890 }); | 9035 }); |
| 8891 _ut.test('test_ambiguousImport_as', () { | |
| 8892 final __test = new CompileTimeErrorCodeTest(); | |
| 8893 runJUnitTest(__test, __test.test_ambiguousImport_as); | |
| 8894 }); | |
| 8895 _ut.test('test_ambiguousImport_extends', () { | |
| 8896 final __test = new CompileTimeErrorCodeTest(); | |
| 8897 runJUnitTest(__test, __test.test_ambiguousImport_extends); | |
| 8898 }); | |
| 8899 _ut.test('test_ambiguousImport_function', () { | |
| 8900 final __test = new CompileTimeErrorCodeTest(); | |
| 8901 runJUnitTest(__test, __test.test_ambiguousImport_function); | |
| 8902 }); | |
| 8903 _ut.test('test_ambiguousImport_implements', () { | |
| 8904 final __test = new CompileTimeErrorCodeTest(); | |
| 8905 runJUnitTest(__test, __test.test_ambiguousImport_implements); | |
| 8906 }); | |
| 8907 _ut.test('test_ambiguousImport_instanceCreation', () { | |
| 8908 final __test = new CompileTimeErrorCodeTest(); | |
| 8909 runJUnitTest(__test, __test.test_ambiguousImport_instanceCreation); | |
| 8910 }); | |
| 8911 _ut.test('test_ambiguousImport_is', () { | |
| 8912 final __test = new CompileTimeErrorCodeTest(); | |
| 8913 runJUnitTest(__test, __test.test_ambiguousImport_is); | |
| 8914 }); | |
| 8915 _ut.test('test_ambiguousImport_qualifier', () { | |
| 8916 final __test = new CompileTimeErrorCodeTest(); | |
| 8917 runJUnitTest(__test, __test.test_ambiguousImport_qualifier); | |
| 8918 }); | |
| 8919 _ut.test('test_ambiguousImport_typeArgument_instanceCreation', () { | |
| 8920 final __test = new CompileTimeErrorCodeTest(); | |
| 8921 runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_instanceCr
eation); | |
| 8922 }); | |
| 8923 _ut.test('test_ambiguousImport_varRead', () { | |
| 8924 final __test = new CompileTimeErrorCodeTest(); | |
| 8925 runJUnitTest(__test, __test.test_ambiguousImport_varRead); | |
| 8926 }); | |
| 8927 _ut.test('test_ambiguousImport_varWrite', () { | |
| 8928 final __test = new CompileTimeErrorCodeTest(); | |
| 8929 runJUnitTest(__test, __test.test_ambiguousImport_varWrite); | |
| 8930 }); | |
| 8931 _ut.test('test_argumentDefinitionTestNonParameter', () { | 9036 _ut.test('test_argumentDefinitionTestNonParameter', () { |
| 8932 final __test = new CompileTimeErrorCodeTest(); | 9037 final __test = new CompileTimeErrorCodeTest(); |
| 8933 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); | 9038 runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter); |
| 8934 }); | 9039 }); |
| 8935 _ut.test('test_argumentTypeNotAssignable_const', () { | 9040 _ut.test('test_argumentTypeNotAssignable_const', () { |
| 8936 final __test = new CompileTimeErrorCodeTest(); | 9041 final __test = new CompileTimeErrorCodeTest(); |
| 8937 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); | 9042 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); |
| 8938 }); | 9043 }); |
| 8939 _ut.test('test_argumentTypeNotAssignable_const_super', () { | 9044 _ut.test('test_argumentTypeNotAssignable_const_super', () { |
| 8940 final __test = new CompileTimeErrorCodeTest(); | 9045 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9637 runJUnitTest(__test, __test.test_mixinWithNonClassSuperclass_typedef); | 9742 runJUnitTest(__test, __test.test_mixinWithNonClassSuperclass_typedef); |
| 9638 }); | 9743 }); |
| 9639 _ut.test('test_multipleRedirectingConstructorInvocations', () { | 9744 _ut.test('test_multipleRedirectingConstructorInvocations', () { |
| 9640 final __test = new CompileTimeErrorCodeTest(); | 9745 final __test = new CompileTimeErrorCodeTest(); |
| 9641 runJUnitTest(__test, __test.test_multipleRedirectingConstructorInvocatio
ns); | 9746 runJUnitTest(__test, __test.test_multipleRedirectingConstructorInvocatio
ns); |
| 9642 }); | 9747 }); |
| 9643 _ut.test('test_multipleSuperInitializers', () { | 9748 _ut.test('test_multipleSuperInitializers', () { |
| 9644 final __test = new CompileTimeErrorCodeTest(); | 9749 final __test = new CompileTimeErrorCodeTest(); |
| 9645 runJUnitTest(__test, __test.test_multipleSuperInitializers); | 9750 runJUnitTest(__test, __test.test_multipleSuperInitializers); |
| 9646 }); | 9751 }); |
| 9752 _ut.test('test_nativeClauseInNonSDKCode', () { |
| 9753 final __test = new CompileTimeErrorCodeTest(); |
| 9754 runJUnitTest(__test, __test.test_nativeClauseInNonSDKCode); |
| 9755 }); |
| 9647 _ut.test('test_nativeFunctionBodyInNonSDKCode_function', () { | 9756 _ut.test('test_nativeFunctionBodyInNonSDKCode_function', () { |
| 9648 final __test = new CompileTimeErrorCodeTest(); | 9757 final __test = new CompileTimeErrorCodeTest(); |
| 9649 runJUnitTest(__test, __test.test_nativeFunctionBodyInNonSDKCode_function
); | 9758 runJUnitTest(__test, __test.test_nativeFunctionBodyInNonSDKCode_function
); |
| 9650 }); | 9759 }); |
| 9651 _ut.test('test_nativeFunctionBodyInNonSDKCode_method', () { | 9760 _ut.test('test_nativeFunctionBodyInNonSDKCode_method', () { |
| 9652 final __test = new CompileTimeErrorCodeTest(); | 9761 final __test = new CompileTimeErrorCodeTest(); |
| 9653 runJUnitTest(__test, __test.test_nativeFunctionBodyInNonSDKCode_method); | 9762 runJUnitTest(__test, __test.test_nativeFunctionBodyInNonSDKCode_method); |
| 9654 }); | 9763 }); |
| 9655 _ut.test('test_noAnnotationConstructorArguments', () { | 9764 _ut.test('test_noAnnotationConstructorArguments', () { |
| 9656 final __test = new CompileTimeErrorCodeTest(); | 9765 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9953 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete
rType_named); | 10062 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete
rType_named); |
| 9954 }); | 10063 }); |
| 9955 _ut.test('test_typeAliasCannotReferenceItself_parameterType_positional', (
) { | 10064 _ut.test('test_typeAliasCannotReferenceItself_parameterType_positional', (
) { |
| 9956 final __test = new CompileTimeErrorCodeTest(); | 10065 final __test = new CompileTimeErrorCodeTest(); |
| 9957 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete
rType_positional); | 10066 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete
rType_positional); |
| 9958 }); | 10067 }); |
| 9959 _ut.test('test_typeAliasCannotReferenceItself_parameterType_required', ()
{ | 10068 _ut.test('test_typeAliasCannotReferenceItself_parameterType_required', ()
{ |
| 9960 final __test = new CompileTimeErrorCodeTest(); | 10069 final __test = new CompileTimeErrorCodeTest(); |
| 9961 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete
rType_required); | 10070 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete
rType_required); |
| 9962 }); | 10071 }); |
| 10072 _ut.test('test_typeAliasCannotReferenceItself_parameterType_typeArgument',
() { |
| 10073 final __test = new CompileTimeErrorCodeTest(); |
| 10074 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_paramete
rType_typeArgument); |
| 10075 }); |
| 10076 _ut.test('test_typeAliasCannotReferenceItself_returnClass_withTypeAlias',
() { |
| 10077 final __test = new CompileTimeErrorCodeTest(); |
| 10078 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnCl
ass_withTypeAlias); |
| 10079 }); |
| 9963 _ut.test('test_typeAliasCannotReferenceItself_returnType', () { | 10080 _ut.test('test_typeAliasCannotReferenceItself_returnType', () { |
| 9964 final __test = new CompileTimeErrorCodeTest(); | 10081 final __test = new CompileTimeErrorCodeTest(); |
| 9965 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe); | 10082 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe); |
| 9966 }); | 10083 }); |
| 9967 _ut.test('test_typeAliasCannotReferenceItself_returnType_indirect', () { | 10084 _ut.test('test_typeAliasCannotReferenceItself_returnType_indirect', () { |
| 9968 final __test = new CompileTimeErrorCodeTest(); | 10085 final __test = new CompileTimeErrorCodeTest(); |
| 9969 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe_indirect); | 10086 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe_indirect); |
| 9970 }); | 10087 }); |
| 9971 _ut.test('test_typeAliasCannotReferenceItself_typeVariableBounds', () { | |
| 9972 final __test = new CompileTimeErrorCodeTest(); | |
| 9973 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_typeVari
ableBounds); | |
| 9974 }); | |
| 9975 _ut.test('test_typeAliasCannotRereferenceItself_mixin_direct', () { | 10088 _ut.test('test_typeAliasCannotRereferenceItself_mixin_direct', () { |
| 9976 final __test = new CompileTimeErrorCodeTest(); | 10089 final __test = new CompileTimeErrorCodeTest(); |
| 9977 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
direct); | 10090 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
direct); |
| 9978 }); | 10091 }); |
| 9979 _ut.test('test_typeAliasCannotRereferenceItself_mixin_indirect', () { | 10092 _ut.test('test_typeAliasCannotRereferenceItself_mixin_indirect', () { |
| 9980 final __test = new CompileTimeErrorCodeTest(); | 10093 final __test = new CompileTimeErrorCodeTest(); |
| 9981 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
indirect); | 10094 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
indirect); |
| 9982 }); | 10095 }); |
| 9983 _ut.test('test_typeArgumentNotMatchingBounds_const', () { | 10096 _ut.test('test_typeArgumentNotMatchingBounds_const', () { |
| 9984 final __test = new CompileTimeErrorCodeTest(); | 10097 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10510 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); | 10623 IndexExpression expression = ASTFactory.indexExpression(array, ASTFactory.id
entifier3("i")); |
| 10511 JUnitTestCase.assertSame(operator, resolve5(expression, [])); | 10624 JUnitTestCase.assertSame(operator, resolve5(expression, [])); |
| 10512 _listener.assertNoErrors(); | 10625 _listener.assertNoErrors(); |
| 10513 } | 10626 } |
| 10514 void test_visitAssignmentExpression_compound() { | 10627 void test_visitAssignmentExpression_compound() { |
| 10515 InterfaceType intType = _typeProvider.intType; | 10628 InterfaceType intType = _typeProvider.intType; |
| 10516 SimpleIdentifier leftHandSide = ASTFactory.identifier3("a"); | 10629 SimpleIdentifier leftHandSide = ASTFactory.identifier3("a"); |
| 10517 leftHandSide.staticType = intType; | 10630 leftHandSide.staticType = intType; |
| 10518 AssignmentExpression assignment = ASTFactory.assignmentExpression(leftHandSi
de, TokenType.PLUS_EQ, ASTFactory.integer(1)); | 10631 AssignmentExpression assignment = ASTFactory.assignmentExpression(leftHandSi
de, TokenType.PLUS_EQ, ASTFactory.integer(1)); |
| 10519 resolveNode(assignment, []); | 10632 resolveNode(assignment, []); |
| 10520 JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.e
lement); | 10633 JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.s
taticElement); |
| 10521 _listener.assertNoErrors(); | 10634 _listener.assertNoErrors(); |
| 10522 } | 10635 } |
| 10523 void test_visitAssignmentExpression_simple() { | 10636 void test_visitAssignmentExpression_simple() { |
| 10524 AssignmentExpression expression = ASTFactory.assignmentExpression(ASTFactory
.identifier3("x"), TokenType.EQ, ASTFactory.integer(0)); | 10637 AssignmentExpression expression = ASTFactory.assignmentExpression(ASTFactory
.identifier3("x"), TokenType.EQ, ASTFactory.integer(0)); |
| 10525 resolveNode(expression, []); | 10638 resolveNode(expression, []); |
| 10526 JUnitTestCase.assertNull(expression.element); | 10639 JUnitTestCase.assertNull(expression.staticElement); |
| 10527 _listener.assertNoErrors(); | 10640 _listener.assertNoErrors(); |
| 10528 } | 10641 } |
| 10529 void test_visitBinaryExpression() { | 10642 void test_visitBinaryExpression() { |
| 10530 InterfaceType numType = _typeProvider.numType; | 10643 InterfaceType numType = _typeProvider.numType; |
| 10531 SimpleIdentifier left = ASTFactory.identifier3("i"); | 10644 SimpleIdentifier left = ASTFactory.identifier3("i"); |
| 10532 left.staticType = numType; | 10645 left.staticType = numType; |
| 10533 BinaryExpression expression = ASTFactory.binaryExpression(left, TokenType.PL
US, ASTFactory.identifier3("j")); | 10646 BinaryExpression expression = ASTFactory.binaryExpression(left, TokenType.PL
US, ASTFactory.identifier3("j")); |
| 10534 resolveNode(expression, []); | 10647 resolveNode(expression, []); |
| 10535 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.element); | 10648 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement
); |
| 10536 _listener.assertNoErrors(); | 10649 _listener.assertNoErrors(); |
| 10537 } | 10650 } |
| 10538 void test_visitBreakStatement_withLabel() { | 10651 void test_visitBreakStatement_withLabel() { |
| 10539 String label = "loop"; | 10652 String label = "loop"; |
| 10540 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier3(
label), false, false); | 10653 LabelElementImpl labelElement = new LabelElementImpl(ASTFactory.identifier3(
label), false, false); |
| 10541 BreakStatement statement = ASTFactory.breakStatement2(label); | 10654 BreakStatement statement = ASTFactory.breakStatement2(label); |
| 10542 JUnitTestCase.assertSame(labelElement, resolve(statement, labelElement)); | 10655 JUnitTestCase.assertSame(labelElement, resolve(statement, labelElement)); |
| 10543 _listener.assertNoErrors(); | 10656 _listener.assertNoErrors(); |
| 10544 } | 10657 } |
| 10545 void test_visitBreakStatement_withoutLabel() { | 10658 void test_visitBreakStatement_withoutLabel() { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10698 JUnitTestCase.assertSame(method, invocation.methodName.element); | 10811 JUnitTestCase.assertSame(method, invocation.methodName.element); |
| 10699 JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] a
s NamedExpression)).name.label.element); | 10812 JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] a
s NamedExpression)).name.label.element); |
| 10700 _listener.assertNoErrors(); | 10813 _listener.assertNoErrors(); |
| 10701 } | 10814 } |
| 10702 void test_visitPostfixExpression() { | 10815 void test_visitPostfixExpression() { |
| 10703 InterfaceType numType = _typeProvider.numType; | 10816 InterfaceType numType = _typeProvider.numType; |
| 10704 SimpleIdentifier operand = ASTFactory.identifier3("i"); | 10817 SimpleIdentifier operand = ASTFactory.identifier3("i"); |
| 10705 operand.staticType = numType; | 10818 operand.staticType = numType; |
| 10706 PostfixExpression expression = ASTFactory.postfixExpression(operand, TokenTy
pe.PLUS_PLUS); | 10819 PostfixExpression expression = ASTFactory.postfixExpression(operand, TokenTy
pe.PLUS_PLUS); |
| 10707 resolveNode(expression, []); | 10820 resolveNode(expression, []); |
| 10708 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.element); | 10821 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement
); |
| 10709 _listener.assertNoErrors(); | 10822 _listener.assertNoErrors(); |
| 10710 } | 10823 } |
| 10711 void test_visitPrefixedIdentifier_dynamic() { | 10824 void test_visitPrefixedIdentifier_dynamic() { |
| 10712 Type2 dynamicType = _typeProvider.dynamicType; | 10825 Type2 dynamicType = _typeProvider.dynamicType; |
| 10713 SimpleIdentifier target = ASTFactory.identifier3("a"); | 10826 SimpleIdentifier target = ASTFactory.identifier3("a"); |
| 10714 VariableElementImpl variable = ElementFactory.localVariableElement(target); | 10827 VariableElementImpl variable = ElementFactory.localVariableElement(target); |
| 10715 variable.type = dynamicType; | 10828 variable.type = dynamicType; |
| 10716 target.element = variable; | 10829 target.element = variable; |
| 10717 target.staticType = dynamicType; | 10830 target.staticType = dynamicType; |
| 10718 PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.ide
ntifier3("b")); | 10831 PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.ide
ntifier3("b")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 10736 JUnitTestCase.assertSame(getter, identifier.element); | 10849 JUnitTestCase.assertSame(getter, identifier.element); |
| 10737 JUnitTestCase.assertSame(getter, identifier.identifier.element); | 10850 JUnitTestCase.assertSame(getter, identifier.identifier.element); |
| 10738 _listener.assertNoErrors(); | 10851 _listener.assertNoErrors(); |
| 10739 } | 10852 } |
| 10740 void test_visitPrefixExpression() { | 10853 void test_visitPrefixExpression() { |
| 10741 InterfaceType numType = _typeProvider.numType; | 10854 InterfaceType numType = _typeProvider.numType; |
| 10742 SimpleIdentifier operand = ASTFactory.identifier3("i"); | 10855 SimpleIdentifier operand = ASTFactory.identifier3("i"); |
| 10743 operand.staticType = numType; | 10856 operand.staticType = numType; |
| 10744 PrefixExpression expression = ASTFactory.prefixExpression(TokenType.PLUS_PLU
S, operand); | 10857 PrefixExpression expression = ASTFactory.prefixExpression(TokenType.PLUS_PLU
S, operand); |
| 10745 resolveNode(expression, []); | 10858 resolveNode(expression, []); |
| 10746 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.element); | 10859 JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement
); |
| 10747 _listener.assertNoErrors(); | 10860 _listener.assertNoErrors(); |
| 10748 } | 10861 } |
| 10749 void test_visitPropertyAccess_getter_identifier() { | 10862 void test_visitPropertyAccess_getter_identifier() { |
| 10750 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 10863 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 10751 String getterName = "b"; | 10864 String getterName = "b"; |
| 10752 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); | 10865 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, _typeProvider.intType); |
| 10753 classA.accessors = <PropertyAccessorElement> [getter]; | 10866 classA.accessors = <PropertyAccessorElement> [getter]; |
| 10754 SimpleIdentifier target = ASTFactory.identifier3("a"); | 10867 SimpleIdentifier target = ASTFactory.identifier3("a"); |
| 10755 target.staticType = classA.type; | 10868 target.staticType = classA.type; |
| 10756 PropertyAccess access = ASTFactory.propertyAccess2(target, getterName); | 10869 PropertyAccess access = ASTFactory.propertyAccess2(target, getterName); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10911 * Return the element associated with the given expression after the resolver
has resolved the | 11024 * Return the element associated with the given expression after the resolver
has resolved the |
| 10912 * expression. | 11025 * expression. |
| 10913 * | 11026 * |
| 10914 * @param node the expression to be resolved | 11027 * @param node the expression to be resolved |
| 10915 * @param definedElements the elements that are to be defined in the scope in
which the element is | 11028 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 10916 * being resolved | 11029 * being resolved |
| 10917 * @return the element to which the expression was resolved | 11030 * @return the element to which the expression was resolved |
| 10918 */ | 11031 */ |
| 10919 Element resolve5(IndexExpression node, List<Element> definedElements) { | 11032 Element resolve5(IndexExpression node, List<Element> definedElements) { |
| 10920 resolveNode(node, definedElements); | 11033 resolveNode(node, definedElements); |
| 10921 return node.element; | 11034 return node.staticElement; |
| 10922 } | 11035 } |
| 10923 | 11036 |
| 10924 /** | 11037 /** |
| 10925 * Return the element associated with the given identifier after the resolver
has resolved the | 11038 * Return the element associated with the given identifier after the resolver
has resolved the |
| 10926 * identifier. | 11039 * identifier. |
| 10927 * | 11040 * |
| 10928 * @param node the expression to be resolved | 11041 * @param node the expression to be resolved |
| 10929 * @param enclosingClass the element representing the class enclosing the iden
tifier | 11042 * @param enclosingClass the element representing the class enclosing the iden
tifier |
| 10930 * @return the element to which the expression was resolved | 11043 * @return the element to which the expression was resolved |
| 10931 */ | 11044 */ |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11413 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); | 11526 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); |
| 11414 verify([source]); | 11527 verify([source]); |
| 11415 } | 11528 } |
| 11416 void fail_undefinedIdentifier_commentReference() { | 11529 void fail_undefinedIdentifier_commentReference() { |
| 11417 Source source = addSource(EngineTestCase.createSource(["/** [m] xxx [new B.c
] */", "class A {", "}"])); | 11530 Source source = addSource(EngineTestCase.createSource(["/** [m] xxx [new B.c
] */", "class A {", "}"])); |
| 11418 resolve(source); | 11531 resolve(source); |
| 11419 assertErrors([ | 11532 assertErrors([ |
| 11420 StaticWarningCode.UNDEFINED_IDENTIFIER, | 11533 StaticWarningCode.UNDEFINED_IDENTIFIER, |
| 11421 StaticWarningCode.UNDEFINED_IDENTIFIER]); | 11534 StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 11422 } | 11535 } |
| 11423 void fail_undefinedIdentifier_function() { | |
| 11424 Source source = addSource(EngineTestCase.createSource(["int a() => b;"])); | |
| 11425 resolve(source); | |
| 11426 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | |
| 11427 verify([source]); | |
| 11428 } | |
| 11429 void fail_undefinedSetter() { | 11536 void fail_undefinedSetter() { |
| 11430 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " C.m = 0;", "}"])); | 11537 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " C.m = 0;", "}"])); |
| 11431 resolve(source); | 11538 resolve(source); |
| 11432 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); | 11539 assertErrors([StaticWarningCode.UNDEFINED_SETTER]); |
| 11433 verify([source]); | 11540 verify([source]); |
| 11434 } | 11541 } |
| 11435 void fail_undefinedStaticMethodOrGetter_getter() { | 11542 void fail_undefinedStaticMethodOrGetter_getter() { |
| 11436 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m);", "}"])); | 11543 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m);", "}"])); |
| 11437 resolve(source); | 11544 resolve(source); |
| 11438 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | 11545 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 11439 verify([source]); | 11546 verify([source]); |
| 11440 } | 11547 } |
| 11441 void fail_undefinedStaticMethodOrGetter_method() { | 11548 void fail_undefinedStaticMethodOrGetter_method() { |
| 11442 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m());", "}"])); | 11549 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var
p) {", " f(C.m());", "}"])); |
| 11443 resolve(source); | 11550 resolve(source); |
| 11444 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); | 11551 assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]); |
| 11445 verify([source]); | 11552 verify([source]); |
| 11446 } | 11553 } |
| 11554 void test_ambiguousImport_as() { |
| 11555 Source source = addSource(EngineTestCase.createSource([ |
| 11556 "import 'lib1.dart';", |
| 11557 "import 'lib2.dart';", |
| 11558 "f(p) {p as N;}"])); |
| 11559 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11560 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11561 resolve(source); |
| 11562 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11563 } |
| 11564 void test_ambiguousImport_extends() { |
| 11565 Source source = addSource(EngineTestCase.createSource([ |
| 11566 "import 'lib1.dart';", |
| 11567 "import 'lib2.dart';", |
| 11568 "class A extends N {}"])); |
| 11569 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11570 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11571 resolve(source); |
| 11572 assertErrors([ |
| 11573 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11574 CompileTimeErrorCode.EXTENDS_NON_CLASS]); |
| 11575 } |
| 11576 void test_ambiguousImport_function() { |
| 11577 Source source = addSource(EngineTestCase.createSource([ |
| 11578 "import 'lib1.dart';", |
| 11579 "import 'lib2.dart';", |
| 11580 "g() { return f(); }"])); |
| 11581 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f()
{}"])); |
| 11582 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f()
{}"])); |
| 11583 resolve(source); |
| 11584 assertErrors([ |
| 11585 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11586 StaticTypeWarningCode.UNDEFINED_FUNCTION]); |
| 11587 } |
| 11588 void test_ambiguousImport_implements() { |
| 11589 Source source = addSource(EngineTestCase.createSource([ |
| 11590 "import 'lib1.dart';", |
| 11591 "import 'lib2.dart';", |
| 11592 "class A implements N {}"])); |
| 11593 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11594 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11595 resolve(source); |
| 11596 assertErrors([ |
| 11597 StaticWarningCode.AMBIGUOUS_IMPORT, |
| 11598 CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]); |
| 11599 } |
| 11600 void test_ambiguousImport_instanceCreation() { |
| 11601 Source source = addSource(EngineTestCase.createSource([ |
| 11602 "library L;", |
| 11603 "import 'lib1.dart';", |
| 11604 "import 'lib2.dart';", |
| 11605 "f() {new N();}"])); |
| 11606 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11607 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11608 resolve(source); |
| 11609 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11610 } |
| 11611 void test_ambiguousImport_is() { |
| 11612 Source source = addSource(EngineTestCase.createSource([ |
| 11613 "import 'lib1.dart';", |
| 11614 "import 'lib2.dart';", |
| 11615 "f(p) {p is N;}"])); |
| 11616 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11617 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11618 resolve(source); |
| 11619 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11620 } |
| 11621 void test_ambiguousImport_qualifier() { |
| 11622 Source source = addSource(EngineTestCase.createSource([ |
| 11623 "import 'lib1.dart';", |
| 11624 "import 'lib2.dart';", |
| 11625 "g() { N.FOO; }"])); |
| 11626 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11627 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11628 resolve(source); |
| 11629 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11630 } |
| 11447 void test_ambiguousImport_typeAnnotation() { | 11631 void test_ambiguousImport_typeAnnotation() { |
| 11448 Source source = addSource(EngineTestCase.createSource([ | 11632 Source source = addSource(EngineTestCase.createSource([ |
| 11449 "import 'lib1.dart';", | 11633 "import 'lib1.dart';", |
| 11450 "import 'lib2.dart';", | 11634 "import 'lib2.dart';", |
| 11451 "typedef N FT(N p);", | 11635 "typedef N FT(N p);", |
| 11452 "N f(N p) {", | 11636 "N f(N p) {", |
| 11453 " N v;", | 11637 " N v;", |
| 11454 "}", | 11638 "}", |
| 11455 "class A {", | 11639 "class A {", |
| 11456 " N m() {}", | 11640 " N m() {}", |
| (...skipping 15 matching lines...) Expand all Loading... |
| 11472 Source source = addSource(EngineTestCase.createSource([ | 11656 Source source = addSource(EngineTestCase.createSource([ |
| 11473 "import 'lib1.dart';", | 11657 "import 'lib1.dart';", |
| 11474 "import 'lib2.dart';", | 11658 "import 'lib2.dart';", |
| 11475 "class A<T> {}", | 11659 "class A<T> {}", |
| 11476 "A<N> f() {}"])); | 11660 "A<N> f() {}"])); |
| 11477 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); | 11661 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11478 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); | 11662 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11479 resolve(source); | 11663 resolve(source); |
| 11480 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); | 11664 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11481 } | 11665 } |
| 11666 void test_ambiguousImport_typeArgument_instanceCreation() { |
| 11667 Source source = addSource(EngineTestCase.createSource([ |
| 11668 "import 'lib1.dart';", |
| 11669 "import 'lib2.dart';", |
| 11670 "class A<T> {}", |
| 11671 "f() {new A<N>();}"])); |
| 11672 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "clas
s N {}"])); |
| 11673 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s N {}"])); |
| 11674 resolve(source); |
| 11675 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11676 } |
| 11677 void test_ambiguousImport_varRead() { |
| 11678 Source source = addSource(EngineTestCase.createSource([ |
| 11679 "import 'lib1.dart';", |
| 11680 "import 'lib2.dart';", |
| 11681 "f() { g(v); }", |
| 11682 "g(p) {}"])); |
| 11683 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); |
| 11684 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); |
| 11685 resolve(source); |
| 11686 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11687 } |
| 11688 void test_ambiguousImport_varWrite() { |
| 11689 Source source = addSource(EngineTestCase.createSource([ |
| 11690 "import 'lib1.dart';", |
| 11691 "import 'lib2.dart';", |
| 11692 "f() { v = 0; }"])); |
| 11693 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var
v;"])); |
| 11694 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var
v;"])); |
| 11695 resolve(source); |
| 11696 assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 11697 } |
| 11482 void test_argumentTypeNotAssignable_annotation_namedConstructor() { | 11698 void test_argumentTypeNotAssignable_annotation_namedConstructor() { |
| 11483 Source source = addSource(EngineTestCase.createSource([ | 11699 Source source = addSource(EngineTestCase.createSource([ |
| 11484 "class A {", | 11700 "class A {", |
| 11485 " const A.fromInt(int p);", | 11701 " const A.fromInt(int p);", |
| 11486 "}", | 11702 "}", |
| 11487 "@A.fromInt('0')", | 11703 "@A.fromInt('0')", |
| 11488 "main() {", | 11704 "main() {", |
| 11489 "}"])); | 11705 "}"])); |
| 11490 resolve(source); | 11706 resolve(source); |
| 11491 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11707 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11641 "class A {", | 11857 "class A {", |
| 11642 " A(String p) {}", | 11858 " A(String p) {}", |
| 11643 "}", | 11859 "}", |
| 11644 "main() {", | 11860 "main() {", |
| 11645 " new A(42);", | 11861 " new A(42);", |
| 11646 "}"])); | 11862 "}"])); |
| 11647 resolve(source); | 11863 resolve(source); |
| 11648 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); | 11864 assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 11649 verify([source]); | 11865 verify([source]); |
| 11650 } | 11866 } |
| 11867 void test_assignmentToConst_instanceVariable() { |
| 11868 Source source = addSource(EngineTestCase.createSource([ |
| 11869 "class A {", |
| 11870 " static const v = 0;", |
| 11871 "}", |
| 11872 "f() {", |
| 11873 " A a = new A();", |
| 11874 " a.v = 1;", |
| 11875 "}"])); |
| 11876 resolve(source); |
| 11877 assertErrors([StaticWarningCode.ASSIGNMENT_TO_CONST]); |
| 11878 verify([source]); |
| 11879 } |
| 11880 void test_assignmentToConst_localVariable() { |
| 11881 Source source = addSource(EngineTestCase.createSource(["f() {", " const x =
0;", " x = 1;", "}"])); |
| 11882 resolve(source); |
| 11883 assertErrors([StaticWarningCode.ASSIGNMENT_TO_CONST]); |
| 11884 verify([source]); |
| 11885 } |
| 11651 void test_assignmentToFinal_instanceVariable() { | 11886 void test_assignmentToFinal_instanceVariable() { |
| 11652 Source source = addSource(EngineTestCase.createSource([ | 11887 Source source = addSource(EngineTestCase.createSource([ |
| 11653 "class A {", | 11888 "class A {", |
| 11654 " final v = 0;", | 11889 " final v = 0;", |
| 11655 "}", | 11890 "}", |
| 11656 "f() {", | 11891 "f() {", |
| 11657 " A a = new A();", | 11892 " A a = new A();", |
| 11658 " a.v = 1;", | 11893 " a.v = 1;", |
| 11659 "}"])); | 11894 "}"])); |
| 11660 resolve(source); | 11895 resolve(source); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11981 verify([source]); | 12216 verify([source]); |
| 11982 } | 12217 } |
| 11983 void test_importDuplicatedLibraryName() { | 12218 void test_importDuplicatedLibraryName() { |
| 11984 Source source = addSource(EngineTestCase.createSource([ | 12219 Source source = addSource(EngineTestCase.createSource([ |
| 11985 "library test;", | 12220 "library test;", |
| 11986 "import 'lib1.dart';", | 12221 "import 'lib1.dart';", |
| 11987 "import 'lib2.dart';"])); | 12222 "import 'lib2.dart';"])); |
| 11988 addSource2("/lib1.dart", "library lib;"); | 12223 addSource2("/lib1.dart", "library lib;"); |
| 11989 addSource2("/lib2.dart", "library lib;"); | 12224 addSource2("/lib2.dart", "library lib;"); |
| 11990 resolve(source); | 12225 resolve(source); |
| 11991 assertErrors([StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME]); | 12226 assertErrors([ |
| 12227 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME, |
| 12228 HintCode.UNUSED_IMPORT, |
| 12229 HintCode.UNUSED_IMPORT]); |
| 11992 verify([source]); | 12230 verify([source]); |
| 11993 } | 12231 } |
| 11994 void test_inconsistentMethodInheritanceGetterAndMethod() { | 12232 void test_inconsistentMethodInheritanceGetterAndMethod() { |
| 11995 Source source = addSource(EngineTestCase.createSource([ | 12233 Source source = addSource(EngineTestCase.createSource([ |
| 11996 "abstract class A {", | 12234 "abstract class A {", |
| 11997 " int x();", | 12235 " int x();", |
| 11998 "}", | 12236 "}", |
| 11999 "abstract class B {", | 12237 "abstract class B {", |
| 12000 " int get x;", | 12238 " int get x;", |
| 12001 "}", | 12239 "}", |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12355 assertErrors([StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); | 12593 assertErrors([StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS]); |
| 12356 verify([source]); | 12594 verify([source]); |
| 12357 } | 12595 } |
| 12358 void test_newWithNonType() { | 12596 void test_newWithNonType() { |
| 12359 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "void f
() {", " var a = new A();", "}"])); | 12597 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "void f
() {", " var a = new A();", "}"])); |
| 12360 resolve(source); | 12598 resolve(source); |
| 12361 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); | 12599 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); |
| 12362 verify([source]); | 12600 verify([source]); |
| 12363 } | 12601 } |
| 12364 void test_newWithNonType_fromLibrary() { | 12602 void test_newWithNonType_fromLibrary() { |
| 12365 Source source1 = addSource2("lib.dart", ""); | 12603 Source source1 = addSource2("lib.dart", "class B {}"); |
| 12366 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([ | 12604 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([ |
| 12367 "import 'lib.dart' as lib;", | 12605 "import 'lib.dart' as lib;", |
| 12368 "void f() {", | 12606 "void f() {", |
| 12369 " var a = new lib.A();", | 12607 " var a = new lib.A();", |
| 12370 "}"])); | 12608 "}", |
| 12609 "lib.B b;"])); |
| 12371 resolve(source1); | 12610 resolve(source1); |
| 12372 resolve(source2); | 12611 resolve(source2); |
| 12373 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); | 12612 assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]); |
| 12374 verify([source1]); | 12613 verify([source1]); |
| 12375 } | 12614 } |
| 12376 void test_newWithUndefinedConstructor() { | 12615 void test_newWithUndefinedConstructor() { |
| 12377 Source source = addSource(EngineTestCase.createSource([ | 12616 Source source = addSource(EngineTestCase.createSource([ |
| 12378 "class A {", | 12617 "class A {", |
| 12379 " A() {}", | 12618 " A() {}", |
| 12380 "}", | 12619 "}", |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12783 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([ | 13022 Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([ |
| 12784 "import 'lib.dart' as lib;", | 13023 "import 'lib.dart' as lib;", |
| 12785 "void f() {", | 13024 "void f() {", |
| 12786 " var g = lib.gg;", | 13025 " var g = lib.gg;", |
| 12787 "}"])); | 13026 "}"])); |
| 12788 resolve(source1); | 13027 resolve(source1); |
| 12789 resolve(source2); | 13028 resolve(source2); |
| 12790 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); | 13029 assertErrors([StaticWarningCode.UNDEFINED_GETTER]); |
| 12791 verify([source1]); | 13030 verify([source1]); |
| 12792 } | 13031 } |
| 13032 void test_undefinedIdentifier_function() { |
| 13033 Source source = addSource(EngineTestCase.createSource(["int a() => b;"])); |
| 13034 resolve(source); |
| 13035 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 13036 } |
| 13037 void test_undefinedIdentifier_function_prefix() { |
| 13038 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
C {}"])); |
| 13039 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
b;", "", "int a() => b;", "b.C c;"])); |
| 13040 resolve(source); |
| 13041 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 13042 verify([source]); |
| 13043 } |
| 12793 void test_undefinedIdentifier_initializer() { | 13044 void test_undefinedIdentifier_initializer() { |
| 12794 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); | 13045 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); |
| 12795 resolve(source); | 13046 resolve(source); |
| 12796 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 13047 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 12797 } | 13048 } |
| 13049 void test_undefinedIdentifier_initializer_prefix() { |
| 13050 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
C {}"])); |
| 13051 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
b;", "", "var a = b;", "b.C c;"])); |
| 13052 resolve(source); |
| 13053 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 13054 } |
| 12798 void test_undefinedIdentifier_metadata() { | 13055 void test_undefinedIdentifier_metadata() { |
| 12799 Source source = addSource(EngineTestCase.createSource(["@undefined class A {
}"])); | 13056 Source source = addSource(EngineTestCase.createSource(["@undefined class A {
}"])); |
| 12800 resolve(source); | 13057 resolve(source); |
| 12801 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 13058 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 12802 } | 13059 } |
| 12803 void test_undefinedIdentifier_methodInvocation() { | 13060 void test_undefinedIdentifier_methodInvocation() { |
| 12804 Source source = addSource(EngineTestCase.createSource(["f() { C.m(); }"])); | 13061 Source source = addSource(EngineTestCase.createSource(["f() { C.m(); }"])); |
| 12805 resolve(source); | 13062 resolve(source); |
| 12806 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); | 13063 assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 12807 } | 13064 } |
| 12808 void test_undefinedNamedParameter() { | 13065 void test_undefinedNamedParameter() { |
| 12809 Source source = addSource(EngineTestCase.createSource(["f({a, b}) {}", "main
() {", " f(c: 1);", "}"])); | 13066 Source source = addSource(EngineTestCase.createSource(["f({a, b}) {}", "main
() {", " f(c: 1);", "}"])); |
| 12810 resolve(source); | 13067 resolve(source); |
| 12811 assertErrors([StaticWarningCode.UNDEFINED_NAMED_PARAMETER]); | 13068 assertErrors([StaticWarningCode.UNDEFINED_NAMED_PARAMETER]); |
| 12812 } | 13069 } |
| 12813 static dartSuite() { | 13070 static dartSuite() { |
| 12814 _ut.group('StaticWarningCodeTest', () { | 13071 _ut.group('StaticWarningCodeTest', () { |
| 13072 _ut.test('test_ambiguousImport_as', () { |
| 13073 final __test = new StaticWarningCodeTest(); |
| 13074 runJUnitTest(__test, __test.test_ambiguousImport_as); |
| 13075 }); |
| 13076 _ut.test('test_ambiguousImport_extends', () { |
| 13077 final __test = new StaticWarningCodeTest(); |
| 13078 runJUnitTest(__test, __test.test_ambiguousImport_extends); |
| 13079 }); |
| 13080 _ut.test('test_ambiguousImport_function', () { |
| 13081 final __test = new StaticWarningCodeTest(); |
| 13082 runJUnitTest(__test, __test.test_ambiguousImport_function); |
| 13083 }); |
| 13084 _ut.test('test_ambiguousImport_implements', () { |
| 13085 final __test = new StaticWarningCodeTest(); |
| 13086 runJUnitTest(__test, __test.test_ambiguousImport_implements); |
| 13087 }); |
| 13088 _ut.test('test_ambiguousImport_instanceCreation', () { |
| 13089 final __test = new StaticWarningCodeTest(); |
| 13090 runJUnitTest(__test, __test.test_ambiguousImport_instanceCreation); |
| 13091 }); |
| 13092 _ut.test('test_ambiguousImport_is', () { |
| 13093 final __test = new StaticWarningCodeTest(); |
| 13094 runJUnitTest(__test, __test.test_ambiguousImport_is); |
| 13095 }); |
| 13096 _ut.test('test_ambiguousImport_qualifier', () { |
| 13097 final __test = new StaticWarningCodeTest(); |
| 13098 runJUnitTest(__test, __test.test_ambiguousImport_qualifier); |
| 13099 }); |
| 12815 _ut.test('test_ambiguousImport_typeAnnotation', () { | 13100 _ut.test('test_ambiguousImport_typeAnnotation', () { |
| 12816 final __test = new StaticWarningCodeTest(); | 13101 final __test = new StaticWarningCodeTest(); |
| 12817 runJUnitTest(__test, __test.test_ambiguousImport_typeAnnotation); | 13102 runJUnitTest(__test, __test.test_ambiguousImport_typeAnnotation); |
| 12818 }); | 13103 }); |
| 12819 _ut.test('test_ambiguousImport_typeArgument_annotation', () { | 13104 _ut.test('test_ambiguousImport_typeArgument_annotation', () { |
| 12820 final __test = new StaticWarningCodeTest(); | 13105 final __test = new StaticWarningCodeTest(); |
| 12821 runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_annotation
); | 13106 runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_annotation
); |
| 12822 }); | 13107 }); |
| 13108 _ut.test('test_ambiguousImport_typeArgument_instanceCreation', () { |
| 13109 final __test = new StaticWarningCodeTest(); |
| 13110 runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_instanceCr
eation); |
| 13111 }); |
| 13112 _ut.test('test_ambiguousImport_varRead', () { |
| 13113 final __test = new StaticWarningCodeTest(); |
| 13114 runJUnitTest(__test, __test.test_ambiguousImport_varRead); |
| 13115 }); |
| 13116 _ut.test('test_ambiguousImport_varWrite', () { |
| 13117 final __test = new StaticWarningCodeTest(); |
| 13118 runJUnitTest(__test, __test.test_ambiguousImport_varWrite); |
| 13119 }); |
| 12823 _ut.test('test_argumentTypeNotAssignable_annotation_namedConstructor', ()
{ | 13120 _ut.test('test_argumentTypeNotAssignable_annotation_namedConstructor', ()
{ |
| 12824 final __test = new StaticWarningCodeTest(); | 13121 final __test = new StaticWarningCodeTest(); |
| 12825 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na
medConstructor); | 13122 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na
medConstructor); |
| 12826 }); | 13123 }); |
| 12827 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', (
) { | 13124 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', (
) { |
| 12828 final __test = new StaticWarningCodeTest(); | 13125 final __test = new StaticWarningCodeTest(); |
| 12829 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un
namedConstructor); | 13126 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un
namedConstructor); |
| 12830 }); | 13127 }); |
| 12831 _ut.test('test_argumentTypeNotAssignable_binary', () { | 13128 _ut.test('test_argumentTypeNotAssignable_binary', () { |
| 12832 final __test = new StaticWarningCodeTest(); | 13129 final __test = new StaticWarningCodeTest(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12881 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_generic); | 13178 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_generic); |
| 12882 }); | 13179 }); |
| 12883 _ut.test('test_argumentTypeNotAssignable_new_optional', () { | 13180 _ut.test('test_argumentTypeNotAssignable_new_optional', () { |
| 12884 final __test = new StaticWarningCodeTest(); | 13181 final __test = new StaticWarningCodeTest(); |
| 12885 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_optional)
; | 13182 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_optional)
; |
| 12886 }); | 13183 }); |
| 12887 _ut.test('test_argumentTypeNotAssignable_new_required', () { | 13184 _ut.test('test_argumentTypeNotAssignable_new_required', () { |
| 12888 final __test = new StaticWarningCodeTest(); | 13185 final __test = new StaticWarningCodeTest(); |
| 12889 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_required)
; | 13186 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_required)
; |
| 12890 }); | 13187 }); |
| 13188 _ut.test('test_assignmentToConst_instanceVariable', () { |
| 13189 final __test = new StaticWarningCodeTest(); |
| 13190 runJUnitTest(__test, __test.test_assignmentToConst_instanceVariable); |
| 13191 }); |
| 13192 _ut.test('test_assignmentToConst_localVariable', () { |
| 13193 final __test = new StaticWarningCodeTest(); |
| 13194 runJUnitTest(__test, __test.test_assignmentToConst_localVariable); |
| 13195 }); |
| 12891 _ut.test('test_assignmentToFinal_instanceVariable', () { | 13196 _ut.test('test_assignmentToFinal_instanceVariable', () { |
| 12892 final __test = new StaticWarningCodeTest(); | 13197 final __test = new StaticWarningCodeTest(); |
| 12893 runJUnitTest(__test, __test.test_assignmentToFinal_instanceVariable); | 13198 runJUnitTest(__test, __test.test_assignmentToFinal_instanceVariable); |
| 12894 }); | 13199 }); |
| 12895 _ut.test('test_assignmentToFinal_localVariable', () { | 13200 _ut.test('test_assignmentToFinal_localVariable', () { |
| 12896 final __test = new StaticWarningCodeTest(); | 13201 final __test = new StaticWarningCodeTest(); |
| 12897 runJUnitTest(__test, __test.test_assignmentToFinal_localVariable); | 13202 runJUnitTest(__test, __test.test_assignmentToFinal_localVariable); |
| 12898 }); | 13203 }); |
| 12899 _ut.test('test_assignmentToFinal_prefixMinusMinus', () { | 13204 _ut.test('test_assignmentToFinal_prefixMinusMinus', () { |
| 12900 final __test = new StaticWarningCodeTest(); | 13205 final __test = new StaticWarningCodeTest(); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13357 runJUnitTest(__test, __test.test_undefinedClass_instanceCreation); | 13662 runJUnitTest(__test, __test.test_undefinedClass_instanceCreation); |
| 13358 }); | 13663 }); |
| 13359 _ut.test('test_undefinedClass_variableDeclaration', () { | 13664 _ut.test('test_undefinedClass_variableDeclaration', () { |
| 13360 final __test = new StaticWarningCodeTest(); | 13665 final __test = new StaticWarningCodeTest(); |
| 13361 runJUnitTest(__test, __test.test_undefinedClass_variableDeclaration); | 13666 runJUnitTest(__test, __test.test_undefinedClass_variableDeclaration); |
| 13362 }); | 13667 }); |
| 13363 _ut.test('test_undefinedGetter_fromLibrary', () { | 13668 _ut.test('test_undefinedGetter_fromLibrary', () { |
| 13364 final __test = new StaticWarningCodeTest(); | 13669 final __test = new StaticWarningCodeTest(); |
| 13365 runJUnitTest(__test, __test.test_undefinedGetter_fromLibrary); | 13670 runJUnitTest(__test, __test.test_undefinedGetter_fromLibrary); |
| 13366 }); | 13671 }); |
| 13672 _ut.test('test_undefinedIdentifier_function', () { |
| 13673 final __test = new StaticWarningCodeTest(); |
| 13674 runJUnitTest(__test, __test.test_undefinedIdentifier_function); |
| 13675 }); |
| 13676 _ut.test('test_undefinedIdentifier_function_prefix', () { |
| 13677 final __test = new StaticWarningCodeTest(); |
| 13678 runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix); |
| 13679 }); |
| 13367 _ut.test('test_undefinedIdentifier_initializer', () { | 13680 _ut.test('test_undefinedIdentifier_initializer', () { |
| 13368 final __test = new StaticWarningCodeTest(); | 13681 final __test = new StaticWarningCodeTest(); |
| 13369 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); | 13682 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); |
| 13370 }); | 13683 }); |
| 13684 _ut.test('test_undefinedIdentifier_initializer_prefix', () { |
| 13685 final __test = new StaticWarningCodeTest(); |
| 13686 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer_prefix)
; |
| 13687 }); |
| 13371 _ut.test('test_undefinedIdentifier_metadata', () { | 13688 _ut.test('test_undefinedIdentifier_metadata', () { |
| 13372 final __test = new StaticWarningCodeTest(); | 13689 final __test = new StaticWarningCodeTest(); |
| 13373 runJUnitTest(__test, __test.test_undefinedIdentifier_metadata); | 13690 runJUnitTest(__test, __test.test_undefinedIdentifier_metadata); |
| 13374 }); | 13691 }); |
| 13375 _ut.test('test_undefinedIdentifier_methodInvocation', () { | 13692 _ut.test('test_undefinedIdentifier_methodInvocation', () { |
| 13376 final __test = new StaticWarningCodeTest(); | 13693 final __test = new StaticWarningCodeTest(); |
| 13377 runJUnitTest(__test, __test.test_undefinedIdentifier_methodInvocation); | 13694 runJUnitTest(__test, __test.test_undefinedIdentifier_methodInvocation); |
| 13378 }); | 13695 }); |
| 13379 _ut.test('test_undefinedNamedParameter', () { | 13696 _ut.test('test_undefinedNamedParameter', () { |
| 13380 final __test = new StaticWarningCodeTest(); | 13697 final __test = new StaticWarningCodeTest(); |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13848 LibraryElementImpl importingLibrary = createTestLibrary2(context, "importing
", []); | 14165 LibraryElementImpl importingLibrary = createTestLibrary2(context, "importing
", []); |
| 13849 importingLibrary.imports = <ImportElement> [import1, import2]; | 14166 importingLibrary.imports = <ImportElement> [import1, import2]; |
| 13850 { | 14167 { |
| 13851 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14168 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 13852 Scope scope = new LibraryImportScope(importingLibrary, errorListener); | 14169 Scope scope = new LibraryImportScope(importingLibrary, errorListener); |
| 13853 JUnitTestCase.assertEquals(typeA, scope.lookup(ASTFactory.identifier3(type
NameA), importingLibrary)); | 14170 JUnitTestCase.assertEquals(typeA, scope.lookup(ASTFactory.identifier3(type
NameA), importingLibrary)); |
| 13854 errorListener.assertNoErrors(); | 14171 errorListener.assertNoErrors(); |
| 13855 JUnitTestCase.assertEquals(typeC, scope.lookup(ASTFactory.identifier3(type
NameC), importingLibrary)); | 14172 JUnitTestCase.assertEquals(typeC, scope.lookup(ASTFactory.identifier3(type
NameC), importingLibrary)); |
| 13856 errorListener.assertNoErrors(); | 14173 errorListener.assertNoErrors(); |
| 13857 Element element = scope.lookup(ASTFactory.identifier3(typeNameB), importin
gLibrary); | 14174 Element element = scope.lookup(ASTFactory.identifier3(typeNameB), importin
gLibrary); |
| 13858 errorListener.assertErrors2([CompileTimeErrorCode.AMBIGUOUS_IMPORT]); | 14175 errorListener.assertErrors2([StaticWarningCode.AMBIGUOUS_IMPORT]); |
| 13859 EngineTestCase.assertInstanceOf(MultiplyDefinedElement, element); | 14176 EngineTestCase.assertInstanceOf(MultiplyDefinedElement, element); |
| 13860 List<Element> conflictingElements = ((element as MultiplyDefinedElement)).
conflictingElements; | 14177 List<Element> conflictingElements = ((element as MultiplyDefinedElement)).
conflictingElements; |
| 13861 JUnitTestCase.assertEquals(typeB1, conflictingElements[0]); | 14178 JUnitTestCase.assertEquals(typeB1, conflictingElements[0]); |
| 13862 JUnitTestCase.assertEquals(typeB2, conflictingElements[1]); | 14179 JUnitTestCase.assertEquals(typeB2, conflictingElements[1]); |
| 13863 JUnitTestCase.assertEquals(2, conflictingElements.length); | 14180 JUnitTestCase.assertEquals(2, conflictingElements.length); |
| 13864 } | 14181 } |
| 13865 { | 14182 { |
| 13866 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14183 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 13867 Scope scope = new LibraryImportScope(importingLibrary, errorListener); | 14184 Scope scope = new LibraryImportScope(importingLibrary, errorListener); |
| 13868 Identifier identifier = ASTFactory.identifier3(typeNameB); | 14185 Identifier identifier = ASTFactory.identifier3(typeNameB); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 13887 ImportElementImpl importElement = new ImportElementImpl(); | 14204 ImportElementImpl importElement = new ImportElementImpl(); |
| 13888 importElement.importedLibrary = importedLibrary; | 14205 importElement.importedLibrary = importedLibrary; |
| 13889 definingLibrary.imports = <ImportElement> [importElement]; | 14206 definingLibrary.imports = <ImportElement> [importElement]; |
| 13890 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14207 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 13891 Scope scope = new LibraryImportScope(definingLibrary, errorListener); | 14208 Scope scope = new LibraryImportScope(definingLibrary, errorListener); |
| 13892 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); | 14209 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); |
| 13893 } | 14210 } |
| 13894 void test_getDefiningLibrary() { | 14211 void test_getDefiningLibrary() { |
| 13895 LibraryElement definingLibrary = createTestLibrary(); | 14212 LibraryElement definingLibrary = createTestLibrary(); |
| 13896 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14213 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 13897 Scope scope = new LibraryImportScope(definingLibrary, errorListener); | 14214 LibraryImportScope scope = new LibraryImportScope(definingLibrary, errorList
ener); |
| 13898 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); | 14215 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); |
| 13899 } | 14216 } |
| 13900 void test_getErrorListener() { | 14217 void test_getErrorListener() { |
| 13901 LibraryElement definingLibrary = createTestLibrary(); | 14218 LibraryElement definingLibrary = createTestLibrary(); |
| 13902 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14219 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 13903 Scope scope = new LibraryImportScope(definingLibrary, errorListener); | 14220 LibraryImportScope scope = new LibraryImportScope(definingLibrary, errorList
ener); |
| 13904 JUnitTestCase.assertEquals(errorListener, scope.errorListener); | 14221 JUnitTestCase.assertEquals(errorListener, scope.errorListener); |
| 13905 } | 14222 } |
| 13906 void test_prefixedAndNonPrefixed() { | 14223 void test_prefixedAndNonPrefixed() { |
| 13907 AnalysisContext context = new AnalysisContextImpl(); | 14224 AnalysisContext context = new AnalysisContextImpl(); |
| 13908 String typeName = "C"; | 14225 String typeName = "C"; |
| 13909 String prefixName = "p"; | 14226 String prefixName = "p"; |
| 13910 ClassElement prefixedType = ElementFactory.classElement2(typeName, []); | 14227 ClassElement prefixedType = ElementFactory.classElement2(typeName, []); |
| 13911 ClassElement nonPrefixedType = ElementFactory.classElement2(typeName, []); | 14228 ClassElement nonPrefixedType = ElementFactory.classElement2(typeName, []); |
| 13912 LibraryElement prefixedLibrary = createTestLibrary2(context, "import.prefixe
d", []); | 14229 LibraryElement prefixedLibrary = createTestLibrary2(context, "import.prefixe
d", []); |
| 13913 ((prefixedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty
pes = <ClassElement> [prefixedType]; | 14230 ((prefixedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty
pes = <ClassElement> [prefixedType]; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14019 } | 14336 } |
| 14020 Object visitBinaryExpression(BinaryExpression node) { | 14337 Object visitBinaryExpression(BinaryExpression node) { |
| 14021 node.visitChildren(this); | 14338 node.visitChildren(this); |
| 14022 if (!node.operator.isUserDefinableOperator) { | 14339 if (!node.operator.isUserDefinableOperator) { |
| 14023 return null; | 14340 return null; |
| 14024 } | 14341 } |
| 14025 Type2 operandType = node.leftOperand.staticType; | 14342 Type2 operandType = node.leftOperand.staticType; |
| 14026 if (operandType == null || operandType.isDynamic) { | 14343 if (operandType == null || operandType.isDynamic) { |
| 14027 return null; | 14344 return null; |
| 14028 } | 14345 } |
| 14029 return checkResolved2(node, node.element, MethodElement); | 14346 return checkResolved2(node, node.staticElement, MethodElement); |
| 14030 } | 14347 } |
| 14031 Object visitCommentReference(CommentReference node) => null; | 14348 Object visitCommentReference(CommentReference node) => null; |
| 14032 Object visitCompilationUnit(CompilationUnit node) { | 14349 Object visitCompilationUnit(CompilationUnit node) { |
| 14033 node.visitChildren(this); | 14350 node.visitChildren(this); |
| 14034 return checkResolved2(node, node.element, CompilationUnitElement); | 14351 return checkResolved2(node, node.element, CompilationUnitElement); |
| 14035 } | 14352 } |
| 14036 Object visitExportDirective(ExportDirective node) => checkResolved2(node, node
.element, ExportElement); | 14353 Object visitExportDirective(ExportDirective node) => checkResolved2(node, node
.element, ExportElement); |
| 14037 Object visitFunctionDeclaration(FunctionDeclaration node) { | 14354 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| 14038 node.visitChildren(this); | 14355 node.visitChildren(this); |
| 14039 if (node.element is LibraryElement) { | 14356 if (node.element is LibraryElement) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 14052 return null; | 14369 return null; |
| 14053 } | 14370 } |
| 14054 return checkResolved2(prefix, prefix.element, PrefixElement); | 14371 return checkResolved2(prefix, prefix.element, PrefixElement); |
| 14055 } | 14372 } |
| 14056 Object visitIndexExpression(IndexExpression node) { | 14373 Object visitIndexExpression(IndexExpression node) { |
| 14057 node.visitChildren(this); | 14374 node.visitChildren(this); |
| 14058 Type2 targetType = node.realTarget.staticType; | 14375 Type2 targetType = node.realTarget.staticType; |
| 14059 if (targetType == null || targetType.isDynamic) { | 14376 if (targetType == null || targetType.isDynamic) { |
| 14060 return null; | 14377 return null; |
| 14061 } | 14378 } |
| 14062 return checkResolved2(node, node.element, MethodElement); | 14379 return checkResolved2(node, node.staticElement, MethodElement); |
| 14063 } | 14380 } |
| 14064 Object visitLibraryDirective(LibraryDirective node) => checkResolved2(node, no
de.element, LibraryElement); | 14381 Object visitLibraryDirective(LibraryDirective node) => checkResolved2(node, no
de.element, LibraryElement); |
| 14065 Object visitNamedExpression(NamedExpression node) => node.expression.accept(th
is); | 14382 Object visitNamedExpression(NamedExpression node) => node.expression.accept(th
is); |
| 14066 Object visitPartDirective(PartDirective node) => checkResolved2(node, node.ele
ment, CompilationUnitElement); | 14383 Object visitPartDirective(PartDirective node) => checkResolved2(node, node.ele
ment, CompilationUnitElement); |
| 14067 Object visitPartOfDirective(PartOfDirective node) => checkResolved2(node, node
.element, LibraryElement); | 14384 Object visitPartOfDirective(PartOfDirective node) => checkResolved2(node, node
.element, LibraryElement); |
| 14068 Object visitPostfixExpression(PostfixExpression node) { | 14385 Object visitPostfixExpression(PostfixExpression node) { |
| 14069 node.visitChildren(this); | 14386 node.visitChildren(this); |
| 14070 if (!node.operator.isUserDefinableOperator) { | 14387 if (!node.operator.isUserDefinableOperator) { |
| 14071 return null; | 14388 return null; |
| 14072 } | 14389 } |
| 14073 Type2 operandType = node.operand.staticType; | 14390 Type2 operandType = node.operand.staticType; |
| 14074 if (operandType == null || operandType.isDynamic) { | 14391 if (operandType == null || operandType.isDynamic) { |
| 14075 return null; | 14392 return null; |
| 14076 } | 14393 } |
| 14077 return checkResolved2(node, node.element, MethodElement); | 14394 return checkResolved2(node, node.staticElement, MethodElement); |
| 14078 } | 14395 } |
| 14079 Object visitPrefixedIdentifier(PrefixedIdentifier node) { | 14396 Object visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 14080 SimpleIdentifier prefix = node.prefix; | 14397 SimpleIdentifier prefix = node.prefix; |
| 14081 prefix.accept(this); | 14398 prefix.accept(this); |
| 14082 Type2 prefixType = prefix.staticType; | 14399 Type2 prefixType = prefix.staticType; |
| 14083 if (prefixType == null || prefixType.isDynamic) { | 14400 if (prefixType == null || prefixType.isDynamic) { |
| 14084 return null; | 14401 return null; |
| 14085 } | 14402 } |
| 14086 return checkResolved(node, node.element); | 14403 return checkResolved(node, node.element); |
| 14087 } | 14404 } |
| 14088 Object visitPrefixExpression(PrefixExpression node) { | 14405 Object visitPrefixExpression(PrefixExpression node) { |
| 14089 node.visitChildren(this); | 14406 node.visitChildren(this); |
| 14090 if (!node.operator.isUserDefinableOperator) { | 14407 if (!node.operator.isUserDefinableOperator) { |
| 14091 return null; | 14408 return null; |
| 14092 } | 14409 } |
| 14093 Type2 operandType = node.operand.staticType; | 14410 Type2 operandType = node.operand.staticType; |
| 14094 if (operandType == null || operandType.isDynamic) { | 14411 if (operandType == null || operandType.isDynamic) { |
| 14095 return null; | 14412 return null; |
| 14096 } | 14413 } |
| 14097 return checkResolved2(node, node.element, MethodElement); | 14414 return checkResolved2(node, node.staticElement, MethodElement); |
| 14098 } | 14415 } |
| 14099 Object visitPropertyAccess(PropertyAccess node) { | 14416 Object visitPropertyAccess(PropertyAccess node) { |
| 14100 Expression target = node.realTarget; | 14417 Expression target = node.realTarget; |
| 14101 target.accept(this); | 14418 target.accept(this); |
| 14102 Type2 targetType = target.staticType; | 14419 Type2 targetType = target.staticType; |
| 14103 if (targetType == null || targetType.isDynamic) { | 14420 if (targetType == null || targetType.isDynamic) { |
| 14104 return null; | 14421 return null; |
| 14105 } | 14422 } |
| 14106 return node.propertyName.accept(this); | 14423 return node.propertyName.accept(this); |
| 14107 } | 14424 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14179 ImportElementImpl importElement = new ImportElementImpl(); | 14496 ImportElementImpl importElement = new ImportElementImpl(); |
| 14180 importElement.importedLibrary = importedLibrary; | 14497 importElement.importedLibrary = importedLibrary; |
| 14181 definingLibrary.imports = <ImportElement> [importElement]; | 14498 definingLibrary.imports = <ImportElement> [importElement]; |
| 14182 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14499 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 14183 Scope scope = new LibraryScope(definingLibrary, errorListener); | 14500 Scope scope = new LibraryScope(definingLibrary, errorListener); |
| 14184 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); | 14501 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3
(importedTypeName), definingLibrary)); |
| 14185 } | 14502 } |
| 14186 void test_getDefiningLibrary() { | 14503 void test_getDefiningLibrary() { |
| 14187 LibraryElement definingLibrary = createTestLibrary(); | 14504 LibraryElement definingLibrary = createTestLibrary(); |
| 14188 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14505 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 14189 Scope scope = new LibraryScope(definingLibrary, errorListener); | 14506 LibraryScope scope = new LibraryScope(definingLibrary, errorListener); |
| 14190 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); | 14507 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); |
| 14191 } | 14508 } |
| 14192 void test_getErrorListener() { | 14509 void test_getErrorListener() { |
| 14193 LibraryElement definingLibrary = createTestLibrary(); | 14510 LibraryElement definingLibrary = createTestLibrary(); |
| 14194 GatheringErrorListener errorListener = new GatheringErrorListener(); | 14511 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 14195 Scope scope = new LibraryScope(definingLibrary, errorListener); | 14512 LibraryScope scope = new LibraryScope(definingLibrary, errorListener); |
| 14196 JUnitTestCase.assertEquals(errorListener, scope.errorListener); | 14513 JUnitTestCase.assertEquals(errorListener, scope.errorListener); |
| 14197 } | 14514 } |
| 14198 static dartSuite() { | 14515 static dartSuite() { |
| 14199 _ut.group('LibraryScopeTest', () { | 14516 _ut.group('LibraryScopeTest', () { |
| 14200 _ut.test('test_creation_empty', () { | 14517 _ut.test('test_creation_empty', () { |
| 14201 final __test = new LibraryScopeTest(); | 14518 final __test = new LibraryScopeTest(); |
| 14202 runJUnitTest(__test, __test.test_creation_empty); | 14519 runJUnitTest(__test, __test.test_creation_empty); |
| 14203 }); | 14520 }); |
| 14204 _ut.test('test_creation_nonEmpty', () { | 14521 _ut.test('test_creation_nonEmpty', () { |
| 14205 final __test = new LibraryScopeTest(); | 14522 final __test = new LibraryScopeTest(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14271 Expression node = ASTFactory.asExpression(ASTFactory.thisExpression(), ASTFa
ctory.typeName(subclass, [])); | 14588 Expression node = ASTFactory.asExpression(ASTFactory.thisExpression(), ASTFa
ctory.typeName(subclass, [])); |
| 14272 JUnitTestCase.assertSame(subclass.type, analyze2(node, superclassType)); | 14589 JUnitTestCase.assertSame(subclass.type, analyze2(node, superclassType)); |
| 14273 _listener.assertNoErrors(); | 14590 _listener.assertNoErrors(); |
| 14274 } | 14591 } |
| 14275 void test_visitAssignmentExpression_compound() { | 14592 void test_visitAssignmentExpression_compound() { |
| 14276 InterfaceType numType = _typeProvider.numType; | 14593 InterfaceType numType = _typeProvider.numType; |
| 14277 SimpleIdentifier identifier = resolvedVariable(_typeProvider.intType, "i"); | 14594 SimpleIdentifier identifier = resolvedVariable(_typeProvider.intType, "i"); |
| 14278 AssignmentExpression node = ASTFactory.assignmentExpression(identifier, Toke
nType.PLUS_EQ, resolvedInteger(1)); | 14595 AssignmentExpression node = ASTFactory.assignmentExpression(identifier, Toke
nType.PLUS_EQ, resolvedInteger(1)); |
| 14279 MethodElement plusMethod = getMethod(numType, "+"); | 14596 MethodElement plusMethod = getMethod(numType, "+"); |
| 14280 node.staticElement = plusMethod; | 14597 node.staticElement = plusMethod; |
| 14281 node.element = plusMethod; | |
| 14282 JUnitTestCase.assertSame(numType, analyze(node)); | 14598 JUnitTestCase.assertSame(numType, analyze(node)); |
| 14283 _listener.assertNoErrors(); | 14599 _listener.assertNoErrors(); |
| 14284 } | 14600 } |
| 14285 void test_visitAssignmentExpression_simple() { | 14601 void test_visitAssignmentExpression_simple() { |
| 14286 InterfaceType intType = _typeProvider.intType; | 14602 InterfaceType intType = _typeProvider.intType; |
| 14287 Expression node = ASTFactory.assignmentExpression(resolvedVariable(intType,
"i"), TokenType.EQ, resolvedInteger(0)); | 14603 Expression node = ASTFactory.assignmentExpression(resolvedVariable(intType,
"i"), TokenType.EQ, resolvedInteger(0)); |
| 14288 JUnitTestCase.assertSame(intType, analyze(node)); | 14604 JUnitTestCase.assertSame(intType, analyze(node)); |
| 14289 _listener.assertNoErrors(); | 14605 _listener.assertNoErrors(); |
| 14290 } | 14606 } |
| 14291 void test_visitBinaryExpression_equals() { | 14607 void test_visitBinaryExpression_equals() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 14303 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 14619 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 14304 _listener.assertNoErrors(); | 14620 _listener.assertNoErrors(); |
| 14305 } | 14621 } |
| 14306 void test_visitBinaryExpression_notEquals() { | 14622 void test_visitBinaryExpression_notEquals() { |
| 14307 Expression node = ASTFactory.binaryExpression(resolvedInteger(2), TokenType.
BANG_EQ, resolvedInteger(3)); | 14623 Expression node = ASTFactory.binaryExpression(resolvedInteger(2), TokenType.
BANG_EQ, resolvedInteger(3)); |
| 14308 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 14624 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 14309 _listener.assertNoErrors(); | 14625 _listener.assertNoErrors(); |
| 14310 } | 14626 } |
| 14311 void test_visitBinaryExpression_plusID() { | 14627 void test_visitBinaryExpression_plusID() { |
| 14312 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), Toke
nType.PLUS, resolvedDouble(2.0)); | 14628 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), Toke
nType.PLUS, resolvedDouble(2.0)); |
| 14313 setStaticElement(node, getMethod(_typeProvider.numType, "+")); | 14629 node.staticElement = getMethod(_typeProvider.numType, "+"); |
| 14314 JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node)); | 14630 JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node)); |
| 14315 _listener.assertNoErrors(); | 14631 _listener.assertNoErrors(); |
| 14316 } | 14632 } |
| 14317 void test_visitBinaryExpression_plusII() { | 14633 void test_visitBinaryExpression_plusII() { |
| 14318 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), Toke
nType.PLUS, resolvedInteger(2)); | 14634 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), Toke
nType.PLUS, resolvedInteger(2)); |
| 14319 setStaticElement(node, getMethod(_typeProvider.numType, "+")); | 14635 node.staticElement = getMethod(_typeProvider.numType, "+"); |
| 14320 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 14636 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 14321 _listener.assertNoErrors(); | 14637 _listener.assertNoErrors(); |
| 14322 } | 14638 } |
| 14323 void test_visitBinaryExpression_slash() { | 14639 void test_visitBinaryExpression_slash() { |
| 14324 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(2), Toke
nType.SLASH, resolvedInteger(2)); | 14640 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(2), Toke
nType.SLASH, resolvedInteger(2)); |
| 14325 setStaticElement(node, getMethod(_typeProvider.numType, "/")); | 14641 node.staticElement = getMethod(_typeProvider.numType, "/"); |
| 14326 JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node)); | 14642 JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node)); |
| 14327 _listener.assertNoErrors(); | 14643 _listener.assertNoErrors(); |
| 14328 } | 14644 } |
| 14329 void test_visitBinaryExpression_star_notSpecial() { | 14645 void test_visitBinaryExpression_star_notSpecial() { |
| 14330 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 14646 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 14331 InterfaceType typeA = classA.type; | 14647 InterfaceType typeA = classA.type; |
| 14332 MethodElement operator = ElementFactory.methodElement("*", typeA, [_typeProv
ider.doubleType]); | 14648 MethodElement operator = ElementFactory.methodElement("*", typeA, [_typeProv
ider.doubleType]); |
| 14333 classA.methods = <MethodElement> [operator]; | 14649 classA.methods = <MethodElement> [operator]; |
| 14334 BinaryExpression node = ASTFactory.binaryExpression(ASTFactory.asExpression(
ASTFactory.identifier3("a"), ASTFactory.typeName(classA, [])), TokenType.PLUS, r
esolvedDouble(2.0)); | 14650 BinaryExpression node = ASTFactory.binaryExpression(ASTFactory.asExpression(
ASTFactory.identifier3("a"), ASTFactory.typeName(classA, [])), TokenType.PLUS, r
esolvedDouble(2.0)); |
| 14335 setStaticElement(node, operator); | 14651 node.staticElement = operator; |
| 14336 JUnitTestCase.assertSame(typeA, analyze(node)); | 14652 JUnitTestCase.assertSame(typeA, analyze(node)); |
| 14337 _listener.assertNoErrors(); | 14653 _listener.assertNoErrors(); |
| 14338 } | 14654 } |
| 14339 void test_visitBinaryExpression_starID() { | 14655 void test_visitBinaryExpression_starID() { |
| 14340 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), Toke
nType.PLUS, resolvedDouble(2.0)); | 14656 BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), Toke
nType.PLUS, resolvedDouble(2.0)); |
| 14341 setStaticElement(node, getMethod(_typeProvider.numType, "*")); | 14657 node.staticElement = getMethod(_typeProvider.numType, "*"); |
| 14342 JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node)); | 14658 JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node)); |
| 14343 _listener.assertNoErrors(); | 14659 _listener.assertNoErrors(); |
| 14344 } | 14660 } |
| 14345 void test_visitBooleanLiteral_false() { | 14661 void test_visitBooleanLiteral_false() { |
| 14346 Expression node = ASTFactory.booleanLiteral(false); | 14662 Expression node = ASTFactory.booleanLiteral(false); |
| 14347 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 14663 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 14348 _listener.assertNoErrors(); | 14664 _listener.assertNoErrors(); |
| 14349 } | 14665 } |
| 14350 void test_visitBooleanLiteral_true() { | 14666 void test_visitBooleanLiteral_true() { |
| 14351 Expression node = ASTFactory.booleanLiteral(true); | 14667 Expression node = ASTFactory.booleanLiteral(true); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14499 Type2 resultType = analyze(node); | 14815 Type2 resultType = analyze(node); |
| 14500 assertFunctionType(_typeProvider.intType, null, <Type2> [dynamicType], null,
resultType); | 14816 assertFunctionType(_typeProvider.intType, null, <Type2> [dynamicType], null,
resultType); |
| 14501 _listener.assertNoErrors(); | 14817 _listener.assertNoErrors(); |
| 14502 } | 14818 } |
| 14503 void test_visitIndexExpression_getter() { | 14819 void test_visitIndexExpression_getter() { |
| 14504 InterfaceType listType = _typeProvider.listType; | 14820 InterfaceType listType = _typeProvider.listType; |
| 14505 SimpleIdentifier identifier = resolvedVariable(listType, "a"); | 14821 SimpleIdentifier identifier = resolvedVariable(listType, "a"); |
| 14506 IndexExpression node = ASTFactory.indexExpression(identifier, resolvedIntege
r(2)); | 14822 IndexExpression node = ASTFactory.indexExpression(identifier, resolvedIntege
r(2)); |
| 14507 MethodElement indexMethod = listType.element.methods[0]; | 14823 MethodElement indexMethod = listType.element.methods[0]; |
| 14508 node.staticElement = indexMethod; | 14824 node.staticElement = indexMethod; |
| 14509 node.element = indexMethod; | |
| 14510 JUnitTestCase.assertSame(listType.typeArguments[0], analyze(node)); | 14825 JUnitTestCase.assertSame(listType.typeArguments[0], analyze(node)); |
| 14511 _listener.assertNoErrors(); | 14826 _listener.assertNoErrors(); |
| 14512 } | 14827 } |
| 14513 void test_visitIndexExpression_setter() { | 14828 void test_visitIndexExpression_setter() { |
| 14514 InterfaceType listType = _typeProvider.listType; | 14829 InterfaceType listType = _typeProvider.listType; |
| 14515 SimpleIdentifier identifier = resolvedVariable(listType, "a"); | 14830 SimpleIdentifier identifier = resolvedVariable(listType, "a"); |
| 14516 IndexExpression node = ASTFactory.indexExpression(identifier, resolvedIntege
r(2)); | 14831 IndexExpression node = ASTFactory.indexExpression(identifier, resolvedIntege
r(2)); |
| 14517 MethodElement indexMethod = listType.element.methods[1]; | 14832 MethodElement indexMethod = listType.element.methods[1]; |
| 14518 node.staticElement = indexMethod; | 14833 node.staticElement = indexMethod; |
| 14519 node.element = indexMethod; | |
| 14520 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); | 14834 ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0)); |
| 14521 JUnitTestCase.assertSame(listType.typeArguments[0], analyze(node)); | 14835 JUnitTestCase.assertSame(listType.typeArguments[0], analyze(node)); |
| 14522 _listener.assertNoErrors(); | 14836 _listener.assertNoErrors(); |
| 14523 } | 14837 } |
| 14524 void test_visitIndexExpression_typeParameters() { | 14838 void test_visitIndexExpression_typeParameters() { |
| 14525 InterfaceType intType = _typeProvider.intType; | 14839 InterfaceType intType = _typeProvider.intType; |
| 14526 InterfaceType listType = _typeProvider.listType; | 14840 InterfaceType listType = _typeProvider.listType; |
| 14527 MethodElement methodElement = getMethod(listType, "[]"); | 14841 MethodElement methodElement = getMethod(listType, "[]"); |
| 14528 SimpleIdentifier identifier = ASTFactory.identifier3("list"); | 14842 SimpleIdentifier identifier = ASTFactory.identifier3("list"); |
| 14529 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); | 14843 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); |
| 14530 identifier.staticType = listOfIntType; | 14844 identifier.staticType = listOfIntType; |
| 14531 IndexExpression indexExpression = ASTFactory.indexExpression(identifier, AST
Factory.integer(0)); | 14845 IndexExpression indexExpression = ASTFactory.indexExpression(identifier, AST
Factory.integer(0)); |
| 14532 MethodElement indexMethod = MethodMember.from(methodElement, listOfIntType); | 14846 MethodElement indexMethod = MethodMember.from(methodElement, listOfIntType); |
| 14533 indexExpression.staticElement = indexMethod; | 14847 indexExpression.staticElement = indexMethod; |
| 14534 indexExpression.element = indexMethod; | |
| 14535 JUnitTestCase.assertSame(intType, analyze(indexExpression)); | 14848 JUnitTestCase.assertSame(intType, analyze(indexExpression)); |
| 14536 _listener.assertNoErrors(); | 14849 _listener.assertNoErrors(); |
| 14537 } | 14850 } |
| 14538 void test_visitIndexExpression_typeParameters_inSetterContext() { | 14851 void test_visitIndexExpression_typeParameters_inSetterContext() { |
| 14539 InterfaceType intType = _typeProvider.intType; | 14852 InterfaceType intType = _typeProvider.intType; |
| 14540 InterfaceType listType = _typeProvider.listType; | 14853 InterfaceType listType = _typeProvider.listType; |
| 14541 MethodElement methodElement = getMethod(listType, "[]="); | 14854 MethodElement methodElement = getMethod(listType, "[]="); |
| 14542 SimpleIdentifier identifier = ASTFactory.identifier3("list"); | 14855 SimpleIdentifier identifier = ASTFactory.identifier3("list"); |
| 14543 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); | 14856 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); |
| 14544 identifier.staticType = listOfIntType; | 14857 identifier.staticType = listOfIntType; |
| 14545 IndexExpression indexExpression = ASTFactory.indexExpression(identifier, AST
Factory.integer(0)); | 14858 IndexExpression indexExpression = ASTFactory.indexExpression(identifier, AST
Factory.integer(0)); |
| 14546 MethodElement indexMethod = MethodMember.from(methodElement, listOfIntType); | 14859 MethodElement indexMethod = MethodMember.from(methodElement, listOfIntType); |
| 14547 indexExpression.staticElement = indexMethod; | 14860 indexExpression.staticElement = indexMethod; |
| 14548 indexExpression.element = indexMethod; | |
| 14549 ASTFactory.assignmentExpression(indexExpression, TokenType.EQ, ASTFactory.in
teger(0)); | 14861 ASTFactory.assignmentExpression(indexExpression, TokenType.EQ, ASTFactory.in
teger(0)); |
| 14550 JUnitTestCase.assertSame(intType, analyze(indexExpression)); | 14862 JUnitTestCase.assertSame(intType, analyze(indexExpression)); |
| 14551 _listener.assertNoErrors(); | 14863 _listener.assertNoErrors(); |
| 14552 } | 14864 } |
| 14553 void test_visitInstanceCreationExpression_named() { | 14865 void test_visitInstanceCreationExpression_named() { |
| 14554 ClassElementImpl classElement = ElementFactory.classElement2("C", []); | 14866 ClassElementImpl classElement = ElementFactory.classElement2("C", []); |
| 14555 String constructorName = "m"; | 14867 String constructorName = "m"; |
| 14556 ConstructorElementImpl constructor = ElementFactory.constructorElement(class
Element, constructorName); | 14868 ConstructorElementImpl constructor = ElementFactory.constructorElement(class
Element, constructorName); |
| 14557 constructor.returnType = classElement.type; | 14869 constructor.returnType = classElement.type; |
| 14558 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); | 14870 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14689 } | 15001 } |
| 14690 void test_visitPrefixExpression_bang() { | 15002 void test_visitPrefixExpression_bang() { |
| 14691 PrefixExpression node = ASTFactory.prefixExpression(TokenType.BANG, resolved
Integer(0)); | 15003 PrefixExpression node = ASTFactory.prefixExpression(TokenType.BANG, resolved
Integer(0)); |
| 14692 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 15004 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 14693 _listener.assertNoErrors(); | 15005 _listener.assertNoErrors(); |
| 14694 } | 15006 } |
| 14695 void test_visitPrefixExpression_minus() { | 15007 void test_visitPrefixExpression_minus() { |
| 14696 PrefixExpression node = ASTFactory.prefixExpression(TokenType.MINUS, resolve
dInteger(0)); | 15008 PrefixExpression node = ASTFactory.prefixExpression(TokenType.MINUS, resolve
dInteger(0)); |
| 14697 MethodElement minusMethod = getMethod(_typeProvider.numType, "-"); | 15009 MethodElement minusMethod = getMethod(_typeProvider.numType, "-"); |
| 14698 node.staticElement = minusMethod; | 15010 node.staticElement = minusMethod; |
| 14699 node.element = minusMethod; | |
| 14700 JUnitTestCase.assertSame(_typeProvider.numType, analyze(node)); | 15011 JUnitTestCase.assertSame(_typeProvider.numType, analyze(node)); |
| 14701 _listener.assertNoErrors(); | 15012 _listener.assertNoErrors(); |
| 14702 } | 15013 } |
| 14703 void test_visitPrefixExpression_minusMinus() { | 15014 void test_visitPrefixExpression_minusMinus() { |
| 14704 PrefixExpression node = ASTFactory.prefixExpression(TokenType.MINUS_MINUS, r
esolvedInteger(0)); | 15015 PrefixExpression node = ASTFactory.prefixExpression(TokenType.MINUS_MINUS, r
esolvedInteger(0)); |
| 14705 MethodElement minusMethod = getMethod(_typeProvider.numType, "-"); | 15016 MethodElement minusMethod = getMethod(_typeProvider.numType, "-"); |
| 14706 node.staticElement = minusMethod; | 15017 node.staticElement = minusMethod; |
| 14707 node.element = minusMethod; | |
| 14708 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 15018 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 14709 _listener.assertNoErrors(); | 15019 _listener.assertNoErrors(); |
| 14710 } | 15020 } |
| 14711 void test_visitPrefixExpression_not() { | 15021 void test_visitPrefixExpression_not() { |
| 14712 Expression node = ASTFactory.prefixExpression(TokenType.BANG, ASTFactory.boo
leanLiteral(true)); | 15022 Expression node = ASTFactory.prefixExpression(TokenType.BANG, ASTFactory.boo
leanLiteral(true)); |
| 14713 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); | 15023 JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node)); |
| 14714 _listener.assertNoErrors(); | 15024 _listener.assertNoErrors(); |
| 14715 } | 15025 } |
| 14716 void test_visitPrefixExpression_plusPlus() { | 15026 void test_visitPrefixExpression_plusPlus() { |
| 14717 PrefixExpression node = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, res
olvedInteger(0)); | 15027 PrefixExpression node = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, res
olvedInteger(0)); |
| 14718 MethodElement plusMethod = getMethod(_typeProvider.numType, "+"); | 15028 MethodElement plusMethod = getMethod(_typeProvider.numType, "+"); |
| 14719 node.staticElement = plusMethod; | 15029 node.staticElement = plusMethod; |
| 14720 node.element = plusMethod; | |
| 14721 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 15030 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 14722 _listener.assertNoErrors(); | 15031 _listener.assertNoErrors(); |
| 14723 } | 15032 } |
| 14724 void test_visitPrefixExpression_tilde() { | 15033 void test_visitPrefixExpression_tilde() { |
| 14725 PrefixExpression node = ASTFactory.prefixExpression(TokenType.TILDE, resolve
dInteger(0)); | 15034 PrefixExpression node = ASTFactory.prefixExpression(TokenType.TILDE, resolve
dInteger(0)); |
| 14726 MethodElement tildeMethod = getMethod(_typeProvider.intType, "~"); | 15035 MethodElement tildeMethod = getMethod(_typeProvider.intType, "~"); |
| 14727 node.staticElement = tildeMethod; | 15036 node.staticElement = tildeMethod; |
| 14728 node.element = tildeMethod; | |
| 14729 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); | 15037 JUnitTestCase.assertSame(_typeProvider.intType, analyze(node)); |
| 14730 _listener.assertNoErrors(); | 15038 _listener.assertNoErrors(); |
| 14731 } | 15039 } |
| 14732 void test_visitPropertyAccess_getter() { | 15040 void test_visitPropertyAccess_getter() { |
| 14733 Type2 boolType = _typeProvider.boolType; | 15041 Type2 boolType = _typeProvider.boolType; |
| 14734 PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false
, boolType); | 15042 PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false
, boolType); |
| 14735 PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier3("a")
, "b"); | 15043 PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier3("a")
, "b"); |
| 14736 node.propertyName.element = getter; | 15044 node.propertyName.element = getter; |
| 14737 JUnitTestCase.assertSame(boolType, analyze(node)); | 15045 JUnitTestCase.assertSame(boolType, analyze(node)); |
| 14738 _listener.assertNoErrors(); | 15046 _listener.assertNoErrors(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 14759 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); | 15067 JUnitTestCase.assertSame(_typeProvider.stringType, analyze(node)); |
| 14760 _listener.assertNoErrors(); | 15068 _listener.assertNoErrors(); |
| 14761 } | 15069 } |
| 14762 void test_visitSuperExpression() { | 15070 void test_visitSuperExpression() { |
| 14763 InterfaceType superType = ElementFactory.classElement2("A", []).type; | 15071 InterfaceType superType = ElementFactory.classElement2("A", []).type; |
| 14764 InterfaceType thisType = ElementFactory.classElement("B", superType, []).typ
e; | 15072 InterfaceType thisType = ElementFactory.classElement("B", superType, []).typ
e; |
| 14765 Expression node = ASTFactory.superExpression(); | 15073 Expression node = ASTFactory.superExpression(); |
| 14766 JUnitTestCase.assertSame(thisType, analyze2(node, thisType)); | 15074 JUnitTestCase.assertSame(thisType, analyze2(node, thisType)); |
| 14767 _listener.assertNoErrors(); | 15075 _listener.assertNoErrors(); |
| 14768 } | 15076 } |
| 15077 void test_visitSymbolLiteral() { |
| 15078 JUnitTestCase.assertSame(_typeProvider.symbolType, analyze(ASTFactory.symbol
Literal(["a"]))); |
| 15079 } |
| 14769 void test_visitThisExpression() { | 15080 void test_visitThisExpression() { |
| 14770 InterfaceType thisType = ElementFactory.classElement("B", ElementFactory.cla
ssElement2("A", []).type, []).type; | 15081 InterfaceType thisType = ElementFactory.classElement("B", ElementFactory.cla
ssElement2("A", []).type, []).type; |
| 14771 Expression node = ASTFactory.thisExpression(); | 15082 Expression node = ASTFactory.thisExpression(); |
| 14772 JUnitTestCase.assertSame(thisType, analyze2(node, thisType)); | 15083 JUnitTestCase.assertSame(thisType, analyze2(node, thisType)); |
| 14773 _listener.assertNoErrors(); | 15084 _listener.assertNoErrors(); |
| 14774 } | 15085 } |
| 14775 void test_visitThrowExpression_withoutValue() { | 15086 void test_visitThrowExpression_withoutValue() { |
| 14776 Expression node = ASTFactory.throwExpression(); | 15087 Expression node = ASTFactory.throwExpression(); |
| 14777 JUnitTestCase.assertSame(_typeProvider.bottomType, analyze(node)); | 15088 JUnitTestCase.assertSame(_typeProvider.bottomType, analyze(node)); |
| 14778 _listener.assertNoErrors(); | 15089 _listener.assertNoErrors(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14981 SimpleIdentifier resolvedVariable(InterfaceType type2, String variableName) { | 15292 SimpleIdentifier resolvedVariable(InterfaceType type2, String variableName) { |
| 14982 SimpleIdentifier identifier = ASTFactory.identifier3(variableName); | 15293 SimpleIdentifier identifier = ASTFactory.identifier3(variableName); |
| 14983 VariableElementImpl element = ElementFactory.localVariableElement(identifier
); | 15294 VariableElementImpl element = ElementFactory.localVariableElement(identifier
); |
| 14984 element.type = type2; | 15295 element.type = type2; |
| 14985 identifier.element = element; | 15296 identifier.element = element; |
| 14986 identifier.staticType = type2; | 15297 identifier.staticType = type2; |
| 14987 return identifier; | 15298 return identifier; |
| 14988 } | 15299 } |
| 14989 | 15300 |
| 14990 /** | 15301 /** |
| 14991 * Sets the element for the node and remembers it as the static resolution. | |
| 14992 */ | |
| 14993 void setStaticElement(BinaryExpression node, MethodElement element2) { | |
| 14994 node.staticElement = element2; | |
| 14995 node.element = element2; | |
| 14996 } | |
| 14997 | |
| 14998 /** | |
| 14999 * Set the type of the given parameter to the given type. | 15302 * Set the type of the given parameter to the given type. |
| 15000 * | 15303 * |
| 15001 * @param parameter the parameter whose type is to be set | 15304 * @param parameter the parameter whose type is to be set |
| 15002 * @param type the new type of the given parameter | 15305 * @param type the new type of the given parameter |
| 15003 */ | 15306 */ |
| 15004 void setType(FormalParameter parameter, Type2 type2) { | 15307 void setType(FormalParameter parameter, Type2 type2) { |
| 15005 SimpleIdentifier identifier = parameter.identifier; | 15308 SimpleIdentifier identifier = parameter.identifier; |
| 15006 Element element = identifier.element; | 15309 Element element = identifier.element; |
| 15007 if (element is! ParameterElement) { | 15310 if (element is! ParameterElement) { |
| 15008 element = new ParameterElementImpl.con1(identifier); | 15311 element = new ParameterElementImpl.con1(identifier); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15261 runJUnitTest(__test, __test.test_visitSimpleStringLiteral); | 15564 runJUnitTest(__test, __test.test_visitSimpleStringLiteral); |
| 15262 }); | 15565 }); |
| 15263 _ut.test('test_visitStringInterpolation', () { | 15566 _ut.test('test_visitStringInterpolation', () { |
| 15264 final __test = new StaticTypeAnalyzerTest(); | 15567 final __test = new StaticTypeAnalyzerTest(); |
| 15265 runJUnitTest(__test, __test.test_visitStringInterpolation); | 15568 runJUnitTest(__test, __test.test_visitStringInterpolation); |
| 15266 }); | 15569 }); |
| 15267 _ut.test('test_visitSuperExpression', () { | 15570 _ut.test('test_visitSuperExpression', () { |
| 15268 final __test = new StaticTypeAnalyzerTest(); | 15571 final __test = new StaticTypeAnalyzerTest(); |
| 15269 runJUnitTest(__test, __test.test_visitSuperExpression); | 15572 runJUnitTest(__test, __test.test_visitSuperExpression); |
| 15270 }); | 15573 }); |
| 15574 _ut.test('test_visitSymbolLiteral', () { |
| 15575 final __test = new StaticTypeAnalyzerTest(); |
| 15576 runJUnitTest(__test, __test.test_visitSymbolLiteral); |
| 15577 }); |
| 15271 _ut.test('test_visitThisExpression', () { | 15578 _ut.test('test_visitThisExpression', () { |
| 15272 final __test = new StaticTypeAnalyzerTest(); | 15579 final __test = new StaticTypeAnalyzerTest(); |
| 15273 runJUnitTest(__test, __test.test_visitThisExpression); | 15580 runJUnitTest(__test, __test.test_visitThisExpression); |
| 15274 }); | 15581 }); |
| 15275 _ut.test('test_visitThrowExpression_withValue', () { | 15582 _ut.test('test_visitThrowExpression_withValue', () { |
| 15276 final __test = new StaticTypeAnalyzerTest(); | 15583 final __test = new StaticTypeAnalyzerTest(); |
| 15277 runJUnitTest(__test, __test.test_visitThrowExpression_withValue); | 15584 runJUnitTest(__test, __test.test_visitThrowExpression_withValue); |
| 15278 }); | 15585 }); |
| 15279 _ut.test('test_visitThrowExpression_withoutValue', () { | 15586 _ut.test('test_visitThrowExpression_withoutValue', () { |
| 15280 final __test = new StaticTypeAnalyzerTest(); | 15587 final __test = new StaticTypeAnalyzerTest(); |
| 15281 runJUnitTest(__test, __test.test_visitThrowExpression_withoutValue); | 15588 runJUnitTest(__test, __test.test_visitThrowExpression_withoutValue); |
| 15282 }); | 15589 }); |
| 15283 }); | 15590 }); |
| 15284 } | 15591 } |
| 15285 } | 15592 } |
| 15286 class NonHintCodeTest extends ResolverTestCase { | 15593 class NonHintCodeTest extends ResolverTestCase { |
| 15287 void test_deadCode_deadCatch_onCatchSubtype() { | 15594 void test_deadCode_deadCatch_onCatchSubtype() { |
| 15288 Source source = addSource(EngineTestCase.createSource([ | 15595 Source source = addSource(EngineTestCase.createSource([ |
| 15289 "class A {}", | 15596 "class A {}", |
| 15290 "class B extends A {}", | 15597 "class B extends A {}", |
| 15291 "f() {", | 15598 "f() {", |
| 15292 " try {} on B catch (e) {} on A catch (e) {} catch (e) {}", | 15599 " try {} on B catch (e) {} on A catch (e) {} catch (e) {}", |
| 15293 "}"])); | 15600 "}"])); |
| 15294 resolve(source); | 15601 resolve(source); |
| 15295 assertNoErrors(); | 15602 assertNoErrors(); |
| 15296 verify([source]); | 15603 verify([source]); |
| 15297 } | 15604 } |
| 15605 void test_unusedImport_export() { |
| 15606 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'lib1.dart';", "Two two;"])); |
| 15607 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "expo
rt 'lib2.dart';", "class One {}"])); |
| 15608 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "clas
s Two {}"])); |
| 15609 resolve(source); |
| 15610 assertNoErrors(); |
| 15611 verify([source]); |
| 15612 } |
| 15613 void test_unusedImport_export_infiniteLoop() { |
| 15614 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'lib1.dart';", "Two one;"])); |
| 15615 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "expo
rt 'lib2.dart';", "class One {}"])); |
| 15616 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "expo
rt 'lib3.dart';", "class Two {}"])); |
| 15617 addSource2("/lib3.dart", EngineTestCase.createSource(["library lib3;", "expo
rt 'lib2.dart';", "class Three {}"])); |
| 15618 resolve(source); |
| 15619 assertNoErrors(); |
| 15620 verify([source]); |
| 15621 } |
| 15622 void test_unusedImport_export2() { |
| 15623 Source source = addSource(EngineTestCase.createSource(["library L;", "import
'lib1.dart';", "Two one;"])); |
| 15624 addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "expo
rt 'lib2.dart';", "class One {}"])); |
| 15625 addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "expo
rt 'lib3.dart';", "class Two {}"])); |
| 15626 addSource2("/lib3.dart", EngineTestCase.createSource(["library lib3;", "clas
s Three {}"])); |
| 15627 resolve(source); |
| 15628 assertNoErrors(); |
| 15629 verify([source]); |
| 15630 } |
| 15298 static dartSuite() { | 15631 static dartSuite() { |
| 15299 _ut.group('NonHintCodeTest', () { | 15632 _ut.group('NonHintCodeTest', () { |
| 15300 _ut.test('test_deadCode_deadCatch_onCatchSubtype', () { | 15633 _ut.test('test_deadCode_deadCatch_onCatchSubtype', () { |
| 15301 final __test = new NonHintCodeTest(); | 15634 final __test = new NonHintCodeTest(); |
| 15302 runJUnitTest(__test, __test.test_deadCode_deadCatch_onCatchSubtype); | 15635 runJUnitTest(__test, __test.test_deadCode_deadCatch_onCatchSubtype); |
| 15303 }); | 15636 }); |
| 15637 _ut.test('test_unusedImport_export', () { |
| 15638 final __test = new NonHintCodeTest(); |
| 15639 runJUnitTest(__test, __test.test_unusedImport_export); |
| 15640 }); |
| 15641 _ut.test('test_unusedImport_export2', () { |
| 15642 final __test = new NonHintCodeTest(); |
| 15643 runJUnitTest(__test, __test.test_unusedImport_export2); |
| 15644 }); |
| 15645 _ut.test('test_unusedImport_export_infiniteLoop', () { |
| 15646 final __test = new NonHintCodeTest(); |
| 15647 runJUnitTest(__test, __test.test_unusedImport_export_infiniteLoop); |
| 15648 }); |
| 15304 }); | 15649 }); |
| 15305 } | 15650 } |
| 15306 } | 15651 } |
| 15307 class EnclosedScopeTest extends ResolverTestCase { | 15652 class EnclosedScopeTest extends ResolverTestCase { |
| 15308 void test_define_duplicate() { | 15653 void test_define_duplicate() { |
| 15309 LibraryElement definingLibrary2 = createTestLibrary(); | 15654 LibraryElement definingLibrary2 = createTestLibrary(); |
| 15310 GatheringErrorListener errorListener2 = new GatheringErrorListener(); | 15655 GatheringErrorListener errorListener2 = new GatheringErrorListener(); |
| 15311 Scope rootScope = new Scope_18(definingLibrary2, errorListener2); | 15656 Scope rootScope = new Scope_19(definingLibrary2, errorListener2); |
| 15312 EnclosedScope scope = new EnclosedScope(rootScope); | 15657 EnclosedScope scope = new EnclosedScope(rootScope); |
| 15313 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 15658 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 15314 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 15659 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 15315 scope.define(element1); | 15660 scope.define(element1); |
| 15316 scope.define(element2); | 15661 scope.define(element2); |
| 15317 errorListener2.assertErrors3([ErrorSeverity.ERROR]); | 15662 errorListener2.assertErrors3([ErrorSeverity.ERROR]); |
| 15318 } | 15663 } |
| 15319 void test_define_normal() { | 15664 void test_define_normal() { |
| 15320 LibraryElement definingLibrary3 = createTestLibrary(); | 15665 LibraryElement definingLibrary3 = createTestLibrary(); |
| 15321 GatheringErrorListener errorListener3 = new GatheringErrorListener(); | 15666 GatheringErrorListener errorListener3 = new GatheringErrorListener(); |
| 15322 Scope rootScope = new Scope_19(definingLibrary3, errorListener3); | 15667 Scope rootScope = new Scope_20(definingLibrary3, errorListener3); |
| 15323 EnclosedScope outerScope = new EnclosedScope(rootScope); | 15668 EnclosedScope outerScope = new EnclosedScope(rootScope); |
| 15324 EnclosedScope innerScope = new EnclosedScope(outerScope); | 15669 EnclosedScope innerScope = new EnclosedScope(outerScope); |
| 15325 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 15670 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 15326 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); | 15671 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 15327 outerScope.define(element1); | 15672 outerScope.define(element1); |
| 15328 innerScope.define(element2); | 15673 innerScope.define(element2); |
| 15329 errorListener3.assertNoErrors(); | 15674 errorListener3.assertNoErrors(); |
| 15330 } | 15675 } |
| 15331 static dartSuite() { | 15676 static dartSuite() { |
| 15332 _ut.group('EnclosedScopeTest', () { | 15677 _ut.group('EnclosedScopeTest', () { |
| 15333 _ut.test('test_define_duplicate', () { | 15678 _ut.test('test_define_duplicate', () { |
| 15334 final __test = new EnclosedScopeTest(); | 15679 final __test = new EnclosedScopeTest(); |
| 15335 runJUnitTest(__test, __test.test_define_duplicate); | 15680 runJUnitTest(__test, __test.test_define_duplicate); |
| 15336 }); | 15681 }); |
| 15337 _ut.test('test_define_normal', () { | 15682 _ut.test('test_define_normal', () { |
| 15338 final __test = new EnclosedScopeTest(); | 15683 final __test = new EnclosedScopeTest(); |
| 15339 runJUnitTest(__test, __test.test_define_normal); | 15684 runJUnitTest(__test, __test.test_define_normal); |
| 15340 }); | 15685 }); |
| 15341 }); | 15686 }); |
| 15342 } | 15687 } |
| 15343 } | 15688 } |
| 15344 class Scope_18 extends Scope { | 15689 class Scope_19 extends Scope { |
| 15345 LibraryElement definingLibrary2; | 15690 LibraryElement definingLibrary2; |
| 15346 GatheringErrorListener errorListener2; | 15691 GatheringErrorListener errorListener2; |
| 15347 Scope_18(this.definingLibrary2, this.errorListener2) : super(); | 15692 Scope_19(this.definingLibrary2, this.errorListener2) : super(); |
| 15348 LibraryElement get definingLibrary => definingLibrary2; | 15693 LibraryElement get definingLibrary => definingLibrary2; |
| 15349 AnalysisErrorListener get errorListener => errorListener2; | 15694 AnalysisErrorListener get errorListener => errorListener2; |
| 15350 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 15695 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 15351 } | 15696 } |
| 15352 class Scope_19 extends Scope { | 15697 class Scope_20 extends Scope { |
| 15353 LibraryElement definingLibrary3; | 15698 LibraryElement definingLibrary3; |
| 15354 GatheringErrorListener errorListener3; | 15699 GatheringErrorListener errorListener3; |
| 15355 Scope_19(this.definingLibrary3, this.errorListener3) : super(); | 15700 Scope_20(this.definingLibrary3, this.errorListener3) : super(); |
| 15356 LibraryElement get definingLibrary => definingLibrary3; | 15701 LibraryElement get definingLibrary => definingLibrary3; |
| 15357 AnalysisErrorListener get errorListener => errorListener3; | 15702 AnalysisErrorListener get errorListener => errorListener3; |
| 15358 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 15703 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 15359 } | 15704 } |
| 15360 class LibraryElementBuilderTest extends EngineTestCase { | 15705 class LibraryElementBuilderTest extends EngineTestCase { |
| 15361 | 15706 |
| 15362 /** | 15707 /** |
| 15363 * The source factory used to create [Source]. | 15708 * The source factory used to create [Source]. |
| 15364 */ | 15709 */ |
| 15365 SourceFactory _sourceFactory; | 15710 SourceFactory _sourceFactory; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15560 GatheringErrorListener errorListener = new GatheringErrorListener(); | 15905 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 15561 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi
stener); | 15906 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi
stener); |
| 15562 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 15907 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 15563 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); | 15908 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 15564 scope.define(element1); | 15909 scope.define(element1); |
| 15565 scope.define(element2); | 15910 scope.define(element2); |
| 15566 errorListener.assertNoErrors(); | 15911 errorListener.assertNoErrors(); |
| 15567 } | 15912 } |
| 15568 void test_getDefiningLibrary() { | 15913 void test_getDefiningLibrary() { |
| 15569 LibraryElement definingLibrary = createTestLibrary(); | 15914 LibraryElement definingLibrary = createTestLibrary(); |
| 15570 Scope scope = new ScopeTest_TestScope(definingLibrary, null); | 15915 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, null); |
| 15571 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); | 15916 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary); |
| 15572 } | 15917 } |
| 15573 void test_getErrorListener() { | 15918 void test_getErrorListener() { |
| 15574 LibraryElement definingLibrary = new LibraryElementImpl(new AnalysisContextI
mpl(), ASTFactory.libraryIdentifier2(["test"])); | 15919 LibraryElement definingLibrary = new LibraryElementImpl(new AnalysisContextI
mpl(), ASTFactory.libraryIdentifier2(["test"])); |
| 15575 GatheringErrorListener errorListener = new GatheringErrorListener(); | 15920 GatheringErrorListener errorListener = new GatheringErrorListener(); |
| 15576 Scope scope = new ScopeTest_TestScope(definingLibrary, errorListener); | 15921 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi
stener); |
| 15577 JUnitTestCase.assertEquals(errorListener, scope.errorListener); | 15922 JUnitTestCase.assertEquals(errorListener, scope.errorListener); |
| 15578 } | 15923 } |
| 15579 void test_isPrivateName_nonPrivate() { | 15924 void test_isPrivateName_nonPrivate() { |
| 15580 JUnitTestCase.assertFalse(Scope.isPrivateName("Public")); | 15925 JUnitTestCase.assertFalse(Scope.isPrivateName("Public")); |
| 15581 } | 15926 } |
| 15582 void test_isPrivateName_private() { | 15927 void test_isPrivateName_private() { |
| 15583 JUnitTestCase.assertTrue(Scope.isPrivateName("_Private")); | 15928 JUnitTestCase.assertTrue(Scope.isPrivateName("_Private")); |
| 15584 } | 15929 } |
| 15585 static dartSuite() { | 15930 static dartSuite() { |
| 15586 _ut.group('ScopeTest', () { | 15931 _ut.group('ScopeTest', () { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15871 CompilationUnitElement unit = library.definingCompilationUnit; | 16216 CompilationUnitElement unit = library.definingCompilationUnit; |
| 15872 JUnitTestCase.assertNotNull(unit); | 16217 JUnitTestCase.assertNotNull(unit); |
| 15873 List<ClassElement> classes = unit.types; | 16218 List<ClassElement> classes = unit.types; |
| 15874 EngineTestCase.assertLength(2, classes); | 16219 EngineTestCase.assertLength(2, classes); |
| 15875 JUnitTestCase.assertFalse(classes[0].hasReferenceToSuper()); | 16220 JUnitTestCase.assertFalse(classes[0].hasReferenceToSuper()); |
| 15876 JUnitTestCase.assertTrue(classes[1].hasReferenceToSuper()); | 16221 JUnitTestCase.assertTrue(classes[1].hasReferenceToSuper()); |
| 15877 assertNoErrors(); | 16222 assertNoErrors(); |
| 15878 verify([source]); | 16223 verify([source]); |
| 15879 } | 16224 } |
| 15880 void test_import_hide() { | 16225 void test_import_hide() { |
| 15881 addSource2("lib1.dart", EngineTestCase.createSource(["library lib1;", "set f
oo(value) {}"])); | 16226 addSource2("lib1.dart", EngineTestCase.createSource(["library lib1;", "set f
oo(value) {}", "class A {}"])); |
| 15882 addSource2("lib2.dart", EngineTestCase.createSource(["library lib2;", "set f
oo(value) {}"])); | 16227 addSource2("lib2.dart", EngineTestCase.createSource(["library lib2;", "set f
oo(value) {}"])); |
| 15883 Source source = addSource2("lib3.dart", EngineTestCase.createSource([ | 16228 Source source = addSource2("lib3.dart", EngineTestCase.createSource([ |
| 15884 "import 'lib1.dart' hide foo;", | 16229 "import 'lib1.dart' hide foo;", |
| 15885 "import 'lib2.dart';", | 16230 "import 'lib2.dart';", |
| 15886 "", | 16231 "", |
| 15887 "main() {", | 16232 "main() {", |
| 15888 " foo = 0;", | 16233 " foo = 0;", |
| 15889 "}"])); | 16234 "}", |
| 16235 "A a;"])); |
| 15890 resolve(source); | 16236 resolve(source); |
| 15891 assertNoErrors(); | 16237 assertNoErrors(); |
| 15892 verify([source]); | 16238 verify([source]); |
| 15893 } | 16239 } |
| 15894 void test_import_prefix() { | 16240 void test_import_prefix() { |
| 15895 addSource2("/two.dart", EngineTestCase.createSource(["library two;", "f(int
x) {", " return x * x;", "}"])); | 16241 addSource2("/two.dart", EngineTestCase.createSource(["library two;", "f(int
x) {", " return x * x;", "}"])); |
| 15896 Source source = addSource2("/one.dart", EngineTestCase.createSource([ | 16242 Source source = addSource2("/one.dart", EngineTestCase.createSource([ |
| 15897 "library one;", | 16243 "library one;", |
| 15898 "import 'two.dart' as _two;", | 16244 "import 'two.dart' as _two;", |
| 15899 "main() {", | 16245 "main() {", |
| 15900 " _two.f(0);", | 16246 " _two.f(0);", |
| 15901 "}"])); | 16247 "}"])); |
| 15902 resolve(source); | 16248 resolve(source); |
| 15903 assertNoErrors(); | 16249 assertNoErrors(); |
| 15904 verify([source]); | 16250 verify([source]); |
| 15905 } | 16251 } |
| 16252 void test_import_spaceInUri() { |
| 16253 addSource2("sub folder/lib.dart", EngineTestCase.createSource(["library lib;
", "foo() {}"])); |
| 16254 Source source = addSource2("app.dart", EngineTestCase.createSource([ |
| 16255 "import 'sub folder/lib.dart';", |
| 16256 "", |
| 16257 "main() {", |
| 16258 " foo();", |
| 16259 "}"])); |
| 16260 resolve(source); |
| 16261 assertNoErrors(); |
| 16262 verify([source]); |
| 16263 } |
| 15906 void test_indexExpression_typeParameters() { | 16264 void test_indexExpression_typeParameters() { |
| 15907 Source source = addSource(EngineTestCase.createSource([ | 16265 Source source = addSource(EngineTestCase.createSource([ |
| 15908 "f() {", | 16266 "f() {", |
| 15909 " List<int> a;", | 16267 " List<int> a;", |
| 15910 " a[0];", | 16268 " a[0];", |
| 15911 " List<List<int>> b;", | 16269 " List<List<int>> b;", |
| 15912 " b[0][0];", | 16270 " b[0][0];", |
| 15913 " List<List<List<int>>> c;", | 16271 " List<List<List<int>>> c;", |
| 15914 " c[0][0][0];", | 16272 " c[0][0][0];", |
| 15915 "}"])); | 16273 "}"])); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16306 runJUnitTest(__test, __test.test_hasReferenceToSuper); | 16664 runJUnitTest(__test, __test.test_hasReferenceToSuper); |
| 16307 }); | 16665 }); |
| 16308 _ut.test('test_import_hide', () { | 16666 _ut.test('test_import_hide', () { |
| 16309 final __test = new SimpleResolverTest(); | 16667 final __test = new SimpleResolverTest(); |
| 16310 runJUnitTest(__test, __test.test_import_hide); | 16668 runJUnitTest(__test, __test.test_import_hide); |
| 16311 }); | 16669 }); |
| 16312 _ut.test('test_import_prefix', () { | 16670 _ut.test('test_import_prefix', () { |
| 16313 final __test = new SimpleResolverTest(); | 16671 final __test = new SimpleResolverTest(); |
| 16314 runJUnitTest(__test, __test.test_import_prefix); | 16672 runJUnitTest(__test, __test.test_import_prefix); |
| 16315 }); | 16673 }); |
| 16674 _ut.test('test_import_spaceInUri', () { |
| 16675 final __test = new SimpleResolverTest(); |
| 16676 runJUnitTest(__test, __test.test_import_spaceInUri); |
| 16677 }); |
| 16316 _ut.test('test_indexExpression_typeParameters', () { | 16678 _ut.test('test_indexExpression_typeParameters', () { |
| 16317 final __test = new SimpleResolverTest(); | 16679 final __test = new SimpleResolverTest(); |
| 16318 runJUnitTest(__test, __test.test_indexExpression_typeParameters); | 16680 runJUnitTest(__test, __test.test_indexExpression_typeParameters); |
| 16319 }); | 16681 }); |
| 16320 _ut.test('test_indexExpression_typeParameters_invalidAssignmentWarning', (
) { | 16682 _ut.test('test_indexExpression_typeParameters_invalidAssignmentWarning', (
) { |
| 16321 final __test = new SimpleResolverTest(); | 16683 final __test = new SimpleResolverTest(); |
| 16322 runJUnitTest(__test, __test.test_indexExpression_typeParameters_invalidA
ssignmentWarning); | 16684 runJUnitTest(__test, __test.test_indexExpression_typeParameters_invalidA
ssignmentWarning); |
| 16323 }); | 16685 }); |
| 16324 _ut.test('test_indirectOperatorThroughCall', () { | 16686 _ut.test('test_indirectOperatorThroughCall', () { |
| 16325 final __test = new SimpleResolverTest(); | 16687 final __test = new SimpleResolverTest(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16390 runJUnitTest(__test, __test.test_setter_inherited); | 16752 runJUnitTest(__test, __test.test_setter_inherited); |
| 16391 }); | 16753 }); |
| 16392 _ut.test('test_setter_static', () { | 16754 _ut.test('test_setter_static', () { |
| 16393 final __test = new SimpleResolverTest(); | 16755 final __test = new SimpleResolverTest(); |
| 16394 runJUnitTest(__test, __test.test_setter_static); | 16756 runJUnitTest(__test, __test.test_setter_static); |
| 16395 }); | 16757 }); |
| 16396 }); | 16758 }); |
| 16397 } | 16759 } |
| 16398 } | 16760 } |
| 16399 main() { | 16761 main() { |
| 16400 // ElementResolverTest.dartSuite(); | 16762 ElementResolverTest.dartSuite(); |
| 16401 // InheritanceManagerTest.dartSuite(); | 16763 InheritanceManagerTest.dartSuite(); |
| 16402 // LibraryElementBuilderTest.dartSuite(); | 16764 LibraryElementBuilderTest.dartSuite(); |
| 16403 // LibraryTest.dartSuite(); | 16765 LibraryTest.dartSuite(); |
| 16404 // StaticTypeAnalyzerTest.dartSuite(); | 16766 StaticTypeAnalyzerTest.dartSuite(); |
| 16405 // TypeOverrideManagerTest.dartSuite(); | 16767 TypeOverrideManagerTest.dartSuite(); |
| 16406 // TypeProviderImplTest.dartSuite(); | 16768 TypeProviderImplTest.dartSuite(); |
| 16407 // TypeResolverVisitorTest.dartSuite(); | 16769 TypeResolverVisitorTest.dartSuite(); |
| 16408 // EnclosedScopeTest.dartSuite(); | 16770 EnclosedScopeTest.dartSuite(); |
| 16409 // LibraryImportScopeTest.dartSuite(); | 16771 LibraryImportScopeTest.dartSuite(); |
| 16410 // LibraryScopeTest.dartSuite(); | 16772 LibraryScopeTest.dartSuite(); |
| 16411 // ScopeTest.dartSuite(); | 16773 ScopeTest.dartSuite(); |
| 16412 // CompileTimeErrorCodeTest.dartSuite(); | 16774 CompileTimeErrorCodeTest.dartSuite(); |
| 16413 // ErrorResolverTest.dartSuite(); | 16775 ErrorResolverTest.dartSuite(); |
| 16414 // HintCodeTest.dartSuite(); | 16776 HintCodeTest.dartSuite(); |
| 16415 // NonHintCodeTest.dartSuite(); | 16777 NonHintCodeTest.dartSuite(); |
| 16416 // NonErrorResolverTest.dartSuite(); | 16778 NonErrorResolverTest.dartSuite(); |
| 16417 // SimpleResolverTest.dartSuite(); | 16779 SimpleResolverTest.dartSuite(); |
| 16418 // StaticTypeWarningCodeTest.dartSuite(); | 16780 StaticTypeWarningCodeTest.dartSuite(); |
| 16419 // StaticWarningCodeTest.dartSuite(); | 16781 StaticWarningCodeTest.dartSuite(); |
| 16420 // StrictModeTest.dartSuite(); | 16782 StrictModeTest.dartSuite(); |
| 16421 // TypePropagationTest.dartSuite(); | 16783 TypePropagationTest.dartSuite(); |
| 16422 } | 16784 } |
| OLD | NEW |