Skip to content

Commit 3c973fb

Browse files
devoncarewCommit Queue
authored andcommitted
[lints] address diagnostics related to strict_top_level_inference
Change-Id: I228058202855900f0adba73c1ab04d35180a6e5d Tested: this is an analyzer diagnostic only change Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414900 Reviewed-by: Nate Bosch <[email protected]> Commit-Queue: Devon Carew <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Nate Biggs <[email protected]> Reviewed-by: Ben Konyi <[email protected]>
1 parent 2337553 commit 3c973fb

File tree

78 files changed

+134
-104
lines changed

Some content is hidden

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

78 files changed

+134
-104
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ vars = {
129129
### /third_party/pkg dependencies
130130
# 'tools/rev_sdk_deps.dart' will rev pkg dependencies to their latest; put an
131131
# EOL comment after a dependency to instead pin at the current revision.
132-
"core_rev": "15c7fe9958b95998ba2f5a4ad1beab66b9d815fb",
132+
"core_rev": "9f4321008457d16674c0faabfe49327a2bb0cd29",
133133
"dartdoc_rev": "c41b86b98ca935ec3c29cdb04cb190df30afb242",
134134
"ecosystem_rev": "a3cc42d999acc95af96a48d155d7749d92cecb92",
135135
"flute_rev": "e4ea0459a7debae5e9592c85141707b01fac86c9",

pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ abstract class DartLanguageServerBenchmark {
130130
}
131131
}
132132

