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

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

Issue 66253002: Version 0.8.10.9 (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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 "import 'dart:async';", 722 "import 'dart:async';",
723 "Future f = null;", 723 "Future f = null;",
724 "Stream s;")); 724 "Stream s;"));
725 addSource("/lib.dart", createSource(// 725 addSource("/lib.dart", createSource(//
726 "library lib;", 726 "library lib;",
727 "class Future {}")); 727 "class Future {}"));
728 resolve(source); 728 resolve(source);
729 assertErrors(source, StaticWarningCode.CONFLICTING_DART_IMPORT); 729 assertErrors(source, StaticWarningCode.CONFLICTING_DART_IMPORT);
730 } 730 }
731 731
732 public void test_conflictingInstanceGetterAndSuperclassMember_direct_field() t hrows Exception { 732 public void test_conflictingInstanceGetterAndSuperclassMember_declField_direct _setter()
733 throws Exception {
733 Source source = addSource(createSource(// 734 Source source = addSource(createSource(//
734 "class A {", 735 "class A {",
735 " static int v;", 736 " static set v(x) {}",
736 "}", 737 "}",
737 "class B extends A {", 738 "class B extends A {",
738 " get v => 0;", 739 " var v;",
739 "}")); 740 "}"));
740 resolve(source); 741 resolve(source);
741 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER); 742 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
742 verify(source); 743 verify(source);
743 } 744 }
744 745
745 public void test_conflictingInstanceGetterAndSuperclassMember_direct_getter() throws Exception { 746 public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_direc t_getter()
747 throws Exception {
746 Source source = addSource(createSource(// 748 Source source = addSource(createSource(//
747 "class A {", 749 "class A {",
748 " static get v => 0;", 750 " static get v => 0;",
749 "}", 751 "}",
750 "class B extends A {", 752 "class B extends A {",
751 " get v => 0;", 753 " get v => 0;",
752 "}")); 754 "}"));
753 resolve(source); 755 resolve(source);
754 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER); 756 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
755 verify(source); 757 verify(source);
756 } 758 }
757 759
758 public void test_conflictingInstanceGetterAndSuperclassMember_direct_method() throws Exception { 760 public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_direc t_method()
761 throws Exception {
759 Source source = addSource(createSource(// 762 Source source = addSource(createSource(//
760 "class A {", 763 "class A {",
761 " static v() {}", 764 " static v() {}",
762 "}", 765 "}",
763 "class B extends A {", 766 "class B extends A {",
764 " get v => 0;", 767 " get v => 0;",
765 "}")); 768 "}"));
766 resolve(source); 769 resolve(source);
767 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER); 770 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
768 verify(source); 771 verify(source);
769 } 772 }
770 773
771 public void test_conflictingInstanceGetterAndSuperclassMember_direct_setter() throws Exception { 774 public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_direc t_setter()
775 throws Exception {
772 Source source = addSource(createSource(// 776 Source source = addSource(createSource(//
773 "class A {", 777 "class A {",
774 " static set v(x) {}", 778 " static set v(x) {}",
775 "}", 779 "}",
776 "class B extends A {", 780 "class B extends A {",
777 " get v => 0;", 781 " get v => 0;",
778 "}")); 782 "}"));
779 resolve(source); 783 resolve(source);
780 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER); 784 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
781 verify(source); 785 verify(source);
782 } 786 }
783 787
784 public void test_conflictingInstanceGetterAndSuperclassMember_indirect() throw s Exception { 788 public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_indir ect()
789 throws Exception {
785 Source source = addSource(createSource(// 790 Source source = addSource(createSource(//
786 "class A {", 791 "class A {",
787 " static int v;", 792 " static int v;",
788 "}", 793 "}",
789 "class B extends A {}", 794 "class B extends A {}",
790 "class C extends B {", 795 "class C extends B {",
791 " get v => 0;", 796 " get v => 0;",
792 "}")); 797 "}"));
793 resolve(source); 798 resolve(source);
794 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER); 799 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
795 verify(source); 800 verify(source);
796 } 801 }
797 802
798 public void test_conflictingInstanceGetterAndSuperclassMember_mixin() throws E xception { 803 public void test_conflictingInstanceGetterAndSuperclassMember_declGetter_mixin () throws Exception {
799 Source source = addSource(createSource(// 804 Source source = addSource(createSource(//
800 "class M {", 805 "class M {",
801 " static int v;", 806 " static int v;",
802 "}", 807 "}",
803 "class B extends Object with M {", 808 "class B extends Object with M {",
804 " get v => 0;", 809 " get v => 0;",
805 "}")); 810 "}"));
806 resolve(source); 811 resolve(source);
807 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER); 812 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
808 verify(source); 813 verify(source);
809 } 814 }
810 815
816 public void test_conflictingInstanceGetterAndSuperclassMember_direct_field() t hrows Exception {
817 Source source = addSource(createSource(//
818 "class A {",
819 " static int v;",
820 "}",
821 "class B extends A {",
822 " get v => 0;",
823 "}"));
824 resolve(source);
825 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
826 verify(source);
827 }
828
829 public void test_conflictingInstanceMethodSetter_sameClass() throws Exception {
830 Source source = addSource(createSource(//
831 "class A {",
832 " foo() {}",
833 " set foo(a) {}",
834 "}"));
835 resolve(source);
836 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER);
837 verify(source);
838 }
839
840 public void test_conflictingInstanceMethodSetter_setterInInterface() throws Ex ception {
841 Source source = addSource(createSource(//
842 "abstract class A {",
843 " set foo(a);",
844 "}",
845 "abstract class B implements A {",
846 " foo() {}",
847 "}"));
848 resolve(source);
849 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER);
850 verify(source);
851 }
852
853 public void test_conflictingInstanceMethodSetter_setterInSuper() throws Except ion {
854 Source source = addSource(createSource(//
855 "class A {",
856 " set foo(a) {}",
857 "}",
858 "class B extends A {",
859 " foo() {}",
860 "}"));
861 resolve(source);
862 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER);
863 verify(source);
864 }
865
811 public void test_conflictingInstanceSetterAndSuperclassMember() throws Excepti on { 866 public void test_conflictingInstanceSetterAndSuperclassMember() throws Excepti on {
812 Source source = addSource(createSource(// 867 Source source = addSource(createSource(//
813 "class A {", 868 "class A {",
814 " static int v;", 869 " static int v;",
815 "}", 870 "}",
816 "class B extends A {", 871 "class B extends A {",
817 " set v(x) {}", 872 " set v(x) {}",
818 "}")); 873 "}"));
819 resolve(source); 874 resolve(source);
820 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPER CLASS_MEMBER); 875 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPER CLASS_MEMBER);
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 " static set s(int i) {}", 2475 " static set s(int i) {}",
2421 "}", 2476 "}",
2422 "class C extends S {}", 2477 "class C extends S {}",
2423 "f(var p) {", 2478 "f(var p) {",
2424 " f(C.s = 1);", 2479 " f(C.s = 1);",
2425 "}")); 2480 "}"));
2426 resolve(source); 2481 resolve(source);
2427 assertErrors(source, StaticTypeWarningCode.UNDEFINED_SETTER); 2482 assertErrors(source, StaticTypeWarningCode.UNDEFINED_SETTER);
2428 } 2483 }
2429 } 2484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698