diff --git a/DEPS b/DEPS index 665504fa95b..8ec9f700962 100644 --- a/DEPS +++ b/DEPS @@ -129,7 +129,7 @@ vars = { ### /third_party/pkg dependencies # 'tools/rev_sdk_deps.dart' will rev pkg dependencies to their latest; put an # EOL comment after a dependency to instead pin at the current revision. - "core_rev": "15c7fe9958b95998ba2f5a4ad1beab66b9d815fb", + "core_rev": "9f4321008457d16674c0faabfe49327a2bb0cd29", "dartdoc_rev": "c41b86b98ca935ec3c29cdb04cb190df30afb242", "ecosystem_rev": "a3cc42d999acc95af96a48d155d7749d92cecb92", "flute_rev": "e4ea0459a7debae5e9592c85141707b01fac86c9", diff --git a/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart b/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart index df0e542cd6e..cd3bc4c995d 100644 --- a/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart +++ b/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart @@ -130,7 +130,7 @@ abstract class DartLanguageServerBenchmark { } } - void _checkLongRunningRequests(timer) { + void _checkLongRunningRequests(Timer timer) { bool reportedSomething = false; for (MapEntry waitingFor in _outstandingRequestsWithId.entries) { diff --git a/pkg/analyzer/analysis_options.yaml b/pkg/analyzer/analysis_options.yaml index 886bf7836d9..a9349c65792 100644 --- a/pkg/analyzer/analysis_options.yaml +++ b/pkg/analyzer/analysis_options.yaml @@ -35,6 +35,9 @@ analyzer: # About 30 violations of this in lib/. provide_deprecation_message: ignore + # ~3,500 violations in test/. + strict_top_level_inference: ignore + # Ignoring this for all developers means developers don't need to ignore # TODOs in their IDE settings. todo: ignore diff --git a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart index f6851943ff7..355d90089f7 100644 --- a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart +++ b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart @@ -38,7 +38,7 @@ Matcher isMapOf(Matcher keyMatcher, Matcher valueMatcher) => Matcher isOneOf(List choiceMatchers) => _OneOf(choiceMatchers); /// Assert that [actual] matches [matcher]. -void outOfTestExpect(actual, Matcher matcher, +void outOfTestExpect(dynamic actual, Matcher matcher, {String? reason, skip, bool verbose = false}) { var matchState = {}; try { @@ -49,8 +49,8 @@ void outOfTestExpect(actual, Matcher matcher, fail(_defaultFailFormatter(actual, matcher, reason, matchState, verbose)); } -String _defaultFailFormatter( - actual, Matcher matcher, String? reason, Map matchState, bool verbose) { +String _defaultFailFormatter(dynamic actual, Matcher matcher, String? reason, + Map matchState, bool verbose) { var description = StringDescription(); description.add('Expected: ').addDescriptionOf(matcher).add('\n'); description.add(' Actual: ').addDescriptionOf(actual).add('\n'); @@ -306,7 +306,7 @@ class MatchesJsonObject extends _RecursiveMatcher { description.add(this.description); @override - void populateMismatches(item, List mismatches) { + void populateMismatches(dynamic item, List mismatches) { if (item is! Map) { mismatches.add(simpleDescription('is not a map')); return; @@ -344,7 +344,7 @@ class MatchesJsonObject extends _RecursiveMatcher { /// Check the type of a field called [key], having value [value], using /// [valueMatcher]. If it doesn't match, record a closure in [mismatches] /// which can describe the mismatch. - void _checkField(String key, value, Matcher valueMatcher, + void _checkField(String key, Object? value, Matcher valueMatcher, List mismatches) { checkSubstructure( value, @@ -757,7 +757,7 @@ abstract class _RecursiveMatcher extends Matcher { /// the mismatch. [describeSubstructure] is used to describe which /// substructure did not match. void checkSubstructure( - item, + Object? item, Matcher matcher, List mismatches, Description Function(Description description) describeSubstructure) { @@ -806,7 +806,7 @@ abstract class _RecursiveMatcher extends Matcher { } @override - bool matches(item, Map matchState) { + bool matches(dynamic item, Map matchState) { var mismatches = []; populateMismatches(item, mismatches); if (mismatches.isEmpty) { @@ -819,7 +819,7 @@ abstract class _RecursiveMatcher extends Matcher { /// Populate [mismatches] with descriptions of all the ways in which [item] /// does not match. - void populateMismatches(item, List mismatches); + void populateMismatches(dynamic item, List mismatches); /// Create a [MismatchDescriber] describing a mismatch with a simple string. MismatchDescriber simpleDescription(String description) => diff --git a/pkg/build_integration/test/file_system/multi_root_test.dart b/pkg/build_integration/test/file_system/multi_root_test.dart index 3c566193de1..d7dc18b8ba7 100644 --- a/pkg/build_integration/test/file_system/multi_root_test.dart +++ b/pkg/build_integration/test/file_system/multi_root_test.dart @@ -14,7 +14,7 @@ import 'package:test/test.dart'; var root = Uri.parse('org-dartlang-test:///'); -main() { +void main() { late MemoryFileSystem memoryFs; late MultiRootFileSystem multiRoot; diff --git a/pkg/build_integration/test/file_system/single_root_test.dart b/pkg/build_integration/test/file_system/single_root_test.dart index 08f14d38b1e..c05db725b1b 100644 --- a/pkg/build_integration/test/file_system/single_root_test.dart +++ b/pkg/build_integration/test/file_system/single_root_test.dart @@ -9,7 +9,7 @@ import 'package:front_end/src/api_unstable/build_integration.dart'; import 'package:front_end/src/api_prototype/memory_file_system.dart'; import 'package:test/test.dart'; -main() { +void main() { var root = Uri.parse('org-dartlang-test:///'); var fileSystem = SingleRootFileSystem( 'single-root', root.resolve('A/B'), MemoryFileSystem(root)); diff --git a/pkg/dart2bytecode/analysis_options.yaml b/pkg/dart2bytecode/analysis_options.yaml index be329ed424d..018cb3181c2 100644 --- a/pkg/dart2bytecode/analysis_options.yaml +++ b/pkg/dart2bytecode/analysis_options.yaml @@ -3,3 +3,8 @@ # BSD-style license that can be found in the LICENSE file. include: package:lints/core.yaml + +analyzer: + errors: + # ~75 violations in test/. + strict_top_level_inference: ignore diff --git a/pkg/dart2bytecode/bin/dump_bytecode.dart b/pkg/dart2bytecode/bin/dump_bytecode.dart index dc6b16507e9..bbed10da511 100644 --- a/pkg/dart2bytecode/bin/dump_bytecode.dart +++ b/pkg/dart2bytecode/bin/dump_bytecode.dart @@ -13,7 +13,7 @@ Usage: dump_bytecode input.bytecode Dumps bytecode file. '''; -main(List arguments) async { +void main(List arguments) async { if (arguments.length != 1) { print(_usage); exit(1); diff --git a/pkg/dart2bytecode/lib/bytecode_generator.dart b/pkg/dart2bytecode/lib/bytecode_generator.dart index d2c35c23894..c0d58a50e64 100644 --- a/pkg/dart2bytecode/lib/bytecode_generator.dart +++ b/pkg/dart2bytecode/lib/bytecode_generator.dart @@ -3999,7 +3999,7 @@ class BytecodeGenerator extends RecursiveVisitor { return locals.tempIndexInFrame(node, tempIndex: 1); } - _saveContextForTryBlock(TreeNode node) { + void _saveContextForTryBlock(TreeNode node) { if (!locals.hasContextVar) { return; } @@ -4007,7 +4007,7 @@ class BytecodeGenerator extends RecursiveVisitor { asm.emitPopLocal(_savedContextVar(node)); } - _restoreContextForTryBlock(TreeNode node) { + void _restoreContextForTryBlock(TreeNode node) { if (!locals.hasContextVar) { return; } diff --git a/pkg/dart2bytecode/lib/disassembler.dart b/pkg/dart2bytecode/lib/disassembler.dart index 4aa9b0167aa..1b07fc9a349 100644 --- a/pkg/dart2bytecode/lib/disassembler.dart +++ b/pkg/dart2bytecode/lib/disassembler.dart @@ -124,7 +124,7 @@ class BytecodeDisassembler { } } - _decodeUint32At(int pos) => + int _decodeUint32At(int pos) => _bytecode[pos] + (_bytecode[pos + 1] << 8) + (_bytecode[pos + 2] << 16) + diff --git a/pkg/dart2bytecode/lib/local_vars.dart b/pkg/dart2bytecode/lib/local_vars.dart index d2cb291f61c..3d2a7951762 100644 --- a/pkg/dart2bytecode/lib/local_vars.dart +++ b/pkg/dart2bytecode/lib/local_vars.dart @@ -436,13 +436,13 @@ class _ScopeBuilder extends RecursiveVisitor { _loopDepth = saveLoopDepth; } - _enterFrame(TreeNode node) { + void _enterFrame(TreeNode node) { _currentFrameInternal = new Frame(node, _currentFrameInternal); _enterScope(node); _currentFrame.topScope = _currentScope; } - _leaveFrame() { + void _leaveFrame() { _leaveScope(); _currentFrameInternal = _currentFrame.parent; } diff --git a/pkg/dart2js_info/lib/src/table.dart b/pkg/dart2js_info/lib/src/table.dart index fac5d97a32e..466036acbc3 100644 --- a/pkg/dart2js_info/lib/src/table.dart +++ b/pkg/dart2js_info/lib/src/table.dart @@ -63,7 +63,7 @@ class Table { /// Add an entry in the table, creating a new row each time [totalColumns] /// entries are added. - void addEntry(entry) { + void addEntry(Object entry) { if (_currentRow == null) { _sealed = true; _currentRow = []; diff --git a/pkg/dart2js_info/lib/src/util.dart b/pkg/dart2js_info/lib/src/util.dart index c344d4e3431..ec4968f72cf 100644 --- a/pkg/dart2js_info/lib/src/util.dart +++ b/pkg/dart2js_info/lib/src/util.dart @@ -149,7 +149,7 @@ String? libraryGroupName(Info info) { } /// Produce a string containing [value] padded with white space up to [n] chars. -String pad(value, n, {bool right = false}) { +String pad(Object value, int n, {bool right = false}) { var s = '$value'; if (s.length >= n) return s; // ignore: avoid_dynamic_calls diff --git a/pkg/dart2js_tools/lib/src/dart2js_mapping.dart b/pkg/dart2js_tools/lib/src/dart2js_mapping.dart index 8b6611bf344..5e93d91d2b8 100644 --- a/pkg/dart2js_tools/lib/src/dart2js_mapping.dart +++ b/pkg/dart2js_tools/lib/src/dart2js_mapping.dart @@ -165,7 +165,7 @@ class _FrameDecoder implements Iterator { } } -_extractMinifiedNames( +void _extractMinifiedNames( String encodedInput, SingleMapping sourceMap, Map minifiedNames, diff --git a/pkg/dart2js_tools/lib/src/util.dart b/pkg/dart2js_tools/lib/src/util.dart index d2c94cd4cd5..5630903771a 100644 --- a/pkg/dart2js_tools/lib/src/util.dart +++ b/pkg/dart2js_tools/lib/src/util.dart @@ -56,7 +56,8 @@ class DownloadedFileProvider extends CachingFileProvider { class Logger { final Set _seenMessages = {}; - log(String message) { + + void log(String message) { if (_seenMessages.add(message)) { print(message); } diff --git a/pkg/dart2wasm/lib/option.dart b/pkg/dart2wasm/lib/option.dart index ebbd9fbcd31..b0e8da4c00e 100644 --- a/pkg/dart2wasm/lib/option.dart +++ b/pkg/dart2wasm/lib/option.dart @@ -87,24 +87,24 @@ class MultiValueOption extends Option> { } class IntMultiOption extends MultiValueOption { - IntMultiOption( - name, void Function(WasmCompilerOptions o, List v) applyToOptions, + IntMultiOption(String name, + void Function(WasmCompilerOptions o, List v) applyToOptions, {Iterable? defaultsTo}) : super(name, applyToOptions, (v) => int.parse(v), defaultsTo: defaultsTo); } class StringMultiOption extends MultiValueOption { - StringMultiOption( - name, void Function(WasmCompilerOptions o, List v) applyToOptions, + StringMultiOption(String name, + void Function(WasmCompilerOptions o, List v) applyToOptions, {String? abbr, Iterable? defaultsTo}) : super(name, applyToOptions, (v) => v, abbr: abbr, defaultsTo: defaultsTo); } class UriMultiOption extends MultiValueOption { - UriMultiOption( - name, void Function(WasmCompilerOptions o, List v) applyToOptions, + UriMultiOption(String name, + void Function(WasmCompilerOptions o, List v) applyToOptions, {Iterable? defaultsTo}) : super(name, applyToOptions, (v) => Uri.file(Directory(v).absolute.path), defaultsTo: defaultsTo); diff --git a/pkg/dds/analysis_options.yaml b/pkg/dds/analysis_options.yaml index 7386f12d2e5..c9da9825c63 100644 --- a/pkg/dds/analysis_options.yaml +++ b/pkg/dds/analysis_options.yaml @@ -1,5 +1,10 @@ include: package:lints/recommended.yaml +analyzer: + errors: + # ~40 violations in test/. + strict_top_level_inference: ignore + linter: rules: - directives_ordering diff --git a/pkg/dds/lib/src/dap/adapters/dart.dart b/pkg/dds/lib/src/dap/adapters/dart.dart index 1e8c4d0600a..542234de15e 100644 --- a/pkg/dds/lib/src/dap/adapters/dart.dart +++ b/pkg/dds/lib/src/dap/adapters/dart.dart @@ -3046,7 +3046,7 @@ class _DdsCapabilities { /// `postEvent`. bool get supportsCustomStreams => _isAtLeast(major: 1, minor: 4); - bool _isAtLeast({required major, required minor}) { + bool _isAtLeast({required int major, required int minor}) { if (this.major > major) { return true; } else if (this.major == major && this.minor >= minor) { diff --git a/pkg/dds/lib/src/dap_handler.dart b/pkg/dds/lib/src/dap_handler.dart index 32ce9e9e95b..4c184a16dc3 100644 --- a/pkg/dds/lib/src/dap_handler.dart +++ b/pkg/dds/lib/src/dap_handler.dart @@ -45,7 +45,7 @@ class DapHandler { }; } - _handleEvent(Event event) { + void _handleEvent(Event event) { if (event.event == 'initialized') { _initializedCompleter.complete(); } diff --git a/pkg/dev_compiler/analysis_options.yaml b/pkg/dev_compiler/analysis_options.yaml index 6c680e028e3..88f9011991d 100644 --- a/pkg/dev_compiler/analysis_options.yaml +++ b/pkg/dev_compiler/analysis_options.yaml @@ -10,6 +10,8 @@ analyzer: constant_identifier_names: ignore implementation_imports: ignore prefer_void_to_null: ignore + # ~5 violations in test/sourcemap. + strict_top_level_inference: ignore exclude: - doc/api/** - gen/** diff --git a/pkg/dev_compiler/lib/src/js_ast/nodes.dart b/pkg/dev_compiler/lib/src/js_ast/nodes.dart index e0a6e6ef5e0..0b359251d78 100644 --- a/pkg/dev_compiler/lib/src/js_ast/nodes.dart +++ b/pkg/dev_compiler/lib/src/js_ast/nodes.dart @@ -323,7 +323,7 @@ abstract class Node { /// Returns a node equivalent to [this], but with new source position and end /// source position. T _withSourceInformation( - sourceInformation, T Function() cloneFunc) { + Object? sourceInformation, T Function() cloneFunc) { if (sourceInformation == this.sourceInformation) { return this as T; } @@ -334,7 +334,7 @@ abstract class Node { return clone; } - Node withSourceInformation(sourceInformation) => + Node withSourceInformation(Object? sourceInformation) => _withSourceInformation(sourceInformation, _clone); bool get isCommaOperator => false; diff --git a/pkg/dev_compiler/lib/src/js_ast/template.dart b/pkg/dev_compiler/lib/src/js_ast/template.dart index 72429ec8af7..663130a5ae2 100644 --- a/pkg/dev_compiler/lib/src/js_ast/template.dart +++ b/pkg/dev_compiler/lib/src/js_ast/template.dart @@ -158,7 +158,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor { } static Instantiator same(T node) => (arguments) => node; - static Null makeNull(arguments) => null; + static Null makeNull(dynamic arguments) => null; Instantiator visit(T node) { if (forceCopy || analysis.containsInterpolatedNodes(node)) { diff --git a/pkg/dynamic_modules/bin/dynamic_module_runner.dart b/pkg/dynamic_modules/bin/dynamic_module_runner.dart index bde4f95862f..0514f89e6bc 100644 --- a/pkg/dynamic_modules/bin/dynamic_module_runner.dart +++ b/pkg/dynamic_modules/bin/dynamic_module_runner.dart @@ -6,7 +6,7 @@ import 'dart:io'; import 'package:dynamic_modules/dynamic_modules.dart' show loadModuleFromBytes; -main(List args) { +Future main(List args) { final bytes = File(args[0]).readAsBytesSync(); return loadModuleFromBytes(bytes); } diff --git a/pkg/dynamic_modules/test/data/apply_mixin/main.dart b/pkg/dynamic_modules/test/data/apply_mixin/main.dart index 405b2ec71ef..0a34e1ba637 100644 --- a/pkg/dynamic_modules/test/data/apply_mixin/main.dart +++ b/pkg/dynamic_modules/test/data/apply_mixin/main.dart @@ -8,7 +8,7 @@ import 'package:expect/expect.dart'; import 'shared/shared.dart' show M; /// A dynamic module can apply an exposed mixin. -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as M; Expect.equals(3, o.method1()); Expect.equals('*3 2', o.method2()); diff --git a/pkg/dynamic_modules/test/data/closure_invocation/main.dart b/pkg/dynamic_modules/test/data/closure_invocation/main.dart index fa56d261b94..360180efed9 100644 --- a/pkg/dynamic_modules/test/data/closure_invocation/main.dart +++ b/pkg/dynamic_modules/test/data/closure_invocation/main.dart @@ -7,7 +7,7 @@ import 'package:expect/expect.dart'; import 'shared/shared.dart' as shared; -main() async { +void main() async { await helper.load('entry1.dart'); Expect.equals('dynamic module 1: hello', shared.topLevelClosure!('hello')); helper.done(); diff --git a/pkg/dynamic_modules/test/data/core_api/main.dart b/pkg/dynamic_modules/test/data/core_api/main.dart index ef53d5444ac..0baee72e7c0 100644 --- a/pkg/dynamic_modules/test/data/core_api/main.dart +++ b/pkg/dynamic_modules/test/data/core_api/main.dart @@ -6,7 +6,7 @@ import '../../common/testing.dart' as helper; import 'package:expect/expect.dart'; /// A dynamic module can use core libraries and language features. -main() async { +void main() async { final result = await helper.load('entry1.dart'); Expect.isTrue(result); helper.done(); diff --git a/pkg/dynamic_modules/test/data/duplicate_library/main.dart b/pkg/dynamic_modules/test/data/duplicate_library/main.dart index 179a1fac643..24f6436deb1 100644 --- a/pkg/dynamic_modules/test/data/duplicate_library/main.dart +++ b/pkg/dynamic_modules/test/data/duplicate_library/main.dart @@ -7,7 +7,7 @@ import 'package:expect/async_helper.dart' show asyncExpectThrows; // It is an error to load a module that provides a second definition for // a library that already exists in the application. -main() async { +void main() async { await helper.load('entry1.dart'); await asyncExpectThrows(helper.load('entry2.dart')); helper.done(); diff --git a/pkg/dynamic_modules/test/data/dyn_module_type_checks/main.dart b/pkg/dynamic_modules/test/data/dyn_module_type_checks/main.dart index d94d6dbee06..499b42a4351 100644 --- a/pkg/dynamic_modules/test/data/dyn_module_type_checks/main.dart +++ b/pkg/dynamic_modules/test/data/dyn_module_type_checks/main.dart @@ -9,7 +9,7 @@ import 'shared/shared.dart' show Base; /// A dynamic module is allowed to extend a class in the dynamic interface and /// override its members. -main() async { +void main() async { Expect.equals(100, Base().method1(0)); final o1 = (await helper.load('entry1.dart')); final o2 = (await helper.load('entry2.dart')); diff --git a/pkg/dynamic_modules/test/data/extend_class/main.dart b/pkg/dynamic_modules/test/data/extend_class/main.dart index ac94bdd1d70..0a70c6111f0 100644 --- a/pkg/dynamic_modules/test/data/extend_class/main.dart +++ b/pkg/dynamic_modules/test/data/extend_class/main.dart @@ -9,7 +9,7 @@ import 'shared/shared.dart' show Base; /// A dynamic module is allowed to extend a class in the dynamic interface and /// override its members. -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as Base; Expect.equals(1, o.method1()); Expect.equals(2, o.method2()); diff --git a/pkg/dynamic_modules/test/data/extend_class2/main.dart b/pkg/dynamic_modules/test/data/extend_class2/main.dart index da9c1d610e5..1079922e7ba 100644 --- a/pkg/dynamic_modules/test/data/extend_class2/main.dart +++ b/pkg/dynamic_modules/test/data/extend_class2/main.dart @@ -18,7 +18,7 @@ class Child extends Base { /// This is similar to the `extend_class` test case, but includes more nuance, /// like extending a non-leaf class that already was used in the program, since /// that may affect dispatch logic based on some backends. -main() async { +void main() async { Base o = Child1(); Expect.equals(1, o.method1()); Expect.equals(3, o.method2()); diff --git a/pkg/dynamic_modules/test/data/extend_class_dyn_only/main.dart b/pkg/dynamic_modules/test/data/extend_class_dyn_only/main.dart index 90c80c5d4db..b601c70c92b 100644 --- a/pkg/dynamic_modules/test/data/extend_class_dyn_only/main.dart +++ b/pkg/dynamic_modules/test/data/extend_class_dyn_only/main.dart @@ -7,7 +7,7 @@ import 'package:expect/expect.dart'; /// A dynamic module is allowed to extend a class in the dynamic interface and /// override its members. -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as int; Expect.equals(1, o); helper.done(); diff --git a/pkg/dynamic_modules/test/data/extend_class_generics/main.dart b/pkg/dynamic_modules/test/data/extend_class_generics/main.dart index 35f0e21f8eb..57125bad858 100644 --- a/pkg/dynamic_modules/test/data/extend_class_generics/main.dart +++ b/pkg/dynamic_modules/test/data/extend_class_generics/main.dart @@ -9,7 +9,7 @@ import 'shared/shared.dart' show Base, SuperBase; /// A dynamic module is allowed to extend a class in the dynamic interface and /// override its members. -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as Base; if (o is SuperBase) { Expect.equals(3, o.method1()); diff --git a/pkg/dynamic_modules/test/data/implement_interface/main.dart b/pkg/dynamic_modules/test/data/implement_interface/main.dart index e8728aae390..c6fdd87f514 100644 --- a/pkg/dynamic_modules/test/data/implement_interface/main.dart +++ b/pkg/dynamic_modules/test/data/implement_interface/main.dart @@ -8,7 +8,7 @@ import 'package:expect/expect.dart'; import 'shared/shared.dart' show Base; /// A dynamic module can implement an exposed class. -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as Base; Expect.equals(3, o.method1()); Expect.equals(4, o.method2()); diff --git a/pkg/dynamic_modules/test/data/implicitly_extendable/main.dart b/pkg/dynamic_modules/test/data/implicitly_extendable/main.dart index 3d96bb6e6a5..72193e963ac 100644 --- a/pkg/dynamic_modules/test/data/implicitly_extendable/main.dart +++ b/pkg/dynamic_modules/test/data/implicitly_extendable/main.dart @@ -8,7 +8,7 @@ import 'package:expect/expect.dart'; import 'shared/shared.dart' show Base; /// A dynamic module can implement an exposed class. -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as Base; Expect.equals(5, o.method1()); Expect.equals(6, o.method2()); diff --git a/pkg/dynamic_modules/test/data/indirect_expose/main.dart b/pkg/dynamic_modules/test/data/indirect_expose/main.dart index 88e721f486f..538d063594b 100644 --- a/pkg/dynamic_modules/test/data/indirect_expose/main.dart +++ b/pkg/dynamic_modules/test/data/indirect_expose/main.dart @@ -8,7 +8,7 @@ import 'package:expect/expect.dart'; import 'shared/shared.dart'; /// A dynamic module can implement an exposed class. -main() async { +void main() async { final o = await helper.load('entry1.dart') as Triple; Expect.equals(3, o.e.method3()); Expect.equals(2, o.i1.method1()); diff --git a/pkg/dynamic_modules/test/data/load_twice/main.dart b/pkg/dynamic_modules/test/data/load_twice/main.dart index 61cdcaa57e6..6b49ff45094 100644 --- a/pkg/dynamic_modules/test/data/load_twice/main.dart +++ b/pkg/dynamic_modules/test/data/load_twice/main.dart @@ -7,7 +7,7 @@ import 'package:expect/async_helper.dart' show asyncExpectThrows; /// For the same reasons as the `duplicate_library` test, it is an error to load /// the same module twice. -main() async { +void main() async { await helper.load('entry1.dart'); await asyncExpectThrows(helper.load('entry1.dart')); helper.done(); diff --git a/pkg/dynamic_modules/test/data/load_unmodifiable_view/main.dart b/pkg/dynamic_modules/test/data/load_unmodifiable_view/main.dart index a2fc344ff51..eb51b619525 100644 --- a/pkg/dynamic_modules/test/data/load_unmodifiable_view/main.dart +++ b/pkg/dynamic_modules/test/data/load_unmodifiable_view/main.dart @@ -8,7 +8,7 @@ import '../../common/testing.dart' as helper; import 'package:expect/expect.dart'; /// Dynamic module can be loaded from unmodifiable view. -main() async { +void main() async { final result = await helper.load('entry1.dart', transformBytes: (Uint8List bytes) => bytes.buffer .asUint8List(0, bytes.lengthInBytes) diff --git a/pkg/dynamic_modules/test/data/multiple_classes/main.dart b/pkg/dynamic_modules/test/data/multiple_classes/main.dart index c2fe2505085..c8915871960 100644 --- a/pkg/dynamic_modules/test/data/multiple_classes/main.dart +++ b/pkg/dynamic_modules/test/data/multiple_classes/main.dart @@ -7,7 +7,7 @@ import 'package:expect/expect.dart'; import '../../common/testing.dart' as helper; import 'modules/common.dart'; -main() async { +void main() async { final a1 = await helper.load('entry1.dart') as A; final a2 = await helper.load('entry2.dart') as A; Expect.equals(a1.getString(), 'B'); diff --git a/pkg/dynamic_modules/test/data/override_extra_params/main.dart b/pkg/dynamic_modules/test/data/override_extra_params/main.dart index 8d0c2cfbf23..0459ee6f680 100644 --- a/pkg/dynamic_modules/test/data/override_extra_params/main.dart +++ b/pkg/dynamic_modules/test/data/override_extra_params/main.dart @@ -9,7 +9,7 @@ import 'shared/shared.dart' show Base; /// A dynamic module is allowed to extend a class in the dynamic interface and /// override its members. -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as Base; Expect.equals(1, o.method1(1)); helper.done(); diff --git a/pkg/dynamic_modules/test/data/reshape_selectors/main.dart b/pkg/dynamic_modules/test/data/reshape_selectors/main.dart index fbb2754d695..c896d69d75f 100644 --- a/pkg/dynamic_modules/test/data/reshape_selectors/main.dart +++ b/pkg/dynamic_modules/test/data/reshape_selectors/main.dart @@ -6,7 +6,7 @@ import '../../common/testing.dart' as helper; import 'shared/shared.dart' show A, B; -main() async { +void main() async { final o = (await helper.load('entry1.dart')) as A; final l = [A(), B()]; for (final entry in l) { diff --git a/pkg/dynamic_modules/test/data/same_record_shape/main.dart b/pkg/dynamic_modules/test/data/same_record_shape/main.dart index a87980b2fa8..5a99c6ffcf9 100644 --- a/pkg/dynamic_modules/test/data/same_record_shape/main.dart +++ b/pkg/dynamic_modules/test/data/same_record_shape/main.dart @@ -8,7 +8,7 @@ import 'package:expect/expect.dart'; // Similar to `isolated_shared`, constant canonicalization distinguishes // two constnats, even if they are created from a common library that was // not part of the original application. -main() async { +void main() async { final c1 = (await helper.load('entry1.dart')); final c2 = (await helper.load('entry2.dart')); diff --git a/pkg/dynamic_modules/test/data/shared_const/main.dart b/pkg/dynamic_modules/test/data/shared_const/main.dart index 812e8e46e85..3a2a9384cd9 100644 --- a/pkg/dynamic_modules/test/data/shared_const/main.dart +++ b/pkg/dynamic_modules/test/data/shared_const/main.dart @@ -13,7 +13,7 @@ class B { // Similar to `isolated_shared`, constant canonicalization distinguishes // two constnats, even if they are created from a common library that was // not part of the original application. -main() async { +void main() async { final c1 = (await helper.load('entry1.dart')); final c2 = (await helper.load('entry2.dart')); diff --git a/pkg/dynamic_modules/test/data/tearoff_no_concrete_impl/main.dart b/pkg/dynamic_modules/test/data/tearoff_no_concrete_impl/main.dart index d1db943c6d0..9dc5c1c57b1 100644 --- a/pkg/dynamic_modules/test/data/tearoff_no_concrete_impl/main.dart +++ b/pkg/dynamic_modules/test/data/tearoff_no_concrete_impl/main.dart @@ -6,7 +6,7 @@ import '../../common/testing.dart' as helper; import 'shared/shared.dart' show A, B, C; -main() async { +void main() async { final c = await helper.load('entry1.dart') as C?; if (c != null) { A(B(c).c.foo); diff --git a/pkg/dynamic_modules/test/data/top_level/main.dart b/pkg/dynamic_modules/test/data/top_level/main.dart index cbc9da4e8ca..0af2def5de1 100644 --- a/pkg/dynamic_modules/test/data/top_level/main.dart +++ b/pkg/dynamic_modules/test/data/top_level/main.dart @@ -8,7 +8,7 @@ import 'package:expect/expect.dart'; import 'shared/shared.dart' as shared; /// A top-level setter can be invoked from a dynamic module. -main() async { +void main() async { Expect.equals('original', shared.topLevelField); Expect.equals(0, shared.topLevelGetterInternal); Expect.equals(0, shared.topLevelSetterInternal); diff --git a/pkg/expect/test/identical_distinct_test.dart b/pkg/expect/test/identical_distinct_test.dart index 3545ab10357..9fa55bb363a 100644 --- a/pkg/expect/test/identical_distinct_test.dart +++ b/pkg/expect/test/identical_distinct_test.dart @@ -4,7 +4,7 @@ import "package:expect/expect.dart"; -main() { +void main() { var o1 = Object(); var o2 = Object(); var o3 = Object(); diff --git a/pkg/heap_snapshot/test/int_set_benchmark.dart b/pkg/heap_snapshot/test/int_set_benchmark.dart index 7a35122bef0..e93d0e410ae 100644 --- a/pkg/heap_snapshot/test/int_set_benchmark.dart +++ b/pkg/heap_snapshot/test/int_set_benchmark.dart @@ -4,7 +4,7 @@ import 'package:heap_snapshot/intset.dart'; -main() { +void main() { for (int every in [16, 8, 4, 3, 2, 1]) { iterationBenchmark(every, 1); iterationBenchmark(every, 0.5); diff --git a/pkg/heap_snapshot/test/int_set_test.dart b/pkg/heap_snapshot/test/int_set_test.dart index 02354b14e3c..bdac7c1db2e 100644 --- a/pkg/heap_snapshot/test/int_set_test.dart +++ b/pkg/heap_snapshot/test/int_set_test.dart @@ -6,7 +6,7 @@ import 'dart:math'; import 'package:heap_snapshot/intset.dart'; -main() { +void main() { checkDump(); checkBounds(); handCodedTests(); @@ -15,7 +15,7 @@ main() { print("OK"); } -void addExpectRangeError(set, int value) { +void addExpectRangeError(Set set, int value) { try { set.add(value); throw "Expected RangeError"; diff --git a/pkg/js_ast/lib/src/template.dart b/pkg/js_ast/lib/src/template.dart index 4c4e926fe8f..56fcbdd64f5 100644 --- a/pkg/js_ast/lib/src/template.dart +++ b/pkg/js_ast/lib/src/template.dart @@ -197,7 +197,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor { } static Instantiator same(Node node) => (arguments) => node; - static Null makeNull(arguments) => null; + static Null makeNull(dynamic arguments) => null; Instantiator visit(Node node) { if (forceCopy || analysis.containsInterpolatedNodes(node)) { diff --git a/pkg/modular_test/lib/src/loader.dart b/pkg/modular_test/lib/src/loader.dart index 61fa60ea913..3f0b30ff140 100644 --- a/pkg/modular_test/lib/src/loader.dart +++ b/pkg/modular_test/lib/src/loader.dart @@ -209,7 +209,8 @@ Future _createSdkModule(Uri root) async { } /// Trim the set of modules, and detect cycles while we are at it. -_detectCyclesAndRemoveUnreachable(Map modules, Module main) { +void _detectCyclesAndRemoveUnreachable( + Map modules, Module main) { Set visiting = {}; Set visited = {}; @@ -249,7 +250,7 @@ packages: '''; /// Report an conflict error. -_moduleConflict(String name, Module existing, Uri root) { +Never _moduleConflict(String name, Module existing, Uri root) { var isFile = name.endsWith('.dart'); var entryType = isFile ? 'file' : 'folder'; diff --git a/pkg/modular_test/test/find_sdk_root1_test.dart b/pkg/modular_test/test/find_sdk_root1_test.dart index dbbf8b63408..bac9d1416d3 100644 --- a/pkg/modular_test/test/find_sdk_root1_test.dart +++ b/pkg/modular_test/test/find_sdk_root1_test.dart @@ -10,7 +10,7 @@ import 'package:modular_test/src/find_sdk_root.dart'; // This and the 'src/find_sdk_root2_test.dart' check that we can locate // the SDK root properly regardless of the location of the `Platform.script`. -main() { +void main() { asyncTest(() async { Expect.equals(Platform.script.resolve("../../../"), await findRoot()); }); diff --git a/pkg/modular_test/test/io_pipeline_test.dart b/pkg/modular_test/test/io_pipeline_test.dart index aa4e818f06e..e9e89221dd0 100644 --- a/pkg/modular_test/test/io_pipeline_test.dart +++ b/pkg/modular_test/test/io_pipeline_test.dart @@ -11,7 +11,7 @@ import 'package:modular_test/src/io_pipeline.dart'; import 'pipeline_common.dart'; -main() async { +void main() async { var uri = Directory.systemTemp.uri.resolve("io_modular_test_root/"); int i = 0; while (await Directory.fromUri(uri).exists()) { diff --git a/pkg/modular_test/test/loader/loader_test.dart b/pkg/modular_test/test/loader/loader_test.dart index cf7de5c7b7e..8b8ceebc10e 100644 --- a/pkg/modular_test/test/loader/loader_test.dart +++ b/pkg/modular_test/test/loader/loader_test.dart @@ -13,7 +13,7 @@ import 'package:modular_test/src/suite.dart'; import 'package:args/args.dart'; -main(List args) async { +void main(List args) async { var options = _Options.parse(args); var baseUri = Platform.script.resolve('./'); var baseDir = Directory.fromUri(baseUri); diff --git a/pkg/modular_test/test/memory_pipeline_test.dart b/pkg/modular_test/test/memory_pipeline_test.dart index 98c1d006101..28a6343d363 100644 --- a/pkg/modular_test/test/memory_pipeline_test.dart +++ b/pkg/modular_test/test/memory_pipeline_test.dart @@ -11,7 +11,7 @@ import 'package:modular_test/src/memory_pipeline.dart'; import 'pipeline_common.dart'; -main() { +void main() { runPipelineTest(MemoryPipelineTestStrategy()); } diff --git a/pkg/modular_test/test/pipeline_common.dart b/pkg/modular_test/test/pipeline_common.dart index 7cef7e3eff5..ceaecd0eaee 100644 --- a/pkg/modular_test/test/pipeline_common.dart +++ b/pkg/modular_test/test/pipeline_common.dart @@ -91,7 +91,8 @@ abstract class PipelineTestStrategy { FutureOr cleanup(Pipeline pipeline); } -runPipelineTest(PipelineTestStrategy testStrategy) { +void runPipelineTest( + PipelineTestStrategy testStrategy) { var sources = { testStrategy.testRootUri.resolve("a1.dart"): 'A1', testStrategy.testRootUri.resolve("a2.dart"): 'A2', diff --git a/pkg/modular_test/test/specification_parser_test.dart b/pkg/modular_test/test/specification_parser_test.dart index 6940d5e93ec..b1432ffa470 100644 --- a/pkg/modular_test/test/specification_parser_test.dart +++ b/pkg/modular_test/test/specification_parser_test.dart @@ -5,7 +5,7 @@ import 'package:test/test.dart'; import 'package:modular_test/src/test_specification_parser.dart'; -main() { +void main() { test('require dependencies section', () { expect(() => parseTestSpecification(""), throwsA(TypeMatcher())); diff --git a/pkg/modular_test/test/src/find_sdk_root2_test.dart b/pkg/modular_test/test/src/find_sdk_root2_test.dart index 05dba888959..a4202e4f93a 100644 --- a/pkg/modular_test/test/src/find_sdk_root2_test.dart +++ b/pkg/modular_test/test/src/find_sdk_root2_test.dart @@ -10,7 +10,7 @@ import 'package:modular_test/src/find_sdk_root.dart'; // This and the '../find_sdk_root1_test.dart' check that we can locate // the SDK root properly regardless of the location of the `Platform.script`. -main() { +void main() { asyncTest(() async { Expect.equals(Platform.script.resolve("../../../../"), await findRoot()); }); diff --git a/pkg/modular_test/test/validate_pipeline_test.dart b/pkg/modular_test/test/validate_pipeline_test.dart index 1e5135b76ed..e0dc309daf4 100644 --- a/pkg/modular_test/test/validate_pipeline_test.dart +++ b/pkg/modular_test/test/validate_pipeline_test.dart @@ -9,7 +9,7 @@ import 'package:test/test.dart'; import 'package:modular_test/src/suite.dart'; import 'package:modular_test/src/pipeline.dart'; -main() { +void main() { test('no steps is OK', () { validateSteps([]); }); @@ -73,7 +73,7 @@ main() { }); } -validateSteps(List steps) { +void validateSteps(List steps) { _NoopPipeline(steps); } diff --git a/pkg/modular_test/test/validate_suite_test.dart b/pkg/modular_test/test/validate_suite_test.dart index 742a9ef4f3b..d78356facd7 100644 --- a/pkg/modular_test/test/validate_suite_test.dart +++ b/pkg/modular_test/test/validate_suite_test.dart @@ -8,7 +8,7 @@ library; import 'package:test/test.dart'; import 'package:modular_test/src/suite.dart'; -main() { +void main() { test('module test is not empty', () { var m = Module("a", [], Uri.parse("app:/"), []); expect(() => ModularTest([], m, []), throwsA(TypeMatcher())); diff --git a/pkg/status_file/bin/lint.dart b/pkg/status_file/bin/lint.dart index 23cd03cc23c..1bb91e3aae4 100644 --- a/pkg/status_file/bin/lint.dart +++ b/pkg/status_file/bin/lint.dart @@ -80,7 +80,7 @@ void lintStdIn( } } -void lintPath(path, +void lintPath(String path, {bool checkForDisjunctions = false, required bool checkForNonExisting}) { var filesWithErrors = []; if (FileSystemEntity.isFileSync(path)) { diff --git a/pkg/status_file/bin/remove_non_essential_entries.dart b/pkg/status_file/bin/remove_non_essential_entries.dart index a7c1f5d7b57..ceaa3b233c4 100644 --- a/pkg/status_file/bin/remove_non_essential_entries.dart +++ b/pkg/status_file/bin/remove_non_essential_entries.dart @@ -224,7 +224,7 @@ String formatComments(List comments) { return sb.toString(); } -main(List arguments) async { +void main(List arguments) async { var parser = buildParser(); var results = parser.parse(arguments); if (results["help"] || results.rest.isEmpty) { diff --git a/pkg/status_file/lib/src/disjunctive.dart b/pkg/status_file/lib/src/disjunctive.dart index 6bac6f7778f..e3d74d2702b 100644 --- a/pkg/status_file/lib/src/disjunctive.dart +++ b/pkg/status_file/lib/src/disjunctive.dart @@ -334,11 +334,13 @@ List _difference(List aList, List bList) { /// Finds the first occurrence of [expressionToFind] in [expressions] or /// returns null. -TExpression? _findFirst( - expressionToFind, List expressions) { - return expressions.cast().firstWhere( - (otherExpression) => expressionToFind.compareTo(otherExpression) == 0, - orElse: () => null); +T? _findFirst(T expressionToFind, List expressions) { + for (var expr in expressions) { + if (expressionToFind.compareTo(expr) == 0) { + return expr; + } + } + return null; } /// Adds [expressionToAdd] to [expressions] if is not present. diff --git a/pkg/status_file/test/linter_test.dart b/pkg/status_file/test/linter_test.dart index c84375517b4..6cb55111b8c 100644 --- a/pkg/status_file/test/linter_test.dart +++ b/pkg/status_file/test/linter_test.dart @@ -41,7 +41,8 @@ StatusFile createFromString(String text) { return StatusFile.parse("test", text.split('\n')); } -expectError(String text, String expectedError, {bool disjunctions = false}) { +void expectError(String text, String expectedError, + {bool disjunctions = false}) { var statusFile = createFromString(text); var errors = lint(statusFile, checkForDisjunctions: disjunctions, checkForNonExisting: false) @@ -49,7 +50,7 @@ expectError(String text, String expectedError, {bool disjunctions = false}) { Expect.equals(expectedError, errors.first.toString()); } -expectNoError(String text, {bool disjunctions = true}) { +void expectNoError(String text, {bool disjunctions = true}) { var errors = lint(createFromString(text), checkForDisjunctions: disjunctions, checkForNonExisting: false) .toList(); diff --git a/pkg/status_file/test/normalize_test.dart b/pkg/status_file/test/normalize_test.dart index 52ceceaac90..890c11b70ce 100644 --- a/pkg/status_file/test/normalize_test.dart +++ b/pkg/status_file/test/normalize_test.dart @@ -16,7 +16,7 @@ import 'package:status_file/status_file_normalizer.dart'; final Uri statusFilePath = Platform.script.resolve("data/"); -main() { +void main() { sanityCheck(); normalizeCheck(); } diff --git a/pkg/status_file/test/status_expression_dnf_test.dart b/pkg/status_file/test/status_expression_dnf_test.dart index 546395a7907..958387155ac 100644 --- a/pkg/status_file/test/status_expression_dnf_test.dart +++ b/pkg/status_file/test/status_expression_dnf_test.dart @@ -6,7 +6,7 @@ import "package:expect/expect.dart"; import "package:status_file/src/expression.dart"; import 'package:status_file/src/disjunctive.dart'; -main() { +void main() { testDnf(); } diff --git a/pkg/status_file/test/status_expression_test.dart b/pkg/status_file/test/status_expression_test.dart index 279f9207a3a..064a18261a3 100644 --- a/pkg/status_file/test/status_expression_test.dart +++ b/pkg/status_file/test/status_expression_test.dart @@ -21,10 +21,10 @@ class TestEnvironment implements Environment { @override String? lookUp(String name) => _values[name]; - operator []=(String key, String value) => _values[key] = value; + void operator []=(String key, String value) => _values[key] = value; } -main() { +void main() { testExpression(); testSyntaxError(); testBoolean(); diff --git a/pkg/test_runner/lib/src/browser_controller.dart b/pkg/test_runner/lib/src/browser_controller.dart index 91a63b85593..6dca53fc14b 100644 --- a/pkg/test_runner/lib/src/browser_controller.dart +++ b/pkg/test_runner/lib/src/browser_controller.dart @@ -1146,7 +1146,7 @@ class BrowserTestingServer { errorReportingServer.listen(errorReportingHandler, onError: errorHandler); } - void setupDispatchingServer(_) { + void setupDispatchingServer(HttpServer _) { var server = configuration.servers.server!; void noCache(HttpRequest request) { request.response.headers diff --git a/pkg/test_runner/lib/src/testing_servers.dart b/pkg/test_runner/lib/src/testing_servers.dart index fcdf199d983..3ece9dbd2b9 100644 --- a/pkg/test_runner/lib/src/testing_servers.dart +++ b/pkg/test_runner/lib/src/testing_servers.dart @@ -152,7 +152,7 @@ class TestingServers { } } - void _onError(e) { + void _onError(Object? e) { DebugLogger.error('HttpServer: an error occurred', e); } diff --git a/pkg/test_runner/test/dependency_graph_test.dart b/pkg/test_runner/test/dependency_graph_test.dart index 86c89668922..db79fb99345 100644 --- a/pkg/test_runner/test/dependency_graph_test.dart +++ b/pkg/test_runner/test/dependency_graph_test.dart @@ -6,7 +6,7 @@ import 'package:expect/expect.dart'; import 'package:test_runner/src/dependency_graph.dart'; -main() { +void main() { var graph = Graph(); var numberOfEvents = 0; var addEventAssertions = []; diff --git a/pkg/test_runner/test/experiment_test.dart b/pkg/test_runner/test/experiment_test.dart index 1dffb4affec..19526d57aec 100644 --- a/pkg/test_runner/test/experiment_test.dart +++ b/pkg/test_runner/test/experiment_test.dart @@ -10,7 +10,7 @@ import 'dart:io'; import 'package:expect/expect.dart'; // SharedOptions=--enable-experiment=test-experiment -main() { +void main() { Expect.isTrue(Platform.executableArguments .contains("--enable-experiment=test-experiment")); } diff --git a/pkg/test_runner/test/skipping_dart2js_compilations_helper.dart b/pkg/test_runner/test/skipping_dart2js_compilations_helper.dart index 74fc9916ba3..48fbe367128 100644 --- a/pkg/test_runner/test/skipping_dart2js_compilations_helper.dart +++ b/pkg/test_runner/test/skipping_dart2js_compilations_helper.dart @@ -4,7 +4,7 @@ import 'dart:io'; -main(List arguments) { +void main(List arguments) { var outputFile = arguments[0]; var file = File(outputFile); file.createSync(); diff --git a/pkg/test_runner/test/test_runner_test.dart b/pkg/test_runner/test/test_runner_test.dart index 7fe3422dd89..3c6332488d6 100644 --- a/pkg/test_runner/test/test_runner_test.dart +++ b/pkg/test_runner/test/test_runner_test.dart @@ -23,7 +23,7 @@ class TestController { static int numCompletedTests = 0; // Used as TestCase.completedCallback. - static processCompletedTest(TestCase testCase) { + static void processCompletedTest(TestCase testCase) { final passed = testCase.result.canBeOutcomeOf(testCase.realExpected); numCompletedTests++; diff --git a/pkg/testing/lib/src/chain.dart b/pkg/testing/lib/src/chain.dart index eac11745bc1..59a285d314d 100644 --- a/pkg/testing/lib/src/chain.dart +++ b/pkg/testing/lib/src/chain.dart @@ -347,13 +347,14 @@ abstract class Step { Future> run(I input, C context); - Result unhandledError(error, StackTrace trace) { + Result unhandledError(Object? error, StackTrace trace) { return Result.crash(error, trace); } Result pass(O output) => Result.pass(output); - Result crash(error, StackTrace trace) => Result.crash(error, trace); + Result crash(Object? error, StackTrace trace) => + Result.crash(error, trace); Result fail(O output, [error, StackTrace? trace]) { return Result.fail(output, error, trace); @@ -392,7 +393,7 @@ class Result { Result.pass(O output) : this(output, Expectation.pass, null); - Result.crash(error, StackTrace trace) + Result.crash(Object? error, StackTrace trace) : this(null, Expectation.crash, error, trace: trace); Result.fail(O output, [error, StackTrace? trace]) diff --git a/pkg/testing/lib/src/log.dart b/pkg/testing/lib/src/log.dart index f85dd3c01c9..d4eb3fe11d7 100644 --- a/pkg/testing/lib/src/log.dart +++ b/pkg/testing/lib/src/log.dart @@ -67,12 +67,12 @@ abstract class Logger { void logSuiteComplete(Suite suite); - void logUncaughtError(error, StackTrace stackTrace); + void logUncaughtError(Object error, StackTrace stackTrace); /// Issued when there's been a crash caught by the framework. /// Notice that the exit-code has already been set and that the error has /// been printed to stderr. - void noticeFrameworkCatchError(error, StackTrace stackTrace); + void noticeFrameworkCatchError(Object? error, StackTrace stackTrace); } class StdoutLogger implements Logger { @@ -196,7 +196,7 @@ class StdoutLogger implements Logger { } @override - void logUncaughtError(error, StackTrace stackTrace) { + void logUncaughtError(Object error, StackTrace stackTrace) { logMessage(error); logMessage(stackTrace); } diff --git a/pkg/vm/analysis_options.yaml b/pkg/vm/analysis_options.yaml index 6d3c44727b3..ba0281ea043 100644 --- a/pkg/vm/analysis_options.yaml +++ b/pkg/vm/analysis_options.yaml @@ -3,3 +3,8 @@ # BSD-style license that can be found in the LICENSE file. include: package:lints/core.yaml + +analyzer: + errors: + # ~50 violations in bin, lib, and test. + strict_top_level_inference: ignore diff --git a/pkg/vm/bin/list_libraries.dart b/pkg/vm/bin/list_libraries.dart index fe400c79757..a1a4257d25a 100644 --- a/pkg/vm/bin/list_libraries.dart +++ b/pkg/vm/bin/list_libraries.dart @@ -13,7 +13,7 @@ Usage: list_libraries input.dill Lists libraries included in a kernel binary file. '''; -main(List arguments) async { +void main(List arguments) async { if (arguments.length != 1) { print(_usage); exit(1); diff --git a/pkg/vm_service/analysis_options.yaml b/pkg/vm_service/analysis_options.yaml index dc7825c45de..6601c71c077 100644 --- a/pkg/vm_service/analysis_options.yaml +++ b/pkg/vm_service/analysis_options.yaml @@ -3,6 +3,8 @@ include: package:lints/recommended.yaml analyzer: errors: unnecessary_library_name: ignore + # ~300 violations in test/. + strict_top_level_inference: ignore linter: rules: diff --git a/third_party/pkg/dap/lib/src/protocol_special.dart b/third_party/pkg/dap/lib/src/protocol_special.dart index 5105ca17363..70f398d49b6 100644 --- a/third_party/pkg/dap/lib/src/protocol_special.dart +++ b/third_party/pkg/dap/lib/src/protocol_special.dart @@ -47,7 +47,7 @@ class Either2 extends ToJsonable { String toString() => map((t) => t.toString(), (t) => t.toString()); /// Checks whether the value of the union equals the supplied value. - bool valueEquals(o) => map((t) => t == o, (t) => t == o); + bool valueEquals(Object o) => map((t) => t == o, (t) => t == o); } /// An object from the LSP/DAP specs that can be converted to JSON. diff --git a/third_party/pkg/language_server_protocol/lib/protocol_special.dart b/third_party/pkg/language_server_protocol/lib/protocol_special.dart index a4f634892ec..502b5deb877 100644 --- a/third_party/pkg/language_server_protocol/lib/protocol_special.dart +++ b/third_party/pkg/language_server_protocol/lib/protocol_special.dart @@ -31,9 +31,9 @@ Object? specToJson(Object? obj) { } } -void _alwaysNull(_, [__]) {} +void _alwaysNull(dynamic _, [dynamic __]) {} -bool _alwaysTrue(_, [__]) => true; +bool _alwaysTrue(dynamic _, [dynamic __]) => true; typedef DocumentChanges = List>; @@ -71,7 +71,7 @@ class Either2 implements ToJsonable { String toString() => map((t) => t.toString(), (t) => t.toString()); /// Checks whether the value of the union equals the supplied value. - bool valueEquals(o) => map((t) => t == o, (t) => t == o); + bool valueEquals(Object o) => map((t) => t == o, (t) => t == o); } class Either3 implements ToJsonable { @@ -125,7 +125,8 @@ class Either3 implements ToJsonable { ); /// Checks whether the value of the union equals the supplied value. - bool valueEquals(o) => map((t) => t == o, (t) => t == o, (t) => t == o); + bool valueEquals(Object o) => + map((t) => t == o, (t) => t == o, (t) => t == o); } class Either4 implements ToJsonable { @@ -193,7 +194,7 @@ class Either4 implements ToJsonable { ); /// Checks whether the value of the union equals the supplied value. - bool valueEquals(o) => + bool valueEquals(Object o) => map((t) => t == o, (t) => t == o, (t) => t == o, (t) => t == o); }