133-
void _checkLongRunningRequests(timer) {
133+
void _checkLongRunningRequests(Timer timer) {
134134
bool reportedSomething = false;
135135
for (MapEntry<int, OutstandingRequest> waitingFor
136136
in _outstandingRequestsWithId.entries) {

pkg/analyzer/analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ analyzer:
3535
# About 30 violations of this in lib/.
3636
provide_deprecation_message: ignore
3737

38+
# ~3,500 violations in test/.
39+
strict_top_level_inference: ignore
40+
3841
# Ignoring this for all developers means developers don't need to ignore
3942
# TODOs in their IDE settings.
4043
todo: ignore

pkg/analyzer_plugin/test/integration/support/integration_tests.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Matcher isMapOf(Matcher keyMatcher, Matcher valueMatcher) =>
3838
Matcher isOneOf(List<Matcher> choiceMatchers) => _OneOf(choiceMatchers);
3939

4040
/// Assert that [actual] matches [matcher].
41-
void outOfTestExpect(actual, Matcher matcher,
41+
void outOfTestExpect(dynamic actual, Matcher matcher,
4242
{String? reason, skip, bool verbose = false}) {
4343
var matchState = {};
4444
try {
@@ -49,8 +49,8 @@ void outOfTestExpect(actual, Matcher matcher,
4949
fail(_defaultFailFormatter(actual, matcher, reason, matchState, verbose));
5050
}
5151

52-
String _defaultFailFormatter(
53-
actual, Matcher matcher, String? reason, Map matchState, bool verbose) {
52+
String _defaultFailFormatter(dynamic actual, Matcher matcher, String? reason,
53+
Map matchState, bool verbose) {
5454
var description = StringDescription();
5555
description.add('Expected: ').addDescriptionOf(matcher).add('\n');
5656
description.add(' Actual: ').addDescriptionOf(actual).add('\n');
@@ -306,7 +306,7 @@ class MatchesJsonObject extends _RecursiveMatcher {
306306
description.add(this.description);
307307

308308
@override
309-
void populateMismatches(item, List<MismatchDescriber> mismatches) {
309+
void populateMismatches(dynamic item, List<MismatchDescriber> mismatches) {
310310
if (item is! Map) {
311311
mismatches.add(simpleDescription('is not a map'));
312312
return;
@@ -344,7 +344,7 @@ class MatchesJsonObject extends _RecursiveMatcher {
344344
/// Check the type of a field called [key], having value [value], using
345345
/// [valueMatcher]. If it doesn't match, record a closure in [mismatches]
346346
/// which can describe the mismatch.
347-
void _checkField(String key, value, Matcher valueMatcher,
347+
void _checkField(String key, Object? value, Matcher valueMatcher,
348348
List<MismatchDescriber> mismatches) {
349349
checkSubstructure(
350350
value,
@@ -757,7 +757,7 @@ abstract class _RecursiveMatcher extends Matcher {
757757
/// the mismatch. [describeSubstructure] is used to describe which
758758
/// substructure did not match.
759759
void checkSubstructure(
760-
item,
760+
Object? item,
761761
Matcher matcher,
762762
List<MismatchDescriber> mismatches,
763763
Description Function(Description description) describeSubstructure) {
@@ -806,7 +806,7 @@ abstract class _RecursiveMatcher extends Matcher {
806806
}
807807

808808
@override
809-
bool matches(item, Map matchState) {
809+
bool matches(dynamic item, Map matchState) {
810810
var mismatches = <MismatchDescriber>[];
811811
populateMismatches(item, mismatches);
812812
if (mismatches.isEmpty) {
@@ -819,7 +819,7 @@ abstract class _RecursiveMatcher extends Matcher {
819819

820820
/// Populate [mismatches] with descriptions of all the ways in which [item]
821821
/// does not match.
822-
void populateMismatches(item, List<MismatchDescriber> mismatches);
822+
void populateMismatches(dynamic item, List<MismatchDescriber> mismatches);
823823

824824
/// Create a [MismatchDescriber] describing a mismatch with a simple string.
825825
MismatchDescriber simpleDescription(String description) =>

pkg/build_integration/test/file_system/multi_root_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:test/test.dart';
1414

1515
var root = Uri.parse('org-dartlang-test:///');
1616

17-
main() {
17+
void main() {
1818
late MemoryFileSystem memoryFs;
1919
late MultiRootFileSystem multiRoot;
2020

pkg/build_integration/test/file_system/single_root_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:front_end/src/api_unstable/build_integration.dart';
99
import 'package:front_end/src/api_prototype/memory_file_system.dart';
1010
import 'package:test/test.dart';
1111

12-
main() {
12+
void main() {
1313
var root = Uri.parse('org-dartlang-test:///');
1414
var fileSystem = SingleRootFileSystem(
1515
'single-root', root.resolve('A/B'), MemoryFileSystem(root));

pkg/dart2bytecode/analysis_options.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
# BSD-style license that can be found in the LICENSE file.
44

55
include: package:lints/core.yaml
6+
7+
analyzer:
8+
errors:
9+
# ~75 violations in test/.
10+
strict_top_level_inference: ignore

pkg/dart2bytecode/bin/dump_bytecode.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Usage: dump_bytecode input.bytecode
1313
Dumps bytecode file.
1414
''';
1515

16-
main(List<String> arguments) async {
16+
void main(List<String> arguments) async {
1717
if (arguments.length != 1) {
1818
print(_usage);
1919
exit(1);

pkg/dart2bytecode/lib/bytecode_generator.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,15 +3999,15 @@ class BytecodeGenerator extends RecursiveVisitor {
39993999
return locals.tempIndexInFrame(node, tempIndex: 1);
40004000
}
40014001

4002-
_saveContextForTryBlock(TreeNode node) {
4002+
void _saveContextForTryBlock(TreeNode node) {
40034003
if (!locals.hasContextVar) {
40044004
return;
40054005
}
40064006
asm.emitPush(locals.contextVarIndexInFrame);
40074007
asm.emitPopLocal(_savedContextVar(node));
40084008
}
40094009

4010-
_restoreContextForTryBlock(TreeNode node) {
4010+
void _restoreContextForTryBlock(TreeNode node) {
40114011
if (!locals.hasContextVar) {
40124012
return;
40134013
}

pkg/dart2bytecode/lib/disassembler.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class BytecodeDisassembler {
124124
}
125125
}
126126

127-
_decodeUint32At(int pos) =>
127+
int _decodeUint32At(int pos) =>
128128
_bytecode[pos] +
129129
(_bytecode[pos + 1] << 8) +
130130
(_bytecode[pos + 2] << 16) +

0 commit comments

Comments
 (0)