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

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

Issue 2228233003: Remove false positive from override hint (issue 27046) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.generated.non_hint_code_test; 5 library analyzer.test.generated.non_hint_code_test;
6 6
7 import 'package:analyzer/src/generated/error.dart'; 7 import 'package:analyzer/src/generated/error.dart';
8 import 'package:analyzer/src/generated/source_io.dart'; 8 import 'package:analyzer/src/generated/source_io.dart';
9 9
10 import '../reflective_tests.dart'; 10 import '../reflective_tests.dart';
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 bool operator ==(x) { return x; } 481 bool operator ==(x) { return x; }
482 get hashCode => 0; 482 get hashCode => 0;
483 }'''); 483 }''');
484 computeLibrarySourceErrors(source); 484 computeLibrarySourceErrors(source);
485 assertNoErrors(source); 485 assertNoErrors(source);
486 verify([source]); 486 verify([source]);
487 } 487 }
488 488
489 void test_overrideOnNonOverridingField_inInterface() { 489 void test_overrideOnNonOverridingField_inInterface() {
490 Source source = addSource(r''' 490 Source source = addSource(r'''
491 library dart.core;
492 const override = null;
493 class A { 491 class A {
494 int get a => 0; 492 int get a => 0;
495 void set b(_) {} 493 void set b(_) {}
496 int c; 494 int c;
497 } 495 }
498 class B implements A { 496 class B implements A {
499 @override 497 @override
500 final int a = 1; 498 final int a = 1;
501 @override 499 @override
502 int b; 500 int b;
503 @override 501 @override
504 int c; 502 int c;
505 }'''); 503 }''');
506 computeLibrarySourceErrors(source); 504 computeLibrarySourceErrors(source);
507 assertNoErrors(source); 505 assertNoErrors(source);
508 verify([source]); 506 verify([source]);
509 } 507 }
510 508
511 void test_overrideOnNonOverridingField_inSuperclass() { 509 void test_overrideOnNonOverridingField_inSuperclass() {
512 Source source = addSource(r''' 510 Source source = addSource(r'''
513 library dart.core;
514 const override = null;
515 class A { 511 class A {
516 int get a => 0; 512 int get a => 0;
517 void set b(_) {} 513 void set b(_) {}
518 int c; 514 int c;
519 } 515 }
520 class B extends A { 516 class B extends A {
521 @override 517 @override
522 final int a = 1; 518 final int a = 1;
523 @override 519 @override
524 int b; 520 int b;
525 @override 521 @override
526 int c; 522 int c;
527 }'''); 523 }''');
528 computeLibrarySourceErrors(source); 524 computeLibrarySourceErrors(source);
529 assertNoErrors(source); 525 assertNoErrors(source);
530 verify([source]); 526 verify([source]);
531 } 527 }
532 528
533 void test_overrideOnNonOverridingGetter_inInterface() { 529 void test_overrideOnNonOverridingGetter_inInterface() {
534 Source source = addSource(r''' 530 Source source = addSource(r'''
535 library dart.core;
536 const override = null;
537 class A { 531 class A {
538 int get m => 0; 532 int get m => 0;
539 } 533 }
540 class B implements A { 534 class B implements A {
541 @override 535 @override
542 int get m => 1; 536 int get m => 1;
543 }'''); 537 }''');
544 computeLibrarySourceErrors(source); 538 computeLibrarySourceErrors(source);
545 assertNoErrors(source); 539 assertNoErrors(source);
546 verify([source]); 540 verify([source]);
547 } 541 }
548 542
549 void test_overrideOnNonOverridingGetter_inSuperclass() { 543 void test_overrideOnNonOverridingGetter_inSuperclass() {
550 Source source = addSource(r''' 544 Source source = addSource(r'''
551 library dart.core;
552 const override = null;
553 class A { 545 class A {
554 int get m => 0; 546 int get m => 0;
555 } 547 }
556 class B extends A { 548 class B extends A {
557 @override 549 @override
558 int get m => 1; 550 int get m => 1;
559 }'''); 551 }''');
560 computeLibrarySourceErrors(source); 552 computeLibrarySourceErrors(source);
561 assertNoErrors(source); 553 assertNoErrors(source);
562 verify([source]); 554 verify([source]);
563 } 555 }
564 556
565 void test_overrideOnNonOverridingMethod_inInterface() { 557 void test_overrideOnNonOverridingMethod_inInterface() {
566 Source source = addSource(r''' 558 Source source = addSource(r'''
567 library dart.core;
568 const override = null;
569 class A { 559 class A {
570 int m() => 0; 560 int m() => 0;
571 } 561 }
572 class B implements A { 562 class B implements A {
573 @override 563 @override
574 int m() => 1; 564 int m() => 1;
575 }'''); 565 }''');
576 computeLibrarySourceErrors(source); 566 computeLibrarySourceErrors(source);
577 assertNoErrors(source); 567 assertNoErrors(source);
578 verify([source]); 568 verify([source]);
579 } 569 }
580 570
581 void test_overrideOnNonOverridingMethod_inSuperclass() { 571 void test_overrideOnNonOverridingMethod_inSuperclass() {
582 Source source = addSource(r''' 572 Source source = addSource(r'''
583 library dart.core;
584 const override = null;
585 class A { 573 class A {
586 int m() => 0; 574 int m() => 0;
587 } 575 }
588 class B extends A { 576 class B extends A {
589 @override 577 @override
590 int m() => 1; 578 int m() => 1;
591 }'''); 579 }''');
592 computeLibrarySourceErrors(source); 580 computeLibrarySourceErrors(source);
593 assertNoErrors(source); 581 assertNoErrors(source);
594 verify([source]); 582 verify([source]);
595 } 583 }
596 584
585 void test_overrideOnNonOverridingMethod_inSuperclass_abstract() {
586 Source source = addSource(r'''
587 abstract class A {
588 int m();
589 }
590 class B extends A {
591 @override
592 int m() => 1;
593 }''');
594 computeLibrarySourceErrors(source);
595 assertNoErrors(source);
596 verify([source]);
597 }
598
597 void test_overrideOnNonOverridingSetter_inInterface() { 599 void test_overrideOnNonOverridingSetter_inInterface() {
598 Source source = addSource(r''' 600 Source source = addSource(r'''
599 library dart.core;
600 const override = null;
601 class A { 601 class A {
602 set m(int x) {} 602 set m(int x) {}
603 } 603 }
604 class B implements A { 604 class B implements A {
605 @override 605 @override
606 set m(int x) {} 606 set m(int x) {}
607 }'''); 607 }''');
608 computeLibrarySourceErrors(source); 608 computeLibrarySourceErrors(source);
609 assertNoErrors(source); 609 assertNoErrors(source);
610 verify([source]); 610 verify([source]);
611 } 611 }
612 612
613 void test_overrideOnNonOverridingSetter_inSuperclass() { 613 void test_overrideOnNonOverridingSetter_inSuperclass() {
614 Source source = addSource(r''' 614 Source source = addSource(r'''
615 library dart.core;
616 const override = null;
617 class A { 615 class A {
618 set m(int x) {} 616 set m(int x) {}
619 } 617 }
620 class B extends A { 618 class B extends A {
621 @override 619 @override
622 set m(int x) {} 620 set m(int x) {}
623 }'''); 621 }''');
624 computeLibrarySourceErrors(source); 622 computeLibrarySourceErrors(source);
625 assertNoErrors(source); 623 assertNoErrors(source);
626 verify([source]); 624 verify([source]);
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 1320
1323 void test_import_valid_outside_lib() { 1321 void test_import_valid_outside_lib() {
1324 cacheSource("/myproj/pubspec.yaml", ""); 1322 cacheSource("/myproj/pubspec.yaml", "");
1325 cacheSource("/myproj/web/other.dart", ""); 1323 cacheSource("/myproj/web/other.dart", "");
1326 Source source = 1324 Source source =
1327 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); 1325 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';");
1328 computeLibrarySourceErrors(source); 1326 computeLibrarySourceErrors(source);
1329 assertNoErrors(source); 1327 assertNoErrors(source);
1330 } 1328 }
1331 } 1329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698