Skip to content

Commit a6cc772

Browse files
johnniwinthercommit-bot@chromium.org
authored andcommitted
[cfe] Add always_declare_return_types lint
Change-Id: I206a7a8132b5ea79dc019acf5c2e0cd800307bcf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212161 Reviewed-by: Jens Johansen <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
1 parent b9c4b68 commit a6cc772

File tree

205 files changed

+556
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+556
-533
lines changed

.dart_tool/package_config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"constraint, update this by running tools/generate_package_config.dart."
1212
],
1313
"configVersion": 2,
14-
"generated": "2021-08-23T16:52:51.727804",
14+
"generated": "2021-09-01T12:41:37.776425",
1515
"generator": "tools/generate_package_config.dart",
1616
"packages": [
1717
{
@@ -316,7 +316,7 @@
316316
"name": "front_end",
317317
"rootUri": "../pkg/front_end",
318318
"packageUri": "lib/",
319-
"languageVersion": "2.12"
319+
"languageVersion": "2.13"
320320
},
321321
{
322322
"name": "front_end_testcases",

pkg/front_end/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ linter:
1919
- lines_longer_than_80_chars
2020
- unrelated_type_equality_checks
2121
- annotate_overrides
22+
- always_declare_return_types
2223
# - always_specify_types

pkg/front_end/benchmarks/ikg/dart2js.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
import 'package:compiler/src/dart2js.dart' as dart2js;
88

9-
main(args) => dart2js.main(args);
9+
void main(args) => dart2js.main(args);

pkg/front_end/benchmarks/ikg/hello.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
main() => print('hello world');
5+
void main() => print('hello world');

pkg/front_end/lib/src/base/libraries_specification.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,19 @@ class LibrariesSpecification {
137137
if (targetName.startsWith("comment:")) return null;
138138
Map<String, LibraryInfo> libraries = <String, LibraryInfo>{};
139139
if (targetData is! Map) {
140-
return _reportError(
141-
"target specification for '$targetName' is not a map");
140+
_reportError("target specification for '$targetName' is not a map");
142141
}
143142
if (!targetData.containsKey("libraries")) {
144-
return _reportError("target specification "
143+
_reportError("target specification "
145144
"for '$targetName' doesn't have a libraries entry");
146145
}
147146
dynamic librariesData = targetData["libraries"];
148147
if (librariesData is! Map<String, dynamic>) {
149-
return _reportError("libraries entry for '$targetName' is not a map");
148+
_reportError("libraries entry for '$targetName' is not a map");
150149
}
151150
librariesData.forEach((String name, data) {
152151
if (data is! Map<String, dynamic>) {
153-
return _reportError(
152+
_reportError(
154153
"library data for '$name' in target '$targetName' is not a map");
155154
}
156155
Uri checkAndResolve(uriString) {
@@ -175,13 +174,12 @@ class LibrariesSpecification {
175174
} else if (data['patches'] == null) {
176175
patches = const [];
177176
} else {
178-
return _reportError(
179-
"patches entry for '$name' is not a list or a string");
177+
_reportError("patches entry for '$name' is not a list or a string");
180178
}
181179

182180
dynamic supported = data['supported'] ?? true;
183181
if (supported is! bool) {
184-
return _reportError("\"supported\" entry: expected a 'bool' but "
182+
_reportError("\"supported\" entry: expected a 'bool' but "
185183
"got a '${supported.runtimeType}' ('$supported')");
186184
}
187185
libraries[name] =
@@ -193,7 +191,7 @@ class LibrariesSpecification {
193191
return new LibrariesSpecification(targets);
194192
}
195193

196-
static _reportError(String error) =>
194+
static Never _reportError(String error) =>
197195
throw new LibrariesSpecificationException(error);
198196

199197
/// Serialize this specification to json.

pkg/front_end/lib/src/base/processed_options.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ class ProcessedOptions {
793793

794794
String debugString() {
795795
StringBuffer sb = new StringBuffer();
796-
writeList(String name, List elements) {
796+
void writeList(String name, List elements) {
797797
if (elements.isEmpty) {
798798
sb.writeln('$name: <empty>');
799799
return;

pkg/front_end/lib/src/fasta/crash.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void resetCrashReporting() {
5050

5151
Future<T> reportCrash<T>(error, StackTrace trace,
5252
[Uri? uri, int? charOffset]) async {
53-
note(String note) async {
53+
Future<void> note(String note) async {
5454
stderr.write(note);
5555
await stderr.flush();
5656
}

pkg/front_end/lib/src/fasta/incremental_compiler.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
20972097
return false;
20982098
}
20992099

2100-
addBuilderAndInvalidateUris(Uri uri, LibraryBuilder libraryBuilder) {
2100+
void addBuilderAndInvalidateUris(Uri uri, LibraryBuilder libraryBuilder) {
21012101
if (uri.scheme == "dart" && !libraryBuilder.isSynthetic) {
21022102
if (seenUris.add(libraryBuilder.importUri)) {
21032103
reusedLibraries.add(libraryBuilder);

pkg/front_end/lib/src/fasta/incremental_serializer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class IncrementalSerializer {
256256

257257
/// Add the group but not its dependencies to the output if they weren't added
258258
/// already.
259-
addDataButNotDependentData(SerializationGroup group,
259+
void addDataButNotDependentData(SerializationGroup group,
260260
Set<SerializationGroup> cachedPackagesInOutput, Sink<List<int>> sink) {
261261
if (cachedPackagesInOutput.add(group)) {
262262
sink.add(group.serializedData);
@@ -265,7 +265,7 @@ class IncrementalSerializer {
265265

266266
/// Add the group and its dependencies to the output if they weren't added
267267
/// already.
268-
addDataAndDependentData(SerializationGroup group,
268+
void addDataAndDependentData(SerializationGroup group,
269269
Set<SerializationGroup> cachedPackagesInOutput, Sink<List<int>> sink) {
270270
if (cachedPackagesInOutput.add(group)) {
271271
sink.add(group.serializedData);

pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ class BodyBuilder extends ScopeListener<JumpTarget>
18591859
}
18601860

18611861
@override
1862-
/* Expression | Generator | Initializer */ finishSend(Object receiver,
1862+
Expression_Generator_Initializer finishSend(Object receiver,
18631863
List<UnresolvedType>? typeArguments, Arguments arguments, int charOffset,
18641864
{bool isTypeArgumentsInForest = false}) {
18651865
if (receiver is Generator) {
@@ -2445,7 +2445,7 @@ class BodyBuilder extends ScopeListener<JumpTarget>
24452445
/// implies that it shouldn't be turned into a [ThisPropertyAccessGenerator]
24462446
/// if the name doesn't resolve in the scope).
24472447
@override
2448-
/*Generator|Expression|Builder*/ scopeLookup(
2448+
Expression_Generator_Builder scopeLookup(
24492449
Scope scope, String name, Token token,
24502450
{bool isQualified: false, PrefixBuilder? prefix}) {
24512451
int charOffset = offsetForToken(token);
@@ -7444,7 +7444,7 @@ class _BodyBuilderCloner extends CloneVisitorNotMembers {
74447444
_BodyBuilderCloner(this.bodyBuilder);
74457445

74467446
@override
7447-
visitStaticInvocation(StaticInvocation node) {
7447+
TreeNode visitStaticInvocation(StaticInvocation node) {
74487448
if (node is FactoryConstructorInvocation) {
74497449
FactoryConstructorInvocation result = new FactoryConstructorInvocation(
74507450
node.target, clone(node.arguments),
@@ -7464,7 +7464,7 @@ class _BodyBuilderCloner extends CloneVisitorNotMembers {
74647464
}
74657465

74667466
@override
7467-
visitConstructorInvocation(ConstructorInvocation node) {
7467+
TreeNode visitConstructorInvocation(ConstructorInvocation node) {
74687468
if (node is TypeAliasedConstructorInvocation) {
74697469
TypeAliasedConstructorInvocation result =
74707470
new TypeAliasedConstructorInvocation(
@@ -7478,7 +7478,7 @@ class _BodyBuilderCloner extends CloneVisitorNotMembers {
74787478
}
74797479

74807480
@override
7481-
visitArguments(Arguments node) {
7481+
TreeNode visitArguments(Arguments node) {
74827482
if (node is ArgumentsImpl) {
74837483
return ArgumentsImpl.clone(node, node.positional.map(clone).toList(),
74847484
node.named.map(clone).toList(), node.types.map(visitType).toList());

0 commit comments

Comments
 (0)