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

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

Issue 56773002: Issue 13241. Report StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use InheritanceManager 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 " static int v;", 822 " static int v;",
823 "}", 823 "}",
824 "class B extends Object with M {", 824 "class B extends Object with M {",
825 " get v => 0;", 825 " get v => 0;",
826 "}")); 826 "}"));
827 resolve(source); 827 resolve(source);
828 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER); 828 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPER CLASS_MEMBER);
829 verify(source); 829 verify(source);
830 } 830 }
831 831
832 public void test_conflictingInstanceMethodSetter_sameClass() throws Exception {
833 Source source = addSource(createSource(//
834 "class A {",
835 " foo() {}",
836 " set foo(a) {}",
837 "}"));
838 resolve(source);
839 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER);
840 verify(source);
841 }
842
843 public void test_conflictingInstanceMethodSetter_setterInInterface() throws Ex ception {
844 Source source = addSource(createSource(//
845 "abstract class A {",
846 " set foo(a);",
847 "}",
848 "abstract class B implements A {",
849 " foo() {}",
850 "}"));
851 resolve(source);
852 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER);
853 verify(source);
854 }
855
856 public void test_conflictingInstanceMethodSetter_setterInSuper() throws Except ion {
857 Source source = addSource(createSource(//
858 "class A {",
859 " set foo(a) {}",
860 "}",
861 "class B extends A {",
862 " foo() {}",
863 "}"));
864 resolve(source);
865 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER);
866 verify(source);
867 }
868
832 public void test_conflictingInstanceSetterAndSuperclassMember() throws Excepti on { 869 public void test_conflictingInstanceSetterAndSuperclassMember() throws Excepti on {
833 Source source = addSource(createSource(// 870 Source source = addSource(createSource(//
834 "class A {", 871 "class A {",
835 " static int v;", 872 " static int v;",
836 "}", 873 "}",
837 "class B extends A {", 874 "class B extends A {",
838 " set v(x) {}", 875 " set v(x) {}",
839 "}")); 876 "}"));
840 resolve(source); 877 resolve(source);
841 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPER CLASS_MEMBER); 878 assertErrors(source, StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPER CLASS_MEMBER);
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 Source source2 = addSource("lib2.dart", createSource(// 2414 Source source2 = addSource("lib2.dart", createSource(//
2378 "import 'lib.dart' as lib;", 2415 "import 'lib.dart' as lib;",
2379 "void f() {", 2416 "void f() {",
2380 " lib.gg = null;", 2417 " lib.gg = null;",
2381 "}")); 2418 "}"));
2382 resolve(source1); 2419 resolve(source1);
2383 resolve(source2); 2420 resolve(source2);
2384 assertErrors(source2, StaticWarningCode.UNDEFINED_SETTER); 2421 assertErrors(source2, StaticWarningCode.UNDEFINED_SETTER);
2385 } 2422 }
2386 } 2423 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698