| 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.AnalysisError; | 16 import com.google.dart.engine.error.AnalysisError; |
| 17 import com.google.dart.engine.error.CompileTimeErrorCode; | 17 import com.google.dart.engine.error.CompileTimeErrorCode; |
| 18 import com.google.dart.engine.error.ErrorCode; | 18 import com.google.dart.engine.error.ErrorCode; |
| 19 import com.google.dart.engine.error.HintCode; | 19 import com.google.dart.engine.error.HintCode; |
| 20 import com.google.dart.engine.error.StaticTypeWarningCode; | 20 import com.google.dart.engine.error.StaticTypeWarningCode; |
| 21 import com.google.dart.engine.error.StaticWarningCode; | 21 import com.google.dart.engine.error.StaticWarningCode; |
| 22 import com.google.dart.engine.source.Source; | 22 import com.google.dart.engine.source.Source; |
| 23 | 23 |
| 24 public class StaticWarningCodeTest extends ResolverTestCase { | 24 public class StaticWarningCodeTest extends ResolverTestCase { |
| 25 public void fail_returnWithoutValue_async() throws Exception { |
| 26 // TODO(paulberry): Some async/await type checking has not yet been fully ba
ckported from dart. |
| 27 // See dartbug.com/22252. |
| 28 Source source = addSource(createSource(// |
| 29 "import 'dart:async';", |
| 30 "Future<int> f() async {", |
| 31 " return;", |
| 32 "}")); |
| 33 resolve(source); |
| 34 assertErrors(source, StaticWarningCode.RETURN_WITHOUT_VALUE); |
| 35 verify(source); |
| 36 } |
| 37 |
| 25 public void fail_undefinedGetter() throws Exception { | 38 public void fail_undefinedGetter() throws Exception { |
| 26 Source source = addSource(createSource(// | 39 Source source = addSource(createSource(// |
| 27 // TODO | 40 // TODO |
| 28 )); | 41 )); |
| 29 resolve(source); | 42 resolve(source); |
| 30 assertErrors(source, StaticWarningCode.UNDEFINED_GETTER); | 43 assertErrors(source, StaticWarningCode.UNDEFINED_GETTER); |
| 31 verify(source); | 44 verify(source); |
| 32 } | 45 } |
| 33 | 46 |
| 34 public void fail_undefinedIdentifier_commentReference() throws Exception { | 47 public void fail_undefinedIdentifier_commentReference() throws Exception { |
| (...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3196 public void test_voidReturnForGetter() throws Exception { | 3209 public void test_voidReturnForGetter() throws Exception { |
| 3197 Source source = addSource(createSource(// | 3210 Source source = addSource(createSource(// |
| 3198 "class S {", | 3211 "class S {", |
| 3199 " void get value {}", | 3212 " void get value {}", |
| 3200 "}")); | 3213 "}")); |
| 3201 resolve(source); | 3214 resolve(source); |
| 3202 assertErrors(source, StaticWarningCode.VOID_RETURN_FOR_GETTER); | 3215 assertErrors(source, StaticWarningCode.VOID_RETURN_FOR_GETTER); |
| 3203 } | 3216 } |
| 3204 | 3217 |
| 3205 } | 3218 } |
| OLD | NEW |