| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.resolver_test; | 3 library engine.resolver_test; |
| 4 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 4 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 5 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/source_io.dart'; | 6 import 'package:analyzer_experimental/src/generated/source_io.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/error.dart'; | 7 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 8 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/ast.dart'; | 9 import 'package:analyzer_experimental/src/generated/ast.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; | 10 import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErro
rCode; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 "class A {}", | 417 "class A {}", |
| 418 "class B extends A {", | 418 "class B extends A {", |
| 419 " B m() => this;", | 419 " B m() => this;", |
| 420 "}", | 420 "}", |
| 421 "A f(A p) {", | 421 "A f(A p) {", |
| 422 " if (p is B) {", | 422 " if (p is B) {", |
| 423 " return p.m();", | 423 " return p.m();", |
| 424 " }", | 424 " }", |
| 425 "}"])); | 425 "}"])); |
| 426 LibraryElement library = resolve(source); | 426 LibraryElement library = resolve(source); |
| 427 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]); | 427 assertNoErrors(source); |
| 428 CompilationUnit unit = resolveCompilationUnit(source, library); | 428 CompilationUnit unit = resolveCompilationUnit(source, library); |
| 429 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; | 429 FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration; |
| 430 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; | 430 BlockFunctionBody body = function.functionExpression.body as BlockFunctionBo
dy; |
| 431 IfStatement ifStatement = body.block.statements[0] as IfStatement; | 431 IfStatement ifStatement = body.block.statements[0] as IfStatement; |
| 432 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; | 432 ReturnStatement statement = ((ifStatement.thenStatement as Block)).statement
s[0] as ReturnStatement; |
| 433 MethodInvocation invocation = statement.expression as MethodInvocation; | 433 MethodInvocation invocation = statement.expression as MethodInvocation; |
| 434 JUnitTestCase.assertNotNull(invocation.methodName.propagatedElement); | 434 JUnitTestCase.assertNotNull(invocation.methodName.propagatedElement); |
| 435 } | 435 } |
| 436 void test_is_while() { | 436 void test_is_while() { |
| 437 Source source = addSource(EngineTestCase.createSource([ | 437 Source source = addSource(EngineTestCase.createSource([ |
| (...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2366 resolve(source); | 2366 resolve(source); |
| 2367 assertNoErrors(source); | 2367 assertNoErrors(source); |
| 2368 verify([source]); | 2368 verify([source]); |
| 2369 } | 2369 } |
| 2370 void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() { | 2370 void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() { |
| 2371 Source source = addSource(EngineTestCase.createSource(["int get x => 0;", "s
et x(v) {}"])); | 2371 Source source = addSource(EngineTestCase.createSource(["int get x => 0;", "s
et x(v) {}"])); |
| 2372 resolve(source); | 2372 resolve(source); |
| 2373 assertNoErrors(source); | 2373 assertNoErrors(source); |
| 2374 verify([source]); | 2374 verify([source]); |
| 2375 } | 2375 } |
| 2376 void test_mixedReturnTypes_differentScopes() { |
| 2377 Source source = addSource(EngineTestCase.createSource([ |
| 2378 "class C {", |
| 2379 " m(int x) {", |
| 2380 " f(int y) {", |
| 2381 " return;", |
| 2382 " }", |
| 2383 " f(x);", |
| 2384 " return 0;", |
| 2385 " }", |
| 2386 "}"])); |
| 2387 resolve(source); |
| 2388 assertNoErrors(source); |
| 2389 verify([source]); |
| 2390 } |
| 2391 void test_mixedReturnTypes_sameKind() { |
| 2392 Source source = addSource(EngineTestCase.createSource([ |
| 2393 "class C {", |
| 2394 " m(int x) {", |
| 2395 " if (x < 0) {", |
| 2396 " return 1;", |
| 2397 " }", |
| 2398 " return 0;", |
| 2399 " }", |
| 2400 "}"])); |
| 2401 resolve(source); |
| 2402 assertNoErrors(source); |
| 2403 verify([source]); |
| 2404 } |
| 2376 void test_mixinDeclaresConstructor() { | 2405 void test_mixinDeclaresConstructor() { |
| 2377 Source source = addSource(EngineTestCase.createSource([ | 2406 Source source = addSource(EngineTestCase.createSource([ |
| 2378 "class A {", | 2407 "class A {", |
| 2379 " m() {}", | 2408 " m() {}", |
| 2380 "}", | 2409 "}", |
| 2381 "class B extends Object with A {}"])); | 2410 "class B extends Object with A {}"])); |
| 2382 resolve(source); | 2411 resolve(source); |
| 2383 assertNoErrors(source); | 2412 assertNoErrors(source); |
| 2384 verify([source]); | 2413 verify([source]); |
| 2385 } | 2414 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 "}", | 2510 "}", |
| 2482 "abstract class B extends A {", | 2511 "abstract class B extends A {", |
| 2483 " m(p);", | 2512 " m(p);", |
| 2484 "}", | 2513 "}", |
| 2485 "class C extends B {", | 2514 "class C extends B {", |
| 2486 "}"])); | 2515 "}"])); |
| 2487 resolve(source); | 2516 resolve(source); |
| 2488 assertNoErrors(source); | 2517 assertNoErrors(source); |
| 2489 verify([source]); | 2518 verify([source]); |
| 2490 } | 2519 } |
| 2520 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_accessor() { |
| 2521 Source source = addSource(EngineTestCase.createSource([ |
| 2522 "abstract class A {", |
| 2523 " int get g;", |
| 2524 "}", |
| 2525 "class B extends A {", |
| 2526 " noSuchMethod(v) => '';", |
| 2527 "}"])); |
| 2528 resolve(source); |
| 2529 assertNoErrors(source); |
| 2530 verify([source]); |
| 2531 } |
| 2532 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_method() { |
| 2533 Source source = addSource(EngineTestCase.createSource([ |
| 2534 "abstract class A {", |
| 2535 " m(p);", |
| 2536 "}", |
| 2537 "class B extends A {", |
| 2538 " noSuchMethod(v) => '';", |
| 2539 "}"])); |
| 2540 resolve(source); |
| 2541 assertNoErrors(source); |
| 2542 verify([source]); |
| 2543 } |
| 2491 void test_nonBoolExpression_functionType() { | 2544 void test_nonBoolExpression_functionType() { |
| 2492 Source source = addSource(EngineTestCase.createSource([ | 2545 Source source = addSource(EngineTestCase.createSource([ |
| 2493 "bool makeAssertion() => true;", | 2546 "bool makeAssertion() => true;", |
| 2494 "f() {", | 2547 "f() {", |
| 2495 " assert(makeAssertion);", | 2548 " assert(makeAssertion);", |
| 2496 "}"])); | 2549 "}"])); |
| 2497 resolve(source); | 2550 resolve(source); |
| 2498 assertNoErrors(source); | 2551 assertNoErrors(source); |
| 2499 verify([source]); | 2552 verify([source]); |
| 2500 } | 2553 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2837 "import 'lib.dart' as p;", | 2890 "import 'lib.dart' as p;", |
| 2838 "typedef P();", | 2891 "typedef P();", |
| 2839 "p2() {}", | 2892 "p2() {}", |
| 2840 "var p3;", | 2893 "var p3;", |
| 2841 "class p4 {}", | 2894 "class p4 {}", |
| 2842 "p.A a;"])); | 2895 "p.A a;"])); |
| 2843 resolve(source); | 2896 resolve(source); |
| 2844 assertNoErrors(source); | 2897 assertNoErrors(source); |
| 2845 verify([source]); | 2898 verify([source]); |
| 2846 } | 2899 } |
| 2847 void test_propagateTypeArgsIntoBounds() { | 2900 void test_propagateTypeArgs_intoBounds() { |
| 2848 Source source = addSource(EngineTestCase.createSource([ | 2901 Source source = addSource(EngineTestCase.createSource([ |
| 2849 "abstract class A<E> {}", | 2902 "abstract class A<E> {}", |
| 2850 "abstract class B<F> implements A<F>{}", | 2903 "abstract class B<F> implements A<F>{}", |
| 2851 "abstract class C<G, H extends A<G>> {}", | 2904 "abstract class C<G, H extends A<G>> {}", |
| 2852 "class D<I> extends C<I, B<I>> {}"])); | 2905 "class D<I> extends C<I, B<I>> {}"])); |
| 2853 resolve(source); | 2906 resolve(source); |
| 2854 assertNoErrors(source); | 2907 assertNoErrors(source); |
| 2855 verify([source]); | 2908 verify([source]); |
| 2856 } | 2909 } |
| 2910 void test_propagateTypeArgs_intoSupertype() { |
| 2911 Source source = addSource(EngineTestCase.createSource([ |
| 2912 "class A<T> {", |
| 2913 " A(T p);", |
| 2914 " A.named(T p);", |
| 2915 "}", |
| 2916 "class B<S> extends A<S> {", |
| 2917 " B(S p) : super(p);", |
| 2918 " B.named(S p) : super.named(p);", |
| 2919 "}"])); |
| 2920 resolve(source); |
| 2921 assertNoErrors(source); |
| 2922 verify([source]); |
| 2923 } |
| 2857 void test_proxy_annotation_prefixed() { | 2924 void test_proxy_annotation_prefixed() { |
| 2858 Source source = addSource(EngineTestCase.createSource([ | 2925 Source source = addSource(EngineTestCase.createSource([ |
| 2859 "library L;", | 2926 "library L;", |
| 2860 "import 'meta.dart';", | 2927 "import 'meta.dart';", |
| 2861 "@proxy", | 2928 "@proxy", |
| 2862 "class A {}", | 2929 "class A {}", |
| 2863 "f(A a) {", | 2930 "f(A a) {", |
| 2864 " a.m();", | 2931 " a.m();", |
| 2865 " var x = a.g;", | 2932 " var x = a.g;", |
| 2866 " a.s = 1;", | 2933 " a.s = 1;", |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3195 resolve(source); | 3262 resolve(source); |
| 3196 assertNoErrors(source); | 3263 assertNoErrors(source); |
| 3197 verify([source]); | 3264 verify([source]); |
| 3198 } | 3265 } |
| 3199 void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() { | 3266 void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() { |
| 3200 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "cl
ass B {", " A a;", "}"])); | 3267 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "cl
ass B {", " A a;", "}"])); |
| 3201 resolve(source); | 3268 resolve(source); |
| 3202 assertNoErrors(source); | 3269 assertNoErrors(source); |
| 3203 verify([source]); | 3270 verify([source]); |
| 3204 } | 3271 } |
| 3205 void test_typeAliasCannotReferenceItself_typeParameterBounds() { | |
| 3206 Source source = addSource(EngineTestCase.createSource(["typedef A<T extends
A>();"])); | |
| 3207 resolve(source); | |
| 3208 assertNoErrors(source); | |
| 3209 verify([source]); | |
| 3210 } | |
| 3211 void test_typeArgumentNotMatchingBounds_const() { | 3272 void test_typeArgumentNotMatchingBounds_const() { |
| 3212 Source source = addSource(EngineTestCase.createSource([ | 3273 Source source = addSource(EngineTestCase.createSource([ |
| 3213 "class A {}", | 3274 "class A {}", |
| 3214 "class B extends A {}", | 3275 "class B extends A {}", |
| 3215 "class G<E extends A> {", | 3276 "class G<E extends A> {", |
| 3216 " const G();", | 3277 " const G();", |
| 3217 "}", | 3278 "}", |
| 3218 "f() { return const G<B>(); }"])); | 3279 "f() { return const G<B>(); }"])); |
| 3219 resolve(source); | 3280 resolve(source); |
| 3220 assertNoErrors(source); | 3281 assertNoErrors(source); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3241 resolve(source); | 3302 resolve(source); |
| 3242 assertNoErrors(source); | 3303 assertNoErrors(source); |
| 3243 verify([source]); | 3304 verify([source]); |
| 3244 } | 3305 } |
| 3245 void test_typeArgumentNotMatchingBounds_typeArgumentList_20() { | 3306 void test_typeArgumentNotMatchingBounds_typeArgumentList_20() { |
| 3246 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A>>>>>>>>>>>>>>>>>>>>>{}"])); | 3307 Source source = addSource(EngineTestCase.createSource(["abstract class A<T e
xtends A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A>>>>>>>>>>>>>>>>>>>>>{}"])); |
| 3247 resolve(source); | 3308 resolve(source); |
| 3248 assertNoErrors(source); | 3309 assertNoErrors(source); |
| 3249 verify([source]); | 3310 verify([source]); |
| 3250 } | 3311 } |
| 3312 void test_typePromotion_booleanAnd_useInRight() { |
| 3313 Source source = addSource(EngineTestCase.createSource([ |
| 3314 "main(Object p) {", |
| 3315 " p is String && p.length != 0;", |
| 3316 "}"])); |
| 3317 resolve(source); |
| 3318 assertNoErrors(source); |
| 3319 verify([source]); |
| 3320 } |
| 3321 void test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_noAssignm
ent() { |
| 3322 Source source = addSource(EngineTestCase.createSource([ |
| 3323 "callMe(f()) { f(); }", |
| 3324 "main(Object p) {", |
| 3325 " (p is String) && callMe(() { p.length; });", |
| 3326 "}"])); |
| 3327 resolve(source); |
| 3328 assertNoErrors(source); |
| 3329 verify([source]); |
| 3330 } |
| 3331 void test_typePromotion_conditional_useInThen() { |
| 3332 Source source = addSource(EngineTestCase.createSource(["main(Object p) {", "
p is String ? p.length : 0;", "}"])); |
| 3333 resolve(source); |
| 3334 assertNoErrors(source); |
| 3335 verify([source]); |
| 3336 } |
| 3337 void test_typePromotion_conditional_useInThen_accessedInClosure_noAssignment()
{ |
| 3338 Source source = addSource(EngineTestCase.createSource([ |
| 3339 "callMe(f()) { f(); }", |
| 3340 "main(Object p) {", |
| 3341 " p is String ? callMe(() { p.length; }) : 0;", |
| 3342 "}"])); |
| 3343 resolve(source); |
| 3344 assertNoErrors(source); |
| 3345 verify([source]); |
| 3346 } |
| 3347 void test_typePromotion_functionType_arg_ignoreIfNotMoreSpecific() { |
| 3348 Source source = addSource(EngineTestCase.createSource([ |
| 3349 "typedef FuncB(B b);", |
| 3350 "typedef FuncA(A a);", |
| 3351 "class A {}", |
| 3352 "class B {}", |
| 3353 "main(FuncA f) {", |
| 3354 " if (f is FuncB) {", |
| 3355 " f(new A());", |
| 3356 " }", |
| 3357 "}"])); |
| 3358 resolve(source); |
| 3359 assertNoErrors(source); |
| 3360 verify([source]); |
| 3361 } |
| 3362 void test_typePromotion_functionType_return_ignoreIfNotMoreSpecific() { |
| 3363 Source source = addSource(EngineTestCase.createSource([ |
| 3364 "typedef FuncDynToDyn(x);", |
| 3365 "typedef void FuncDynToVoid(x);", |
| 3366 "class A {}", |
| 3367 "main(FuncDynToDyn f) {", |
| 3368 " if (f is FuncDynToVoid) {", |
| 3369 " A a = f(null);", |
| 3370 " }", |
| 3371 "}"])); |
| 3372 resolve(source); |
| 3373 assertNoErrors(source); |
| 3374 verify([source]); |
| 3375 } |
| 3376 void test_typePromotion_functionType_return_voidToDynamic() { |
| 3377 Source source = addSource(EngineTestCase.createSource([ |
| 3378 "typedef FuncDynToDyn(x);", |
| 3379 "typedef void FuncDynToVoid(x);", |
| 3380 "class A {}", |
| 3381 "main(FuncDynToVoid f) {", |
| 3382 " if (f is FuncDynToDyn) {", |
| 3383 " A a = f(null);", |
| 3384 " }", |
| 3385 "}"])); |
| 3386 resolve(source); |
| 3387 assertNoErrors(source); |
| 3388 verify([source]); |
| 3389 } |
| 3390 void test_typePromotion_if_accessedInClosure_noAssignment() { |
| 3391 Source source = addSource(EngineTestCase.createSource([ |
| 3392 "callMe(f()) { f(); }", |
| 3393 "main(Object p) {", |
| 3394 " if (p is String) {", |
| 3395 " callMe(() {", |
| 3396 " p.length;", |
| 3397 " });", |
| 3398 " }", |
| 3399 "}"])); |
| 3400 resolve(source); |
| 3401 assertNoErrors(source); |
| 3402 verify([source]); |
| 3403 } |
| 3404 void test_typePromotion_if_hasAssignment_outsideAfter() { |
| 3405 Source source = addSource(EngineTestCase.createSource([ |
| 3406 "main(Object p) {", |
| 3407 " if (p is String) {", |
| 3408 " p.length;", |
| 3409 " }", |
| 3410 " p = 0;", |
| 3411 "}"])); |
| 3412 resolve(source); |
| 3413 assertNoErrors(source); |
| 3414 verify([source]); |
| 3415 } |
| 3416 void test_typePromotion_if_hasAssignment_outsideBefore() { |
| 3417 Source source = addSource(EngineTestCase.createSource([ |
| 3418 "main(Object p, Object p2) {", |
| 3419 " p = p2;", |
| 3420 " if (p is String) {", |
| 3421 " p.length;", |
| 3422 " }", |
| 3423 "}"])); |
| 3424 resolve(source); |
| 3425 assertNoErrors(source); |
| 3426 verify([source]); |
| 3427 } |
| 3428 void test_typePromotion_if_is_and_left() { |
| 3429 Source source = addSource(EngineTestCase.createSource([ |
| 3430 "bool tt() => true;", |
| 3431 "main(Object p) {", |
| 3432 " if (p is String && tt()) {", |
| 3433 " p.length;", |
| 3434 " }", |
| 3435 "}"])); |
| 3436 resolve(source); |
| 3437 assertNoErrors(source); |
| 3438 verify([source]); |
| 3439 } |
| 3440 void test_typePromotion_if_is_and_right() { |
| 3441 Source source = addSource(EngineTestCase.createSource([ |
| 3442 "bool tt() => true;", |
| 3443 "main(Object p) {", |
| 3444 " if (tt() && p is String) {", |
| 3445 " p.length;", |
| 3446 " }", |
| 3447 "}"])); |
| 3448 resolve(source); |
| 3449 assertNoErrors(source); |
| 3450 verify([source]); |
| 3451 } |
| 3452 void test_typePromotion_if_is_and_subThenSuper() { |
| 3453 Source source = addSource(EngineTestCase.createSource([ |
| 3454 "class A {", |
| 3455 " var a;", |
| 3456 "}", |
| 3457 "class B extends A {", |
| 3458 " var b;", |
| 3459 "}", |
| 3460 "main(Object p) {", |
| 3461 " if (p is B && p is A) {", |
| 3462 " p.a;", |
| 3463 " p.b;", |
| 3464 " }", |
| 3465 "}"])); |
| 3466 resolve(source); |
| 3467 assertNoErrors(source); |
| 3468 verify([source]); |
| 3469 } |
| 3470 void test_typePromotion_if_is_parenthesized() { |
| 3471 Source source = addSource(EngineTestCase.createSource([ |
| 3472 "main(Object p) {", |
| 3473 " if ((p is String)) {", |
| 3474 " p.length;", |
| 3475 " }", |
| 3476 "}"])); |
| 3477 resolve(source); |
| 3478 assertNoErrors(source); |
| 3479 verify([source]); |
| 3480 } |
| 3481 void test_typePromotion_if_is_single() { |
| 3482 Source source = addSource(EngineTestCase.createSource([ |
| 3483 "main(Object p) {", |
| 3484 " if (p is String) {", |
| 3485 " p.length;", |
| 3486 " }", |
| 3487 "}"])); |
| 3488 resolve(source); |
| 3489 assertNoErrors(source); |
| 3490 verify([source]); |
| 3491 } |
| 3251 void test_undefinedConstructorInInitializer_explicit_named() { | 3492 void test_undefinedConstructorInInitializer_explicit_named() { |
| 3252 Source source = addSource(EngineTestCase.createSource([ | 3493 Source source = addSource(EngineTestCase.createSource([ |
| 3253 "class A {", | 3494 "class A {", |
| 3254 " A.named() {}", | 3495 " A.named() {}", |
| 3255 "}", | 3496 "}", |
| 3256 "class B extends A {", | 3497 "class B extends A {", |
| 3257 " B() : super.named();", | 3498 " B() : super.named();", |
| 3258 "}"])); | 3499 "}"])); |
| 3259 resolve(source); | 3500 resolve(source); |
| 3260 assertNoErrors(source); | 3501 assertNoErrors(source); |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4051 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_topLevel
_sameTypes); | 4292 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_topLevel
_sameTypes); |
| 4052 }); | 4293 }); |
| 4053 _ut.test('test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedGetter',
() { | 4294 _ut.test('test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedGetter',
() { |
| 4054 final __test = new NonErrorResolverTest(); | 4295 final __test = new NonErrorResolverTest(); |
| 4055 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_topLevel
_unspecifiedGetter); | 4296 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_topLevel
_unspecifiedGetter); |
| 4056 }); | 4297 }); |
| 4057 _ut.test('test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter',
() { | 4298 _ut.test('test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter',
() { |
| 4058 final __test = new NonErrorResolverTest(); | 4299 final __test = new NonErrorResolverTest(); |
| 4059 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_topLevel
_unspecifiedSetter); | 4300 runJUnitTest(__test, __test.test_misMatchedGetterAndSetterTypes_topLevel
_unspecifiedSetter); |
| 4060 }); | 4301 }); |
| 4302 _ut.test('test_mixedReturnTypes_differentScopes', () { |
| 4303 final __test = new NonErrorResolverTest(); |
| 4304 runJUnitTest(__test, __test.test_mixedReturnTypes_differentScopes); |
| 4305 }); |
| 4306 _ut.test('test_mixedReturnTypes_sameKind', () { |
| 4307 final __test = new NonErrorResolverTest(); |
| 4308 runJUnitTest(__test, __test.test_mixedReturnTypes_sameKind); |
| 4309 }); |
| 4061 _ut.test('test_mixinDeclaresConstructor', () { | 4310 _ut.test('test_mixinDeclaresConstructor', () { |
| 4062 final __test = new NonErrorResolverTest(); | 4311 final __test = new NonErrorResolverTest(); |
| 4063 runJUnitTest(__test, __test.test_mixinDeclaresConstructor); | 4312 runJUnitTest(__test, __test.test_mixinDeclaresConstructor); |
| 4064 }); | 4313 }); |
| 4065 _ut.test('test_mixinDeclaresConstructor_factory', () { | 4314 _ut.test('test_mixinDeclaresConstructor_factory', () { |
| 4066 final __test = new NonErrorResolverTest(); | 4315 final __test = new NonErrorResolverTest(); |
| 4067 runJUnitTest(__test, __test.test_mixinDeclaresConstructor_factory); | 4316 runJUnitTest(__test, __test.test_mixinDeclaresConstructor_factory); |
| 4068 }); | 4317 }); |
| 4069 _ut.test('test_mixinInheritsFromNotObject_classDeclaration_mixTypeAlias',
() { | 4318 _ut.test('test_mixinInheritsFromNotObject_classDeclaration_mixTypeAlias',
() { |
| 4070 final __test = new NonErrorResolverTest(); | 4319 final __test = new NonErrorResolverTest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4095 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); | 4344 runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault); |
| 4096 }); | 4345 }); |
| 4097 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_accessor', () { | 4346 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_accessor', () { |
| 4098 final __test = new NonErrorResolverTest(); | 4347 final __test = new NonErrorResolverTest(); |
| 4099 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_accessor); | 4348 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_accessor); |
| 4100 }); | 4349 }); |
| 4101 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_method', () { | 4350 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverrides
Concrete_method', () { |
| 4102 final __test = new NonErrorResolverTest(); | 4351 final __test = new NonErrorResolverTest(); |
| 4103 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_method); | 4352 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_abstractOverridesConcrete_method); |
| 4104 }); | 4353 }); |
| 4354 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_acce
ssor', () { |
| 4355 final __test = new NonErrorResolverTest(); |
| 4356 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod_accessor); |
| 4357 }); |
| 4358 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_meth
od', () { |
| 4359 final __test = new NonErrorResolverTest(); |
| 4360 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_noSuchMethod_method); |
| 4361 }); |
| 4105 _ut.test('test_nonBoolExpression_functionType', () { | 4362 _ut.test('test_nonBoolExpression_functionType', () { |
| 4106 final __test = new NonErrorResolverTest(); | 4363 final __test = new NonErrorResolverTest(); |
| 4107 runJUnitTest(__test, __test.test_nonBoolExpression_functionType); | 4364 runJUnitTest(__test, __test.test_nonBoolExpression_functionType); |
| 4108 }); | 4365 }); |
| 4109 _ut.test('test_nonBoolExpression_interfaceType', () { | 4366 _ut.test('test_nonBoolExpression_interfaceType', () { |
| 4110 final __test = new NonErrorResolverTest(); | 4367 final __test = new NonErrorResolverTest(); |
| 4111 runJUnitTest(__test, __test.test_nonBoolExpression_interfaceType); | 4368 runJUnitTest(__test, __test.test_nonBoolExpression_interfaceType); |
| 4112 }); | 4369 }); |
| 4113 _ut.test('test_nonConstCaseExpression', () { | 4370 _ut.test('test_nonConstCaseExpression', () { |
| 4114 final __test = new NonErrorResolverTest(); | 4371 final __test = new NonErrorResolverTest(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4239 runJUnitTest(__test, __test.test_null_callOperator); | 4496 runJUnitTest(__test, __test.test_null_callOperator); |
| 4240 }); | 4497 }); |
| 4241 _ut.test('test_optionalParameterInOperator_required', () { | 4498 _ut.test('test_optionalParameterInOperator_required', () { |
| 4242 final __test = new NonErrorResolverTest(); | 4499 final __test = new NonErrorResolverTest(); |
| 4243 runJUnitTest(__test, __test.test_optionalParameterInOperator_required); | 4500 runJUnitTest(__test, __test.test_optionalParameterInOperator_required); |
| 4244 }); | 4501 }); |
| 4245 _ut.test('test_prefixCollidesWithTopLevelMembers', () { | 4502 _ut.test('test_prefixCollidesWithTopLevelMembers', () { |
| 4246 final __test = new NonErrorResolverTest(); | 4503 final __test = new NonErrorResolverTest(); |
| 4247 runJUnitTest(__test, __test.test_prefixCollidesWithTopLevelMembers); | 4504 runJUnitTest(__test, __test.test_prefixCollidesWithTopLevelMembers); |
| 4248 }); | 4505 }); |
| 4249 _ut.test('test_propagateTypeArgsIntoBounds', () { | 4506 _ut.test('test_propagateTypeArgs_intoBounds', () { |
| 4250 final __test = new NonErrorResolverTest(); | 4507 final __test = new NonErrorResolverTest(); |
| 4251 runJUnitTest(__test, __test.test_propagateTypeArgsIntoBounds); | 4508 runJUnitTest(__test, __test.test_propagateTypeArgs_intoBounds); |
| 4509 }); |
| 4510 _ut.test('test_propagateTypeArgs_intoSupertype', () { |
| 4511 final __test = new NonErrorResolverTest(); |
| 4512 runJUnitTest(__test, __test.test_propagateTypeArgs_intoSupertype); |
| 4252 }); | 4513 }); |
| 4253 _ut.test('test_proxy_annotation_prefixed', () { | 4514 _ut.test('test_proxy_annotation_prefixed', () { |
| 4254 final __test = new NonErrorResolverTest(); | 4515 final __test = new NonErrorResolverTest(); |
| 4255 runJUnitTest(__test, __test.test_proxy_annotation_prefixed); | 4516 runJUnitTest(__test, __test.test_proxy_annotation_prefixed); |
| 4256 }); | 4517 }); |
| 4257 _ut.test('test_proxy_annotation_prefixed2', () { | 4518 _ut.test('test_proxy_annotation_prefixed2', () { |
| 4258 final __test = new NonErrorResolverTest(); | 4519 final __test = new NonErrorResolverTest(); |
| 4259 runJUnitTest(__test, __test.test_proxy_annotation_prefixed2); | 4520 runJUnitTest(__test, __test.test_proxy_annotation_prefixed2); |
| 4260 }); | 4521 }); |
| 4261 _ut.test('test_proxy_annotation_prefixed3', () { | 4522 _ut.test('test_proxy_annotation_prefixed3', () { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4351 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_propertyAc
cess_propertyAccessor); | 4612 runJUnitTest(__test, __test.test_staticAccessToInstanceMember_propertyAc
cess_propertyAccessor); |
| 4352 }); | 4613 }); |
| 4353 _ut.test('test_superInInvalidContext', () { | 4614 _ut.test('test_superInInvalidContext', () { |
| 4354 final __test = new NonErrorResolverTest(); | 4615 final __test = new NonErrorResolverTest(); |
| 4355 runJUnitTest(__test, __test.test_superInInvalidContext); | 4616 runJUnitTest(__test, __test.test_superInInvalidContext); |
| 4356 }); | 4617 }); |
| 4357 _ut.test('test_typeAliasCannotReferenceItself_returnClass_withTypeAlias',
() { | 4618 _ut.test('test_typeAliasCannotReferenceItself_returnClass_withTypeAlias',
() { |
| 4358 final __test = new NonErrorResolverTest(); | 4619 final __test = new NonErrorResolverTest(); |
| 4359 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnCl
ass_withTypeAlias); | 4620 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnCl
ass_withTypeAlias); |
| 4360 }); | 4621 }); |
| 4361 _ut.test('test_typeAliasCannotReferenceItself_typeParameterBounds', () { | |
| 4362 final __test = new NonErrorResolverTest(); | |
| 4363 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_typePara
meterBounds); | |
| 4364 }); | |
| 4365 _ut.test('test_typeArgumentNotMatchingBounds_const', () { | 4622 _ut.test('test_typeArgumentNotMatchingBounds_const', () { |
| 4366 final __test = new NonErrorResolverTest(); | 4623 final __test = new NonErrorResolverTest(); |
| 4367 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); | 4624 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const); |
| 4368 }); | 4625 }); |
| 4369 _ut.test('test_typeArgumentNotMatchingBounds_new', () { | 4626 _ut.test('test_typeArgumentNotMatchingBounds_new', () { |
| 4370 final __test = new NonErrorResolverTest(); | 4627 final __test = new NonErrorResolverTest(); |
| 4371 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); | 4628 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_new); |
| 4372 }); | 4629 }); |
| 4373 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_0', () { | 4630 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_0', () { |
| 4374 final __test = new NonErrorResolverTest(); | 4631 final __test = new NonErrorResolverTest(); |
| 4375 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgum
entList_0); | 4632 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgum
entList_0); |
| 4376 }); | 4633 }); |
| 4377 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_1', () { | 4634 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_1', () { |
| 4378 final __test = new NonErrorResolverTest(); | 4635 final __test = new NonErrorResolverTest(); |
| 4379 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgum
entList_1); | 4636 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgum
entList_1); |
| 4380 }); | 4637 }); |
| 4381 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_20', () { | 4638 _ut.test('test_typeArgumentNotMatchingBounds_typeArgumentList_20', () { |
| 4382 final __test = new NonErrorResolverTest(); | 4639 final __test = new NonErrorResolverTest(); |
| 4383 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgum
entList_20); | 4640 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_typeArgum
entList_20); |
| 4384 }); | 4641 }); |
| 4642 _ut.test('test_typePromotion_booleanAnd_useInRight', () { |
| 4643 final __test = new NonErrorResolverTest(); |
| 4644 runJUnitTest(__test, __test.test_typePromotion_booleanAnd_useInRight); |
| 4645 }); |
| 4646 _ut.test('test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_
noAssignment', () { |
| 4647 final __test = new NonErrorResolverTest(); |
| 4648 runJUnitTest(__test, __test.test_typePromotion_booleanAnd_useInRight_acc
essedInClosureRight_noAssignment); |
| 4649 }); |
| 4650 _ut.test('test_typePromotion_conditional_useInThen', () { |
| 4651 final __test = new NonErrorResolverTest(); |
| 4652 runJUnitTest(__test, __test.test_typePromotion_conditional_useInThen); |
| 4653 }); |
| 4654 _ut.test('test_typePromotion_conditional_useInThen_accessedInClosure_noAss
ignment', () { |
| 4655 final __test = new NonErrorResolverTest(); |
| 4656 runJUnitTest(__test, __test.test_typePromotion_conditional_useInThen_acc
essedInClosure_noAssignment); |
| 4657 }); |
| 4658 _ut.test('test_typePromotion_functionType_arg_ignoreIfNotMoreSpecific', ()
{ |
| 4659 final __test = new NonErrorResolverTest(); |
| 4660 runJUnitTest(__test, __test.test_typePromotion_functionType_arg_ignoreIf
NotMoreSpecific); |
| 4661 }); |
| 4662 _ut.test('test_typePromotion_functionType_return_ignoreIfNotMoreSpecific',
() { |
| 4663 final __test = new NonErrorResolverTest(); |
| 4664 runJUnitTest(__test, __test.test_typePromotion_functionType_return_ignor
eIfNotMoreSpecific); |
| 4665 }); |
| 4666 _ut.test('test_typePromotion_functionType_return_voidToDynamic', () { |
| 4667 final __test = new NonErrorResolverTest(); |
| 4668 runJUnitTest(__test, __test.test_typePromotion_functionType_return_voidT
oDynamic); |
| 4669 }); |
| 4670 _ut.test('test_typePromotion_if_accessedInClosure_noAssignment', () { |
| 4671 final __test = new NonErrorResolverTest(); |
| 4672 runJUnitTest(__test, __test.test_typePromotion_if_accessedInClosure_noAs
signment); |
| 4673 }); |
| 4674 _ut.test('test_typePromotion_if_hasAssignment_outsideAfter', () { |
| 4675 final __test = new NonErrorResolverTest(); |
| 4676 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_outsideA
fter); |
| 4677 }); |
| 4678 _ut.test('test_typePromotion_if_hasAssignment_outsideBefore', () { |
| 4679 final __test = new NonErrorResolverTest(); |
| 4680 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_outsideB
efore); |
| 4681 }); |
| 4682 _ut.test('test_typePromotion_if_is_and_left', () { |
| 4683 final __test = new NonErrorResolverTest(); |
| 4684 runJUnitTest(__test, __test.test_typePromotion_if_is_and_left); |
| 4685 }); |
| 4686 _ut.test('test_typePromotion_if_is_and_right', () { |
| 4687 final __test = new NonErrorResolverTest(); |
| 4688 runJUnitTest(__test, __test.test_typePromotion_if_is_and_right); |
| 4689 }); |
| 4690 _ut.test('test_typePromotion_if_is_and_subThenSuper', () { |
| 4691 final __test = new NonErrorResolverTest(); |
| 4692 runJUnitTest(__test, __test.test_typePromotion_if_is_and_subThenSuper); |
| 4693 }); |
| 4694 _ut.test('test_typePromotion_if_is_parenthesized', () { |
| 4695 final __test = new NonErrorResolverTest(); |
| 4696 runJUnitTest(__test, __test.test_typePromotion_if_is_parenthesized); |
| 4697 }); |
| 4698 _ut.test('test_typePromotion_if_is_single', () { |
| 4699 final __test = new NonErrorResolverTest(); |
| 4700 runJUnitTest(__test, __test.test_typePromotion_if_is_single); |
| 4701 }); |
| 4385 _ut.test('test_undefinedConstructorInInitializer_explicit_named', () { | 4702 _ut.test('test_undefinedConstructorInInitializer_explicit_named', () { |
| 4386 final __test = new NonErrorResolverTest(); | 4703 final __test = new NonErrorResolverTest(); |
| 4387 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli
cit_named); | 4704 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli
cit_named); |
| 4388 }); | 4705 }); |
| 4389 _ut.test('test_undefinedConstructorInInitializer_explicit_unnamed', () { | 4706 _ut.test('test_undefinedConstructorInInitializer_explicit_unnamed', () { |
| 4390 final __test = new NonErrorResolverTest(); | 4707 final __test = new NonErrorResolverTest(); |
| 4391 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli
cit_unnamed); | 4708 runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_expli
cit_unnamed); |
| 4392 }); | 4709 }); |
| 4393 _ut.test('test_undefinedConstructorInInitializer_hasOptionalParameters', (
) { | 4710 _ut.test('test_undefinedConstructorInInitializer_hasOptionalParameters', (
) { |
| 4394 final __test = new NonErrorResolverTest(); | 4711 final __test = new NonErrorResolverTest(); |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5146 resolve(source); | 5463 resolve(source); |
| 5147 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); | 5464 assertErrors(source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUND
S]); |
| 5148 verify([source]); | 5465 verify([source]); |
| 5149 } | 5466 } |
| 5150 void test_typeParameterSupertypeOfItsBound() { | 5467 void test_typeParameterSupertypeOfItsBound() { |
| 5151 Source source = addSource(EngineTestCase.createSource(["class A<T extends T>
{", "}"])); | 5468 Source source = addSource(EngineTestCase.createSource(["class A<T extends T>
{", "}"])); |
| 5152 resolve(source); | 5469 resolve(source); |
| 5153 assertErrors(source, [StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_
BOUND]); | 5470 assertErrors(source, [StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_
BOUND]); |
| 5154 verify([source]); | 5471 verify([source]); |
| 5155 } | 5472 } |
| 5473 void test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_mutated()
{ |
| 5474 Source source = addSource(EngineTestCase.createSource([ |
| 5475 "callMe(f()) { f(); }", |
| 5476 "main(Object p) {", |
| 5477 " (p is String) && callMe(() { p.length; });", |
| 5478 " p = 0;", |
| 5479 "}"])); |
| 5480 resolve(source); |
| 5481 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5482 } |
| 5483 void test_typePromotion_booleanAnd_useInRight_mutatedInLeft() { |
| 5484 Source source = addSource(EngineTestCase.createSource([ |
| 5485 "main(Object p) {", |
| 5486 " ((p is String) && ((p = 42) == 42)) && p.length != 0;", |
| 5487 "}"])); |
| 5488 resolve(source); |
| 5489 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5490 } |
| 5491 void test_typePromotion_booleanAnd_useInRight_mutatedInRight() { |
| 5492 Source source = addSource(EngineTestCase.createSource([ |
| 5493 "main(Object p) {", |
| 5494 " (p is String) && (((p = 42) == 42) && p.length != 0);", |
| 5495 "}"])); |
| 5496 resolve(source); |
| 5497 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5498 } |
| 5499 void test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_
after() { |
| 5500 Source source = addSource(EngineTestCase.createSource([ |
| 5501 "callMe(f()) { f(); }", |
| 5502 "main(Object p) {", |
| 5503 " p is String ? callMe(() { p.length; }) : 0;", |
| 5504 " p = 42;", |
| 5505 "}"])); |
| 5506 resolve(source); |
| 5507 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5508 } |
| 5509 void test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_
before() { |
| 5510 Source source = addSource(EngineTestCase.createSource([ |
| 5511 "callMe(f()) { f(); }", |
| 5512 "main(Object p) {", |
| 5513 " p = 42;", |
| 5514 " p is String ? callMe(() { p.length; }) : 0;", |
| 5515 "}"])); |
| 5516 resolve(source); |
| 5517 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5518 } |
| 5519 void test_typePromotion_conditional_useInThen_hasAssignment() { |
| 5520 Source source = addSource(EngineTestCase.createSource([ |
| 5521 "main(Object p) {", |
| 5522 " p is String ? (p.length + (p = 42)) : 0;", |
| 5523 "}"])); |
| 5524 resolve(source); |
| 5525 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5526 } |
| 5527 void test_typePromotion_if_accessedInClosure_hasAssignment() { |
| 5528 Source source = addSource(EngineTestCase.createSource([ |
| 5529 "callMe(f()) { f(); }", |
| 5530 "main(Object p) {", |
| 5531 " if (p is String) {", |
| 5532 " callMe(() {", |
| 5533 " p.length;", |
| 5534 " });", |
| 5535 " }", |
| 5536 " p = 0;", |
| 5537 "}"])); |
| 5538 resolve(source); |
| 5539 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5540 } |
| 5541 void test_typePromotion_if_and_right_hasAssignment() { |
| 5542 Source source = addSource(EngineTestCase.createSource([ |
| 5543 "main(Object p) {", |
| 5544 " if (p is String && (p = null) == null) {", |
| 5545 " p.length;", |
| 5546 " }", |
| 5547 "}"])); |
| 5548 resolve(source); |
| 5549 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5550 } |
| 5551 void test_typePromotion_if_hasAssignment_after() { |
| 5552 Source source = addSource(EngineTestCase.createSource([ |
| 5553 "main(Object p) {", |
| 5554 " if (p is String) {", |
| 5555 " p.length;", |
| 5556 " p = 0;", |
| 5557 " }", |
| 5558 "}"])); |
| 5559 resolve(source); |
| 5560 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5561 } |
| 5562 void test_typePromotion_if_hasAssignment_before() { |
| 5563 Source source = addSource(EngineTestCase.createSource([ |
| 5564 "main(Object p) {", |
| 5565 " if (p is String) {", |
| 5566 " p = 0;", |
| 5567 " p.length;", |
| 5568 " }", |
| 5569 "}"])); |
| 5570 resolve(source); |
| 5571 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5572 } |
| 5156 void test_undefinedGetter() { | 5573 void test_undefinedGetter() { |
| 5157 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e)
{ return e.m; }"])); | 5574 Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e)
{ return e.m; }"])); |
| 5158 resolve(source); | 5575 resolve(source); |
| 5159 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); | 5576 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5160 } | 5577 } |
| 5161 void test_undefinedGetter_static() { | 5578 void test_undefinedGetter_static() { |
| 5162 Source source = addSource(EngineTestCase.createSource(["class A {}", "var a
= A.B;"])); | 5579 Source source = addSource(EngineTestCase.createSource(["class A {}", "var a
= A.B;"])); |
| 5163 resolve(source); | 5580 resolve(source); |
| 5164 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); | 5581 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]); |
| 5165 } | 5582 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5203 " test() {", | 5620 " test() {", |
| 5204 " _foo();", | 5621 " _foo();", |
| 5205 " }", | 5622 " }", |
| 5206 "}"])); | 5623 "}"])); |
| 5207 resolve(source); | 5624 resolve(source); |
| 5208 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]); | 5625 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]); |
| 5209 } | 5626 } |
| 5210 void test_undefinedOperator_indexBoth() { | 5627 void test_undefinedOperator_indexBoth() { |
| 5211 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0]++;", "}"])); | 5628 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0]++;", "}"])); |
| 5212 resolve(source); | 5629 resolve(source); |
| 5213 assertErrors(source, [ | 5630 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 5214 StaticTypeWarningCode.UNDEFINED_OPERATOR, | |
| 5215 StaticTypeWarningCode.UNDEFINED_OPERATOR]); | |
| 5216 } | 5631 } |
| 5217 void test_undefinedOperator_indexGetter() { | 5632 void test_undefinedOperator_indexGetter() { |
| 5218 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0];", "}"])); | 5633 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0];", "}"])); |
| 5219 resolve(source); | 5634 resolve(source); |
| 5220 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 5635 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 5221 } | 5636 } |
| 5222 void test_undefinedOperator_indexSetter() { | 5637 void test_undefinedOperator_indexSetter() { |
| 5223 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0] = 1;", "}"])); | 5638 Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a)
{", " a[0] = 1;", "}"])); |
| 5224 resolve(source); | 5639 resolve(source); |
| 5225 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 5640 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5573 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_variableD
eclaration); | 5988 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_variableD
eclaration); |
| 5574 }); | 5989 }); |
| 5575 _ut.test('test_typeArgumentNotMatchingBounds_with', () { | 5990 _ut.test('test_typeArgumentNotMatchingBounds_with', () { |
| 5576 final __test = new StaticTypeWarningCodeTest(); | 5991 final __test = new StaticTypeWarningCodeTest(); |
| 5577 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_with); | 5992 runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_with); |
| 5578 }); | 5993 }); |
| 5579 _ut.test('test_typeParameterSupertypeOfItsBound', () { | 5994 _ut.test('test_typeParameterSupertypeOfItsBound', () { |
| 5580 final __test = new StaticTypeWarningCodeTest(); | 5995 final __test = new StaticTypeWarningCodeTest(); |
| 5581 runJUnitTest(__test, __test.test_typeParameterSupertypeOfItsBound); | 5996 runJUnitTest(__test, __test.test_typeParameterSupertypeOfItsBound); |
| 5582 }); | 5997 }); |
| 5998 _ut.test('test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_
mutated', () { |
| 5999 final __test = new StaticTypeWarningCodeTest(); |
| 6000 runJUnitTest(__test, __test.test_typePromotion_booleanAnd_useInRight_acc
essedInClosureRight_mutated); |
| 6001 }); |
| 6002 _ut.test('test_typePromotion_booleanAnd_useInRight_mutatedInLeft', () { |
| 6003 final __test = new StaticTypeWarningCodeTest(); |
| 6004 runJUnitTest(__test, __test.test_typePromotion_booleanAnd_useInRight_mut
atedInLeft); |
| 6005 }); |
| 6006 _ut.test('test_typePromotion_booleanAnd_useInRight_mutatedInRight', () { |
| 6007 final __test = new StaticTypeWarningCodeTest(); |
| 6008 runJUnitTest(__test, __test.test_typePromotion_booleanAnd_useInRight_mut
atedInRight); |
| 6009 }); |
| 6010 _ut.test('test_typePromotion_conditional_useInThen_accessedInClosure_hasAs
signment_after', () { |
| 6011 final __test = new StaticTypeWarningCodeTest(); |
| 6012 runJUnitTest(__test, __test.test_typePromotion_conditional_useInThen_acc
essedInClosure_hasAssignment_after); |
| 6013 }); |
| 6014 _ut.test('test_typePromotion_conditional_useInThen_accessedInClosure_hasAs
signment_before', () { |
| 6015 final __test = new StaticTypeWarningCodeTest(); |
| 6016 runJUnitTest(__test, __test.test_typePromotion_conditional_useInThen_acc
essedInClosure_hasAssignment_before); |
| 6017 }); |
| 6018 _ut.test('test_typePromotion_conditional_useInThen_hasAssignment', () { |
| 6019 final __test = new StaticTypeWarningCodeTest(); |
| 6020 runJUnitTest(__test, __test.test_typePromotion_conditional_useInThen_has
Assignment); |
| 6021 }); |
| 6022 _ut.test('test_typePromotion_if_accessedInClosure_hasAssignment', () { |
| 6023 final __test = new StaticTypeWarningCodeTest(); |
| 6024 runJUnitTest(__test, __test.test_typePromotion_if_accessedInClosure_hasA
ssignment); |
| 6025 }); |
| 6026 _ut.test('test_typePromotion_if_and_right_hasAssignment', () { |
| 6027 final __test = new StaticTypeWarningCodeTest(); |
| 6028 runJUnitTest(__test, __test.test_typePromotion_if_and_right_hasAssignmen
t); |
| 6029 }); |
| 6030 _ut.test('test_typePromotion_if_hasAssignment_after', () { |
| 6031 final __test = new StaticTypeWarningCodeTest(); |
| 6032 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_after); |
| 6033 }); |
| 6034 _ut.test('test_typePromotion_if_hasAssignment_before', () { |
| 6035 final __test = new StaticTypeWarningCodeTest(); |
| 6036 runJUnitTest(__test, __test.test_typePromotion_if_hasAssignment_before); |
| 6037 }); |
| 5583 _ut.test('test_undefinedGetter', () { | 6038 _ut.test('test_undefinedGetter', () { |
| 5584 final __test = new StaticTypeWarningCodeTest(); | 6039 final __test = new StaticTypeWarningCodeTest(); |
| 5585 runJUnitTest(__test, __test.test_undefinedGetter); | 6040 runJUnitTest(__test, __test.test_undefinedGetter); |
| 5586 }); | 6041 }); |
| 5587 _ut.test('test_undefinedGetter_static', () { | 6042 _ut.test('test_undefinedGetter_static', () { |
| 5588 final __test = new StaticTypeWarningCodeTest(); | 6043 final __test = new StaticTypeWarningCodeTest(); |
| 5589 runJUnitTest(__test, __test.test_undefinedGetter_static); | 6044 runJUnitTest(__test, __test.test_undefinedGetter_static); |
| 5590 }); | 6045 }); |
| 5591 _ut.test('test_undefinedMethod', () { | 6046 _ut.test('test_undefinedMethod', () { |
| 5592 final __test = new StaticTypeWarningCodeTest(); | 6047 final __test = new StaticTypeWarningCodeTest(); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6082 } | 6537 } |
| 6083 void test_undefinedOperator_indexBoth() { | 6538 void test_undefinedOperator_indexBoth() { |
| 6084 Source source = addSource(EngineTestCase.createSource([ | 6539 Source source = addSource(EngineTestCase.createSource([ |
| 6085 "class A {}", | 6540 "class A {}", |
| 6086 "f(var a) {", | 6541 "f(var a) {", |
| 6087 " if(a is A) {", | 6542 " if(a is A) {", |
| 6088 " a[0]++;", | 6543 " a[0]++;", |
| 6089 " }", | 6544 " }", |
| 6090 "}"])); | 6545 "}"])); |
| 6091 resolve(source); | 6546 resolve(source); |
| 6092 assertErrors(source, [HintCode.UNDEFINED_OPERATOR, HintCode.UNDEFINED_OPERAT
OR]); | 6547 assertErrors(source, [HintCode.UNDEFINED_OPERATOR]); |
| 6093 } | 6548 } |
| 6094 void test_undefinedOperator_indexGetter() { | 6549 void test_undefinedOperator_indexGetter() { |
| 6095 Source source = addSource(EngineTestCase.createSource([ | 6550 Source source = addSource(EngineTestCase.createSource([ |
| 6096 "class A {}", | 6551 "class A {}", |
| 6097 "f(var a) {", | 6552 "f(var a) {", |
| 6098 " if(a is A) {", | 6553 " if(a is A) {", |
| 6099 " a[0];", | 6554 " a[0];", |
| 6100 " }", | 6555 " }", |
| 6101 "}"])); | 6556 "}"])); |
| 6102 resolve(source); | 6557 resolve(source); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6562 LibraryElementImpl element = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["lib"])); | 7017 LibraryElementImpl element = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["lib"])); |
| 6563 element.definingCompilationUnit = new CompilationUnitElementImpl("lib.dart")
; | 7018 element.definingCompilationUnit = new CompilationUnitElementImpl("lib.dart")
; |
| 6564 _library.libraryElement = element; | 7019 _library.libraryElement = element; |
| 6565 _typeProvider = new TestTypeProvider(); | 7020 _typeProvider = new TestTypeProvider(); |
| 6566 _visitor = new TypeResolverVisitor.con1(_library, librarySource, _typeProvid
er); | 7021 _visitor = new TypeResolverVisitor.con1(_library, librarySource, _typeProvid
er); |
| 6567 } | 7022 } |
| 6568 void test_visitCatchClause_exception() { | 7023 void test_visitCatchClause_exception() { |
| 6569 CatchClause clause = ASTFactory.catchClause("e", []); | 7024 CatchClause clause = ASTFactory.catchClause("e", []); |
| 6570 SimpleIdentifier exceptionParameter = clause.exceptionParameter; | 7025 SimpleIdentifier exceptionParameter = clause.exceptionParameter; |
| 6571 exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionPar
ameter); | 7026 exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionPar
ameter); |
| 6572 resolve(clause, _typeProvider.objectType, null, []); | 7027 resolve(clause, _typeProvider.dynamicType, null, []); |
| 6573 _listener.assertNoErrors(); | 7028 _listener.assertNoErrors(); |
| 6574 } | 7029 } |
| 6575 void test_visitCatchClause_exception_stackTrace() { | 7030 void test_visitCatchClause_exception_stackTrace() { |
| 6576 CatchClause clause = ASTFactory.catchClause2("e", "s", []); | 7031 CatchClause clause = ASTFactory.catchClause2("e", "s", []); |
| 6577 SimpleIdentifier exceptionParameter = clause.exceptionParameter; | 7032 SimpleIdentifier exceptionParameter = clause.exceptionParameter; |
| 6578 exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionPar
ameter); | 7033 exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionPar
ameter); |
| 6579 SimpleIdentifier stackTraceParameter = clause.stackTraceParameter; | 7034 SimpleIdentifier stackTraceParameter = clause.stackTraceParameter; |
| 6580 stackTraceParameter.staticElement = new LocalVariableElementImpl(stackTraceP
arameter); | 7035 stackTraceParameter.staticElement = new LocalVariableElementImpl(stackTraceP
arameter); |
| 6581 resolve(clause, _typeProvider.objectType, _typeProvider.stackTraceType, []); | 7036 resolve(clause, _typeProvider.dynamicType, _typeProvider.stackTraceType, [])
; |
| 6582 _listener.assertNoErrors(); | 7037 _listener.assertNoErrors(); |
| 6583 } | 7038 } |
| 6584 void test_visitCatchClause_on_exception() { | 7039 void test_visitCatchClause_on_exception() { |
| 6585 ClassElement exceptionElement = ElementFactory.classElement2("E", []); | 7040 ClassElement exceptionElement = ElementFactory.classElement2("E", []); |
| 6586 TypeName exceptionType = ASTFactory.typeName(exceptionElement, []); | 7041 TypeName exceptionType = ASTFactory.typeName(exceptionElement, []); |
| 6587 CatchClause clause = ASTFactory.catchClause4(exceptionType, "e", []); | 7042 CatchClause clause = ASTFactory.catchClause4(exceptionType, "e", []); |
| 6588 SimpleIdentifier exceptionParameter = clause.exceptionParameter; | 7043 SimpleIdentifier exceptionParameter = clause.exceptionParameter; |
| 6589 exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionPar
ameter); | 7044 exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionPar
ameter); |
| 6590 resolve(clause, exceptionElement.type, null, [exceptionElement]); | 7045 resolve(clause, exceptionElement.type, null, [exceptionElement]); |
| 6591 _listener.assertNoErrors(); | 7046 _listener.assertNoErrors(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6734 * Analyze the given catch clause and assert that the types of the parameters
have been set to the | 7189 * Analyze the given catch clause and assert that the types of the parameters
have been set to the |
| 6735 * given types. The types can be null if the catch clause does not have the co
rresponding | 7190 * given types. The types can be null if the catch clause does not have the co
rresponding |
| 6736 * parameter. | 7191 * parameter. |
| 6737 * | 7192 * |
| 6738 * @param node the catch clause to be analyzed | 7193 * @param node the catch clause to be analyzed |
| 6739 * @param exceptionType the expected type of the exception parameter | 7194 * @param exceptionType the expected type of the exception parameter |
| 6740 * @param stackTraceType the expected type of the stack trace parameter | 7195 * @param stackTraceType the expected type of the stack trace parameter |
| 6741 * @param definedElements the elements that are to be defined in the scope in
which the element is | 7196 * @param definedElements the elements that are to be defined in the scope in
which the element is |
| 6742 * being resolved | 7197 * being resolved |
| 6743 */ | 7198 */ |
| 6744 void resolve(CatchClause node, InterfaceType exceptionType, InterfaceType stac
kTraceType, List<Element> definedElements) { | 7199 void resolve(CatchClause node, Type2 exceptionType, InterfaceType stackTraceTy
pe, List<Element> definedElements) { |
| 6745 resolveNode(node, definedElements); | 7200 resolveNode(node, definedElements); |
| 6746 SimpleIdentifier exceptionParameter = node.exceptionParameter; | 7201 SimpleIdentifier exceptionParameter = node.exceptionParameter; |
| 6747 if (exceptionParameter != null) { | 7202 if (exceptionParameter != null) { |
| 6748 JUnitTestCase.assertSame(exceptionType, exceptionParameter.staticType); | 7203 JUnitTestCase.assertSame(exceptionType, exceptionParameter.staticType); |
| 6749 } | 7204 } |
| 6750 SimpleIdentifier stackTraceParameter = node.stackTraceParameter; | 7205 SimpleIdentifier stackTraceParameter = node.stackTraceParameter; |
| 6751 if (stackTraceParameter != null) { | 7206 if (stackTraceParameter != null) { |
| 6752 JUnitTestCase.assertSame(stackTraceType, stackTraceParameter.staticType); | 7207 JUnitTestCase.assertSame(stackTraceType, stackTraceParameter.staticType); |
| 6753 } | 7208 } |
| 6754 } | 7209 } |
| (...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8422 resolve(source); | 8877 resolve(source); |
| 8423 assertErrors(source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_P
ARAMETER]); | 8878 assertErrors(source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_P
ARAMETER]); |
| 8424 verify([source]); | 8879 verify([source]); |
| 8425 } | 8880 } |
| 8426 void test_defaultValueInFunctionTypedParameter_optional() { | 8881 void test_defaultValueInFunctionTypedParameter_optional() { |
| 8427 Source source = addSource(EngineTestCase.createSource(["f(g([p = null])) {}"
])); | 8882 Source source = addSource(EngineTestCase.createSource(["f(g([p = null])) {}"
])); |
| 8428 resolve(source); | 8883 resolve(source); |
| 8429 assertErrors(source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_P
ARAMETER]); | 8884 assertErrors(source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_P
ARAMETER]); |
| 8430 verify([source]); | 8885 verify([source]); |
| 8431 } | 8886 } |
| 8887 void test_defaultValueInRedirectingFactoryConstructor() { |
| 8888 Source source = addSource(EngineTestCase.createSource([ |
| 8889 "class A {", |
| 8890 " factory A([int x = 0]) = B;", |
| 8891 "}", |
| 8892 "", |
| 8893 "class B implements A {", |
| 8894 " B([int x = 1]) {}", |
| 8895 "}"])); |
| 8896 resolve(source); |
| 8897 assertErrors(source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACT
ORY_CONSTRUCTOR]); |
| 8898 verify([source]); |
| 8899 } |
| 8432 void test_duplicateConstructorName_named() { | 8900 void test_duplicateConstructorName_named() { |
| 8433 Source source = addSource(EngineTestCase.createSource(["class A {", " A.a()
{}", " A.a() {}", "}"])); | 8901 Source source = addSource(EngineTestCase.createSource(["class A {", " A.a()
{}", " A.a() {}", "}"])); |
| 8434 resolve(source); | 8902 resolve(source); |
| 8435 assertErrors(source, [ | 8903 assertErrors(source, [ |
| 8436 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, | 8904 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME, |
| 8437 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME]); | 8905 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME]); |
| 8438 verify([source]); | 8906 verify([source]); |
| 8439 } | 8907 } |
| 8440 void test_duplicateConstructorName_unnamed() { | 8908 void test_duplicateConstructorName_unnamed() { |
| 8441 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", " A() {}", "}"])); | 8909 Source source = addSource(EngineTestCase.createSource(["class A {", " A() {
}", " A() {}", "}"])); |
| 8442 resolve(source); | 8910 resolve(source); |
| 8443 assertErrors(source, [ | 8911 assertErrors(source, [ |
| 8444 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, | 8912 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, |
| 8445 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT]); | 8913 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT]); |
| 8446 verify([source]); | 8914 verify([source]); |
| 8447 } | 8915 } |
| 8448 void test_duplicateDefinition() { | 8916 void test_duplicateDefinition() { |
| 8449 Source source = addSource(EngineTestCase.createSource(["f() {", " int m = 0
;", " m(a) {}", "}"])); | 8917 Source source = addSource(EngineTestCase.createSource(["f() {", " int m = 0
;", " m(a) {}", "}"])); |
| 8450 resolve(source); | 8918 resolve(source); |
| 8451 assertErrors(source, [ | 8919 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8452 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8453 CompileTimeErrorCode.DUPLICATE_DEFINITION]); | |
| 8454 verify([source]); | 8920 verify([source]); |
| 8455 } | 8921 } |
| 8456 void test_duplicateDefinition_acrossLibraries() { | 8922 void test_duplicateDefinition_acrossLibraries() { |
| 8457 Source librarySource = addSource2("/lib.dart", EngineTestCase.createSource([
"library lib;", "", "part 'a.dart';", "part 'b.dart';"])); | 8923 Source librarySource = addSource2("/lib.dart", EngineTestCase.createSource([
"library lib;", "", "part 'a.dart';", "part 'b.dart';"])); |
| 8458 Source sourceA = addSource2("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 8924 Source sourceA = addSource2("/a.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 8459 Source sourceB = addSource2("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); | 8925 Source sourceB = addSource2("/b.dart", EngineTestCase.createSource(["part of
lib;", "", "class A {}"])); |
| 8460 resolve(librarySource); | 8926 resolve(librarySource); |
| 8461 assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); | 8927 assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8462 verify([librarySource, sourceA, sourceB]); | 8928 verify([librarySource, sourceA, sourceB]); |
| 8463 } | 8929 } |
| 8464 void test_duplicateDefinition_classMembers_fields() { | 8930 void test_duplicateDefinition_classMembers_fields() { |
| 8465 Source source = addSource(EngineTestCase.createSource(["class A {", " int a
;", " int a;", "}"])); | 8931 Source source = addSource(EngineTestCase.createSource(["class A {", " int a
;", " int a;", "}"])); |
| 8466 resolve(source); | 8932 resolve(source); |
| 8467 assertErrors(source, [ | 8933 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8468 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8469 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8470 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8471 CompileTimeErrorCode.DUPLICATE_DEFINITION]); | |
| 8472 verify([source]); | 8934 verify([source]); |
| 8473 } | 8935 } |
| 8474 void test_duplicateDefinition_classMembers_fields_oneStatic() { | 8936 void test_duplicateDefinition_classMembers_fields_oneStatic() { |
| 8475 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " static int x;", "}"])); | 8937 Source source = addSource(EngineTestCase.createSource(["class A {", " int x
;", " static int x;", "}"])); |
| 8476 resolve(source); | 8938 resolve(source); |
| 8477 assertErrors(source, [ | 8939 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8478 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8479 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8480 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8481 CompileTimeErrorCode.DUPLICATE_DEFINITION]); | |
| 8482 verify([source]); | 8940 verify([source]); |
| 8483 } | 8941 } |
| 8484 void test_duplicateDefinition_classMembers_methods() { | 8942 void test_duplicateDefinition_classMembers_methods() { |
| 8485 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", " m() {}", "}"])); | 8943 Source source = addSource(EngineTestCase.createSource(["class A {", " m() {
}", " m() {}", "}"])); |
| 8486 resolve(source); | 8944 resolve(source); |
| 8487 assertErrors(source, [ | 8945 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8488 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8489 CompileTimeErrorCode.DUPLICATE_DEFINITION]); | |
| 8490 verify([source]); | 8946 verify([source]); |
| 8491 } | 8947 } |
| 8492 void test_duplicateDefinition_localFields() { | 8948 void test_duplicateDefinition_localFields() { |
| 8493 Source source = addSource(EngineTestCase.createSource([ | 8949 Source source = addSource(EngineTestCase.createSource([ |
| 8494 "class A {", | 8950 "class A {", |
| 8495 " m() {", | 8951 " m() {", |
| 8496 " int a;", | 8952 " int a;", |
| 8497 " int a;", | 8953 " int a;", |
| 8498 " }", | 8954 " }", |
| 8499 "}"])); | 8955 "}"])); |
| 8500 resolve(source); | 8956 resolve(source); |
| 8501 assertErrors(source, [ | 8957 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8502 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8503 CompileTimeErrorCode.DUPLICATE_DEFINITION]); | |
| 8504 verify([source]); | 8958 verify([source]); |
| 8505 } | 8959 } |
| 8506 void test_duplicateDefinition_parameterWithFunctionName_local() { | 8960 void test_duplicateDefinition_parameterWithFunctionName_local() { |
| 8507 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); | 8961 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); |
| 8508 resolve(source); | 8962 resolve(source); |
| 8509 assertErrors(source, [ | 8963 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8510 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8511 CompileTimeErrorCode.DUPLICATE_DEFINITION]); | |
| 8512 verify([source]); | 8964 verify([source]); |
| 8513 } | 8965 } |
| 8514 void test_duplicateDefinition_parameterWithFunctionName_topLevel() { | 8966 void test_duplicateDefinition_parameterWithFunctionName_topLevel() { |
| 8515 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); | 8967 Source source = addSource(EngineTestCase.createSource(["main() {", " f(f) {
}", "}"])); |
| 8516 resolve(source); | 8968 resolve(source); |
| 8517 assertErrors(source, [ | 8969 assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]); |
| 8518 CompileTimeErrorCode.DUPLICATE_DEFINITION, | |
| 8519 CompileTimeErrorCode.DUPLICATE_DEFINITION]); | |
| 8520 verify([source]); | 8970 verify([source]); |
| 8521 } | 8971 } |
| 8522 void test_duplicateDefinitionInheritance_instanceGetter_staticGetter() { | 8972 void test_duplicateDefinitionInheritance_instanceGetter_staticGetter() { |
| 8523 Source source = addSource(EngineTestCase.createSource([ | 8973 Source source = addSource(EngineTestCase.createSource([ |
| 8524 "class A {", | 8974 "class A {", |
| 8525 " int get x => 0;", | 8975 " int get x => 0;", |
| 8526 "}", | 8976 "}", |
| 8527 "class B extends A {", | 8977 "class B extends A {", |
| 8528 " static int get x => 0;", | 8978 " static int get x => 0;", |
| 8529 "}"])); | 8979 "}"])); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8835 } | 9285 } |
| 8836 void test_finalNotInitialized_local_const() { | 9286 void test_finalNotInitialized_local_const() { |
| 8837 Source source = addSource(EngineTestCase.createSource(["f() {", " const int
x;", "}"])); | 9287 Source source = addSource(EngineTestCase.createSource(["f() {", " const int
x;", "}"])); |
| 8838 resolve(source); | 9288 resolve(source); |
| 8839 assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]); | 9289 assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]); |
| 8840 verify([source]); | 9290 verify([source]); |
| 8841 } | 9291 } |
| 8842 void test_getterAndMethodWithSameName() { | 9292 void test_getterAndMethodWithSameName() { |
| 8843 Source source = addSource(EngineTestCase.createSource(["class A {", " x(y)
{}", " get x => 0;", "}"])); | 9293 Source source = addSource(EngineTestCase.createSource(["class A {", " x(y)
{}", " get x => 0;", "}"])); |
| 8844 resolve(source); | 9294 resolve(source); |
| 8845 assertErrors(source, [ | 9295 assertErrors(source, [CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]
); |
| 8846 CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME, | |
| 8847 CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]); | |
| 8848 verify([source]); | 9296 verify([source]); |
| 8849 } | 9297 } |
| 8850 void test_implementsDisallowedClass_bool() { | 9298 void test_implementsDisallowedClass_bool() { |
| 8851 Source source = addSource(EngineTestCase.createSource(["class A implements b
ool {}"])); | 9299 Source source = addSource(EngineTestCase.createSource(["class A implements b
ool {}"])); |
| 8852 resolve(source); | 9300 resolve(source); |
| 8853 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); | 9301 assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]); |
| 8854 verify([source]); | 9302 verify([source]); |
| 8855 } | 9303 } |
| 8856 void test_implementsDisallowedClass_double() { | 9304 void test_implementsDisallowedClass_double() { |
| 8857 Source source = addSource(EngineTestCase.createSource(["class A implements d
ouble {}"])); | 9305 Source source = addSource(EngineTestCase.createSource(["class A implements d
ouble {}"])); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9357 Source source = addSource(EngineTestCase.createSource(["class A {", " get A
=> 0;", "}"])); | 9805 Source source = addSource(EngineTestCase.createSource(["class A {", " get A
=> 0;", "}"])); |
| 9358 resolve(source); | 9806 resolve(source); |
| 9359 assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); | 9807 assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]); |
| 9360 verify([source]); | 9808 verify([source]); |
| 9361 } | 9809 } |
| 9362 void test_memberWithClassName_method() { | 9810 void test_memberWithClassName_method() { |
| 9363 } | 9811 } |
| 9364 void test_methodAndGetterWithSameName() { | 9812 void test_methodAndGetterWithSameName() { |
| 9365 Source source = addSource(EngineTestCase.createSource(["class A {", " get x
=> 0;", " x(y) {}", "}"])); | 9813 Source source = addSource(EngineTestCase.createSource(["class A {", " get x
=> 0;", " x(y) {}", "}"])); |
| 9366 resolve(source); | 9814 resolve(source); |
| 9367 assertErrors(source, [ | 9815 assertErrors(source, [CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]
); |
| 9368 CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME, | |
| 9369 CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]); | |
| 9370 verify([source]); | 9816 verify([source]); |
| 9371 } | 9817 } |
| 9372 void test_mixinDeclaresConstructor_classDeclaration() { | 9818 void test_mixinDeclaresConstructor_classDeclaration() { |
| 9373 Source source = addSource(EngineTestCase.createSource([ | 9819 Source source = addSource(EngineTestCase.createSource([ |
| 9374 "class A {", | 9820 "class A {", |
| 9375 " A() {}", | 9821 " A() {}", |
| 9376 "}", | 9822 "}", |
| 9377 "class B extends Object with A {}"])); | 9823 "class B extends Object with A {}"])); |
| 9378 resolve(source); | 9824 resolve(source); |
| 9379 assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); | 9825 assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]); |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10050 void test_redirectToNonConstConstructor() { | 10496 void test_redirectToNonConstConstructor() { |
| 10051 Source source = addSource(EngineTestCase.createSource([ | 10497 Source source = addSource(EngineTestCase.createSource([ |
| 10052 "class A {", | 10498 "class A {", |
| 10053 " A.a() {}", | 10499 " A.a() {}", |
| 10054 " const factory A.b() = A.a;", | 10500 " const factory A.b() = A.a;", |
| 10055 "}"])); | 10501 "}"])); |
| 10056 resolve(source); | 10502 resolve(source); |
| 10057 assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR
]); | 10503 assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR
]); |
| 10058 verify([source]); | 10504 verify([source]); |
| 10059 } | 10505 } |
| 10506 void test_referencedBeforeDeclaration_hideInBlock_function() { |
| 10507 Source source = addSource(EngineTestCase.createSource([ |
| 10508 "var v = 1;", |
| 10509 "main() {", |
| 10510 " print(v);", |
| 10511 " v() {}", |
| 10512 "}", |
| 10513 "print(x) {}"])); |
| 10514 resolve(source); |
| 10515 assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| 10516 } |
| 10517 void test_referencedBeforeDeclaration_hideInBlock_local() { |
| 10518 Source source = addSource(EngineTestCase.createSource([ |
| 10519 "var v = 1;", |
| 10520 "main() {", |
| 10521 " print(v);", |
| 10522 " var v = 2;", |
| 10523 "}", |
| 10524 "print(x) {}"])); |
| 10525 resolve(source); |
| 10526 assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| 10527 } |
| 10528 void test_referencedBeforeDeclaration_hideInBlock_subBlock() { |
| 10529 Source source = addSource(EngineTestCase.createSource([ |
| 10530 "var v = 1;", |
| 10531 "main() {", |
| 10532 " {", |
| 10533 " print(v);", |
| 10534 " }", |
| 10535 " var v = 2;", |
| 10536 "}", |
| 10537 "print(x) {}"])); |
| 10538 resolve(source); |
| 10539 assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]); |
| 10540 } |
| 10060 void test_referenceToDeclaredVariableInInitializer_closure() { | 10541 void test_referenceToDeclaredVariableInInitializer_closure() { |
| 10061 Source source = addSource(EngineTestCase.createSource(["f() {", " var x = (
x) {};", "}"])); | 10542 Source source = addSource(EngineTestCase.createSource(["f() {", " var x = (
x) {};", "}"])); |
| 10062 resolve(source); | 10543 resolve(source); |
| 10063 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN
_INITIALIZER]); | 10544 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN
_INITIALIZER]); |
| 10064 verify([source]); | 10545 verify([source]); |
| 10065 } | 10546 } |
| 10066 void test_referenceToDeclaredVariableInInitializer_getter() { | 10547 void test_referenceToDeclaredVariableInInitializer_getter() { |
| 10067 Source source = addSource(EngineTestCase.createSource(["f() {", " int x = x
+ 1;", "}"])); | 10548 Source source = addSource(EngineTestCase.createSource(["f() {", " int x = x
+ 1;", "}"])); |
| 10068 resolve(source); | 10549 resolve(source); |
| 10069 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN
_INITIALIZER]); | 10550 assertErrors(source, [CompileTimeErrorCode.REFERENCE_TO_DECLARED_VARIABLE_IN
_INITIALIZER]); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10236 verify([source]); | 10717 verify([source]); |
| 10237 } | 10718 } |
| 10238 void test_typeAliasCannotReferenceItself_returnType_indirect() { | 10719 void test_typeAliasCannotReferenceItself_returnType_indirect() { |
| 10239 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "ty
pedef A B();"])); | 10720 Source source = addSource(EngineTestCase.createSource(["typedef B A();", "ty
pedef A B();"])); |
| 10240 resolve(source); | 10721 resolve(source); |
| 10241 assertErrors(source, [ | 10722 assertErrors(source, [ |
| 10242 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, | 10723 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, |
| 10243 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); | 10724 CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]); |
| 10244 verify([source]); | 10725 verify([source]); |
| 10245 } | 10726 } |
| 10727 void test_typeAliasCannotReferenceItself_typeVariableBounds() { |
| 10728 Source source = addSource(EngineTestCase.createSource(["typedef A<T extends
A>();"])); |
| 10729 resolve(source); |
| 10730 assertErrors(source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSEL
F]); |
| 10731 verify([source]); |
| 10732 } |
| 10246 void test_typeAliasCannotRereferenceItself_mixin_direct() { | 10733 void test_typeAliasCannotRereferenceItself_mixin_direct() { |
| 10247 Source source = addSource(EngineTestCase.createSource(["class M = Object wit
h M;"])); | 10734 Source source = addSource(EngineTestCase.createSource(["class M = Object wit
h M;"])); |
| 10248 resolve(source); | 10735 resolve(source); |
| 10249 assertErrors(source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSEL
F]); | 10736 assertErrors(source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSEL
F]); |
| 10250 verify([source]); | 10737 verify([source]); |
| 10251 } | 10738 } |
| 10252 void test_typeAliasCannotRereferenceItself_mixin_indirect() { | 10739 void test_typeAliasCannotRereferenceItself_mixin_indirect() { |
| 10253 Source source = addSource(EngineTestCase.createSource([ | 10740 Source source = addSource(EngineTestCase.createSource([ |
| 10254 "class M1 = Object with M2;", | 10741 "class M1 = Object with M2;", |
| 10255 "class M2 = Object with M1;"])); | 10742 "class M2 = Object with M1;"])); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10764 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); | 11251 runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias); |
| 10765 }); | 11252 }); |
| 10766 _ut.test('test_defaultValueInFunctionTypedParameter_named', () { | 11253 _ut.test('test_defaultValueInFunctionTypedParameter_named', () { |
| 10767 final __test = new CompileTimeErrorCodeTest(); | 11254 final __test = new CompileTimeErrorCodeTest(); |
| 10768 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_na
med); | 11255 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_na
med); |
| 10769 }); | 11256 }); |
| 10770 _ut.test('test_defaultValueInFunctionTypedParameter_optional', () { | 11257 _ut.test('test_defaultValueInFunctionTypedParameter_optional', () { |
| 10771 final __test = new CompileTimeErrorCodeTest(); | 11258 final __test = new CompileTimeErrorCodeTest(); |
| 10772 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_op
tional); | 11259 runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_op
tional); |
| 10773 }); | 11260 }); |
| 11261 _ut.test('test_defaultValueInRedirectingFactoryConstructor', () { |
| 11262 final __test = new CompileTimeErrorCodeTest(); |
| 11263 runJUnitTest(__test, __test.test_defaultValueInRedirectingFactoryConstru
ctor); |
| 11264 }); |
| 10774 _ut.test('test_duplicateConstructorName_named', () { | 11265 _ut.test('test_duplicateConstructorName_named', () { |
| 10775 final __test = new CompileTimeErrorCodeTest(); | 11266 final __test = new CompileTimeErrorCodeTest(); |
| 10776 runJUnitTest(__test, __test.test_duplicateConstructorName_named); | 11267 runJUnitTest(__test, __test.test_duplicateConstructorName_named); |
| 10777 }); | 11268 }); |
| 10778 _ut.test('test_duplicateConstructorName_unnamed', () { | 11269 _ut.test('test_duplicateConstructorName_unnamed', () { |
| 10779 final __test = new CompileTimeErrorCodeTest(); | 11270 final __test = new CompileTimeErrorCodeTest(); |
| 10780 runJUnitTest(__test, __test.test_duplicateConstructorName_unnamed); | 11271 runJUnitTest(__test, __test.test_duplicateConstructorName_unnamed); |
| 10781 }); | 11272 }); |
| 10782 _ut.test('test_duplicateDefinition', () { | 11273 _ut.test('test_duplicateDefinition', () { |
| 10783 final __test = new CompileTimeErrorCodeTest(); | 11274 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11560 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_getter); | 12051 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_getter); |
| 11561 }); | 12052 }); |
| 11562 _ut.test('test_referenceToDeclaredVariableInInitializer_setter', () { | 12053 _ut.test('test_referenceToDeclaredVariableInInitializer_setter', () { |
| 11563 final __test = new CompileTimeErrorCodeTest(); | 12054 final __test = new CompileTimeErrorCodeTest(); |
| 11564 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_setter); | 12055 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_setter); |
| 11565 }); | 12056 }); |
| 11566 _ut.test('test_referenceToDeclaredVariableInInitializer_unqualifiedInvocat
ion', () { | 12057 _ut.test('test_referenceToDeclaredVariableInInitializer_unqualifiedInvocat
ion', () { |
| 11567 final __test = new CompileTimeErrorCodeTest(); | 12058 final __test = new CompileTimeErrorCodeTest(); |
| 11568 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_unqualifiedInvocation); | 12059 runJUnitTest(__test, __test.test_referenceToDeclaredVariableInInitialize
r_unqualifiedInvocation); |
| 11569 }); | 12060 }); |
| 12061 _ut.test('test_referencedBeforeDeclaration_hideInBlock_function', () { |
| 12062 final __test = new CompileTimeErrorCodeTest(); |
| 12063 runJUnitTest(__test, __test.test_referencedBeforeDeclaration_hideInBlock
_function); |
| 12064 }); |
| 12065 _ut.test('test_referencedBeforeDeclaration_hideInBlock_local', () { |
| 12066 final __test = new CompileTimeErrorCodeTest(); |
| 12067 runJUnitTest(__test, __test.test_referencedBeforeDeclaration_hideInBlock
_local); |
| 12068 }); |
| 12069 _ut.test('test_referencedBeforeDeclaration_hideInBlock_subBlock', () { |
| 12070 final __test = new CompileTimeErrorCodeTest(); |
| 12071 runJUnitTest(__test, __test.test_referencedBeforeDeclaration_hideInBlock
_subBlock); |
| 12072 }); |
| 11570 _ut.test('test_rethrowOutsideCatch', () { | 12073 _ut.test('test_rethrowOutsideCatch', () { |
| 11571 final __test = new CompileTimeErrorCodeTest(); | 12074 final __test = new CompileTimeErrorCodeTest(); |
| 11572 runJUnitTest(__test, __test.test_rethrowOutsideCatch); | 12075 runJUnitTest(__test, __test.test_rethrowOutsideCatch); |
| 11573 }); | 12076 }); |
| 11574 _ut.test('test_returnInGenerativeConstructor', () { | 12077 _ut.test('test_returnInGenerativeConstructor', () { |
| 11575 final __test = new CompileTimeErrorCodeTest(); | 12078 final __test = new CompileTimeErrorCodeTest(); |
| 11576 runJUnitTest(__test, __test.test_returnInGenerativeConstructor); | 12079 runJUnitTest(__test, __test.test_returnInGenerativeConstructor); |
| 11577 }); | 12080 }); |
| 11578 _ut.test('test_returnInGenerativeConstructor_expressionFunctionBody', () { | 12081 _ut.test('test_returnInGenerativeConstructor_expressionFunctionBody', () { |
| 11579 final __test = new CompileTimeErrorCodeTest(); | 12082 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11640 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnCl
ass_withTypeAlias); | 12143 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnCl
ass_withTypeAlias); |
| 11641 }); | 12144 }); |
| 11642 _ut.test('test_typeAliasCannotReferenceItself_returnType', () { | 12145 _ut.test('test_typeAliasCannotReferenceItself_returnType', () { |
| 11643 final __test = new CompileTimeErrorCodeTest(); | 12146 final __test = new CompileTimeErrorCodeTest(); |
| 11644 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe); | 12147 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe); |
| 11645 }); | 12148 }); |
| 11646 _ut.test('test_typeAliasCannotReferenceItself_returnType_indirect', () { | 12149 _ut.test('test_typeAliasCannotReferenceItself_returnType_indirect', () { |
| 11647 final __test = new CompileTimeErrorCodeTest(); | 12150 final __test = new CompileTimeErrorCodeTest(); |
| 11648 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe_indirect); | 12151 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnTy
pe_indirect); |
| 11649 }); | 12152 }); |
| 12153 _ut.test('test_typeAliasCannotReferenceItself_typeVariableBounds', () { |
| 12154 final __test = new CompileTimeErrorCodeTest(); |
| 12155 runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_typeVari
ableBounds); |
| 12156 }); |
| 11650 _ut.test('test_typeAliasCannotRereferenceItself_mixin_direct', () { | 12157 _ut.test('test_typeAliasCannotRereferenceItself_mixin_direct', () { |
| 11651 final __test = new CompileTimeErrorCodeTest(); | 12158 final __test = new CompileTimeErrorCodeTest(); |
| 11652 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
direct); | 12159 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
direct); |
| 11653 }); | 12160 }); |
| 11654 _ut.test('test_typeAliasCannotRereferenceItself_mixin_indirect', () { | 12161 _ut.test('test_typeAliasCannotRereferenceItself_mixin_indirect', () { |
| 11655 final __test = new CompileTimeErrorCodeTest(); | 12162 final __test = new CompileTimeErrorCodeTest(); |
| 11656 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
indirect); | 12163 runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_
indirect); |
| 11657 }); | 12164 }); |
| 11658 _ut.test('test_typeArgumentNotMatchingBounds_const', () { | 12165 _ut.test('test_typeArgumentNotMatchingBounds_const', () { |
| 11659 final __test = new CompileTimeErrorCodeTest(); | 12166 final __test = new CompileTimeErrorCodeTest(); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11963 "}"])); | 12470 "}"])); |
| 11964 resolve(source); | 12471 resolve(source); |
| 11965 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 12472 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 11966 } | 12473 } |
| 11967 void test_conditional_and_is() { | 12474 void test_conditional_and_is() { |
| 11968 Source source = addSource(EngineTestCase.createSource([ | 12475 Source source = addSource(EngineTestCase.createSource([ |
| 11969 "int f(num n) {", | 12476 "int f(num n) {", |
| 11970 " return (n is int && n > 0) ? n & 0x0F : 0;", | 12477 " return (n is int && n > 0) ? n & 0x0F : 0;", |
| 11971 "}"])); | 12478 "}"])); |
| 11972 resolve(source); | 12479 resolve(source); |
| 11973 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 12480 assertNoErrors(source); |
| 11974 } | 12481 } |
| 11975 void test_conditional_is() { | 12482 void test_conditional_is() { |
| 11976 Source source = addSource(EngineTestCase.createSource([ | 12483 Source source = addSource(EngineTestCase.createSource([ |
| 11977 "int f(num n) {", | 12484 "int f(num n) {", |
| 11978 " return (n is int) ? n & 0x0F : 0;", | 12485 " return (n is int) ? n & 0x0F : 0;", |
| 11979 "}"])); | 12486 "}"])); |
| 11980 resolve(source); | 12487 resolve(source); |
| 11981 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 12488 assertNoErrors(source); |
| 11982 } | 12489 } |
| 11983 void test_conditional_isNot() { | 12490 void test_conditional_isNot() { |
| 11984 Source source = addSource(EngineTestCase.createSource([ | 12491 Source source = addSource(EngineTestCase.createSource([ |
| 11985 "int f(num n) {", | 12492 "int f(num n) {", |
| 11986 " return (n is! int) ? 0 : n & 0x0F;", | 12493 " return (n is! int) ? 0 : n & 0x0F;", |
| 11987 "}"])); | 12494 "}"])); |
| 11988 resolve(source); | 12495 resolve(source); |
| 11989 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 12496 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); |
| 11990 } | 12497 } |
| 11991 void test_conditional_or_is() { | 12498 void test_conditional_or_is() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 12009 } | 12516 } |
| 12010 void test_if_and_is() { | 12517 void test_if_and_is() { |
| 12011 Source source = addSource(EngineTestCase.createSource([ | 12518 Source source = addSource(EngineTestCase.createSource([ |
| 12012 "int f(num n) {", | 12519 "int f(num n) {", |
| 12013 " if (n is int && n > 0) {", | 12520 " if (n is int && n > 0) {", |
| 12014 " return n & 0x0F;", | 12521 " return n & 0x0F;", |
| 12015 " }", | 12522 " }", |
| 12016 " return 0;", | 12523 " return 0;", |
| 12017 "}"])); | 12524 "}"])); |
| 12018 resolve(source); | 12525 resolve(source); |
| 12019 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 12526 assertNoErrors(source); |
| 12020 } | 12527 } |
| 12021 void test_if_is() { | 12528 void test_if_is() { |
| 12022 Source source = addSource(EngineTestCase.createSource([ | 12529 Source source = addSource(EngineTestCase.createSource([ |
| 12023 "int f(num n) {", | 12530 "int f(num n) {", |
| 12024 " if (n is int) {", | 12531 " if (n is int) {", |
| 12025 " return n & 0x0F;", | 12532 " return n & 0x0F;", |
| 12026 " }", | 12533 " }", |
| 12027 " return 0;", | 12534 " return 0;", |
| 12028 "}"])); | 12535 "}"])); |
| 12029 resolve(source); | 12536 resolve(source); |
| 12030 assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]); | 12537 assertNoErrors(source); |
| 12031 } | 12538 } |
| 12032 void test_if_isNot() { | 12539 void test_if_isNot() { |
| 12033 Source source = addSource(EngineTestCase.createSource([ | 12540 Source source = addSource(EngineTestCase.createSource([ |
| 12034 "int f(num n) {", | 12541 "int f(num n) {", |
| 12035 " if (n is! int) {", | 12542 " if (n is! int) {", |
| 12036 " return 0;", | 12543 " return 0;", |
| 12037 " } else {", | 12544 " } else {", |
| 12038 " return n & 0x0F;", | 12545 " return n & 0x0F;", |
| 12039 " }", | 12546 " }", |
| 12040 "}"])); | 12547 "}"])); |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13032 runJUnitTest(__test, __test.test_import_valid_inside_lib2); | 13539 runJUnitTest(__test, __test.test_import_valid_inside_lib2); |
| 13033 }); | 13540 }); |
| 13034 _ut.test('test_import_valid_outside_lib', () { | 13541 _ut.test('test_import_valid_outside_lib', () { |
| 13035 final __test = new PubSuggestionCodeTest(); | 13542 final __test = new PubSuggestionCodeTest(); |
| 13036 runJUnitTest(__test, __test.test_import_valid_outside_lib); | 13543 runJUnitTest(__test, __test.test_import_valid_outside_lib); |
| 13037 }); | 13544 }); |
| 13038 }); | 13545 }); |
| 13039 } | 13546 } |
| 13040 } | 13547 } |
| 13041 class StaticWarningCodeTest extends ResolverTestCase { | 13548 class StaticWarningCodeTest extends ResolverTestCase { |
| 13042 void fail_commentReferenceConstructorNotVisible() { | |
| 13043 Source source = addSource(EngineTestCase.createSource([])); | |
| 13044 resolve(source); | |
| 13045 assertErrors(source, [StaticWarningCode.COMMENT_REFERENCE_CONSTRUCTOR_NOT_VI
SIBLE]); | |
| 13046 verify([source]); | |
| 13047 } | |
| 13048 void fail_commentReferenceIdentifierNotVisible() { | |
| 13049 Source source = addSource(EngineTestCase.createSource([])); | |
| 13050 resolve(source); | |
| 13051 assertErrors(source, [StaticWarningCode.COMMENT_REFERENCE_IDENTIFIER_NOT_VIS
IBLE]); | |
| 13052 verify([source]); | |
| 13053 } | |
| 13054 void fail_commentReferenceUndeclaredConstructor() { | |
| 13055 Source source = addSource(EngineTestCase.createSource([])); | |
| 13056 resolve(source); | |
| 13057 assertErrors(source, [StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_CONSTRU
CTOR]); | |
| 13058 verify([source]); | |
| 13059 } | |
| 13060 void fail_commentReferenceUndeclaredIdentifier() { | |
| 13061 Source source = addSource(EngineTestCase.createSource([])); | |
| 13062 resolve(source); | |
| 13063 assertErrors(source, [StaticWarningCode.COMMENT_REFERENCE_UNDECLARED_IDENTIF
IER]); | |
| 13064 verify([source]); | |
| 13065 } | |
| 13066 void fail_commentReferenceUriNotLibrary() { | |
| 13067 Source source = addSource(EngineTestCase.createSource([])); | |
| 13068 resolve(source); | |
| 13069 assertErrors(source, [StaticWarningCode.COMMENT_REFERENCE_URI_NOT_LIBRARY]); | |
| 13070 verify([source]); | |
| 13071 } | |
| 13072 void fail_mismatchedAccessorTypes_getterAndSuperSetter() { | |
| 13073 Source source = addSource(EngineTestCase.createSource([ | |
| 13074 "class A {", | |
| 13075 " int get g { return 0; }", | |
| 13076 " set g(int v) {}", | |
| 13077 "}", | |
| 13078 "class B extends A {", | |
| 13079 " set g(String v) {}", | |
| 13080 "}"])); | |
| 13081 resolve(source); | |
| 13082 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES])
; | |
| 13083 verify([source]); | |
| 13084 } | |
| 13085 void fail_mismatchedAccessorTypes_superGetterAndSetter() { | |
| 13086 Source source = addSource(EngineTestCase.createSource([ | |
| 13087 "class A {", | |
| 13088 " int get g { return 0; }", | |
| 13089 " set g(int v) {}", | |
| 13090 "}", | |
| 13091 "class B extends A {", | |
| 13092 " String get g { return ''; }", | |
| 13093 "}"])); | |
| 13094 resolve(source); | |
| 13095 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES])
; | |
| 13096 verify([source]); | |
| 13097 } | |
| 13098 void fail_undefinedGetter() { | 13549 void fail_undefinedGetter() { |
| 13099 Source source = addSource(EngineTestCase.createSource([])); | 13550 Source source = addSource(EngineTestCase.createSource([])); |
| 13100 resolve(source); | 13551 resolve(source); |
| 13101 assertErrors(source, [StaticWarningCode.UNDEFINED_GETTER]); | 13552 assertErrors(source, [StaticWarningCode.UNDEFINED_GETTER]); |
| 13102 verify([source]); | 13553 verify([source]); |
| 13103 } | 13554 } |
| 13104 void fail_undefinedIdentifier_commentReference() { | 13555 void fail_undefinedIdentifier_commentReference() { |
| 13105 Source source = addSource(EngineTestCase.createSource(["/** [m] xxx [new B.c
] */", "class A {", "}"])); | 13556 Source source = addSource(EngineTestCase.createSource(["/** [m] xxx [new B.c
] */", "class A {", "}"])); |
| 13106 resolve(source); | 13557 resolve(source); |
| 13107 assertErrors(source, [ | 13558 assertErrors(source, [ |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13498 resolve(source); | 13949 resolve(source); |
| 13499 assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]); | 13950 assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]); |
| 13500 verify([source]); | 13951 verify([source]); |
| 13501 } | 13952 } |
| 13502 void test_assignmentToConst_localVariable() { | 13953 void test_assignmentToConst_localVariable() { |
| 13503 Source source = addSource(EngineTestCase.createSource(["f() {", " const x =
0;", " x = 1;", "}"])); | 13954 Source source = addSource(EngineTestCase.createSource(["f() {", " const x =
0;", " x = 1;", "}"])); |
| 13504 resolve(source); | 13955 resolve(source); |
| 13505 assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]); | 13956 assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]); |
| 13506 verify([source]); | 13957 verify([source]); |
| 13507 } | 13958 } |
| 13508 void test_assignmentToFinal_excludedSetter() { | |
| 13509 Source source = addSource(EngineTestCase.createSource([ | |
| 13510 "class A {", | |
| 13511 " var v;", | |
| 13512 "}", | |
| 13513 "class B extends A {", | |
| 13514 " final v = 0;", | |
| 13515 "}", | |
| 13516 "main() {", | |
| 13517 " new B().v = 1;", | |
| 13518 "}"])); | |
| 13519 resolve(source); | |
| 13520 assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]); | |
| 13521 verify([source]); | |
| 13522 } | |
| 13523 void test_assignmentToFinal_instanceVariable() { | 13959 void test_assignmentToFinal_instanceVariable() { |
| 13524 Source source = addSource(EngineTestCase.createSource([ | 13960 Source source = addSource(EngineTestCase.createSource([ |
| 13525 "class A {", | 13961 "class A {", |
| 13526 " final v = 0;", | 13962 " final v = 0;", |
| 13527 "}", | 13963 "}", |
| 13528 "f() {", | 13964 "f() {", |
| 13529 " A a = new A();", | 13965 " A a = new A();", |
| 13530 " a.v = 1;", | 13966 " a.v = 1;", |
| 13531 "}"])); | 13967 "}"])); |
| 13532 resolve(source); | 13968 resolve(source); |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14301 void test_mismatchedAccessorTypes_class() { | 14737 void test_mismatchedAccessorTypes_class() { |
| 14302 Source source = addSource(EngineTestCase.createSource([ | 14738 Source source = addSource(EngineTestCase.createSource([ |
| 14303 "class A {", | 14739 "class A {", |
| 14304 " int get g { return 0; }", | 14740 " int get g { return 0; }", |
| 14305 " set g(String v) {}", | 14741 " set g(String v) {}", |
| 14306 "}"])); | 14742 "}"])); |
| 14307 resolve(source); | 14743 resolve(source); |
| 14308 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES])
; | 14744 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES])
; |
| 14309 verify([source]); | 14745 verify([source]); |
| 14310 } | 14746 } |
| 14747 void test_mismatchedAccessorTypes_getterAndSuperSetter() { |
| 14748 Source source = addSource(EngineTestCase.createSource([ |
| 14749 "class A {", |
| 14750 " int get g { return 0; }", |
| 14751 "}", |
| 14752 "class B extends A {", |
| 14753 " set g(String v) {}", |
| 14754 "}"])); |
| 14755 resolve(source); |
| 14756 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES_F
ROM_SUPERTYPE]); |
| 14757 verify([source]); |
| 14758 } |
| 14759 void test_mismatchedAccessorTypes_setterAndSuperGetter() { |
| 14760 Source source = addSource(EngineTestCase.createSource([ |
| 14761 "class A {", |
| 14762 " set g(int v) {}", |
| 14763 "}", |
| 14764 "class B extends A {", |
| 14765 " String get g { return ''; }", |
| 14766 "}"])); |
| 14767 resolve(source); |
| 14768 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES_F
ROM_SUPERTYPE]); |
| 14769 verify([source]); |
| 14770 } |
| 14311 void test_mismatchedAccessorTypes_topLevel() { | 14771 void test_mismatchedAccessorTypes_topLevel() { |
| 14312 Source source = addSource(EngineTestCase.createSource(["int get g { return 0
; }", "set g(String v) {}"])); | 14772 Source source = addSource(EngineTestCase.createSource(["int get g { return 0
; }", "set g(String v) {}"])); |
| 14313 resolve(source); | 14773 resolve(source); |
| 14314 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES])
; | 14774 assertErrors(source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES])
; |
| 14315 verify([source]); | 14775 verify([source]); |
| 14316 } | 14776 } |
| 14777 void test_mixedReturnTypes_localFunction() { |
| 14778 Source source = addSource(EngineTestCase.createSource([ |
| 14779 "class C {", |
| 14780 " m(int x) {", |
| 14781 " return (int y) {", |
| 14782 " if (y < 0) {", |
| 14783 " return;", |
| 14784 " }", |
| 14785 " return 0;", |
| 14786 " };", |
| 14787 " }", |
| 14788 "}"])); |
| 14789 resolve(source); |
| 14790 assertErrors(source, [StaticWarningCode.MIXED_RETURN_TYPES]); |
| 14791 verify([source]); |
| 14792 } |
| 14793 void test_mixedReturnTypes_method() { |
| 14794 Source source = addSource(EngineTestCase.createSource([ |
| 14795 "class C {", |
| 14796 " m(int x) {", |
| 14797 " if (x < 0) {", |
| 14798 " return;", |
| 14799 " }", |
| 14800 " return 0;", |
| 14801 " }", |
| 14802 "}"])); |
| 14803 resolve(source); |
| 14804 assertErrors(source, [StaticWarningCode.MIXED_RETURN_TYPES]); |
| 14805 verify([source]); |
| 14806 } |
| 14807 void test_mixedReturnTypes_topLevelFunction() { |
| 14808 Source source = addSource(EngineTestCase.createSource([ |
| 14809 "f(int x) {", |
| 14810 " if (x < 0) {", |
| 14811 " return;", |
| 14812 " }", |
| 14813 " return 0;", |
| 14814 "}"])); |
| 14815 resolve(source); |
| 14816 assertErrors(source, [StaticWarningCode.MIXED_RETURN_TYPES]); |
| 14817 verify([source]); |
| 14818 } |
| 14317 void test_newWithAbstractClass() { | 14819 void test_newWithAbstractClass() { |
| 14318 Source source = addSource(EngineTestCase.createSource([ | 14820 Source source = addSource(EngineTestCase.createSource([ |
| 14319 "abstract class A {}", | 14821 "abstract class A {}", |
| 14320 "void f() {", | 14822 "void f() {", |
| 14321 " A a = new A();", | 14823 " A a = new A();", |
| 14322 "}"])); | 14824 "}"])); |
| 14323 resolve(source); | 14825 resolve(source); |
| 14324 assertErrors(source, [StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); | 14826 assertErrors(source, [StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]); |
| 14325 verify([source]); | 14827 verify([source]); |
| 14326 } | 14828 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14474 "}", | 14976 "}", |
| 14475 "abstract class B {", | 14977 "abstract class B {", |
| 14476 " int x(int a, [int b]);", | 14978 " int x(int a, [int b]);", |
| 14477 "}", | 14979 "}", |
| 14478 "class C implements A, B {", | 14980 "class C implements A, B {", |
| 14479 "}"])); | 14981 "}"])); |
| 14480 resolve(source); | 14982 resolve(source); |
| 14481 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); | 14983 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); |
| 14482 verify([source]); | 14984 verify([source]); |
| 14483 } | 14985 } |
| 14484 void test_nonAbstractClassInheritsAbstractMemberOne_setter_excluded() { | |
| 14485 Source source = addSource(EngineTestCase.createSource([ | |
| 14486 "class A {", | |
| 14487 " final int x = 0;", | |
| 14488 "}", | |
| 14489 "class B implements A {", | |
| 14490 " int get x => 42;", | |
| 14491 "}"])); | |
| 14492 resolve(source); | |
| 14493 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); | |
| 14494 verify([source]); | |
| 14495 } | |
| 14496 void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface() { | 14986 void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface() { |
| 14497 Source source = addSource(EngineTestCase.createSource([ | 14987 Source source = addSource(EngineTestCase.createSource([ |
| 14498 "class I {", | 14988 "class I {", |
| 14499 " set s(int i) {}", | 14989 " set s(int i) {}", |
| 14500 "}", | 14990 "}", |
| 14501 "class C implements I {", | 14991 "class C implements I {", |
| 14502 "}"])); | 14992 "}"])); |
| 14503 resolve(source); | 14993 resolve(source); |
| 14504 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); | 14994 assertErrors(source, [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT
_MEMBER_ONE]); |
| 14505 verify([source]); | 14995 verify([source]); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14760 resolve(source); | 15250 resolve(source); |
| 14761 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); | 15251 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); |
| 14762 verify([source]); | 15252 verify([source]); |
| 14763 } | 15253 } |
| 14764 void test_typeParameterReferencedByStatic_setter() { | 15254 void test_typeParameterReferencedByStatic_setter() { |
| 14765 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic set s(K k) {}", "}"])); | 15255 Source source = addSource(EngineTestCase.createSource(["class A<K> {", " st
atic set s(K k) {}", "}"])); |
| 14766 resolve(source); | 15256 resolve(source); |
| 14767 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); | 15257 assertErrors(source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]
); |
| 14768 verify([source]); | 15258 verify([source]); |
| 14769 } | 15259 } |
| 15260 void test_typePromotion_functionType_arg_InterToDyn() { |
| 15261 Source source = addSource(EngineTestCase.createSource([ |
| 15262 "typedef FuncDyn(x);", |
| 15263 "typedef FuncA(A a);", |
| 15264 "class A {}", |
| 15265 "class B {}", |
| 15266 "main(FuncA f) {", |
| 15267 " if (f is FuncDyn) {", |
| 15268 " f(new B());", |
| 15269 " }", |
| 15270 "}"])); |
| 15271 resolve(source); |
| 15272 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); |
| 15273 } |
| 14770 void test_typeTestNonType() { | 15274 void test_typeTestNonType() { |
| 14771 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(var
p) {", " if (p is A) {", " }", "}"])); | 15275 Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(var
p) {", " if (p is A) {", " }", "}"])); |
| 14772 resolve(source); | 15276 resolve(source); |
| 14773 assertErrors(source, [StaticWarningCode.TYPE_TEST_NON_TYPE]); | 15277 assertErrors(source, [StaticWarningCode.TYPE_TEST_NON_TYPE]); |
| 14774 verify([source]); | 15278 verify([source]); |
| 14775 } | 15279 } |
| 14776 void test_undefinedClass_instanceCreation() { | 15280 void test_undefinedClass_instanceCreation() { |
| 14777 Source source = addSource(EngineTestCase.createSource(["f() { new C(); }"]))
; | 15281 Source source = addSource(EngineTestCase.createSource(["f() { new C(); }"]))
; |
| 14778 resolve(source); | 15282 resolve(source); |
| 14779 assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]); | 15283 assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 14810 resolve(source); | 15314 resolve(source); |
| 14811 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 15315 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 14812 } | 15316 } |
| 14813 void test_undefinedIdentifier_function_prefix() { | 15317 void test_undefinedIdentifier_function_prefix() { |
| 14814 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
C {}"])); | 15318 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
C {}"])); |
| 14815 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
b;", "", "int a() => b;", "b.C c;"])); | 15319 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
b;", "", "int a() => b;", "b.C c;"])); |
| 14816 resolve(source); | 15320 resolve(source); |
| 14817 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 15321 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 14818 verify([source]); | 15322 verify([source]); |
| 14819 } | 15323 } |
| 14820 void test_undefinedIdentifier_hideInBlock_function() { | |
| 14821 Source source = addSource(EngineTestCase.createSource([ | |
| 14822 "var v = 1;", | |
| 14823 "main() {", | |
| 14824 " print(v);", | |
| 14825 " v() {}", | |
| 14826 "}", | |
| 14827 "print(x) {}"])); | |
| 14828 resolve(source); | |
| 14829 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | |
| 14830 } | |
| 14831 void test_undefinedIdentifier_hideInBlock_local() { | |
| 14832 Source source = addSource(EngineTestCase.createSource([ | |
| 14833 "var v = 1;", | |
| 14834 "main() {", | |
| 14835 " print(v);", | |
| 14836 " var v = 2;", | |
| 14837 "}", | |
| 14838 "print(x) {}"])); | |
| 14839 resolve(source); | |
| 14840 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | |
| 14841 } | |
| 14842 void test_undefinedIdentifier_hideInBlock_subBlock() { | |
| 14843 Source source = addSource(EngineTestCase.createSource([ | |
| 14844 "var v = 1;", | |
| 14845 "main() {", | |
| 14846 " {", | |
| 14847 " print(v);", | |
| 14848 " }", | |
| 14849 " var v = 2;", | |
| 14850 "}", | |
| 14851 "print(x) {}"])); | |
| 14852 resolve(source); | |
| 14853 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | |
| 14854 } | |
| 14855 void test_undefinedIdentifier_initializer() { | 15324 void test_undefinedIdentifier_initializer() { |
| 14856 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); | 15325 Source source = addSource(EngineTestCase.createSource(["var a = b;"])); |
| 14857 resolve(source); | 15326 resolve(source); |
| 14858 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 15327 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 14859 } | 15328 } |
| 14860 void test_undefinedIdentifier_initializer_prefix() { | 15329 void test_undefinedIdentifier_initializer_prefix() { |
| 14861 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
C {}"])); | 15330 addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class
C {}"])); |
| 14862 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
b;", "", "var a = b;", "b.C c;"])); | 15331 Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as
b;", "", "var a = b;", "b.C c;"])); |
| 14863 resolve(source); | 15332 resolve(source); |
| 14864 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 15333 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15048 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_required)
; | 15517 runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_required)
; |
| 15049 }); | 15518 }); |
| 15050 _ut.test('test_assignmentToConst_instanceVariable', () { | 15519 _ut.test('test_assignmentToConst_instanceVariable', () { |
| 15051 final __test = new StaticWarningCodeTest(); | 15520 final __test = new StaticWarningCodeTest(); |
| 15052 runJUnitTest(__test, __test.test_assignmentToConst_instanceVariable); | 15521 runJUnitTest(__test, __test.test_assignmentToConst_instanceVariable); |
| 15053 }); | 15522 }); |
| 15054 _ut.test('test_assignmentToConst_localVariable', () { | 15523 _ut.test('test_assignmentToConst_localVariable', () { |
| 15055 final __test = new StaticWarningCodeTest(); | 15524 final __test = new StaticWarningCodeTest(); |
| 15056 runJUnitTest(__test, __test.test_assignmentToConst_localVariable); | 15525 runJUnitTest(__test, __test.test_assignmentToConst_localVariable); |
| 15057 }); | 15526 }); |
| 15058 _ut.test('test_assignmentToFinal_excludedSetter', () { | |
| 15059 final __test = new StaticWarningCodeTest(); | |
| 15060 runJUnitTest(__test, __test.test_assignmentToFinal_excludedSetter); | |
| 15061 }); | |
| 15062 _ut.test('test_assignmentToFinal_instanceVariable', () { | 15527 _ut.test('test_assignmentToFinal_instanceVariable', () { |
| 15063 final __test = new StaticWarningCodeTest(); | 15528 final __test = new StaticWarningCodeTest(); |
| 15064 runJUnitTest(__test, __test.test_assignmentToFinal_instanceVariable); | 15529 runJUnitTest(__test, __test.test_assignmentToFinal_instanceVariable); |
| 15065 }); | 15530 }); |
| 15066 _ut.test('test_assignmentToFinal_localVariable', () { | 15531 _ut.test('test_assignmentToFinal_localVariable', () { |
| 15067 final __test = new StaticWarningCodeTest(); | 15532 final __test = new StaticWarningCodeTest(); |
| 15068 runJUnitTest(__test, __test.test_assignmentToFinal_localVariable); | 15533 runJUnitTest(__test, __test.test_assignmentToFinal_localVariable); |
| 15069 }); | 15534 }); |
| 15070 _ut.test('test_assignmentToFinal_prefixMinusMinus', () { | 15535 _ut.test('test_assignmentToFinal_prefixMinusMinus', () { |
| 15071 final __test = new StaticWarningCodeTest(); | 15536 final __test = new StaticWarningCodeTest(); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15356 runJUnitTest(__test, __test.test_mapKeyTypeNotAssignable); | 15821 runJUnitTest(__test, __test.test_mapKeyTypeNotAssignable); |
| 15357 }); | 15822 }); |
| 15358 _ut.test('test_mapValueTypeNotAssignable', () { | 15823 _ut.test('test_mapValueTypeNotAssignable', () { |
| 15359 final __test = new StaticWarningCodeTest(); | 15824 final __test = new StaticWarningCodeTest(); |
| 15360 runJUnitTest(__test, __test.test_mapValueTypeNotAssignable); | 15825 runJUnitTest(__test, __test.test_mapValueTypeNotAssignable); |
| 15361 }); | 15826 }); |
| 15362 _ut.test('test_mismatchedAccessorTypes_class', () { | 15827 _ut.test('test_mismatchedAccessorTypes_class', () { |
| 15363 final __test = new StaticWarningCodeTest(); | 15828 final __test = new StaticWarningCodeTest(); |
| 15364 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_class); | 15829 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_class); |
| 15365 }); | 15830 }); |
| 15831 _ut.test('test_mismatchedAccessorTypes_getterAndSuperSetter', () { |
| 15832 final __test = new StaticWarningCodeTest(); |
| 15833 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_getterAndSuperS
etter); |
| 15834 }); |
| 15835 _ut.test('test_mismatchedAccessorTypes_setterAndSuperGetter', () { |
| 15836 final __test = new StaticWarningCodeTest(); |
| 15837 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_setterAndSuperG
etter); |
| 15838 }); |
| 15366 _ut.test('test_mismatchedAccessorTypes_topLevel', () { | 15839 _ut.test('test_mismatchedAccessorTypes_topLevel', () { |
| 15367 final __test = new StaticWarningCodeTest(); | 15840 final __test = new StaticWarningCodeTest(); |
| 15368 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_topLevel); | 15841 runJUnitTest(__test, __test.test_mismatchedAccessorTypes_topLevel); |
| 15369 }); | 15842 }); |
| 15843 _ut.test('test_mixedReturnTypes_localFunction', () { |
| 15844 final __test = new StaticWarningCodeTest(); |
| 15845 runJUnitTest(__test, __test.test_mixedReturnTypes_localFunction); |
| 15846 }); |
| 15847 _ut.test('test_mixedReturnTypes_method', () { |
| 15848 final __test = new StaticWarningCodeTest(); |
| 15849 runJUnitTest(__test, __test.test_mixedReturnTypes_method); |
| 15850 }); |
| 15851 _ut.test('test_mixedReturnTypes_topLevelFunction', () { |
| 15852 final __test = new StaticWarningCodeTest(); |
| 15853 runJUnitTest(__test, __test.test_mixedReturnTypes_topLevelFunction); |
| 15854 }); |
| 15370 _ut.test('test_newWithAbstractClass', () { | 15855 _ut.test('test_newWithAbstractClass', () { |
| 15371 final __test = new StaticWarningCodeTest(); | 15856 final __test = new StaticWarningCodeTest(); |
| 15372 runJUnitTest(__test, __test.test_newWithAbstractClass); | 15857 runJUnitTest(__test, __test.test_newWithAbstractClass); |
| 15373 }); | 15858 }); |
| 15374 _ut.test('test_newWithInvalidTypeParameters', () { | 15859 _ut.test('test_newWithInvalidTypeParameters', () { |
| 15375 final __test = new StaticWarningCodeTest(); | 15860 final __test = new StaticWarningCodeTest(); |
| 15376 runJUnitTest(__test, __test.test_newWithInvalidTypeParameters); | 15861 runJUnitTest(__test, __test.test_newWithInvalidTypeParameters); |
| 15377 }); | 15862 }); |
| 15378 _ut.test('test_newWithInvalidTypeParameters_tooFew', () { | 15863 _ut.test('test_newWithInvalidTypeParameters_tooFew', () { |
| 15379 final __test = new StaticWarningCodeTest(); | 15864 final __test = new StaticWarningCodeTest(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15420 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_method_fromInterface); | 15905 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_method_fromInterface); |
| 15421 }); | 15906 }); |
| 15422 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_method_fromSuperc
lass', () { | 15907 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_method_fromSuperc
lass', () { |
| 15423 final __test = new StaticWarningCodeTest(); | 15908 final __test = new StaticWarningCodeTest(); |
| 15424 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_method_fromSuperclass); | 15909 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_method_fromSuperclass); |
| 15425 }); | 15910 }); |
| 15426 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_method_optionalPa
ramCount', () { | 15911 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_method_optionalPa
ramCount', () { |
| 15427 final __test = new StaticWarningCodeTest(); | 15912 final __test = new StaticWarningCodeTest(); |
| 15428 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_method_optionalParamCount); | 15913 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_method_optionalParamCount); |
| 15429 }); | 15914 }); |
| 15430 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_setter_excluded',
() { | |
| 15431 final __test = new StaticWarningCodeTest(); | |
| 15432 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_setter_excluded); | |
| 15433 }); | |
| 15434 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterf
ace', () { | 15915 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterf
ace', () { |
| 15435 final __test = new StaticWarningCodeTest(); | 15916 final __test = new StaticWarningCodeTest(); |
| 15436 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_setter_fromInterface); | 15917 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_setter_fromInterface); |
| 15437 }); | 15918 }); |
| 15438 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_setter_fromSuperc
lass', () { | 15919 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_setter_fromSuperc
lass', () { |
| 15439 final __test = new StaticWarningCodeTest(); | 15920 final __test = new StaticWarningCodeTest(); |
| 15440 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_setter_fromSuperclass); | 15921 runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberO
ne_setter_fromSuperclass); |
| 15441 }); | 15922 }); |
| 15442 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_superclasses_inte
rface', () { | 15923 _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_superclasses_inte
rface', () { |
| 15443 final __test = new StaticWarningCodeTest(); | 15924 final __test = new StaticWarningCodeTest(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15552 runJUnitTest(__test, __test.test_typeParameterReferencedByStatic_methodP
arameter); | 16033 runJUnitTest(__test, __test.test_typeParameterReferencedByStatic_methodP
arameter); |
| 15553 }); | 16034 }); |
| 15554 _ut.test('test_typeParameterReferencedByStatic_methodReturn', () { | 16035 _ut.test('test_typeParameterReferencedByStatic_methodReturn', () { |
| 15555 final __test = new StaticWarningCodeTest(); | 16036 final __test = new StaticWarningCodeTest(); |
| 15556 runJUnitTest(__test, __test.test_typeParameterReferencedByStatic_methodR
eturn); | 16037 runJUnitTest(__test, __test.test_typeParameterReferencedByStatic_methodR
eturn); |
| 15557 }); | 16038 }); |
| 15558 _ut.test('test_typeParameterReferencedByStatic_setter', () { | 16039 _ut.test('test_typeParameterReferencedByStatic_setter', () { |
| 15559 final __test = new StaticWarningCodeTest(); | 16040 final __test = new StaticWarningCodeTest(); |
| 15560 runJUnitTest(__test, __test.test_typeParameterReferencedByStatic_setter)
; | 16041 runJUnitTest(__test, __test.test_typeParameterReferencedByStatic_setter)
; |
| 15561 }); | 16042 }); |
| 16043 _ut.test('test_typePromotion_functionType_arg_InterToDyn', () { |
| 16044 final __test = new StaticWarningCodeTest(); |
| 16045 runJUnitTest(__test, __test.test_typePromotion_functionType_arg_InterToD
yn); |
| 16046 }); |
| 15562 _ut.test('test_typeTestNonType', () { | 16047 _ut.test('test_typeTestNonType', () { |
| 15563 final __test = new StaticWarningCodeTest(); | 16048 final __test = new StaticWarningCodeTest(); |
| 15564 runJUnitTest(__test, __test.test_typeTestNonType); | 16049 runJUnitTest(__test, __test.test_typeTestNonType); |
| 15565 }); | 16050 }); |
| 15566 _ut.test('test_undefinedClassBoolean_variableDeclaration', () { | 16051 _ut.test('test_undefinedClassBoolean_variableDeclaration', () { |
| 15567 final __test = new StaticWarningCodeTest(); | 16052 final __test = new StaticWarningCodeTest(); |
| 15568 runJUnitTest(__test, __test.test_undefinedClassBoolean_variableDeclarati
on); | 16053 runJUnitTest(__test, __test.test_undefinedClassBoolean_variableDeclarati
on); |
| 15569 }); | 16054 }); |
| 15570 _ut.test('test_undefinedClass_instanceCreation', () { | 16055 _ut.test('test_undefinedClass_instanceCreation', () { |
| 15571 final __test = new StaticWarningCodeTest(); | 16056 final __test = new StaticWarningCodeTest(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 15584 runJUnitTest(__test, __test.test_undefinedIdentifier_for); | 16069 runJUnitTest(__test, __test.test_undefinedIdentifier_for); |
| 15585 }); | 16070 }); |
| 15586 _ut.test('test_undefinedIdentifier_function', () { | 16071 _ut.test('test_undefinedIdentifier_function', () { |
| 15587 final __test = new StaticWarningCodeTest(); | 16072 final __test = new StaticWarningCodeTest(); |
| 15588 runJUnitTest(__test, __test.test_undefinedIdentifier_function); | 16073 runJUnitTest(__test, __test.test_undefinedIdentifier_function); |
| 15589 }); | 16074 }); |
| 15590 _ut.test('test_undefinedIdentifier_function_prefix', () { | 16075 _ut.test('test_undefinedIdentifier_function_prefix', () { |
| 15591 final __test = new StaticWarningCodeTest(); | 16076 final __test = new StaticWarningCodeTest(); |
| 15592 runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix); | 16077 runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix); |
| 15593 }); | 16078 }); |
| 15594 _ut.test('test_undefinedIdentifier_hideInBlock_function', () { | |
| 15595 final __test = new StaticWarningCodeTest(); | |
| 15596 runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_functio
n); | |
| 15597 }); | |
| 15598 _ut.test('test_undefinedIdentifier_hideInBlock_local', () { | |
| 15599 final __test = new StaticWarningCodeTest(); | |
| 15600 runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_local); | |
| 15601 }); | |
| 15602 _ut.test('test_undefinedIdentifier_hideInBlock_subBlock', () { | |
| 15603 final __test = new StaticWarningCodeTest(); | |
| 15604 runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_subBloc
k); | |
| 15605 }); | |
| 15606 _ut.test('test_undefinedIdentifier_initializer', () { | 16079 _ut.test('test_undefinedIdentifier_initializer', () { |
| 15607 final __test = new StaticWarningCodeTest(); | 16080 final __test = new StaticWarningCodeTest(); |
| 15608 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); | 16081 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer); |
| 15609 }); | 16082 }); |
| 15610 _ut.test('test_undefinedIdentifier_initializer_prefix', () { | 16083 _ut.test('test_undefinedIdentifier_initializer_prefix', () { |
| 15611 final __test = new StaticWarningCodeTest(); | 16084 final __test = new StaticWarningCodeTest(); |
| 15612 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer_prefix)
; | 16085 runJUnitTest(__test, __test.test_undefinedIdentifier_initializer_prefix)
; |
| 15613 }); | 16086 }); |
| 15614 _ut.test('test_undefinedIdentifier_metadata', () { | 16087 _ut.test('test_undefinedIdentifier_metadata', () { |
| 15615 final __test = new StaticWarningCodeTest(); | 16088 final __test = new StaticWarningCodeTest(); |
| (...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17845 void test_overrideEqualsButNotHashCode() { | 18318 void test_overrideEqualsButNotHashCode() { |
| 17846 Source source = addSource(EngineTestCase.createSource([ | 18319 Source source = addSource(EngineTestCase.createSource([ |
| 17847 "class A {", | 18320 "class A {", |
| 17848 " bool operator ==(x) {}", | 18321 " bool operator ==(x) {}", |
| 17849 " get hashCode => 0;", | 18322 " get hashCode => 0;", |
| 17850 "}"])); | 18323 "}"])); |
| 17851 resolve(source); | 18324 resolve(source); |
| 17852 assertNoErrors(source); | 18325 assertNoErrors(source); |
| 17853 verify([source]); | 18326 verify([source]); |
| 17854 } | 18327 } |
| 17855 void test_unnecessaryCast_13855_parameter_A() { | 18328 void test_proxy_annotation_prefixed() { |
| 17856 Source source = addSource(EngineTestCase.createSource([ | 18329 Source source = addSource(EngineTestCase.createSource([ |
| 17857 "class A{", | 18330 "library L;", |
| 17858 " a() {}", | 18331 "import 'meta.dart';", |
| 17859 "}", | 18332 "@proxy", |
| 17860 "class B<E> {", | 18333 "class A {}", |
| 17861 " E e;", | 18334 "f(var a) {", |
| 17862 " m() {", | 18335 " a = new A();", |
| 17863 " (e as A).a();", | 18336 " a.m();", |
| 18337 " var x = a.g;", |
| 18338 " a.s = 1;", |
| 18339 " var y = a + a;", |
| 18340 " a++;", |
| 18341 " ++a;", |
| 18342 "}"])); |
| 18343 addSource2("/meta.dart", EngineTestCase.createSource([ |
| 18344 "library meta;", |
| 18345 "const proxy = const _Proxy();", |
| 18346 "class _Proxy { const _Proxy(); }"])); |
| 18347 resolve(source); |
| 18348 assertNoErrors(source); |
| 18349 } |
| 18350 void test_proxy_annotation_prefixed2() { |
| 18351 Source source = addSource(EngineTestCase.createSource([ |
| 18352 "library L;", |
| 18353 "import 'meta.dart';", |
| 18354 "@proxy", |
| 18355 "class A {}", |
| 18356 "class B {", |
| 18357 " f(var a) {", |
| 18358 " a = new A();", |
| 18359 " a.m();", |
| 18360 " var x = a.g;", |
| 18361 " a.s = 1;", |
| 18362 " var y = a + a;", |
| 18363 " a++;", |
| 18364 " ++a;", |
| 17864 " }", | 18365 " }", |
| 17865 "}"])); | 18366 "}"])); |
| 18367 addSource2("/meta.dart", EngineTestCase.createSource([ |
| 18368 "library meta;", |
| 18369 "const proxy = const _Proxy();", |
| 18370 "class _Proxy { const _Proxy(); }"])); |
| 17866 resolve(source); | 18371 resolve(source); |
| 17867 assertNoErrors(source); | 18372 assertNoErrors(source); |
| 17868 verify([source]); | 18373 } |
| 18374 void test_proxy_annotation_prefixed3() { |
| 18375 Source source = addSource(EngineTestCase.createSource([ |
| 18376 "library L;", |
| 18377 "import 'meta.dart';", |
| 18378 "class B {", |
| 18379 " f(var a) {", |
| 18380 " a = new A();", |
| 18381 " a.m();", |
| 18382 " var x = a.g;", |
| 18383 " a.s = 1;", |
| 18384 " var y = a + a;", |
| 18385 " a++;", |
| 18386 " ++a;", |
| 18387 " }", |
| 18388 "}", |
| 18389 "@proxy", |
| 18390 "class A {}"])); |
| 18391 addSource2("/meta.dart", EngineTestCase.createSource([ |
| 18392 "library meta;", |
| 18393 "const proxy = const _Proxy();", |
| 18394 "class _Proxy { const _Proxy(); }"])); |
| 18395 resolve(source); |
| 18396 assertNoErrors(source); |
| 17869 } | 18397 } |
| 17870 void test_undefinedGetter_inSubtype() { | 18398 void test_undefinedGetter_inSubtype() { |
| 17871 Source source = addSource(EngineTestCase.createSource([ | 18399 Source source = addSource(EngineTestCase.createSource([ |
| 17872 "class A {}", | 18400 "class A {}", |
| 17873 "class B extends A {", | 18401 "class B extends A {", |
| 17874 " get b => 0;", | 18402 " get b => 0;", |
| 17875 "}", | 18403 "}", |
| 17876 "f(var a) {", | 18404 "f(var a) {", |
| 17877 " if(a is A) {", | 18405 " if(a is A) {", |
| 17878 " return a.b;", | 18406 " return a.b;", |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17999 " set b(x) {}", | 18527 " set b(x) {}", |
| 18000 "}", | 18528 "}", |
| 18001 "f(var a) {", | 18529 "f(var a) {", |
| 18002 " if(a is A) {", | 18530 " if(a is A) {", |
| 18003 " a.b = 0;", | 18531 " a.b = 0;", |
| 18004 " }", | 18532 " }", |
| 18005 "}"])); | 18533 "}"])); |
| 18006 resolve(source); | 18534 resolve(source); |
| 18007 assertNoErrors(source); | 18535 assertNoErrors(source); |
| 18008 } | 18536 } |
| 18537 void test_unnecessaryCast_13855_parameter_A() { |
| 18538 Source source = addSource(EngineTestCase.createSource([ |
| 18539 "class A{", |
| 18540 " a() {}", |
| 18541 "}", |
| 18542 "class B<E> {", |
| 18543 " E e;", |
| 18544 " m() {", |
| 18545 " (e as A).a();", |
| 18546 " }", |
| 18547 "}"])); |
| 18548 resolve(source); |
| 18549 assertNoErrors(source); |
| 18550 verify([source]); |
| 18551 } |
| 18009 void test_unnecessaryCast_dynamic_type() { | 18552 void test_unnecessaryCast_dynamic_type() { |
| 18010 Source source = addSource(EngineTestCase.createSource(["m(v) {", " var b =
v as Object;", "}"])); | 18553 Source source = addSource(EngineTestCase.createSource(["m(v) {", " var b =
v as Object;", "}"])); |
| 18011 resolve(source); | 18554 resolve(source); |
| 18012 assertNoErrors(source); | 18555 assertNoErrors(source); |
| 18013 verify([source]); | 18556 verify([source]); |
| 18014 } | 18557 } |
| 18015 void test_unnecessaryCast_type_dynamic() { | 18558 void test_unnecessaryCast_type_dynamic() { |
| 18016 Source source = addSource(EngineTestCase.createSource(["m(v) {", " var b =
Object as dynamic;", "}"])); | 18559 Source source = addSource(EngineTestCase.createSource(["m(v) {", " var b =
Object as dynamic;", "}"])); |
| 18017 resolve(source); | 18560 resolve(source); |
| 18018 assertNoErrors(source); | 18561 assertNoErrors(source); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18144 runJUnitTest(__test, __test.test_duplicateImport_show); | 18687 runJUnitTest(__test, __test.test_duplicateImport_show); |
| 18145 }); | 18688 }); |
| 18146 _ut.test('test_overriddingPrivateMember_sameLibrary', () { | 18689 _ut.test('test_overriddingPrivateMember_sameLibrary', () { |
| 18147 final __test = new NonHintCodeTest(); | 18690 final __test = new NonHintCodeTest(); |
| 18148 runJUnitTest(__test, __test.test_overriddingPrivateMember_sameLibrary); | 18691 runJUnitTest(__test, __test.test_overriddingPrivateMember_sameLibrary); |
| 18149 }); | 18692 }); |
| 18150 _ut.test('test_overrideEqualsButNotHashCode', () { | 18693 _ut.test('test_overrideEqualsButNotHashCode', () { |
| 18151 final __test = new NonHintCodeTest(); | 18694 final __test = new NonHintCodeTest(); |
| 18152 runJUnitTest(__test, __test.test_overrideEqualsButNotHashCode); | 18695 runJUnitTest(__test, __test.test_overrideEqualsButNotHashCode); |
| 18153 }); | 18696 }); |
| 18697 _ut.test('test_proxy_annotation_prefixed', () { |
| 18698 final __test = new NonHintCodeTest(); |
| 18699 runJUnitTest(__test, __test.test_proxy_annotation_prefixed); |
| 18700 }); |
| 18701 _ut.test('test_proxy_annotation_prefixed2', () { |
| 18702 final __test = new NonHintCodeTest(); |
| 18703 runJUnitTest(__test, __test.test_proxy_annotation_prefixed2); |
| 18704 }); |
| 18705 _ut.test('test_proxy_annotation_prefixed3', () { |
| 18706 final __test = new NonHintCodeTest(); |
| 18707 runJUnitTest(__test, __test.test_proxy_annotation_prefixed3); |
| 18708 }); |
| 18154 _ut.test('test_undefinedGetter_inSubtype', () { | 18709 _ut.test('test_undefinedGetter_inSubtype', () { |
| 18155 final __test = new NonHintCodeTest(); | 18710 final __test = new NonHintCodeTest(); |
| 18156 runJUnitTest(__test, __test.test_undefinedGetter_inSubtype); | 18711 runJUnitTest(__test, __test.test_undefinedGetter_inSubtype); |
| 18157 }); | 18712 }); |
| 18158 _ut.test('test_undefinedMethod_assignmentExpression_inSubtype', () { | 18713 _ut.test('test_undefinedMethod_assignmentExpression_inSubtype', () { |
| 18159 final __test = new NonHintCodeTest(); | 18714 final __test = new NonHintCodeTest(); |
| 18160 runJUnitTest(__test, __test.test_undefinedMethod_assignmentExpression_in
Subtype); | 18715 runJUnitTest(__test, __test.test_undefinedMethod_assignmentExpression_in
Subtype); |
| 18161 }); | 18716 }); |
| 18162 _ut.test('test_undefinedMethod_inSubtype', () { | 18717 _ut.test('test_undefinedMethod_inSubtype', () { |
| 18163 final __test = new NonHintCodeTest(); | 18718 final __test = new NonHintCodeTest(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18227 final __test = new NonHintCodeTest(); | 18782 final __test = new NonHintCodeTest(); |
| 18228 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); | 18783 runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction); |
| 18229 }); | 18784 }); |
| 18230 }); | 18785 }); |
| 18231 } | 18786 } |
| 18232 } | 18787 } |
| 18233 class EnclosedScopeTest extends ResolverTestCase { | 18788 class EnclosedScopeTest extends ResolverTestCase { |
| 18234 void test_define_duplicate() { | 18789 void test_define_duplicate() { |
| 18235 LibraryElement definingLibrary2 = createTestLibrary(); | 18790 LibraryElement definingLibrary2 = createTestLibrary(); |
| 18236 GatheringErrorListener errorListener2 = new GatheringErrorListener(); | 18791 GatheringErrorListener errorListener2 = new GatheringErrorListener(); |
| 18237 Scope rootScope = new Scope_20(definingLibrary2, errorListener2); | 18792 Scope rootScope = new Scope_22(definingLibrary2, errorListener2); |
| 18238 EnclosedScope scope = new EnclosedScope(rootScope); | 18793 EnclosedScope scope = new EnclosedScope(rootScope); |
| 18239 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 18794 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 18240 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 18795 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 18241 scope.define(element1); | 18796 scope.define(element1); |
| 18242 scope.define(element2); | 18797 scope.define(element2); |
| 18243 errorListener2.assertErrors3([ErrorSeverity.ERROR]); | 18798 errorListener2.assertErrors3([ErrorSeverity.ERROR]); |
| 18244 } | 18799 } |
| 18245 void test_define_normal() { | 18800 void test_define_normal() { |
| 18246 LibraryElement definingLibrary3 = createTestLibrary(); | 18801 LibraryElement definingLibrary3 = createTestLibrary(); |
| 18247 GatheringErrorListener errorListener3 = new GatheringErrorListener(); | 18802 GatheringErrorListener errorListener3 = new GatheringErrorListener(); |
| 18248 Scope rootScope = new Scope_21(definingLibrary3, errorListener3); | 18803 Scope rootScope = new Scope_23(definingLibrary3, errorListener3); |
| 18249 EnclosedScope outerScope = new EnclosedScope(rootScope); | 18804 EnclosedScope outerScope = new EnclosedScope(rootScope); |
| 18250 EnclosedScope innerScope = new EnclosedScope(outerScope); | 18805 EnclosedScope innerScope = new EnclosedScope(outerScope); |
| 18251 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); | 18806 VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v1")); |
| 18252 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); | 18807 VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.id
entifier3("v2")); |
| 18253 outerScope.define(element1); | 18808 outerScope.define(element1); |
| 18254 innerScope.define(element2); | 18809 innerScope.define(element2); |
| 18255 errorListener3.assertNoErrors(); | 18810 errorListener3.assertNoErrors(); |
| 18256 } | 18811 } |
| 18257 static dartSuite() { | 18812 static dartSuite() { |
| 18258 _ut.group('EnclosedScopeTest', () { | 18813 _ut.group('EnclosedScopeTest', () { |
| 18259 _ut.test('test_define_duplicate', () { | 18814 _ut.test('test_define_duplicate', () { |
| 18260 final __test = new EnclosedScopeTest(); | 18815 final __test = new EnclosedScopeTest(); |
| 18261 runJUnitTest(__test, __test.test_define_duplicate); | 18816 runJUnitTest(__test, __test.test_define_duplicate); |
| 18262 }); | 18817 }); |
| 18263 _ut.test('test_define_normal', () { | 18818 _ut.test('test_define_normal', () { |
| 18264 final __test = new EnclosedScopeTest(); | 18819 final __test = new EnclosedScopeTest(); |
| 18265 runJUnitTest(__test, __test.test_define_normal); | 18820 runJUnitTest(__test, __test.test_define_normal); |
| 18266 }); | 18821 }); |
| 18267 }); | 18822 }); |
| 18268 } | 18823 } |
| 18269 } | 18824 } |
| 18270 class Scope_20 extends Scope { | 18825 class Scope_22 extends Scope { |
| 18271 LibraryElement definingLibrary2; | 18826 LibraryElement definingLibrary2; |
| 18272 GatheringErrorListener errorListener2; | 18827 GatheringErrorListener errorListener2; |
| 18273 Scope_20(this.definingLibrary2, this.errorListener2) : super(); | 18828 Scope_22(this.definingLibrary2, this.errorListener2) : super(); |
| 18274 LibraryElement get definingLibrary => definingLibrary2; | 18829 LibraryElement get definingLibrary => definingLibrary2; |
| 18275 AnalysisErrorListener get errorListener => errorListener2; | 18830 AnalysisErrorListener get errorListener => errorListener2; |
| 18276 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 18831 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 18277 } | 18832 } |
| 18278 class Scope_21 extends Scope { | 18833 class Scope_23 extends Scope { |
| 18279 LibraryElement definingLibrary3; | 18834 LibraryElement definingLibrary3; |
| 18280 GatheringErrorListener errorListener3; | 18835 GatheringErrorListener errorListener3; |
| 18281 Scope_21(this.definingLibrary3, this.errorListener3) : super(); | 18836 Scope_23(this.definingLibrary3, this.errorListener3) : super(); |
| 18282 LibraryElement get definingLibrary => definingLibrary3; | 18837 LibraryElement get definingLibrary => definingLibrary3; |
| 18283 AnalysisErrorListener get errorListener => errorListener3; | 18838 AnalysisErrorListener get errorListener => errorListener3; |
| 18284 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; | 18839 Element lookup3(Identifier identifier, String name, LibraryElement referencing
Library) => null; |
| 18285 } | 18840 } |
| 18286 class LibraryElementBuilderTest extends EngineTestCase { | 18841 class LibraryElementBuilderTest extends EngineTestCase { |
| 18287 | 18842 |
| 18288 /** | 18843 /** |
| 18289 * The source factory used to create [Source]. | 18844 * The source factory used to create [Source]. |
| 18290 */ | 18845 */ |
| 18291 SourceFactory _sourceFactory; | 18846 SourceFactory _sourceFactory; |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19440 // HintCodeTest.dartSuite(); | 19995 // HintCodeTest.dartSuite(); |
| 19441 // MemberMapTest.dartSuite(); | 19996 // MemberMapTest.dartSuite(); |
| 19442 // NonHintCodeTest.dartSuite(); | 19997 // NonHintCodeTest.dartSuite(); |
| 19443 // NonErrorResolverTest.dartSuite(); | 19998 // NonErrorResolverTest.dartSuite(); |
| 19444 // SimpleResolverTest.dartSuite(); | 19999 // SimpleResolverTest.dartSuite(); |
| 19445 // StaticTypeWarningCodeTest.dartSuite(); | 20000 // StaticTypeWarningCodeTest.dartSuite(); |
| 19446 // StaticWarningCodeTest.dartSuite(); | 20001 // StaticWarningCodeTest.dartSuite(); |
| 19447 // StrictModeTest.dartSuite(); | 20002 // StrictModeTest.dartSuite(); |
| 19448 // TypePropagationTest.dartSuite(); | 20003 // TypePropagationTest.dartSuite(); |
| 19449 } | 20004 } |
| OLD | NEW |