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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/NonErrorResolverTest.java

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 addSource("/lib.dart", createSource(// 1355 addSource("/lib.dart", createSource(//
1356 "library L;", 1356 "library L;",
1357 "class A {", 1357 "class A {",
1358 " static _m() {}", 1358 " static _m() {}",
1359 "}")); 1359 "}"));
1360 resolve(source); 1360 resolve(source);
1361 assertErrors(source, HintCode.OVERRIDDING_PRIVATE_MEMBER); 1361 assertErrors(source, HintCode.OVERRIDDING_PRIVATE_MEMBER);
1362 verify(source); 1362 verify(source);
1363 } 1363 }
1364 1364
1365 public void test_invalidAnnotation_constantVariable() throws Exception { 1365 public void test_invalidAnnotation_constantVariable_field() throws Exception {
1366 Source source = addSource(createSource(//
1367 "@A.C",
1368 "class A {",
1369 " static const C = 0;",
1370 "}"));
1371 resolve(source);
1372 assertNoErrors(source);
1373 verify(source);
1374 }
1375
1376 public void test_invalidAnnotation_constantVariable_field_importWithPrefix() t hrows Exception {
1377 addSource("/lib.dart", createSource(//
1378 "library lib;",
1379 "class A {",
1380 " static const C = 0;",
1381 "}"));
1382 Source source = addSource(createSource(//
1383 "import 'lib.dart' as p;",
1384 "@p.A.C",
1385 "main() {",
1386 "}"));
1387 resolve(source);
1388 assertNoErrors(source);
1389 verify(source);
1390 }
1391
1392 public void test_invalidAnnotation_constantVariable_topLevel() throws Exceptio n {
1366 Source source = addSource(createSource(// 1393 Source source = addSource(createSource(//
1367 "const C = 0;", 1394 "const C = 0;",
1368 "@C", 1395 "@C",
1369 "main() {", 1396 "main() {",
1370 "}")); 1397 "}"));
1371 resolve(source); 1398 resolve(source);
1372 assertNoErrors(source); 1399 assertNoErrors(source);
1373 verify(source); 1400 verify(source);
1374 } 1401 }
1375 1402
1376 public void test_invalidAnnotation_importWithPrefix_constantVariable() throws Exception { 1403 public void test_invalidAnnotation_constantVariable_topLevel_importWithPrefix( ) throws Exception {
1377 addSource("/lib.dart", createSource(// 1404 addSource("/lib.dart", createSource(//
1378 "library lib;", 1405 "library lib;",
1379 "const C = 0;")); 1406 "const C = 0;"));
1380 Source source = addSource(createSource(// 1407 Source source = addSource(createSource(//
1381 "import 'lib.dart' as p;", 1408 "import 'lib.dart' as p;",
1382 "@p.C", 1409 "@p.C",
1383 "main() {", 1410 "main() {",
1384 "}")); 1411 "}"));
1385 resolve(source); 1412 resolve(source);
1386 assertNoErrors(source); 1413 assertNoErrors(source);
1387 verify(source); 1414 verify(source);
1388 } 1415 }
1389 1416
1390 public void test_invalidAnnotation_importWithPrefix_constConstructor() throws Exception { 1417 public void test_invalidAnnotation_constConstructor_importWithPrefix() throws Exception {
1418 addSource("/lib.dart", createSource(//
1419 "library lib;",
1420 "class A {",
1421 " const A(int p);",
1422 "}"));
1423 Source source = addSource(createSource(//
1424 "import 'lib.dart' as p;",
1425 "@p.A(42)",
1426 "main() {",
1427 "}"));
1428 resolve(source);
1429 assertNoErrors(source);
1430 verify(source);
1431 }
1432
1433 public void test_invalidAnnotation_constConstructor_named_importWithPrefix() t hrows Exception {
1391 addSource("/lib.dart", createSource(// 1434 addSource("/lib.dart", createSource(//
1392 "library lib;", 1435 "library lib;",
1393 "class A {", 1436 "class A {",
1394 " const A.named(int p);", 1437 " const A.named(int p);",
1395 "}")); 1438 "}"));
1396 Source source = addSource(createSource(// 1439 Source source = addSource(createSource(//
1397 "import 'lib.dart' as p;", 1440 "import 'lib.dart' as p;",
1398 "@p.A.named(42)", 1441 "@p.A.named(42)",
1399 "main() {", 1442 "main() {",
1400 "}")); 1443 "}"));
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 " B.named(S p) : super.named(p);", 2622 " B.named(S p) : super.named(p);",
2580 "}")); 2623 "}"));
2581 resolve(source); 2624 resolve(source);
2582 assertNoErrors(source); 2625 assertNoErrors(source);
2583 verify(source); 2626 verify(source);
2584 } 2627 }
2585 2628
2586 public void test_proxy_annotation_prefixed() throws Exception { 2629 public void test_proxy_annotation_prefixed() throws Exception {
2587 Source source = addSource(createSource(// 2630 Source source = addSource(createSource(//
2588 "library L;", 2631 "library L;",
2589 "import 'meta.dart';",
2590 "@proxy", 2632 "@proxy",
2591 "class A {}", 2633 "class A {}",
2592 "f(A a) {", 2634 "f(A a) {",
2593 " a.m();", 2635 " a.m();",
2594 " var x = a.g;", 2636 " var x = a.g;",
2595 " a.s = 1;", 2637 " a.s = 1;",
2596 " var y = a + a;", 2638 " var y = a + a;",
2597 " a++;", 2639 " a++;",
2598 " ++a;", 2640 " ++a;",
2599 "}")); 2641 "}"));
2600 addSource("/meta.dart", createSource(//
2601 "library meta;",
2602 "const proxy = const _Proxy();",
2603 "class _Proxy { const _Proxy(); }"));
2604 resolve(source); 2642 resolve(source);
2605 assertNoErrors(source); 2643 assertNoErrors(source);
2606 } 2644 }
2607 2645
2608 public void test_proxy_annotation_prefixed2() throws Exception { 2646 public void test_proxy_annotation_prefixed2() throws Exception {
2609 Source source = addSource(createSource(// 2647 Source source = addSource(createSource(//
2610 "library L;", 2648 "library L;",
2611 "import 'meta.dart';",
2612 "@proxy", 2649 "@proxy",
2613 "class A {}", 2650 "class A {}",
2614 "class B {", 2651 "class B {",
2615 " f(A a) {", 2652 " f(A a) {",
2616 " a.m();", 2653 " a.m();",
2617 " var x = a.g;", 2654 " var x = a.g;",
2618 " a.s = 1;", 2655 " a.s = 1;",
2619 " var y = a + a;", 2656 " var y = a + a;",
2620 " a++;", 2657 " a++;",
2621 " ++a;", 2658 " ++a;",
2622 " }", 2659 " }",
2623 "}")); 2660 "}"));
2624 addSource("/meta.dart", createSource(//
2625 "library meta;",
2626 "const proxy = const _Proxy();",
2627 "class _Proxy { const _Proxy(); }"));
2628 resolve(source); 2661 resolve(source);
2629 assertNoErrors(source); 2662 assertNoErrors(source);
2630 } 2663 }
2631 2664
2632 public void test_proxy_annotation_prefixed3() throws Exception { 2665 public void test_proxy_annotation_prefixed3() throws Exception {
2633 Source source = addSource(createSource(// 2666 Source source = addSource(createSource(//
2634 "library L;", 2667 "library L;",
2635 "import 'meta.dart';",
2636 "class B {", 2668 "class B {",
2637 " f(A a) {", 2669 " f(A a) {",
2638 " a.m();", 2670 " a.m();",
2639 " var x = a.g;", 2671 " var x = a.g;",
2640 " a.s = 1;", 2672 " a.s = 1;",
2641 " var y = a + a;", 2673 " var y = a + a;",
2642 " a++;", 2674 " a++;",
2643 " ++a;", 2675 " ++a;",
2644 " }", 2676 " }",
2645 "}", 2677 "}",
2646 "@proxy", 2678 "@proxy",
2647 "class A {}")); 2679 "class A {}"));
2648 addSource("/meta.dart", createSource(//
2649 "library meta;",
2650 "const proxy = const _Proxy();",
2651 "class _Proxy { const _Proxy(); }"));
2652 resolve(source); 2680 resolve(source);
2653 assertNoErrors(source); 2681 assertNoErrors(source);
2654 } 2682 }
2655 2683
2656 public void test_proxy_annotation_simple() throws Exception { 2684 public void test_proxy_annotation_simple() throws Exception {
2657 Source source = addSource(createSource(// 2685 Source source = addSource(createSource(//
2658 "library L;", 2686 "library L;",
2659 "import 'meta.dart';",
2660 "@proxy", 2687 "@proxy",
2661 "class B {", 2688 "class B {",
2662 " m() {", 2689 " m() {",
2663 " n();", 2690 " n();",
2664 " var x = g;", 2691 " var x = g;",
2665 " s = 1;", 2692 " s = 1;",
2666 " var y = this + this;", 2693 " var y = this + this;",
2667 " }", 2694 " }",
2668 "}")); 2695 "}"));
2669 addSource("/meta.dart", createSource(//
2670 "library meta;",
2671 "const proxy = const _Proxy();",
2672 "class _Proxy { const _Proxy(); }"));
2673 resolve(source); 2696 resolve(source);
2674 assertNoErrors(source); 2697 assertNoErrors(source);
2675 } 2698 }
2676 2699
2677 public void test_recursiveConstructorRedirect() throws Exception { 2700 public void test_recursiveConstructorRedirect() throws Exception {
2678 Source source = addSource(createSource(// 2701 Source source = addSource(createSource(//
2679 "class A {", 2702 "class A {",
2680 " A.a() : this.b();", 2703 " A.a() : this.b();",
2681 " A.b() : this.c();", 2704 " A.b() : this.c();",
2682 " A.c() {}", 2705 " A.c() {}",
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 "main(Object p) {", 3297 "main(Object p) {",
3275 " if (p is String) {", 3298 " if (p is String) {",
3276 " p.length;", 3299 " p.length;",
3277 " }", 3300 " }",
3278 "}")); 3301 "}"));
3279 resolve(source); 3302 resolve(source);
3280 assertNoErrors(source); 3303 assertNoErrors(source);
3281 verify(source); 3304 verify(source);
3282 } 3305 }
3283 3306
3307 public void test_typePromotion_parentheses() throws Exception {
3308 Source source = addSource(createSource(//
3309 "main(Object p) {",
3310 " (p is String) ? p.length : 0;",
3311 " (p) is String ? p.length : 0;",
3312 " ((p)) is String ? p.length : 0;",
3313 " ((p) is String) ? p.length : 0;",
3314 "}"));
3315 resolve(source);
3316 assertNoErrors(source);
3317 verify(source);
3318 }
3319
3284 public void test_typeType_class() throws Exception { 3320 public void test_typeType_class() throws Exception {
3285 Source source = addSource(createSource(// 3321 Source source = addSource(createSource(//
3286 "class C {}", 3322 "class C {}",
3287 "f(Type t) {}", 3323 "f(Type t) {}",
3288 "main() {", 3324 "main() {",
3289 " f(C);", 3325 " f(C);",
3290 "}")); 3326 "}"));
3291 resolve(source); 3327 resolve(source);
3292 assertNoErrors(source); 3328 assertNoErrors(source);
3293 verify(source); 3329 verify(source);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
3604 resolve(source); 3640 resolve(source);
3605 assertNoErrors(source); 3641 assertNoErrors(source);
3606 verify(source); 3642 verify(source);
3607 reset(); 3643 reset();
3608 } 3644 }
3609 3645
3610 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc eption { 3646 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc eption {
3611 check_wrongNumberOfParametersForOperator(name, "a"); 3647 check_wrongNumberOfParametersForOperator(name, "a");
3612 } 3648 }
3613 } 3649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698