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

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

Issue 2630023003: Report HintCode.MISSING_RETURN for async functions with return type that matters. (Closed)
Patch Set: Created 3 years, 11 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.hint_code_test; 5 library analyzer.test.generated.hint_code_test;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/parser.dart'; 10 import 'package:analyzer/src/generated/parser.dart';
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 m() { 161 m() {
162 var i = ''; 162 var i = '';
163 n(i); 163 n(i);
164 } 164 }
165 n(int i) {}'''); 165 n(int i) {}''');
166 await computeAnalysisResult(source); 166 await computeAnalysisResult(source);
167 assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]); 167 assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
168 verify([source]); 168 verify([source]);
169 } 169 }
170 170
171 test_async_future_object_without_return() async {
172 Source source = addSource('''
173 import 'dart:async';
174 Future<Object> f() async {}
175 ''');
176 await computeAnalysisResult(source);
177 assertErrors(source, [HintCode.MISSING_RETURN]);
178 verify([source]);
179 }
180
171 test_canBeNullAfterNullAware_false_methodInvocation() async { 181 test_canBeNullAfterNullAware_false_methodInvocation() async {
172 Source source = addSource(r''' 182 Source source = addSource(r'''
173 m(x) { 183 m(x) {
174 x?.a()?.b(); 184 x?.a()?.b();
175 } 185 }
176 '''); 186 ''');
177 await computeAnalysisResult(source); 187 await computeAnalysisResult(source);
178 assertNoErrors(source); 188 assertNoErrors(source);
179 verify([source]); 189 verify([source]);
180 } 190 }
(...skipping 3852 matching lines...) Expand 10 before | Expand all | Expand 10 after
4033 n() { 4043 n() {
4034 var a = m(), b = m(); 4044 var a = m(), b = m();
4035 } 4045 }
4036 }'''); 4046 }''');
4037 await computeAnalysisResult(source); 4047 await computeAnalysisResult(source);
4038 assertErrors( 4048 assertErrors(
4039 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 4049 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
4040 verify([source]); 4050 verify([source]);
4041 } 4051 }
4042 } 4052 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698