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

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

Issue 1923593002: provide MISSING_RETURN on factory constructors (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Addressing feedback Created 4 years, 7 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/src/generated/engine.dart'; 7 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
9 import 'package:analyzer/src/generated/source_io.dart'; 9 import 'package:analyzer/src/generated/source_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 verify([source]); 1316 verify([source]);
1317 } 1317 }
1318 1318
1319 void test_missingReturn_function() { 1319 void test_missingReturn_function() {
1320 Source source = addSource("int f() {}"); 1320 Source source = addSource("int f() {}");
1321 computeLibrarySourceErrors(source); 1321 computeLibrarySourceErrors(source);
1322 assertErrors(source, [HintCode.MISSING_RETURN]); 1322 assertErrors(source, [HintCode.MISSING_RETURN]);
1323 verify([source]); 1323 verify([source]);
1324 } 1324 }
1325 1325
1326 void test_missingReturn_factory() {
1327 Source source = addSource(r'''
1328 class A {
1329 factory A() {}
1330 }
1331 ''');
1332 computeLibrarySourceErrors(source);
1333 assertErrors(source, [HintCode.MISSING_RETURN]);
1334 verify([source]);
1335 }
1336
1326 void test_missingReturn_method() { 1337 void test_missingReturn_method() {
1327 Source source = addSource(r''' 1338 Source source = addSource(r'''
1328 class A { 1339 class A {
1329 int m() {} 1340 int m() {}
1330 }'''); 1341 }''');
1331 computeLibrarySourceErrors(source); 1342 computeLibrarySourceErrors(source);
1332 assertErrors(source, [HintCode.MISSING_RETURN]); 1343 assertErrors(source, [HintCode.MISSING_RETURN]);
1333 verify([source]); 1344 verify([source]);
1334 } 1345 }
1335 1346
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 n() { 3297 n() {
3287 var a = m(), b = m(); 3298 var a = m(), b = m();
3288 } 3299 }
3289 }'''); 3300 }''');
3290 computeLibrarySourceErrors(source); 3301 computeLibrarySourceErrors(source);
3291 assertErrors( 3302 assertErrors(
3292 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 3303 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
3293 verify([source]); 3304 verify([source]);
3294 } 3305 }
3295 } 3306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698