OLD | NEW |
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 |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.engine.resolver; | 14 package com.google.dart.engine.resolver; |
15 | 15 |
16 import com.google.dart.engine.error.CompileTimeErrorCode; | 16 import com.google.dart.engine.error.CompileTimeErrorCode; |
17 import com.google.dart.engine.error.HintCode; | 17 import com.google.dart.engine.error.HintCode; |
18 import com.google.dart.engine.error.StaticTypeWarningCode; | |
19 import com.google.dart.engine.error.StaticWarningCode; | 18 import com.google.dart.engine.error.StaticWarningCode; |
20 import com.google.dart.engine.source.Source; | 19 import com.google.dart.engine.source.Source; |
21 | 20 |
22 public class StaticWarningCodeTest extends ResolverTestCase { | 21 public class StaticWarningCodeTest extends ResolverTestCase { |
23 // TODO(scheglov) requires fix for TypeVariableTypeImpl.isSubtypeOf() | 22 // TODO(scheglov) requires fix for TypeVariableTypeImpl.isSubtypeOf() |
24 public void fail_argumentTypeNotAssignable_invocation_functionParameter_generi
c() | 23 public void fail_argumentTypeNotAssignable_invocation_functionParameter_generi
c() |
25 throws Exception { | 24 throws Exception { |
26 Source source = addSource(createSource(// | 25 Source source = addSource(createSource(// |
27 "class A<K, V> {", | 26 "class A<K, V> {", |
28 " m(f(K k), V v) {", | 27 " m(f(K k), V v) {", |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 addSource("/lib1.dart", createSource(// | 180 addSource("/lib1.dart", createSource(// |
182 "library lib1;", | 181 "library lib1;", |
183 "class N {}")); | 182 "class N {}")); |
184 addSource("/lib2.dart", createSource(// | 183 addSource("/lib2.dart", createSource(// |
185 "library lib2;", | 184 "library lib2;", |
186 "class N {}")); | 185 "class N {}")); |
187 resolve(source); | 186 resolve(source); |
188 assertErrors(StaticWarningCode.AMBIGUOUS_IMPORT, CompileTimeErrorCode.EXTEND
S_NON_CLASS); | 187 assertErrors(StaticWarningCode.AMBIGUOUS_IMPORT, CompileTimeErrorCode.EXTEND
S_NON_CLASS); |
189 } | 188 } |
190 | 189 |
191 public void test_ambiguousImport_function() throws Exception { | |
192 Source source = addSource(createSource(// | |
193 "import 'lib1.dart';", | |
194 "import 'lib2.dart';", | |
195 "g() { return f(); }")); | |
196 addSource("/lib1.dart", createSource(// | |
197 "library lib1;", | |
198 "f() {}")); | |
199 addSource("/lib2.dart", createSource(// | |
200 "library lib2;", | |
201 "f() {}")); | |
202 resolve(source); | |
203 assertErrors(StaticWarningCode.AMBIGUOUS_IMPORT, StaticTypeWarningCode.UNDEF
INED_FUNCTION); | |
204 } | |
205 | |
206 public void test_ambiguousImport_implements() throws Exception { | 190 public void test_ambiguousImport_implements() throws Exception { |
207 Source source = addSource(createSource(// | 191 Source source = addSource(createSource(// |
208 "import 'lib1.dart';", | 192 "import 'lib1.dart';", |
209 "import 'lib2.dart';", | 193 "import 'lib2.dart';", |
210 "class A implements N {}")); | 194 "class A implements N {}")); |
211 addSource("/lib1.dart", createSource(// | 195 addSource("/lib1.dart", createSource(// |
212 "library lib1;", | 196 "library lib1;", |
213 "class N {}")); | 197 "class N {}")); |
214 addSource("/lib2.dart", createSource(// | 198 addSource("/lib2.dart", createSource(// |
215 "library lib2;", | 199 "library lib2;", |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 Source source = addSource(createSource(// | 2060 Source source = addSource(createSource(// |
2077 "f({a, b}) {}", | 2061 "f({a, b}) {}", |
2078 "main() {", | 2062 "main() {", |
2079 " f(c: 1);", | 2063 " f(c: 1);", |
2080 "}")); | 2064 "}")); |
2081 resolve(source); | 2065 resolve(source); |
2082 assertErrors(StaticWarningCode.UNDEFINED_NAMED_PARAMETER); | 2066 assertErrors(StaticWarningCode.UNDEFINED_NAMED_PARAMETER); |
2083 // no verify(), 'c' is not resolved | 2067 // no verify(), 'c' is not resolved |
2084 } | 2068 } |
2085 } | 2069 } |
OLD | NEW |