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

Side by Side Diff: dart/pkg/analyzer/test/generated/resolver_test.dart

Issue 56933002: Version 0.8.10.1 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 'package:analyzer/src/generated/java_core.dart'; 4 import 'package:analyzer/src/generated/java_core.dart';
5 import 'package:analyzer/src/generated/java_junit.dart'; 5 import 'package:analyzer/src/generated/java_junit.dart';
6 import 'package:analyzer/src/generated/source_io.dart'; 6 import 'package:analyzer/src/generated/source_io.dart';
7 import 'package:analyzer/src/generated/error.dart'; 7 import 'package:analyzer/src/generated/error.dart';
8 import 'package:analyzer/src/generated/scanner.dart'; 8 import 'package:analyzer/src/generated/scanner.dart';
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
11 import 'package:analyzer/src/generated/element.dart'; 11 import 'package:analyzer/src/generated/element.dart';
12 import 'package:analyzer/src/generated/resolver.dart'; 12 import 'package:analyzer/src/generated/resolver.dart';
13 import 'package:analyzer/src/generated/engine.dart'; 13 import 'package:analyzer/src/generated/engine.dart';
14 import 'package:analyzer/src/generated/java_engine_io.dart'; 14 import 'package:analyzer/src/generated/java_engine_io.dart';
15 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; 15 import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
16 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; 16 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk;
17 import 'package:unittest/unittest.dart' as _ut; 17 import 'package:unittest/unittest.dart' as _ut;
18 import 'test_support.dart'; 18 import 'test_support.dart';
19 import 'ast_test.dart' show ASTFactory; 19 import 'ast_test.dart' show ASTFactory;
20 import 'element_test.dart' show ElementFactory; 20 import 'element_test.dart' show ElementFactory;
21 class TypePropagationTest extends ResolverTestCase { 21 class TypePropagationTest extends ResolverTestCase {
22 void fail_functionExpression_asInvocationArgument_functionExpressionInvocation () {
23 String code = EngineTestCase.createSource([
24 "main() {",
25 " (f(String value)) {} ((v) {",
26 " v;",
27 " });",
28 "}"]);
29 Source source = addSource(code);
30 LibraryElement library = resolve(source);
31 assertNoErrors(source);
32 verify([source]);
33 CompilationUnit unit = resolveCompilationUnit(source, library);
34 Type2 dynamicType = typeProvider.dynamicType;
35 Type2 stringType = typeProvider.stringType;
36 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Forma lParameter);
37 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType);
38 JUnitTestCase.assertSame(dynamicType, vParameter.identifier.staticType);
39 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim pleIdentifier);
40 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType);
41 JUnitTestCase.assertSame(dynamicType, vIdentifier.staticType);
42 }
43 void fail_propagatedReturnType_functionExpression() { 22 void fail_propagatedReturnType_functionExpression() {
44 String code = EngineTestCase.createSource(["main() {", " var v = (() {retur n 42;})();", "}"]); 23 String code = EngineTestCase.createSource(["main() {", " var v = (() {retur n 42;})();", "}"]);
45 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT ype); 24 check_propagatedReturnType(code, typeProvider.dynamicType, typeProvider.intT ype);
46 } 25 }
47 void test_as() { 26 void test_as() {
48 Source source = addSource(EngineTestCase.createSource([ 27 Source source = addSource(EngineTestCase.createSource([
49 "class A {", 28 "class A {",
50 " bool get g => true;", 29 " bool get g => true;",
51 "}", 30 "}",
52 "A f(var p) {", 31 "A f(var p) {",
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 assertNoErrors(source); 156 assertNoErrors(source);
178 verify([source]); 157 verify([source]);
179 CompilationUnit unit = resolveCompilationUnit(source, library); 158 CompilationUnit unit = resolveCompilationUnit(source, library);
180 Type2 intType = typeProvider.intType; 159 Type2 intType = typeProvider.intType;
181 FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", Simp leFormalParameter); 160 FormalParameter kParameter = EngineTestCase.findNode(unit, code, "k, ", Simp leFormalParameter);
182 JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType); 161 JUnitTestCase.assertSame(intType, kParameter.identifier.propagatedType);
183 Type2 stringType = typeProvider.stringType; 162 Type2 stringType = typeProvider.stringType;
184 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl eFormalParameter); 163 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Simpl eFormalParameter);
185 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType); 164 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType);
186 } 165 }
166 void test_functionExpression_asInvocationArgument_functionExpressionInvocation () {
167 String code = EngineTestCase.createSource([
168 "main() {",
169 " (f(String value)) {} ((v) {",
170 " v;",
171 " });",
172 "}"]);
173 Source source = addSource(code);
174 LibraryElement library = resolve(source);
175 assertNoErrors(source);
176 verify([source]);
177 CompilationUnit unit = resolveCompilationUnit(source, library);
178 Type2 dynamicType = typeProvider.dynamicType;
179 Type2 stringType = typeProvider.stringType;
180 FormalParameter vParameter = EngineTestCase.findNode(unit, code, "v)", Forma lParameter);
181 JUnitTestCase.assertSame(stringType, vParameter.identifier.propagatedType);
182 JUnitTestCase.assertSame(dynamicType, vParameter.identifier.staticType);
183 SimpleIdentifier vIdentifier = EngineTestCase.findNode(unit, code, "v;", Sim pleIdentifier);
184 JUnitTestCase.assertSame(stringType, vIdentifier.propagatedType);
185 JUnitTestCase.assertSame(dynamicType, vIdentifier.staticType);
186 }
187 void test_functionExpression_asInvocationArgument_keepIfLessSpecific() { 187 void test_functionExpression_asInvocationArgument_keepIfLessSpecific() {
188 String code = EngineTestCase.createSource([ 188 String code = EngineTestCase.createSource([
189 "class MyList {", 189 "class MyList {",
190 " forEach(f(Object value)) {}", 190 " forEach(f(Object value)) {}",
191 "}", 191 "}",
192 "f(MyList list) {", 192 "f(MyList list) {",
193 " list.forEach((int v) {", 193 " list.forEach((int v) {",
194 " v;", 194 " v;",
195 " });", 195 " });",
196 "}"]); 196 "}"]);
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 runJUnitTest(__test, __test.test_forEach); 752 runJUnitTest(__test, __test.test_forEach);
753 }); 753 });
754 _ut.test('test_functionExpression_asInvocationArgument', () { 754 _ut.test('test_functionExpression_asInvocationArgument', () {
755 final __test = new TypePropagationTest(); 755 final __test = new TypePropagationTest();
756 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument ); 756 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument );
757 }); 757 });
758 _ut.test('test_functionExpression_asInvocationArgument_fromInferredInvocat ion', () { 758 _ut.test('test_functionExpression_asInvocationArgument_fromInferredInvocat ion', () {
759 final __test = new TypePropagationTest(); 759 final __test = new TypePropagationTest();
760 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument _fromInferredInvocation); 760 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument _fromInferredInvocation);
761 }); 761 });
762 _ut.test('test_functionExpression_asInvocationArgument_functionExpressionI nvocation', () {
763 final __test = new TypePropagationTest();
764 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument _functionExpressionInvocation);
765 });
762 _ut.test('test_functionExpression_asInvocationArgument_keepIfLessSpecific' , () { 766 _ut.test('test_functionExpression_asInvocationArgument_keepIfLessSpecific' , () {
763 final __test = new TypePropagationTest(); 767 final __test = new TypePropagationTest();
764 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument _keepIfLessSpecific); 768 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument _keepIfLessSpecific);
765 }); 769 });
766 _ut.test('test_functionExpression_asInvocationArgument_replaceIfMoreSpecif ic', () { 770 _ut.test('test_functionExpression_asInvocationArgument_replaceIfMoreSpecif ic', () {
767 final __test = new TypePropagationTest(); 771 final __test = new TypePropagationTest();
768 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument _replaceIfMoreSpecific); 772 runJUnitTest(__test, __test.test_functionExpression_asInvocationArgument _replaceIfMoreSpecific);
769 }); 773 });
770 _ut.test('test_initializer', () { 774 _ut.test('test_initializer', () {
771 final __test = new TypePropagationTest(); 775 final __test = new TypePropagationTest();
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2929 " B(S p) : super(p);", 2933 " B(S p) : super(p);",
2930 " B.named(S p) : super.named(p);", 2934 " B.named(S p) : super.named(p);",
2931 "}"])); 2935 "}"]));
2932 resolve(source); 2936 resolve(source);
2933 assertNoErrors(source); 2937 assertNoErrors(source);
2934 verify([source]); 2938 verify([source]);
2935 } 2939 }
2936 void test_proxy_annotation_prefixed() { 2940 void test_proxy_annotation_prefixed() {
2937 Source source = addSource(EngineTestCase.createSource([ 2941 Source source = addSource(EngineTestCase.createSource([
2938 "library L;", 2942 "library L;",
2943 "import 'meta.dart';",
2939 "@proxy", 2944 "@proxy",
2940 "class A {}", 2945 "class A {}",
2941 "f(A a) {", 2946 "f(A a) {",
2942 " a.m();", 2947 " a.m();",
2943 " var x = a.g;", 2948 " var x = a.g;",
2944 " a.s = 1;", 2949 " a.s = 1;",
2945 " var y = a + a;", 2950 " var y = a + a;",
2946 " a++;", 2951 " a++;",
2947 " ++a;", 2952 " ++a;",
2948 "}"])); 2953 "}"]));
2954 addSource2("/meta.dart", EngineTestCase.createSource([
2955 "library meta;",
2956 "const proxy = const _Proxy();",
2957 "class _Proxy { const _Proxy(); }"]));
2949 resolve(source); 2958 resolve(source);
2950 assertNoErrors(source); 2959 assertNoErrors(source);
2951 } 2960 }
2952 void test_proxy_annotation_prefixed2() { 2961 void test_proxy_annotation_prefixed2() {
2953 Source source = addSource(EngineTestCase.createSource([ 2962 Source source = addSource(EngineTestCase.createSource([
2954 "library L;", 2963 "library L;",
2964 "import 'meta.dart';",
2955 "@proxy", 2965 "@proxy",
2956 "class A {}", 2966 "class A {}",
2957 "class B {", 2967 "class B {",
2958 " f(A a) {", 2968 " f(A a) {",
2959 " a.m();", 2969 " a.m();",
2960 " var x = a.g;", 2970 " var x = a.g;",
2961 " a.s = 1;", 2971 " a.s = 1;",
2962 " var y = a + a;", 2972 " var y = a + a;",
2963 " a++;", 2973 " a++;",
2964 " ++a;", 2974 " ++a;",
2965 " }", 2975 " }",
2966 "}"])); 2976 "}"]));
2977 addSource2("/meta.dart", EngineTestCase.createSource([
2978 "library meta;",
2979 "const proxy = const _Proxy();",
2980 "class _Proxy { const _Proxy(); }"]));
2967 resolve(source); 2981 resolve(source);
2968 assertNoErrors(source); 2982 assertNoErrors(source);
2969 } 2983 }
2970 void test_proxy_annotation_prefixed3() { 2984 void test_proxy_annotation_prefixed3() {
2971 Source source = addSource(EngineTestCase.createSource([ 2985 Source source = addSource(EngineTestCase.createSource([
2972 "library L;", 2986 "library L;",
2987 "import 'meta.dart';",
2973 "class B {", 2988 "class B {",
2974 " f(A a) {", 2989 " f(A a) {",
2975 " a.m();", 2990 " a.m();",
2976 " var x = a.g;", 2991 " var x = a.g;",
2977 " a.s = 1;", 2992 " a.s = 1;",
2978 " var y = a + a;", 2993 " var y = a + a;",
2979 " a++;", 2994 " a++;",
2980 " ++a;", 2995 " ++a;",
2981 " }", 2996 " }",
2982 "}", 2997 "}",
2983 "@proxy", 2998 "@proxy",
2984 "class A {}"])); 2999 "class A {}"]));
3000 addSource2("/meta.dart", EngineTestCase.createSource([
3001 "library meta;",
3002 "const proxy = const _Proxy();",
3003 "class _Proxy { const _Proxy(); }"]));
2985 resolve(source); 3004 resolve(source);
2986 assertNoErrors(source); 3005 assertNoErrors(source);
2987 } 3006 }
2988 void test_proxy_annotation_simple() { 3007 void test_proxy_annotation_simple() {
2989 Source source = addSource(EngineTestCase.createSource([ 3008 Source source = addSource(EngineTestCase.createSource([
2990 "library L;", 3009 "library L;",
3010 "import 'meta.dart';",
2991 "@proxy", 3011 "@proxy",
2992 "class B {", 3012 "class B {",
2993 " m() {", 3013 " m() {",
2994 " n();", 3014 " n();",
2995 " var x = g;", 3015 " var x = g;",
2996 " s = 1;", 3016 " s = 1;",
2997 " var y = this + this;", 3017 " var y = this + this;",
2998 " }", 3018 " }",
2999 "}"])); 3019 "}"]));
3020 addSource2("/meta.dart", EngineTestCase.createSource([
3021 "library meta;",
3022 "const proxy = const _Proxy();",
3023 "class _Proxy { const _Proxy(); }"]));
3000 resolve(source); 3024 resolve(source);
3001 assertNoErrors(source); 3025 assertNoErrors(source);
3002 } 3026 }
3003 void test_recursiveConstructorRedirect() { 3027 void test_recursiveConstructorRedirect() {
3004 Source source = addSource(EngineTestCase.createSource([ 3028 Source source = addSource(EngineTestCase.createSource([
3005 "class A {", 3029 "class A {",
3006 " A.a() : this.b();", 3030 " A.a() : this.b();",
3007 " A.b() : this.c();", 3031 " A.b() : this.c();",
3008 " A.c() {}", 3032 " A.c() {}",
3009 "}"])); 3033 "}"]));
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 resolve(source); 3203 resolve(source);
3180 assertNoErrors(source); 3204 assertNoErrors(source);
3181 verify([source]); 3205 verify([source]);
3182 } 3206 }
3183 void test_returnWithoutValue_void() { 3207 void test_returnWithoutValue_void() {
3184 Source source = addSource(EngineTestCase.createSource(["void f() { return; } "])); 3208 Source source = addSource(EngineTestCase.createSource(["void f() { return; } "]));
3185 resolve(source); 3209 resolve(source);
3186 assertNoErrors(source); 3210 assertNoErrors(source);
3187 verify([source]); 3211 verify([source]);
3188 } 3212 }
3213 void test_reversedTypeArguments() {
3214 Source source = addSource(EngineTestCase.createSource([
3215 "class Codec<S1, T1> {",
3216 " Codec<T1, S1> get inverted => new _InvertedCodec<T1, S1>(this);",
3217 "}",
3218 "class _InvertedCodec<T2, S2> extends Codec<T2, S2> {",
3219 " _InvertedCodec(Codec<S2, T2> codec);",
3220 "}"]));
3221 resolve(source);
3222 assertNoErrors(source);
3223 verify([source]);
3224 }
3189 void test_staticAccessToInstanceMember_annotation() { 3225 void test_staticAccessToInstanceMember_annotation() {
3190 Source source = addSource(EngineTestCase.createSource([ 3226 Source source = addSource(EngineTestCase.createSource([
3191 "class A {", 3227 "class A {",
3192 " const A.name();", 3228 " const A.name();",
3193 "}", 3229 "}",
3194 "@A.name()", 3230 "@A.name()",
3195 "main() {", 3231 "main() {",
3196 "}"])); 3232 "}"]));
3197 resolve(source); 3233 resolve(source);
3198 assertNoErrors(source); 3234 assertNoErrors(source);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3386 " if (p is String) {", 3422 " if (p is String) {",
3387 " callMe(() {", 3423 " callMe(() {",
3388 " p.length;", 3424 " p.length;",
3389 " });", 3425 " });",
3390 " }", 3426 " }",
3391 "}"])); 3427 "}"]));
3392 resolve(source); 3428 resolve(source);
3393 assertNoErrors(source); 3429 assertNoErrors(source);
3394 verify([source]); 3430 verify([source]);
3395 } 3431 }
3432 void test_typePromotion_if_extends_moreSpecific() {
3433 Source source = addSource(EngineTestCase.createSource([
3434 "class V {}",
3435 "class VP extends V {}",
3436 "class A<T> {}",
3437 "class B<S> extends A<S> {",
3438 " var b;",
3439 "}",
3440 "",
3441 "main(A<V> p) {",
3442 " if (p is B<VP>) {",
3443 " p.b;",
3444 " }",
3445 "}"]));
3446 resolve(source);
3447 assertNoErrors(source);
3448 verify([source]);
3449 }
3396 void test_typePromotion_if_hasAssignment_outsideAfter() { 3450 void test_typePromotion_if_hasAssignment_outsideAfter() {
3397 Source source = addSource(EngineTestCase.createSource([ 3451 Source source = addSource(EngineTestCase.createSource([
3398 "main(Object p) {", 3452 "main(Object p) {",
3399 " if (p is String) {", 3453 " if (p is String) {",
3400 " p.length;", 3454 " p.length;",
3401 " }", 3455 " }",
3402 " p = 0;", 3456 " p = 0;",
3403 "}"])); 3457 "}"]));
3404 resolve(source); 3458 resolve(source);
3405 assertNoErrors(source); 3459 assertNoErrors(source);
3406 verify([source]); 3460 verify([source]);
3407 } 3461 }
3408 void test_typePromotion_if_hasAssignment_outsideBefore() { 3462 void test_typePromotion_if_hasAssignment_outsideBefore() {
3409 Source source = addSource(EngineTestCase.createSource([ 3463 Source source = addSource(EngineTestCase.createSource([
3410 "main(Object p, Object p2) {", 3464 "main(Object p, Object p2) {",
3411 " p = p2;", 3465 " p = p2;",
3412 " if (p is String) {", 3466 " if (p is String) {",
3413 " p.length;", 3467 " p.length;",
3414 " }", 3468 " }",
3415 "}"])); 3469 "}"]));
3416 resolve(source); 3470 resolve(source);
3417 assertNoErrors(source); 3471 assertNoErrors(source);
3418 verify([source]); 3472 verify([source]);
3419 } 3473 }
3474 void test_typePromotion_if_implements_moreSpecific() {
3475 Source source = addSource(EngineTestCase.createSource([
3476 "class V {}",
3477 "class VP extends V {}",
3478 "class A<T> {}",
3479 "class B<S> implements A<S> {",
3480 " var b;",
3481 "}",
3482 "",
3483 "main(A<V> p) {",
3484 " if (p is B<VP>) {",
3485 " p.b;",
3486 " }",
3487 "}"]));
3488 resolve(source);
3489 assertNoErrors(source);
3490 verify([source]);
3491 }
3492 void test_typePromotion_if_inClosure_assignedAfter_inSameFunction() {
3493 Source source = addSource(EngineTestCase.createSource([
3494 "main() {",
3495 " f(Object p) {",
3496 " if (p is String) {",
3497 " p.length;",
3498 " }",
3499 " p = 0;",
3500 " };",
3501 "}"]));
3502 resolve(source);
3503 assertNoErrors(source);
3504 verify([source]);
3505 }
3420 void test_typePromotion_if_is_and_left() { 3506 void test_typePromotion_if_is_and_left() {
3421 Source source = addSource(EngineTestCase.createSource([ 3507 Source source = addSource(EngineTestCase.createSource([
3422 "bool tt() => true;", 3508 "bool tt() => true;",
3423 "main(Object p) {", 3509 "main(Object p) {",
3424 " if (p is String && tt()) {", 3510 " if (p is String && tt()) {",
3425 " p.length;", 3511 " p.length;",
3426 " }", 3512 " }",
3427 "}"])); 3513 "}"]));
3428 resolve(source); 3514 resolve(source);
3429 assertNoErrors(source); 3515 assertNoErrors(source);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 Source source = addSource(EngineTestCase.createSource([ 3560 Source source = addSource(EngineTestCase.createSource([
3475 "main(Object p) {", 3561 "main(Object p) {",
3476 " if (p is String) {", 3562 " if (p is String) {",
3477 " p.length;", 3563 " p.length;",
3478 " }", 3564 " }",
3479 "}"])); 3565 "}"]));
3480 resolve(source); 3566 resolve(source);
3481 assertNoErrors(source); 3567 assertNoErrors(source);
3482 verify([source]); 3568 verify([source]);
3483 } 3569 }
3570 void test_typeType_class() {
3571 Source source = addSource(EngineTestCase.createSource(["class C {}", "f(Type t) {}", "main() {", " f(C);", "}"]));
3572 resolve(source);
3573 assertNoErrors(source);
3574 verify([source]);
3575 }
3576 void test_typeType_class_prefixed() {
3577 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class C {}"]));
3578 Source source = addSource(EngineTestCase.createSource([
3579 "import 'lib.dart' as p;",
3580 "f(Type t) {}",
3581 "main() {",
3582 " f(p.C);",
3583 "}"]));
3584 resolve(source);
3585 assertNoErrors(source);
3586 verify([source]);
3587 }
3588 void test_typeType_functionTypeAlias() {
3589 Source source = addSource(EngineTestCase.createSource([
3590 "typedef F();",
3591 "f(Type t) {}",
3592 "main() {",
3593 " f(F);",
3594 "}"]));
3595 resolve(source);
3596 assertNoErrors(source);
3597 verify([source]);
3598 }
3599 void test_typeType_functionTypeAlias_prefixed() {
3600 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "typede f F();"]));
3601 Source source = addSource(EngineTestCase.createSource([
3602 "import 'lib.dart' as p;",
3603 "f(Type t) {}",
3604 "main() {",
3605 " f(p.F);",
3606 "}"]));
3607 resolve(source);
3608 assertNoErrors(source);
3609 verify([source]);
3610 }
3484 void test_undefinedConstructorInInitializer_explicit_named() { 3611 void test_undefinedConstructorInInitializer_explicit_named() {
3485 Source source = addSource(EngineTestCase.createSource([ 3612 Source source = addSource(EngineTestCase.createSource([
3486 "class A {", 3613 "class A {",
3487 " A.named() {}", 3614 " A.named() {}",
3488 "}", 3615 "}",
3489 "class B extends A {", 3616 "class B extends A {",
3490 " B() : super.named();", 3617 " B() : super.named();",
3491 "}"])); 3618 "}"]));
3492 resolve(source); 3619 resolve(source);
3493 assertNoErrors(source); 3620 assertNoErrors(source);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 "}", 3766 "}",
3640 "class B extends A {", 3767 "class B extends A {",
3641 " f() {", 3768 " f() {",
3642 " super.m();", 3769 " super.m();",
3643 " }", 3770 " }",
3644 "}"])); 3771 "}"]));
3645 resolve(source); 3772 resolve(source);
3646 assertNoErrors(source); 3773 assertNoErrors(source);
3647 verify([source]); 3774 verify([source]);
3648 } 3775 }
3776 void test_unqualifiedReferenceToNonLocalStaticMember_fromComment_new() {
3777 Source source = addSource(EngineTestCase.createSource([
3778 "class A {",
3779 " A() {}",
3780 " A.named() {}",
3781 "}",
3782 "/// [new A] or [new A.named]",
3783 "main() {",
3784 "}"]));
3785 resolve(source);
3786 assertNoErrors(source);
3787 verify([source]);
3788 }
3649 void test_wrongNumberOfParametersForOperator_index() { 3789 void test_wrongNumberOfParametersForOperator_index() {
3650 Source source = addSource(EngineTestCase.createSource(["class A {", " opera tor []=(a, b) {}", "}"])); 3790 Source source = addSource(EngineTestCase.createSource(["class A {", " opera tor []=(a, b) {}", "}"]));
3651 resolve(source); 3791 resolve(source);
3652 assertNoErrors(source); 3792 assertNoErrors(source);
3653 verify([source]); 3793 verify([source]);
3654 } 3794 }
3655 void test_wrongNumberOfParametersForOperator_minus() { 3795 void test_wrongNumberOfParametersForOperator_minus() {
3656 check_wrongNumberOfParametersForOperator("-", ""); 3796 check_wrongNumberOfParametersForOperator("-", "");
3657 check_wrongNumberOfParametersForOperator("-", "a"); 3797 check_wrongNumberOfParametersForOperator("-", "a");
3658 } 3798 }
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
4584 runJUnitTest(__test, __test.test_returnOfInvalidType_void); 4724 runJUnitTest(__test, __test.test_returnOfInvalidType_void);
4585 }); 4725 });
4586 _ut.test('test_returnWithoutValue_noReturnType', () { 4726 _ut.test('test_returnWithoutValue_noReturnType', () {
4587 final __test = new NonErrorResolverTest(); 4727 final __test = new NonErrorResolverTest();
4588 runJUnitTest(__test, __test.test_returnWithoutValue_noReturnType); 4728 runJUnitTest(__test, __test.test_returnWithoutValue_noReturnType);
4589 }); 4729 });
4590 _ut.test('test_returnWithoutValue_void', () { 4730 _ut.test('test_returnWithoutValue_void', () {
4591 final __test = new NonErrorResolverTest(); 4731 final __test = new NonErrorResolverTest();
4592 runJUnitTest(__test, __test.test_returnWithoutValue_void); 4732 runJUnitTest(__test, __test.test_returnWithoutValue_void);
4593 }); 4733 });
4734 _ut.test('test_reversedTypeArguments', () {
4735 final __test = new NonErrorResolverTest();
4736 runJUnitTest(__test, __test.test_reversedTypeArguments);
4737 });
4594 _ut.test('test_staticAccessToInstanceMember_annotation', () { 4738 _ut.test('test_staticAccessToInstanceMember_annotation', () {
4595 final __test = new NonErrorResolverTest(); 4739 final __test = new NonErrorResolverTest();
4596 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_annotation ); 4740 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_annotation );
4597 }); 4741 });
4598 _ut.test('test_staticAccessToInstanceMember_method', () { 4742 _ut.test('test_staticAccessToInstanceMember_method', () {
4599 final __test = new NonErrorResolverTest(); 4743 final __test = new NonErrorResolverTest();
4600 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_method); 4744 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_method);
4601 }); 4745 });
4602 _ut.test('test_staticAccessToInstanceMember_propertyAccess_field', () { 4746 _ut.test('test_staticAccessToInstanceMember_propertyAccess_field', () {
4603 final __test = new NonErrorResolverTest(); 4747 final __test = new NonErrorResolverTest();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
4660 runJUnitTest(__test, __test.test_typePromotion_functionType_return_ignor eIfNotMoreSpecific); 4804 runJUnitTest(__test, __test.test_typePromotion_functionType_return_ignor eIfNotMoreSpecific);
4661 }); 4805 });
4662 _ut.test('test_typePromotion_functionType_return_voidToDynamic', () { 4806 _ut.test('test_typePromotion_functionType_return_voidToDynamic', () {
4663 final __test = new NonErrorResolverTest(); 4807 final __test = new NonErrorResolverTest();
4664 runJUnitTest(__test, __test.test_typePromotion_functionType_return_voidT oDynamic); 4808 runJUnitTest(__test, __test.test_typePromotion_functionType_return_voidT oDynamic);
4665 }); 4809 });
4666 _ut.test('test_typePromotion_if_accessedInClosure_noAssignment', () { 4810 _ut.test('test_typePromotion_if_accessedInClosure_noAssignment', () {
4667 final __test = new NonErrorResolverTest(); 4811 final __test = new NonErrorResolverTest();
4668 runJUnitTest(__test, __test.test_typePromotion_if_accessedInClosure_noAs signment); 4812 runJUnitTest(__test, __test.test_typePromotion_if_accessedInClosure_noAs signment);
4669 }); 4813 });
4814 _ut.test('test_typePromotion_if_extends_moreSpecific', () {
4815 final __test = new NonErrorResolverTest();
4816 runJUnitTest(__test, __test.test_typePromotion_if_extends_moreSpecific);
4817 });
4670 _ut.test('test_typePromotion_if_hasAssignment_outsideAfter', () { 4818 _ut.test('test_typePromotion_if_hasAssignment_outsideAfter', () {
4671 final __test = new NonErrorResolverTest(); 4819 final __test = new NonErrorResolverTest();
4672 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_outsideA fter); 4820 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_outsideA fter);
4673 }); 4821 });
4674 _ut.test('test_typePromotion_if_hasAssignment_outsideBefore', () { 4822 _ut.test('test_typePromotion_if_hasAssignment_outsideBefore', () {
4675 final __test = new NonErrorResolverTest(); 4823 final __test = new NonErrorResolverTest();
4676 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_outsideB efore); 4824 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_outsideB efore);
4677 }); 4825 });
4826 _ut.test('test_typePromotion_if_implements_moreSpecific', () {
4827 final __test = new NonErrorResolverTest();
4828 runJUnitTest(__test, __test.test_typePromotion_if_implements_moreSpecifi c);
4829 });
4830 _ut.test('test_typePromotion_if_inClosure_assignedAfter_inSameFunction', ( ) {
4831 final __test = new NonErrorResolverTest();
4832 runJUnitTest(__test, __test.test_typePromotion_if_inClosure_assignedAfte r_inSameFunction);
4833 });
4678 _ut.test('test_typePromotion_if_is_and_left', () { 4834 _ut.test('test_typePromotion_if_is_and_left', () {
4679 final __test = new NonErrorResolverTest(); 4835 final __test = new NonErrorResolverTest();
4680 runJUnitTest(__test, __test.test_typePromotion_if_is_and_left); 4836 runJUnitTest(__test, __test.test_typePromotion_if_is_and_left);
4681 }); 4837 });
4682 _ut.test('test_typePromotion_if_is_and_right', () { 4838 _ut.test('test_typePromotion_if_is_and_right', () {
4683 final __test = new NonErrorResolverTest(); 4839 final __test = new NonErrorResolverTest();
4684 runJUnitTest(__test, __test.test_typePromotion_if_is_and_right); 4840 runJUnitTest(__test, __test.test_typePromotion_if_is_and_right);
4685 }); 4841 });
4686 _ut.test('test_typePromotion_if_is_and_subThenSuper', () { 4842 _ut.test('test_typePromotion_if_is_and_subThenSuper', () {
4687 final __test = new NonErrorResolverTest(); 4843 final __test = new NonErrorResolverTest();
4688 runJUnitTest(__test, __test.test_typePromotion_if_is_and_subThenSuper); 4844 runJUnitTest(__test, __test.test_typePromotion_if_is_and_subThenSuper);
4689 }); 4845 });
4690 _ut.test('test_typePromotion_if_is_parenthesized', () { 4846 _ut.test('test_typePromotion_if_is_parenthesized', () {
4691 final __test = new NonErrorResolverTest(); 4847 final __test = new NonErrorResolverTest();
4692 runJUnitTest(__test, __test.test_typePromotion_if_is_parenthesized); 4848 runJUnitTest(__test, __test.test_typePromotion_if_is_parenthesized);
4693 }); 4849 });
4694 _ut.test('test_typePromotion_if_is_single', () { 4850 _ut.test('test_typePromotion_if_is_single', () {
4695 final __test = new NonErrorResolverTest(); 4851 final __test = new NonErrorResolverTest();
4696 runJUnitTest(__test, __test.test_typePromotion_if_is_single); 4852 runJUnitTest(__test, __test.test_typePromotion_if_is_single);
4697 }); 4853 });
4854 _ut.test('test_typeType_class', () {
4855 final __test = new NonErrorResolverTest();
4856 runJUnitTest(__test, __test.test_typeType_class);
4857 });
4858 _ut.test('test_typeType_class_prefixed', () {
4859 final __test = new NonErrorResolverTest();
4860 runJUnitTest(__test, __test.test_typeType_class_prefixed);
4861 });
4862 _ut.test('test_typeType_functionTypeAlias', () {
4863 final __test = new NonErrorResolverTest();
4864 runJUnitTest(__test, __test.test_typeType_functionTypeAlias);
4865 });
4866 _ut.test('test_typeType_functionTypeAlias_prefixed', () {
4867 final __test = new NonErrorResolverTest();
4868 runJUnitTest(__test, __test.test_typeType_functionTypeAlias_prefixed);
4869 });
4698 _ut.test('test_undefinedConstructorInInitializer_explicit_named', () { 4870 _ut.test('test_undefinedConstructorInInitializer_explicit_named', () {
4699 final __test = new NonErrorResolverTest(); 4871 final __test = new NonErrorResolverTest();
4700 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli cit_named); 4872 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli cit_named);
4701 }); 4873 });
4702 _ut.test('test_undefinedConstructorInInitializer_explicit_unnamed', () { 4874 _ut.test('test_undefinedConstructorInInitializer_explicit_unnamed', () {
4703 final __test = new NonErrorResolverTest(); 4875 final __test = new NonErrorResolverTest();
4704 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli cit_unnamed); 4876 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli cit_unnamed);
4705 }); 4877 });
4706 _ut.test('test_undefinedConstructorInInitializer_hasOptionalParameters', ( ) { 4878 _ut.test('test_undefinedConstructorInInitializer_hasOptionalParameters', ( ) {
4707 final __test = new NonErrorResolverTest(); 4879 final __test = new NonErrorResolverTest();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4752 runJUnitTest(__test, __test.test_undefinedSetter_importWithPrefix); 4924 runJUnitTest(__test, __test.test_undefinedSetter_importWithPrefix);
4753 }); 4925 });
4754 _ut.test('test_undefinedSuperMethod_field', () { 4926 _ut.test('test_undefinedSuperMethod_field', () {
4755 final __test = new NonErrorResolverTest(); 4927 final __test = new NonErrorResolverTest();
4756 runJUnitTest(__test, __test.test_undefinedSuperMethod_field); 4928 runJUnitTest(__test, __test.test_undefinedSuperMethod_field);
4757 }); 4929 });
4758 _ut.test('test_undefinedSuperMethod_method', () { 4930 _ut.test('test_undefinedSuperMethod_method', () {
4759 final __test = new NonErrorResolverTest(); 4931 final __test = new NonErrorResolverTest();
4760 runJUnitTest(__test, __test.test_undefinedSuperMethod_method); 4932 runJUnitTest(__test, __test.test_undefinedSuperMethod_method);
4761 }); 4933 });
4934 _ut.test('test_unqualifiedReferenceToNonLocalStaticMember_fromComment_new' , () {
4935 final __test = new NonErrorResolverTest();
4936 runJUnitTest(__test, __test.test_unqualifiedReferenceToNonLocalStaticMem ber_fromComment_new);
4937 });
4762 _ut.test('test_wrongNumberOfParametersForOperator1', () { 4938 _ut.test('test_wrongNumberOfParametersForOperator1', () {
4763 final __test = new NonErrorResolverTest(); 4939 final __test = new NonErrorResolverTest();
4764 runJUnitTest(__test, __test.test_wrongNumberOfParametersForOperator1); 4940 runJUnitTest(__test, __test.test_wrongNumberOfParametersForOperator1);
4765 }); 4941 });
4766 _ut.test('test_wrongNumberOfParametersForOperator_index', () { 4942 _ut.test('test_wrongNumberOfParametersForOperator_index', () {
4767 final __test = new NonErrorResolverTest(); 4943 final __test = new NonErrorResolverTest();
4768 runJUnitTest(__test, __test.test_wrongNumberOfParametersForOperator_inde x); 4944 runJUnitTest(__test, __test.test_wrongNumberOfParametersForOperator_inde x);
4769 }); 4945 });
4770 _ut.test('test_wrongNumberOfParametersForOperator_minus', () { 4946 _ut.test('test_wrongNumberOfParametersForOperator_minus', () {
4771 final __test = new NonErrorResolverTest(); 4947 final __test = new NonErrorResolverTest();
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
5543 void test_typePromotion_if_and_right_hasAssignment() { 5719 void test_typePromotion_if_and_right_hasAssignment() {
5544 Source source = addSource(EngineTestCase.createSource([ 5720 Source source = addSource(EngineTestCase.createSource([
5545 "main(Object p) {", 5721 "main(Object p) {",
5546 " if (p is String && (p = null) == null) {", 5722 " if (p is String && (p = null) == null) {",
5547 " p.length;", 5723 " p.length;",
5548 " }", 5724 " }",
5549 "}"])); 5725 "}"]));
5550 resolve(source); 5726 resolve(source);
5551 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); 5727 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5552 } 5728 }
5729 void test_typePromotion_if_extends_notMoreSpecific_dynamic() {
5730 Source source = addSource(EngineTestCase.createSource([
5731 "class V {}",
5732 "class A<T> {}",
5733 "class B<S> extends A<S> {",
5734 " var b;",
5735 "}",
5736 "",
5737 "main(A<V> p) {",
5738 " if (p is B) {",
5739 " p.b;",
5740 " }",
5741 "}"]));
5742 resolve(source);
5743 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5744 }
5745 void test_typePromotion_if_extends_notMoreSpecific_notMoreSpecificTypeArg() {
5746 Source source = addSource(EngineTestCase.createSource([
5747 "class V {}",
5748 "class A<T> {}",
5749 "class B<S> extends A<S> {",
5750 " var b;",
5751 "}",
5752 "",
5753 "main(A<V> p) {",
5754 " if (p is B<int>) {",
5755 " p.b;",
5756 " }",
5757 "}"]));
5758 resolve(source);
5759 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5760 }
5553 void test_typePromotion_if_hasAssignment_after() { 5761 void test_typePromotion_if_hasAssignment_after() {
5554 Source source = addSource(EngineTestCase.createSource([ 5762 Source source = addSource(EngineTestCase.createSource([
5555 "main(Object p) {", 5763 "main(Object p) {",
5556 " if (p is String) {", 5764 " if (p is String) {",
5557 " p.length;", 5765 " p.length;",
5558 " p = 0;", 5766 " p = 0;",
5559 " }", 5767 " }",
5560 "}"])); 5768 "}"]));
5561 resolve(source); 5769 resolve(source);
5562 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); 5770 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5563 } 5771 }
5564 void test_typePromotion_if_hasAssignment_before() { 5772 void test_typePromotion_if_hasAssignment_before() {
5565 Source source = addSource(EngineTestCase.createSource([ 5773 Source source = addSource(EngineTestCase.createSource([
5566 "main(Object p) {", 5774 "main(Object p) {",
5567 " if (p is String) {", 5775 " if (p is String) {",
5568 " p = 0;", 5776 " p = 0;",
5569 " p.length;", 5777 " p.length;",
5570 " }", 5778 " }",
5571 "}"])); 5779 "}"]));
5572 resolve(source); 5780 resolve(source);
5573 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); 5781 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5574 } 5782 }
5783 void test_typePromotion_if_hasAssignment_inClosure_anonymous_after() {
5784 Source source = addSource(EngineTestCase.createSource([
5785 "main(Object p) {",
5786 " if (p is String) {",
5787 " p.length;",
5788 " }",
5789 " () {p = 0;};",
5790 "}"]));
5791 resolve(source);
5792 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5793 }
5794 void test_typePromotion_if_hasAssignment_inClosure_anonymous_before() {
5795 Source source = addSource(EngineTestCase.createSource([
5796 "main(Object p) {",
5797 " () {p = 0;};",
5798 " if (p is String) {",
5799 " p.length;",
5800 " }",
5801 "}"]));
5802 resolve(source);
5803 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5804 }
5805 void test_typePromotion_if_hasAssignment_inClosure_function_after() {
5806 Source source = addSource(EngineTestCase.createSource([
5807 "main(Object p) {",
5808 " if (p is String) {",
5809 " p.length;",
5810 " }",
5811 " f() {p = 0;};",
5812 "}"]));
5813 resolve(source);
5814 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5815 }
5816 void test_typePromotion_if_hasAssignment_inClosure_function_before() {
5817 Source source = addSource(EngineTestCase.createSource([
5818 "main(Object p) {",
5819 " f() {p = 0;};",
5820 " if (p is String) {",
5821 " p.length;",
5822 " }",
5823 "}"]));
5824 resolve(source);
5825 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5826 }
5827 void test_typePromotion_if_implements_notMoreSpecific_dynamic() {
5828 Source source = addSource(EngineTestCase.createSource([
5829 "class V {}",
5830 "class A<T> {}",
5831 "class B<S> implements A<S> {",
5832 " var b;",
5833 "}",
5834 "",
5835 "main(A<V> p) {",
5836 " if (p is B) {",
5837 " p.b;",
5838 " }",
5839 "}"]));
5840 resolve(source);
5841 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5842 }
5843 void test_typePromotion_if_with_notMoreSpecific_dynamic() {
5844 Source source = addSource(EngineTestCase.createSource([
5845 "class V {}",
5846 "class A<T> {}",
5847 "class B<S> extends Object with A<S> {",
5848 " var b;",
5849 "}",
5850 "",
5851 "main(A<V> p) {",
5852 " if (p is B) {",
5853 " p.b;",
5854 " }",
5855 "}"]));
5856 resolve(source);
5857 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5858 }
5575 void test_undefinedGetter() { 5859 void test_undefinedGetter() {
5576 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e) { return e.m; }"])); 5860 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e) { return e.m; }"]));
5577 resolve(source); 5861 resolve(source);
5578 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); 5862 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5579 } 5863 }
5580 void test_undefinedGetter_static() { 5864 void test_undefinedGetter_static() {
5581 Source source = addSource(EngineTestCase.createSource(["class A {}", "var a = A.B;"])); 5865 Source source = addSource(EngineTestCase.createSource(["class A {}", "var a = A.B;"]));
5582 resolve(source); 5866 resolve(source);
5583 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); 5867 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
5584 } 5868 }
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
6026 runJUnitTest(__test, __test.test_typePromotion_conditional_useInThen_has Assignment); 6310 runJUnitTest(__test, __test.test_typePromotion_conditional_useInThen_has Assignment);
6027 }); 6311 });
6028 _ut.test('test_typePromotion_if_accessedInClosure_hasAssignment', () { 6312 _ut.test('test_typePromotion_if_accessedInClosure_hasAssignment', () {
6029 final __test = new StaticTypeWarningCodeTest(); 6313 final __test = new StaticTypeWarningCodeTest();
6030 runJUnitTest(__test, __test.test_typePromotion_if_accessedInClosure_hasA ssignment); 6314 runJUnitTest(__test, __test.test_typePromotion_if_accessedInClosure_hasA ssignment);
6031 }); 6315 });
6032 _ut.test('test_typePromotion_if_and_right_hasAssignment', () { 6316 _ut.test('test_typePromotion_if_and_right_hasAssignment', () {
6033 final __test = new StaticTypeWarningCodeTest(); 6317 final __test = new StaticTypeWarningCodeTest();
6034 runJUnitTest(__test, __test.test_typePromotion_if_and_right_hasAssignmen t); 6318 runJUnitTest(__test, __test.test_typePromotion_if_and_right_hasAssignmen t);
6035 }); 6319 });
6320 _ut.test('test_typePromotion_if_extends_notMoreSpecific_dynamic', () {
6321 final __test = new StaticTypeWarningCodeTest();
6322 runJUnitTest(__test, __test.test_typePromotion_if_extends_notMoreSpecifi c_dynamic);
6323 });
6324 _ut.test('test_typePromotion_if_extends_notMoreSpecific_notMoreSpecificTyp eArg', () {
6325 final __test = new StaticTypeWarningCodeTest();
6326 runJUnitTest(__test, __test.test_typePromotion_if_extends_notMoreSpecifi c_notMoreSpecificTypeArg);
6327 });
6036 _ut.test('test_typePromotion_if_hasAssignment_after', () { 6328 _ut.test('test_typePromotion_if_hasAssignment_after', () {
6037 final __test = new StaticTypeWarningCodeTest(); 6329 final __test = new StaticTypeWarningCodeTest();
6038 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_after); 6330 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_after);
6039 }); 6331 });
6040 _ut.test('test_typePromotion_if_hasAssignment_before', () { 6332 _ut.test('test_typePromotion_if_hasAssignment_before', () {
6041 final __test = new StaticTypeWarningCodeTest(); 6333 final __test = new StaticTypeWarningCodeTest();
6042 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_before); 6334 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_before);
6043 }); 6335 });
6336 _ut.test('test_typePromotion_if_hasAssignment_inClosure_anonymous_after', () {
6337 final __test = new StaticTypeWarningCodeTest();
6338 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_inClosur e_anonymous_after);
6339 });
6340 _ut.test('test_typePromotion_if_hasAssignment_inClosure_anonymous_before', () {
6341 final __test = new StaticTypeWarningCodeTest();
6342 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_inClosur e_anonymous_before);
6343 });
6344 _ut.test('test_typePromotion_if_hasAssignment_inClosure_function_after', ( ) {
6345 final __test = new StaticTypeWarningCodeTest();
6346 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_inClosur e_function_after);
6347 });
6348 _ut.test('test_typePromotion_if_hasAssignment_inClosure_function_before', () {
6349 final __test = new StaticTypeWarningCodeTest();
6350 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_inClosur e_function_before);
6351 });
6352 _ut.test('test_typePromotion_if_implements_notMoreSpecific_dynamic', () {
6353 final __test = new StaticTypeWarningCodeTest();
6354 runJUnitTest(__test, __test.test_typePromotion_if_implements_notMoreSpec ific_dynamic);
6355 });
6356 _ut.test('test_typePromotion_if_with_notMoreSpecific_dynamic', () {
6357 final __test = new StaticTypeWarningCodeTest();
6358 runJUnitTest(__test, __test.test_typePromotion_if_with_notMoreSpecific_d ynamic);
6359 });
6044 _ut.test('test_undefinedGetter', () { 6360 _ut.test('test_undefinedGetter', () {
6045 final __test = new StaticTypeWarningCodeTest(); 6361 final __test = new StaticTypeWarningCodeTest();
6046 runJUnitTest(__test, __test.test_undefinedGetter); 6362 runJUnitTest(__test, __test.test_undefinedGetter);
6047 }); 6363 });
6048 _ut.test('test_undefinedGetter_static', () { 6364 _ut.test('test_undefinedGetter_static', () {
6049 final __test = new StaticTypeWarningCodeTest(); 6365 final __test = new StaticTypeWarningCodeTest();
6050 runJUnitTest(__test, __test.test_undefinedGetter_static); 6366 runJUnitTest(__test, __test.test_undefinedGetter_static);
6051 }); 6367 });
6052 _ut.test('test_undefinedMethod', () { 6368 _ut.test('test_undefinedMethod', () {
6053 final __test = new StaticTypeWarningCodeTest(); 6369 final __test = new StaticTypeWarningCodeTest();
(...skipping 3570 matching lines...) Expand 10 before | Expand all | Expand 10 after
9624 "class A {", 9940 "class A {",
9625 " static f() {}", 9941 " static f() {}",
9626 "}", 9942 "}",
9627 "@A.f", 9943 "@A.f",
9628 "main() {", 9944 "main() {",
9629 "}"])); 9945 "}"]));
9630 resolve(source); 9946 resolve(source);
9631 assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]); 9947 assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
9632 verify([source]); 9948 verify([source]);
9633 } 9949 }
9950 void test_invalidAnnotation_unresolved_identifier() {
9951 Source source = addSource(EngineTestCase.createSource(["@unresolved", "main( ) {", "}"]));
9952 resolve(source);
9953 assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
9954 }
9955 void test_invalidAnnotation_unresolved_invocation() {
9956 Source source = addSource(EngineTestCase.createSource(["@Unresolved()", "mai n() {", "}"]));
9957 resolve(source);
9958 assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
9959 }
9960 void test_invalidAnnotation_unresolved_prefixedIdentifier() {
9961 Source source = addSource(EngineTestCase.createSource([
9962 "import 'dart:math' as p;",
9963 "@p.unresolved",
9964 "main() {",
9965 "}"]));
9966 resolve(source);
9967 assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
9968 }
9634 void test_invalidConstructorName_notEnclosingClassName_defined() { 9969 void test_invalidConstructorName_notEnclosingClassName_defined() {
9635 Source source = addSource(EngineTestCase.createSource(["class A {", " B() : super();", "}", "class B {}"])); 9970 Source source = addSource(EngineTestCase.createSource(["class A {", " B() : super();", "}", "class B {}"]));
9636 resolve(source); 9971 resolve(source);
9637 assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); 9972 assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
9638 } 9973 }
9639 void test_invalidConstructorName_notEnclosingClassName_undefined() { 9974 void test_invalidConstructorName_notEnclosingClassName_undefined() {
9640 Source source = addSource(EngineTestCase.createSource(["class A {", " B() : super();", "}"])); 9975 Source source = addSource(EngineTestCase.createSource(["class A {", " B() : super();", "}"]));
9641 resolve(source); 9976 resolve(source);
9642 assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]); 9977 assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
9643 } 9978 }
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
10571 "main() {", 10906 "main() {",
10572 " {", 10907 " {",
10573 " print(v);", 10908 " print(v);",
10574 " }", 10909 " }",
10575 " var v = 2;", 10910 " var v = 2;",
10576 "}", 10911 "}",
10577 "print(x) {}"])); 10912 "print(x) {}"]));
10578 resolve(source); 10913 resolve(source);
10579 assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); 10914 assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
10580 } 10915 }
10581 void test_referenceToDeclaredVariableInInitializer_closure() {
10582 Source source = addSource(EngineTestCase.createSource(["f() {", " var x = ( x) {};", "}"]));
10583 resolve(source);
10584 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN _INITIALIZER]);
10585 verify([source]);
10586 }
10587 void test_referenceToDeclaredVariableInInitializer_getter() {
10588 Source source = addSource(EngineTestCase.createSource(["f() {", " int x = x + 1;", "}"]));
10589 resolve(source);
10590 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN _INITIALIZER]);
10591 verify([source]);
10592 }
10593 void test_referenceToDeclaredVariableInInitializer_setter() {
10594 Source source = addSource(EngineTestCase.createSource(["f() {", " int x = x ++;", "}"]));
10595 resolve(source);
10596 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN _INITIALIZER]);
10597 verify([source]);
10598 }
10599 void test_referenceToDeclaredVariableInInitializer_unqualifiedInvocation() {
10600 Source source = addSource(EngineTestCase.createSource(["f() {", " var x = x ();", "}"]));
10601 resolve(source);
10602 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN _INITIALIZER]);
10603 verify([source]);
10604 }
10605 void test_rethrowOutsideCatch() { 10916 void test_rethrowOutsideCatch() {
10606 Source source = addSource(EngineTestCase.createSource(["f() {", " rethrow;" , "}"])); 10917 Source source = addSource(EngineTestCase.createSource(["f() {", " rethrow;" , "}"]));
10607 resolve(source); 10918 resolve(source);
10608 assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]); 10919 assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]);
10609 verify([source]); 10920 verify([source]);
10610 } 10921 }
10611 void test_returnInGenerativeConstructor() { 10922 void test_returnInGenerativeConstructor() {
10612 Source source = addSource(EngineTestCase.createSource(["class A {", " A() { return 0; }", "}"])); 10923 Source source = addSource(EngineTestCase.createSource(["class A {", " A() { return 0; }", "}"]));
10613 resolve(source); 10924 resolve(source);
10614 assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR] ); 10925 assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR] );
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
11647 runJUnitTest(__test, __test.test_invalidAnnotation_notConstantVariable); 11958 runJUnitTest(__test, __test.test_invalidAnnotation_notConstantVariable);
11648 }); 11959 });
11649 _ut.test('test_invalidAnnotation_notVariableOrConstructorInvocation', () { 11960 _ut.test('test_invalidAnnotation_notVariableOrConstructorInvocation', () {
11650 final __test = new CompileTimeErrorCodeTest(); 11961 final __test = new CompileTimeErrorCodeTest();
11651 runJUnitTest(__test, __test.test_invalidAnnotation_notVariableOrConstruc torInvocation); 11962 runJUnitTest(__test, __test.test_invalidAnnotation_notVariableOrConstruc torInvocation);
11652 }); 11963 });
11653 _ut.test('test_invalidAnnotation_staticMethodReference', () { 11964 _ut.test('test_invalidAnnotation_staticMethodReference', () {
11654 final __test = new CompileTimeErrorCodeTest(); 11965 final __test = new CompileTimeErrorCodeTest();
11655 runJUnitTest(__test, __test.test_invalidAnnotation_staticMethodReference ); 11966 runJUnitTest(__test, __test.test_invalidAnnotation_staticMethodReference );
11656 }); 11967 });
11968 _ut.test('test_invalidAnnotation_unresolved_identifier', () {
11969 final __test = new CompileTimeErrorCodeTest();
11970 runJUnitTest(__test, __test.test_invalidAnnotation_unresolved_identifier );
11971 });
11972 _ut.test('test_invalidAnnotation_unresolved_invocation', () {
11973 final __test = new CompileTimeErrorCodeTest();
11974 runJUnitTest(__test, __test.test_invalidAnnotation_unresolved_invocation );
11975 });
11976 _ut.test('test_invalidAnnotation_unresolved_prefixedIdentifier', () {
11977 final __test = new CompileTimeErrorCodeTest();
11978 runJUnitTest(__test, __test.test_invalidAnnotation_unresolved_prefixedId entifier);
11979 });
11657 _ut.test('test_invalidConstructorName_notEnclosingClassName_defined', () { 11980 _ut.test('test_invalidConstructorName_notEnclosingClassName_defined', () {
11658 final __test = new CompileTimeErrorCodeTest(); 11981 final __test = new CompileTimeErrorCodeTest();
11659 runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClas sName_defined); 11982 runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClas sName_defined);
11660 }); 11983 });
11661 _ut.test('test_invalidConstructorName_notEnclosingClassName_undefined', () { 11984 _ut.test('test_invalidConstructorName_notEnclosingClassName_undefined', () {
11662 final __test = new CompileTimeErrorCodeTest(); 11985 final __test = new CompileTimeErrorCodeTest();
11663 runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClas sName_undefined); 11986 runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClas sName_undefined);
11664 }); 11987 });
11665 _ut.test('test_invalidFactoryNameNotAClass_notClassName', () { 11988 _ut.test('test_invalidFactoryNameNotAClass_notClassName', () {
11666 final __test = new CompileTimeErrorCodeTest(); 11989 final __test = new CompileTimeErrorCodeTest();
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
12091 runJUnitTest(__test, __test.test_redirectToNonClass_notAType); 12414 runJUnitTest(__test, __test.test_redirectToNonClass_notAType);
12092 }); 12415 });
12093 _ut.test('test_redirectToNonClass_undefinedIdentifier', () { 12416 _ut.test('test_redirectToNonClass_undefinedIdentifier', () {
12094 final __test = new CompileTimeErrorCodeTest(); 12417 final __test = new CompileTimeErrorCodeTest();
12095 runJUnitTest(__test, __test.test_redirectToNonClass_undefinedIdentifier) ; 12418 runJUnitTest(__test, __test.test_redirectToNonClass_undefinedIdentifier) ;
12096 }); 12419 });
12097 _ut.test('test_redirectToNonConstConstructor', () { 12420 _ut.test('test_redirectToNonConstConstructor', () {
12098 final __test = new CompileTimeErrorCodeTest(); 12421 final __test = new CompileTimeErrorCodeTest();
12099 runJUnitTest(__test, __test.test_redirectToNonConstConstructor); 12422 runJUnitTest(__test, __test.test_redirectToNonConstConstructor);
12100 }); 12423 });
12101 _ut.test('test_referenceToDeclaredVariableInInitializer_closure', () {
12102 final __test = new CompileTimeErrorCodeTest();
12103 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize r_closure);
12104 });
12105 _ut.test('test_referenceToDeclaredVariableInInitializer_getter', () {
12106 final __test = new CompileTimeErrorCodeTest();
12107 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize r_getter);
12108 });
12109 _ut.test('test_referenceToDeclaredVariableInInitializer_setter', () {
12110 final __test = new CompileTimeErrorCodeTest();
12111 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize r_setter);
12112 });
12113 _ut.test('test_referenceToDeclaredVariableInInitializer_unqualifiedInvocat ion', () {
12114 final __test = new CompileTimeErrorCodeTest();
12115 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize r_unqualifiedInvocation);
12116 });
12117 _ut.test('test_referencedBeforeDeclaration_hideInBlock_function', () { 12424 _ut.test('test_referencedBeforeDeclaration_hideInBlock_function', () {
12118 final __test = new CompileTimeErrorCodeTest(); 12425 final __test = new CompileTimeErrorCodeTest();
12119 runJUnitTest(__test, __test.test_referencedBeforeDeclaration_hideInBlock _function); 12426 runJUnitTest(__test, __test.test_referencedBeforeDeclaration_hideInBlock _function);
12120 }); 12427 });
12121 _ut.test('test_referencedBeforeDeclaration_hideInBlock_local', () { 12428 _ut.test('test_referencedBeforeDeclaration_hideInBlock_local', () {
12122 final __test = new CompileTimeErrorCodeTest(); 12429 final __test = new CompileTimeErrorCodeTest();
12123 runJUnitTest(__test, __test.test_referencedBeforeDeclaration_hideInBlock _local); 12430 runJUnitTest(__test, __test.test_referencedBeforeDeclaration_hideInBlock _local);
12124 }); 12431 });
12125 _ut.test('test_referencedBeforeDeclaration_hideInBlock_subBlock', () { 12432 _ut.test('test_referencedBeforeDeclaration_hideInBlock_subBlock', () {
12126 final __test = new CompileTimeErrorCodeTest(); 12433 final __test = new CompileTimeErrorCodeTest();
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
13808 "class A {", 14115 "class A {",
13809 " operator +(int p) {}", 14116 " operator +(int p) {}",
13810 "}", 14117 "}",
13811 "f(A a) {", 14118 "f(A a) {",
13812 " a + '0';", 14119 " a + '0';",
13813 "}"])); 14120 "}"]));
13814 resolve(source); 14121 resolve(source);
13815 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 14122 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
13816 verify([source]); 14123 verify([source]);
13817 } 14124 }
14125 void test_argumentTypeNotAssignable_cascadeSEcond() {
14126 Source source = addSource(EngineTestCase.createSource([
14127 "// filler filler filler filler filler filler filler filler filler fille r",
14128 "class A {",
14129 " B ma() {}",
14130 "}",
14131 "class B {",
14132 " mb(String p) {}",
14133 "}",
14134 "",
14135 "main() {",
14136 " A a = new A();",
14137 " a.. ma().mb(0);",
14138 "}"]));
14139 resolve(source);
14140 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
14141 verify([source]);
14142 }
13818 void test_argumentTypeNotAssignable_const() { 14143 void test_argumentTypeNotAssignable_const() {
13819 Source source = addSource(EngineTestCase.createSource([ 14144 Source source = addSource(EngineTestCase.createSource([
13820 "class A {", 14145 "class A {",
13821 " const A(String p);", 14146 " const A(String p);",
13822 "}", 14147 "}",
13823 "main() {", 14148 "main() {",
13824 " const A(42);", 14149 " const A(42);",
13825 "}"])); 14150 "}"]));
13826 resolve(source); 14151 resolve(source);
13827 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 14152 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
13828 verify([source]); 14153 verify([source]);
13829 } 14154 }
13830 void test_argumentTypeNotAssignable_const_super() { 14155 void test_argumentTypeNotAssignable_const_super() {
13831 Source source = addSource(EngineTestCase.createSource([ 14156 Source source = addSource(EngineTestCase.createSource([
13832 "class A {", 14157 "class A {",
13833 " const A(String p);", 14158 " const A(String p);",
13834 "}", 14159 "}",
13835 "class B extends A {", 14160 "class B extends A {",
13836 " const B() : super(42);", 14161 " const B() : super(42);",
13837 "}"])); 14162 "}"]));
13838 resolve(source); 14163 resolve(source);
13839 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 14164 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
13840 verify([source]); 14165 verify([source]);
13841 } 14166 }
14167 void test_argumentTypeNotAssignable_functionExpressionInvocation_required() {
14168 Source source = addSource(EngineTestCase.createSource(["main() {", " (int x ) {} ('');", "}"]));
14169 resolve(source);
14170 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
14171 verify([source]);
14172 }
13842 void test_argumentTypeNotAssignable_index() { 14173 void test_argumentTypeNotAssignable_index() {
13843 Source source = addSource(EngineTestCase.createSource([ 14174 Source source = addSource(EngineTestCase.createSource([
13844 "class A {", 14175 "class A {",
13845 " operator [](int index) {}", 14176 " operator [](int index) {}",
13846 "}", 14177 "}",
13847 "f(A a) {", 14178 "f(A a) {",
13848 " a['0'];", 14179 " a['0'];",
13849 "}"])); 14180 "}"]));
13850 resolve(source); 14181 resolve(source);
13851 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 14182 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
14287 resolve(source); 14618 resolve(source);
14288 assertErrors(source, [StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAME]); 14619 assertErrors(source, [StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAME]);
14289 verify([source]); 14620 verify([source]);
14290 } 14621 }
14291 void test_extraPositionalArguments() { 14622 void test_extraPositionalArguments() {
14292 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {", " f(0, 1, '2');", "}"])); 14623 Source source = addSource(EngineTestCase.createSource(["f() {}", "main() {", " f(0, 1, '2');", "}"]));
14293 resolve(source); 14624 resolve(source);
14294 assertErrors(source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]); 14625 assertErrors(source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]);
14295 verify([source]); 14626 verify([source]);
14296 } 14627 }
14628 void test_extraPositionalArguments_functionExpression() {
14629 Source source = addSource(EngineTestCase.createSource(["main() {", " (int x ) {} (0, 1);", "}"]));
14630 resolve(source);
14631 assertErrors(source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]);
14632 verify([source]);
14633 }
14297 void test_fieldInitializedInInitializerAndDeclaration_final() { 14634 void test_fieldInitializedInInitializerAndDeclaration_final() {
14298 Source source = addSource(EngineTestCase.createSource([ 14635 Source source = addSource(EngineTestCase.createSource([
14299 "class A {", 14636 "class A {",
14300 " final int x = 0;", 14637 " final int x = 0;",
14301 " A() : x = 1 {}", 14638 " A() : x = 1 {}",
14302 "}"])); 14639 "}"]));
14303 resolve(source); 14640 resolve(source);
14304 assertErrors(source, [StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND _DECLARATION]); 14641 assertErrors(source, [StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND _DECLARATION]);
14305 verify([source]); 14642 verify([source]);
14306 } 14643 }
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
15146 resolve(source); 15483 resolve(source);
15147 assertErrors(source, [StaticWarningCode.NOT_A_TYPE]); 15484 assertErrors(source, [StaticWarningCode.NOT_A_TYPE]);
15148 verify([source]); 15485 verify([source]);
15149 } 15486 }
15150 void test_notEnoughRequiredArguments() { 15487 void test_notEnoughRequiredArguments() {
15151 Source source = addSource(EngineTestCase.createSource(["f(int a, String b) { }", "main() {", " f();", "}"])); 15488 Source source = addSource(EngineTestCase.createSource(["f(int a, String b) { }", "main() {", " f();", "}"]));
15152 resolve(source); 15489 resolve(source);
15153 assertErrors(source, [StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]); 15490 assertErrors(source, [StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
15154 verify([source]); 15491 verify([source]);
15155 } 15492 }
15493 void test_notEnoughRequiredArguments_functionExpression() {
15494 Source source = addSource(EngineTestCase.createSource(["main() {", " (int x ) {} ();", "}"]));
15495 resolve(source);
15496 assertErrors(source, [StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
15497 verify([source]);
15498 }
15156 void test_partOfDifferentLibrary() { 15499 void test_partOfDifferentLibrary() {
15157 Source source = addSource(EngineTestCase.createSource(["library lib;", "part 'part.dart';"])); 15500 Source source = addSource(EngineTestCase.createSource(["library lib;", "part 'part.dart';"]));
15158 addSource2("/part.dart", EngineTestCase.createSource(["part of lub;"])); 15501 addSource2("/part.dart", EngineTestCase.createSource(["part of lub;"]));
15159 resolve(source); 15502 resolve(source);
15160 assertErrors(source, [StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]); 15503 assertErrors(source, [StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]);
15161 verify([source]); 15504 verify([source]);
15162 } 15505 }
15163 void test_redirectToInvalidFunctionType() { 15506 void test_redirectToInvalidFunctionType() {
15164 Source source = addSource(EngineTestCase.createSource([ 15507 Source source = addSource(EngineTestCase.createSource([
15165 "class A implements B {", 15508 "class A implements B {",
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
15381 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); 15724 Source source = addSource(EngineTestCase.createSource(["var a = b;"]));
15382 resolve(source); 15725 resolve(source);
15383 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); 15726 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
15384 } 15727 }
15385 void test_undefinedIdentifier_initializer_prefix() { 15728 void test_undefinedIdentifier_initializer_prefix() {
15386 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class C {}"])); 15729 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class C {}"]));
15387 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as b;", "", "var a = b;", "b.C c;"])); 15730 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as b;", "", "var a = b;", "b.C c;"]));
15388 resolve(source); 15731 resolve(source);
15389 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); 15732 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
15390 } 15733 }
15391 void test_undefinedIdentifier_metadata() {
15392 Source source = addSource(EngineTestCase.createSource(["@undefined class A { }"]));
15393 resolve(source);
15394 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
15395 }
15396 void test_undefinedIdentifier_methodInvocation() { 15734 void test_undefinedIdentifier_methodInvocation() {
15397 Source source = addSource(EngineTestCase.createSource(["f() { C.m(); }"])); 15735 Source source = addSource(EngineTestCase.createSource(["f() { C.m(); }"]));
15398 resolve(source); 15736 resolve(source);
15399 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); 15737 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
15400 } 15738 }
15401 void test_undefinedIdentifier_private_getter() { 15739 void test_undefinedIdentifier_private_getter() {
15402 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class A {", " var _foo;", "}"])); 15740 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class A {", " var _foo;", "}"]));
15403 Source source = addSource(EngineTestCase.createSource([ 15741 Source source = addSource(EngineTestCase.createSource([
15404 "import 'lib.dart';", 15742 "import 'lib.dart';",
15405 "class B extends A {", 15743 "class B extends A {",
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
15493 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na medConstructor); 15831 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_na medConstructor);
15494 }); 15832 });
15495 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', ( ) { 15833 _ut.test('test_argumentTypeNotAssignable_annotation_unnamedConstructor', ( ) {
15496 final __test = new StaticWarningCodeTest(); 15834 final __test = new StaticWarningCodeTest();
15497 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un namedConstructor); 15835 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_un namedConstructor);
15498 }); 15836 });
15499 _ut.test('test_argumentTypeNotAssignable_binary', () { 15837 _ut.test('test_argumentTypeNotAssignable_binary', () {
15500 final __test = new StaticWarningCodeTest(); 15838 final __test = new StaticWarningCodeTest();
15501 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_binary); 15839 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_binary);
15502 }); 15840 });
15841 _ut.test('test_argumentTypeNotAssignable_cascadeSEcond', () {
15842 final __test = new StaticWarningCodeTest();
15843 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_cascadeSEcond );
15844 });
15503 _ut.test('test_argumentTypeNotAssignable_const', () { 15845 _ut.test('test_argumentTypeNotAssignable_const', () {
15504 final __test = new StaticWarningCodeTest(); 15846 final __test = new StaticWarningCodeTest();
15505 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const); 15847 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const);
15506 }); 15848 });
15507 _ut.test('test_argumentTypeNotAssignable_const_super', () { 15849 _ut.test('test_argumentTypeNotAssignable_const_super', () {
15508 final __test = new StaticWarningCodeTest(); 15850 final __test = new StaticWarningCodeTest();
15509 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const_super); 15851 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_const_super);
15510 }); 15852 });
15853 _ut.test('test_argumentTypeNotAssignable_functionExpressionInvocation_requ ired', () {
15854 final __test = new StaticWarningCodeTest();
15855 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_functionExpre ssionInvocation_required);
15856 });
15511 _ut.test('test_argumentTypeNotAssignable_index', () { 15857 _ut.test('test_argumentTypeNotAssignable_index', () {
15512 final __test = new StaticWarningCodeTest(); 15858 final __test = new StaticWarningCodeTest();
15513 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_index); 15859 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_index);
15514 }); 15860 });
15515 _ut.test('test_argumentTypeNotAssignable_invocation_callParameter', () { 15861 _ut.test('test_argumentTypeNotAssignable_invocation_callParameter', () {
15516 final __test = new StaticWarningCodeTest(); 15862 final __test = new StaticWarningCodeTest();
15517 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_ca llParameter); 15863 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_ca llParameter);
15518 }); 15864 });
15519 _ut.test('test_argumentTypeNotAssignable_invocation_callVariable', () { 15865 _ut.test('test_argumentTypeNotAssignable_invocation_callVariable', () {
15520 final __test = new StaticWarningCodeTest(); 15866 final __test = new StaticWarningCodeTest();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
15689 runJUnitTest(__test, __test.test_equalKeysInMap); 16035 runJUnitTest(__test, __test.test_equalKeysInMap);
15690 }); 16036 });
15691 _ut.test('test_exportDuplicatedLibraryName', () { 16037 _ut.test('test_exportDuplicatedLibraryName', () {
15692 final __test = new StaticWarningCodeTest(); 16038 final __test = new StaticWarningCodeTest();
15693 runJUnitTest(__test, __test.test_exportDuplicatedLibraryName); 16039 runJUnitTest(__test, __test.test_exportDuplicatedLibraryName);
15694 }); 16040 });
15695 _ut.test('test_extraPositionalArguments', () { 16041 _ut.test('test_extraPositionalArguments', () {
15696 final __test = new StaticWarningCodeTest(); 16042 final __test = new StaticWarningCodeTest();
15697 runJUnitTest(__test, __test.test_extraPositionalArguments); 16043 runJUnitTest(__test, __test.test_extraPositionalArguments);
15698 }); 16044 });
16045 _ut.test('test_extraPositionalArguments_functionExpression', () {
16046 final __test = new StaticWarningCodeTest();
16047 runJUnitTest(__test, __test.test_extraPositionalArguments_functionExpres sion);
16048 });
15699 _ut.test('test_fieldInitializedInInitializerAndDeclaration_final', () { 16049 _ut.test('test_fieldInitializedInInitializerAndDeclaration_final', () {
15700 final __test = new StaticWarningCodeTest(); 16050 final __test = new StaticWarningCodeTest();
15701 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara tion_final); 16051 runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclara tion_final);
15702 }); 16052 });
15703 _ut.test('test_fieldInitializerNotAssignable', () { 16053 _ut.test('test_fieldInitializerNotAssignable', () {
15704 final __test = new StaticWarningCodeTest(); 16054 final __test = new StaticWarningCodeTest();
15705 runJUnitTest(__test, __test.test_fieldInitializerNotAssignable); 16055 runJUnitTest(__test, __test.test_fieldInitializerNotAssignable);
15706 }); 16056 });
15707 _ut.test('test_fieldInitializingFormalNotAssignable', () { 16057 _ut.test('test_fieldInitializingFormalNotAssignable', () {
15708 final __test = new StaticWarningCodeTest(); 16058 final __test = new StaticWarningCodeTest();
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
16009 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method); 16359 runJUnitTest(__test, __test.test_nonVoidReturnForSetter_method);
16010 }); 16360 });
16011 _ut.test('test_notAType', () { 16361 _ut.test('test_notAType', () {
16012 final __test = new StaticWarningCodeTest(); 16362 final __test = new StaticWarningCodeTest();
16013 runJUnitTest(__test, __test.test_notAType); 16363 runJUnitTest(__test, __test.test_notAType);
16014 }); 16364 });
16015 _ut.test('test_notEnoughRequiredArguments', () { 16365 _ut.test('test_notEnoughRequiredArguments', () {
16016 final __test = new StaticWarningCodeTest(); 16366 final __test = new StaticWarningCodeTest();
16017 runJUnitTest(__test, __test.test_notEnoughRequiredArguments); 16367 runJUnitTest(__test, __test.test_notEnoughRequiredArguments);
16018 }); 16368 });
16369 _ut.test('test_notEnoughRequiredArguments_functionExpression', () {
16370 final __test = new StaticWarningCodeTest();
16371 runJUnitTest(__test, __test.test_notEnoughRequiredArguments_functionExpr ession);
16372 });
16019 _ut.test('test_partOfDifferentLibrary', () { 16373 _ut.test('test_partOfDifferentLibrary', () {
16020 final __test = new StaticWarningCodeTest(); 16374 final __test = new StaticWarningCodeTest();
16021 runJUnitTest(__test, __test.test_partOfDifferentLibrary); 16375 runJUnitTest(__test, __test.test_partOfDifferentLibrary);
16022 }); 16376 });
16023 _ut.test('test_redirectToInvalidFunctionType', () { 16377 _ut.test('test_redirectToInvalidFunctionType', () {
16024 final __test = new StaticWarningCodeTest(); 16378 final __test = new StaticWarningCodeTest();
16025 runJUnitTest(__test, __test.test_redirectToInvalidFunctionType); 16379 runJUnitTest(__test, __test.test_redirectToInvalidFunctionType);
16026 }); 16380 });
16027 _ut.test('test_redirectToInvalidReturnType', () { 16381 _ut.test('test_redirectToInvalidReturnType', () {
16028 final __test = new StaticWarningCodeTest(); 16382 final __test = new StaticWarningCodeTest();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
16133 runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix); 16487 runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix);
16134 }); 16488 });
16135 _ut.test('test_undefinedIdentifier_initializer', () { 16489 _ut.test('test_undefinedIdentifier_initializer', () {
16136 final __test = new StaticWarningCodeTest(); 16490 final __test = new StaticWarningCodeTest();
16137 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); 16491 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer);
16138 }); 16492 });
16139 _ut.test('test_undefinedIdentifier_initializer_prefix', () { 16493 _ut.test('test_undefinedIdentifier_initializer_prefix', () {
16140 final __test = new StaticWarningCodeTest(); 16494 final __test = new StaticWarningCodeTest();
16141 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer_prefix) ; 16495 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer_prefix) ;
16142 }); 16496 });
16143 _ut.test('test_undefinedIdentifier_metadata', () {
16144 final __test = new StaticWarningCodeTest();
16145 runJUnitTest(__test, __test.test_undefinedIdentifier_metadata);
16146 });
16147 _ut.test('test_undefinedIdentifier_methodInvocation', () { 16497 _ut.test('test_undefinedIdentifier_methodInvocation', () {
16148 final __test = new StaticWarningCodeTest(); 16498 final __test = new StaticWarningCodeTest();
16149 runJUnitTest(__test, __test.test_undefinedIdentifier_methodInvocation); 16499 runJUnitTest(__test, __test.test_undefinedIdentifier_methodInvocation);
16150 }); 16500 });
16151 _ut.test('test_undefinedIdentifier_private_getter', () { 16501 _ut.test('test_undefinedIdentifier_private_getter', () {
16152 final __test = new StaticWarningCodeTest(); 16502 final __test = new StaticWarningCodeTest();
16153 runJUnitTest(__test, __test.test_undefinedIdentifier_private_getter); 16503 runJUnitTest(__test, __test.test_undefinedIdentifier_private_getter);
16154 }); 16504 });
16155 _ut.test('test_undefinedIdentifier_private_setter', () { 16505 _ut.test('test_undefinedIdentifier_private_setter', () {
16156 final __test = new StaticWarningCodeTest(); 16506 final __test = new StaticWarningCodeTest();
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
16685 LibraryElement importedLibrary = createTestLibrary2(context, "imported", []) ; 17035 LibraryElement importedLibrary = createTestLibrary2(context, "imported", []) ;
16686 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty pes = <ClassElement> [importedType]; 17036 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty pes = <ClassElement> [importedType];
16687 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing" , []); 17037 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing" , []);
16688 ImportElementImpl importElement = new ImportElementImpl(); 17038 ImportElementImpl importElement = new ImportElementImpl();
16689 importElement.importedLibrary = importedLibrary; 17039 importElement.importedLibrary = importedLibrary;
16690 definingLibrary.imports = <ImportElement> [importElement]; 17040 definingLibrary.imports = <ImportElement> [importElement];
16691 GatheringErrorListener errorListener = new GatheringErrorListener(); 17041 GatheringErrorListener errorListener = new GatheringErrorListener();
16692 Scope scope = new LibraryImportScope(definingLibrary, errorListener); 17042 Scope scope = new LibraryImportScope(definingLibrary, errorListener);
16693 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3 (importedTypeName), definingLibrary)); 17043 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3 (importedTypeName), definingLibrary));
16694 } 17044 }
16695 void test_getDefiningLibrary() {
16696 LibraryElement definingLibrary = createTestLibrary();
16697 GatheringErrorListener errorListener = new GatheringErrorListener();
16698 LibraryImportScope scope = new LibraryImportScope(definingLibrary, errorList ener);
16699 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary);
16700 }
16701 void test_getErrorListener() { 17045 void test_getErrorListener() {
16702 LibraryElement definingLibrary = createTestLibrary(); 17046 LibraryElement definingLibrary = createTestLibrary();
16703 GatheringErrorListener errorListener = new GatheringErrorListener(); 17047 GatheringErrorListener errorListener = new GatheringErrorListener();
16704 LibraryImportScope scope = new LibraryImportScope(definingLibrary, errorList ener); 17048 LibraryImportScope scope = new LibraryImportScope(definingLibrary, errorList ener);
16705 JUnitTestCase.assertEquals(errorListener, scope.errorListener); 17049 JUnitTestCase.assertEquals(errorListener, scope.errorListener);
16706 } 17050 }
16707 void test_nonConflictingImports_fromSdk() { 17051 void test_nonConflictingImports_fromSdk() {
16708 AnalysisContext context = AnalysisContextFactory.contextWithCore(); 17052 AnalysisContext context = AnalysisContextFactory.contextWithCore();
16709 String typeName = "List"; 17053 String typeName = "List";
16710 ClassElement type = ElementFactory.classElement2(typeName, []); 17054 ClassElement type = ElementFactory.classElement2(typeName, []);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
16768 runJUnitTest(__test, __test.test_conflictingImports); 17112 runJUnitTest(__test, __test.test_conflictingImports);
16769 }); 17113 });
16770 _ut.test('test_creation_empty', () { 17114 _ut.test('test_creation_empty', () {
16771 final __test = new LibraryImportScopeTest(); 17115 final __test = new LibraryImportScopeTest();
16772 runJUnitTest(__test, __test.test_creation_empty); 17116 runJUnitTest(__test, __test.test_creation_empty);
16773 }); 17117 });
16774 _ut.test('test_creation_nonEmpty', () { 17118 _ut.test('test_creation_nonEmpty', () {
16775 final __test = new LibraryImportScopeTest(); 17119 final __test = new LibraryImportScopeTest();
16776 runJUnitTest(__test, __test.test_creation_nonEmpty); 17120 runJUnitTest(__test, __test.test_creation_nonEmpty);
16777 }); 17121 });
16778 _ut.test('test_getDefiningLibrary', () {
16779 final __test = new LibraryImportScopeTest();
16780 runJUnitTest(__test, __test.test_getDefiningLibrary);
16781 });
16782 _ut.test('test_getErrorListener', () { 17122 _ut.test('test_getErrorListener', () {
16783 final __test = new LibraryImportScopeTest(); 17123 final __test = new LibraryImportScopeTest();
16784 runJUnitTest(__test, __test.test_getErrorListener); 17124 runJUnitTest(__test, __test.test_getErrorListener);
16785 }); 17125 });
16786 _ut.test('test_nonConflictingImports_fromSdk', () { 17126 _ut.test('test_nonConflictingImports_fromSdk', () {
16787 final __test = new LibraryImportScopeTest(); 17127 final __test = new LibraryImportScopeTest();
16788 runJUnitTest(__test, __test.test_nonConflictingImports_fromSdk); 17128 runJUnitTest(__test, __test.test_nonConflictingImports_fromSdk);
16789 }); 17129 });
16790 _ut.test('test_nonConflictingImports_sameElement', () { 17130 _ut.test('test_nonConflictingImports_sameElement', () {
16791 final __test = new LibraryImportScopeTest(); 17131 final __test = new LibraryImportScopeTest();
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
17076 LibraryElement importedLibrary = createTestLibrary2(context, "imported", []) ; 17416 LibraryElement importedLibrary = createTestLibrary2(context, "imported", []) ;
17077 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty pes = <ClassElement> [importedType]; 17417 ((importedLibrary.definingCompilationUnit as CompilationUnitElementImpl)).ty pes = <ClassElement> [importedType];
17078 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing" , []); 17418 LibraryElementImpl definingLibrary = createTestLibrary2(context, "importing" , []);
17079 ImportElementImpl importElement = new ImportElementImpl(); 17419 ImportElementImpl importElement = new ImportElementImpl();
17080 importElement.importedLibrary = importedLibrary; 17420 importElement.importedLibrary = importedLibrary;
17081 definingLibrary.imports = <ImportElement> [importElement]; 17421 definingLibrary.imports = <ImportElement> [importElement];
17082 GatheringErrorListener errorListener = new GatheringErrorListener(); 17422 GatheringErrorListener errorListener = new GatheringErrorListener();
17083 Scope scope = new LibraryScope(definingLibrary, errorListener); 17423 Scope scope = new LibraryScope(definingLibrary, errorListener);
17084 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3 (importedTypeName), definingLibrary)); 17424 JUnitTestCase.assertEquals(importedType, scope.lookup(ASTFactory.identifier3 (importedTypeName), definingLibrary));
17085 } 17425 }
17086 void test_getDefiningLibrary() {
17087 LibraryElement definingLibrary = createTestLibrary();
17088 GatheringErrorListener errorListener = new GatheringErrorListener();
17089 LibraryScope scope = new LibraryScope(definingLibrary, errorListener);
17090 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary);
17091 }
17092 void test_getErrorListener() { 17426 void test_getErrorListener() {
17093 LibraryElement definingLibrary = createTestLibrary(); 17427 LibraryElement definingLibrary = createTestLibrary();
17094 GatheringErrorListener errorListener = new GatheringErrorListener(); 17428 GatheringErrorListener errorListener = new GatheringErrorListener();
17095 LibraryScope scope = new LibraryScope(definingLibrary, errorListener); 17429 LibraryScope scope = new LibraryScope(definingLibrary, errorListener);
17096 JUnitTestCase.assertEquals(errorListener, scope.errorListener); 17430 JUnitTestCase.assertEquals(errorListener, scope.errorListener);
17097 } 17431 }
17098 static dartSuite() { 17432 static dartSuite() {
17099 _ut.group('LibraryScopeTest', () { 17433 _ut.group('LibraryScopeTest', () {
17100 _ut.test('test_creation_empty', () { 17434 _ut.test('test_creation_empty', () {
17101 final __test = new LibraryScopeTest(); 17435 final __test = new LibraryScopeTest();
17102 runJUnitTest(__test, __test.test_creation_empty); 17436 runJUnitTest(__test, __test.test_creation_empty);
17103 }); 17437 });
17104 _ut.test('test_creation_nonEmpty', () { 17438 _ut.test('test_creation_nonEmpty', () {
17105 final __test = new LibraryScopeTest(); 17439 final __test = new LibraryScopeTest();
17106 runJUnitTest(__test, __test.test_creation_nonEmpty); 17440 runJUnitTest(__test, __test.test_creation_nonEmpty);
17107 }); 17441 });
17108 _ut.test('test_getDefiningLibrary', () {
17109 final __test = new LibraryScopeTest();
17110 runJUnitTest(__test, __test.test_getDefiningLibrary);
17111 });
17112 _ut.test('test_getErrorListener', () { 17442 _ut.test('test_getErrorListener', () {
17113 final __test = new LibraryScopeTest(); 17443 final __test = new LibraryScopeTest();
17114 runJUnitTest(__test, __test.test_getErrorListener); 17444 runJUnitTest(__test, __test.test_getErrorListener);
17115 }); 17445 });
17116 }); 17446 });
17117 } 17447 }
17118 } 17448 }
17119 class StaticTypeAnalyzerTest extends EngineTestCase { 17449 class StaticTypeAnalyzerTest extends EngineTestCase {
17120 17450
17121 /** 17451 /**
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
18377 " bool operator ==(x) {}", 18707 " bool operator ==(x) {}",
18378 " get hashCode => 0;", 18708 " get hashCode => 0;",
18379 "}"])); 18709 "}"]));
18380 resolve(source); 18710 resolve(source);
18381 assertNoErrors(source); 18711 assertNoErrors(source);
18382 verify([source]); 18712 verify([source]);
18383 } 18713 }
18384 void test_proxy_annotation_prefixed() { 18714 void test_proxy_annotation_prefixed() {
18385 Source source = addSource(EngineTestCase.createSource([ 18715 Source source = addSource(EngineTestCase.createSource([
18386 "library L;", 18716 "library L;",
18717 "import 'meta.dart';",
18387 "@proxy", 18718 "@proxy",
18388 "class A {}", 18719 "class A {}",
18389 "f(var a) {", 18720 "f(var a) {",
18390 " a = new A();", 18721 " a = new A();",
18391 " a.m();", 18722 " a.m();",
18392 " var x = a.g;", 18723 " var x = a.g;",
18393 " a.s = 1;", 18724 " a.s = 1;",
18394 " var y = a + a;", 18725 " var y = a + a;",
18395 " a++;", 18726 " a++;",
18396 " ++a;", 18727 " ++a;",
18397 "}"])); 18728 "}"]));
18729 addSource2("/meta.dart", EngineTestCase.createSource([
18730 "library meta;",
18731 "const proxy = const _Proxy();",
18732 "class _Proxy { const _Proxy(); }"]));
18398 resolve(source); 18733 resolve(source);
18399 assertNoErrors(source); 18734 assertNoErrors(source);
18400 } 18735 }
18401 void test_proxy_annotation_prefixed2() { 18736 void test_proxy_annotation_prefixed2() {
18402 Source source = addSource(EngineTestCase.createSource([ 18737 Source source = addSource(EngineTestCase.createSource([
18403 "library L;", 18738 "library L;",
18739 "import 'meta.dart';",
18404 "@proxy", 18740 "@proxy",
18405 "class A {}", 18741 "class A {}",
18406 "class B {", 18742 "class B {",
18407 " f(var a) {", 18743 " f(var a) {",
18408 " a = new A();", 18744 " a = new A();",
18409 " a.m();", 18745 " a.m();",
18410 " var x = a.g;", 18746 " var x = a.g;",
18411 " a.s = 1;", 18747 " a.s = 1;",
18412 " var y = a + a;", 18748 " var y = a + a;",
18413 " a++;", 18749 " a++;",
18414 " ++a;", 18750 " ++a;",
18415 " }", 18751 " }",
18416 "}"])); 18752 "}"]));
18753 addSource2("/meta.dart", EngineTestCase.createSource([
18754 "library meta;",
18755 "const proxy = const _Proxy();",
18756 "class _Proxy { const _Proxy(); }"]));
18417 resolve(source); 18757 resolve(source);
18418 assertNoErrors(source); 18758 assertNoErrors(source);
18419 } 18759 }
18420 void test_proxy_annotation_prefixed3() { 18760 void test_proxy_annotation_prefixed3() {
18421 Source source = addSource(EngineTestCase.createSource([ 18761 Source source = addSource(EngineTestCase.createSource([
18422 "library L;", 18762 "library L;",
18763 "import 'meta.dart';",
18423 "class B {", 18764 "class B {",
18424 " f(var a) {", 18765 " f(var a) {",
18425 " a = new A();", 18766 " a = new A();",
18426 " a.m();", 18767 " a.m();",
18427 " var x = a.g;", 18768 " var x = a.g;",
18428 " a.s = 1;", 18769 " a.s = 1;",
18429 " var y = a + a;", 18770 " var y = a + a;",
18430 " a++;", 18771 " a++;",
18431 " ++a;", 18772 " ++a;",
18432 " }", 18773 " }",
18433 "}", 18774 "}",
18434 "@proxy", 18775 "@proxy",
18435 "class A {}"])); 18776 "class A {}"]));
18777 addSource2("/meta.dart", EngineTestCase.createSource([
18778 "library meta;",
18779 "const proxy = const _Proxy();",
18780 "class _Proxy { const _Proxy(); }"]));
18436 resolve(source); 18781 resolve(source);
18437 assertNoErrors(source); 18782 assertNoErrors(source);
18438 } 18783 }
18439 void test_undefinedGetter_inSubtype() { 18784 void test_undefinedGetter_inSubtype() {
18440 Source source = addSource(EngineTestCase.createSource([ 18785 Source source = addSource(EngineTestCase.createSource([
18441 "class A {}", 18786 "class A {}",
18442 "class B extends A {", 18787 "class B extends A {",
18443 " get b => 0;", 18788 " get b => 0;",
18444 "}", 18789 "}",
18445 "f(var a) {", 18790 "f(var a) {",
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
18821 }); 19166 });
18822 _ut.test('test_unusedImport_prefix_topLevelFunction', () { 19167 _ut.test('test_unusedImport_prefix_topLevelFunction', () {
18823 final __test = new NonHintCodeTest(); 19168 final __test = new NonHintCodeTest();
18824 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); 19169 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction);
18825 }); 19170 });
18826 }); 19171 });
18827 } 19172 }
18828 } 19173 }
18829 class EnclosedScopeTest extends ResolverTestCase { 19174 class EnclosedScopeTest extends ResolverTestCase {
18830 void test_define_duplicate() { 19175 void test_define_duplicate() {
18831 LibraryElement definingLibrary2 = createTestLibrary();
18832 GatheringErrorListener errorListener2 = new GatheringErrorListener(); 19176 GatheringErrorListener errorListener2 = new GatheringErrorListener();
18833 Scope rootScope = new Scope_21(definingLibrary2, errorListener2); 19177 Scope rootScope = new Scope_21(errorListener2);
18834 EnclosedScope scope = new EnclosedScope(rootScope); 19178 EnclosedScope scope = new EnclosedScope(rootScope);
18835 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 19179 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
18836 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 19180 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
18837 scope.define(element1); 19181 scope.define(element1);
18838 scope.define(element2); 19182 scope.define(element2);
18839 errorListener2.assertErrors3([ErrorSeverity.ERROR]); 19183 errorListener2.assertErrors3([ErrorSeverity.ERROR]);
18840 } 19184 }
18841 void test_define_normal() { 19185 void test_define_normal() {
18842 LibraryElement definingLibrary3 = createTestLibrary();
18843 GatheringErrorListener errorListener3 = new GatheringErrorListener(); 19186 GatheringErrorListener errorListener3 = new GatheringErrorListener();
18844 Scope rootScope = new Scope_22(definingLibrary3, errorListener3); 19187 Scope rootScope = new Scope_22(errorListener3);
18845 EnclosedScope outerScope = new EnclosedScope(rootScope); 19188 EnclosedScope outerScope = new EnclosedScope(rootScope);
18846 EnclosedScope innerScope = new EnclosedScope(outerScope); 19189 EnclosedScope innerScope = new EnclosedScope(outerScope);
18847 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 19190 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
18848 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v2")); 19191 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v2"));
18849 outerScope.define(element1); 19192 outerScope.define(element1);
18850 innerScope.define(element2); 19193 innerScope.define(element2);
18851 errorListener3.assertNoErrors(); 19194 errorListener3.assertNoErrors();
18852 } 19195 }
18853 static dartSuite() { 19196 static dartSuite() {
18854 _ut.group('EnclosedScopeTest', () { 19197 _ut.group('EnclosedScopeTest', () {
18855 _ut.test('test_define_duplicate', () { 19198 _ut.test('test_define_duplicate', () {
18856 final __test = new EnclosedScopeTest(); 19199 final __test = new EnclosedScopeTest();
18857 runJUnitTest(__test, __test.test_define_duplicate); 19200 runJUnitTest(__test, __test.test_define_duplicate);
18858 }); 19201 });
18859 _ut.test('test_define_normal', () { 19202 _ut.test('test_define_normal', () {
18860 final __test = new EnclosedScopeTest(); 19203 final __test = new EnclosedScopeTest();
18861 runJUnitTest(__test, __test.test_define_normal); 19204 runJUnitTest(__test, __test.test_define_normal);
18862 }); 19205 });
18863 }); 19206 });
18864 } 19207 }
18865 } 19208 }
18866 class Scope_21 extends Scope { 19209 class Scope_21 extends Scope {
18867 LibraryElement definingLibrary2;
18868 GatheringErrorListener errorListener2; 19210 GatheringErrorListener errorListener2;
18869 Scope_21(this.definingLibrary2, this.errorListener2) : super(); 19211 Scope_21(this.errorListener2) : super();
18870 LibraryElement get definingLibrary => definingLibrary2;
18871 AnalysisErrorListener get errorListener => errorListener2; 19212 AnalysisErrorListener get errorListener => errorListener2;
18872 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null; 19213 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null;
18873 } 19214 }
18874 class Scope_22 extends Scope { 19215 class Scope_22 extends Scope {
18875 LibraryElement definingLibrary3;
18876 GatheringErrorListener errorListener3; 19216 GatheringErrorListener errorListener3;
18877 Scope_22(this.definingLibrary3, this.errorListener3) : super(); 19217 Scope_22(this.errorListener3) : super();
18878 LibraryElement get definingLibrary => definingLibrary3;
18879 AnalysisErrorListener get errorListener => errorListener3; 19218 AnalysisErrorListener get errorListener => errorListener3;
18880 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null; 19219 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => null;
18881 } 19220 }
18882 class LibraryElementBuilderTest extends EngineTestCase { 19221 class LibraryElementBuilderTest extends EngineTestCase {
18883 19222
18884 /** 19223 /**
18885 * The source factory used to create [Source]. 19224 * The source factory used to create [Source].
18886 */ 19225 */
18887 SourceFactory _sourceFactory; 19226 SourceFactory _sourceFactory;
18888 void setUp() { 19227 void setUp() {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
19061 }); 19400 });
19062 _ut.test('test_singleFile', () { 19401 _ut.test('test_singleFile', () {
19063 final __test = new LibraryElementBuilderTest(); 19402 final __test = new LibraryElementBuilderTest();
19064 runJUnitTest(__test, __test.test_singleFile); 19403 runJUnitTest(__test, __test.test_singleFile);
19065 }); 19404 });
19066 }); 19405 });
19067 } 19406 }
19068 } 19407 }
19069 class ScopeTest extends ResolverTestCase { 19408 class ScopeTest extends ResolverTestCase {
19070 void test_define_duplicate() { 19409 void test_define_duplicate() {
19071 LibraryElement definingLibrary = createTestLibrary();
19072 GatheringErrorListener errorListener = new GatheringErrorListener(); 19410 GatheringErrorListener errorListener = new GatheringErrorListener();
19073 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi stener); 19411 ScopeTest_TestScope scope = new ScopeTest_TestScope(errorListener);
19074 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 19412 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
19075 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 19413 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
19076 scope.define(element1); 19414 scope.define(element1);
19077 scope.define(element2); 19415 scope.define(element2);
19078 errorListener.assertErrors3([ErrorSeverity.ERROR]); 19416 errorListener.assertErrors3([ErrorSeverity.ERROR]);
19079 } 19417 }
19080 void test_define_normal() { 19418 void test_define_normal() {
19081 LibraryElement definingLibrary = createTestLibrary();
19082 GatheringErrorListener errorListener = new GatheringErrorListener(); 19419 GatheringErrorListener errorListener = new GatheringErrorListener();
19083 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi stener); 19420 ScopeTest_TestScope scope = new ScopeTest_TestScope(errorListener);
19084 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1")); 19421 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v1"));
19085 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v2")); 19422 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id entifier3("v2"));
19086 scope.define(element1); 19423 scope.define(element1);
19087 scope.define(element2); 19424 scope.define(element2);
19088 errorListener.assertNoErrors(); 19425 errorListener.assertNoErrors();
19089 } 19426 }
19090 void test_getDefiningLibrary() {
19091 LibraryElement definingLibrary = createTestLibrary();
19092 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, null);
19093 JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary);
19094 }
19095 void test_getErrorListener() { 19427 void test_getErrorListener() {
19096 LibraryElement definingLibrary = new LibraryElementImpl(new AnalysisContextI mpl(), ASTFactory.libraryIdentifier2(["test"]));
19097 GatheringErrorListener errorListener = new GatheringErrorListener(); 19428 GatheringErrorListener errorListener = new GatheringErrorListener();
19098 ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorLi stener); 19429 ScopeTest_TestScope scope = new ScopeTest_TestScope(errorListener);
19099 JUnitTestCase.assertEquals(errorListener, scope.errorListener); 19430 JUnitTestCase.assertEquals(errorListener, scope.errorListener);
19100 } 19431 }
19101 void test_isPrivateName_nonPrivate() { 19432 void test_isPrivateName_nonPrivate() {
19102 JUnitTestCase.assertFalse(Scope.isPrivateName("Public")); 19433 JUnitTestCase.assertFalse(Scope.isPrivateName("Public"));
19103 } 19434 }
19104 void test_isPrivateName_private() { 19435 void test_isPrivateName_private() {
19105 JUnitTestCase.assertTrue(Scope.isPrivateName("_Private")); 19436 JUnitTestCase.assertTrue(Scope.isPrivateName("_Private"));
19106 } 19437 }
19107 static dartSuite() { 19438 static dartSuite() {
19108 _ut.group('ScopeTest', () { 19439 _ut.group('ScopeTest', () {
19109 _ut.test('test_define_duplicate', () { 19440 _ut.test('test_define_duplicate', () {
19110 final __test = new ScopeTest(); 19441 final __test = new ScopeTest();
19111 runJUnitTest(__test, __test.test_define_duplicate); 19442 runJUnitTest(__test, __test.test_define_duplicate);
19112 }); 19443 });
19113 _ut.test('test_define_normal', () { 19444 _ut.test('test_define_normal', () {
19114 final __test = new ScopeTest(); 19445 final __test = new ScopeTest();
19115 runJUnitTest(__test, __test.test_define_normal); 19446 runJUnitTest(__test, __test.test_define_normal);
19116 }); 19447 });
19117 _ut.test('test_getDefiningLibrary', () {
19118 final __test = new ScopeTest();
19119 runJUnitTest(__test, __test.test_getDefiningLibrary);
19120 });
19121 _ut.test('test_getErrorListener', () { 19448 _ut.test('test_getErrorListener', () {
19122 final __test = new ScopeTest(); 19449 final __test = new ScopeTest();
19123 runJUnitTest(__test, __test.test_getErrorListener); 19450 runJUnitTest(__test, __test.test_getErrorListener);
19124 }); 19451 });
19125 _ut.test('test_isPrivateName_nonPrivate', () { 19452 _ut.test('test_isPrivateName_nonPrivate', () {
19126 final __test = new ScopeTest(); 19453 final __test = new ScopeTest();
19127 runJUnitTest(__test, __test.test_isPrivateName_nonPrivate); 19454 runJUnitTest(__test, __test.test_isPrivateName_nonPrivate);
19128 }); 19455 });
19129 _ut.test('test_isPrivateName_private', () { 19456 _ut.test('test_isPrivateName_private', () {
19130 final __test = new ScopeTest(); 19457 final __test = new ScopeTest();
19131 runJUnitTest(__test, __test.test_isPrivateName_private); 19458 runJUnitTest(__test, __test.test_isPrivateName_private);
19132 }); 19459 });
19133 }); 19460 });
19134 } 19461 }
19135 } 19462 }
19136 /** 19463 /**
19137 * A non-abstract subclass that can be used for testing purposes. 19464 * A non-abstract subclass that can be used for testing purposes.
19138 */ 19465 */
19139 class ScopeTest_TestScope extends Scope { 19466 class ScopeTest_TestScope extends Scope {
19140 19467
19141 /** 19468 /**
19142 * The element representing the library in which this scope is enclosed.
19143 */
19144 LibraryElement _definingLibrary;
19145
19146 /**
19147 * The listener that is to be informed when an error is encountered. 19469 * The listener that is to be informed when an error is encountered.
19148 */ 19470 */
19149 AnalysisErrorListener _errorListener; 19471 AnalysisErrorListener _errorListener;
19150 ScopeTest_TestScope(LibraryElement definingLibrary, AnalysisErrorListener erro rListener) { 19472 ScopeTest_TestScope(AnalysisErrorListener errorListener) {
19151 this._definingLibrary = definingLibrary;
19152 this._errorListener = errorListener; 19473 this._errorListener = errorListener;
19153 } 19474 }
19154 LibraryElement get definingLibrary => _definingLibrary;
19155 AnalysisErrorListener get errorListener => _errorListener; 19475 AnalysisErrorListener get errorListener => _errorListener;
19156 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => localLookup(name, referencingLibrary); 19476 Element lookup3(Identifier identifier, String name, LibraryElement referencing Library) => localLookup(name, referencingLibrary);
19157 } 19477 }
19158 class SimpleResolverTest extends ResolverTestCase { 19478 class SimpleResolverTest extends ResolverTestCase {
19159 void fail_staticInvocation() { 19479 void fail_staticInvocation() {
19160 Source source = addSource(EngineTestCase.createSource([ 19480 Source source = addSource(EngineTestCase.createSource([
19161 "class A {", 19481 "class A {",
19162 " static int get g => (a,b) => 0;", 19482 " static int get g => (a,b) => 0;",
19163 "}", 19483 "}",
19164 "class B {", 19484 "class B {",
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
20035 // ErrorResolverTest.dartSuite(); 20355 // ErrorResolverTest.dartSuite();
20036 // HintCodeTest.dartSuite(); 20356 // HintCodeTest.dartSuite();
20037 // MemberMapTest.dartSuite(); 20357 // MemberMapTest.dartSuite();
20038 // NonHintCodeTest.dartSuite(); 20358 // NonHintCodeTest.dartSuite();
20039 // NonErrorResolverTest.dartSuite(); 20359 // NonErrorResolverTest.dartSuite();
20040 // SimpleResolverTest.dartSuite(); 20360 // SimpleResolverTest.dartSuite();
20041 // StaticTypeWarningCodeTest.dartSuite(); 20361 // StaticTypeWarningCodeTest.dartSuite();
20042 // StaticWarningCodeTest.dartSuite(); 20362 // StaticWarningCodeTest.dartSuite();
20043 // StrictModeTest.dartSuite(); 20363 // StrictModeTest.dartSuite();
20044 // TypePropagationTest.dartSuite(); 20364 // TypePropagationTest.dartSuite();
20045 } 20365 }
OLDNEW
« no previous file with comments | « dart/pkg/analyzer/test/generated/parser_test.dart ('k') | dart/pkg/analyzer/test/generated/scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698