Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable strict-inference #46062

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 7,7 @@
analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
errors:
# allow self-reference to deprecated members (we do this because otherwise we have
Expand Down
2 changes: 1 addition & 1 deletion ci/bin/format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 99,7 @@ Future<String> _runGit(
return result.stdout;
}

typedef MessageCallback = Function(String? message, {MessageType type});
typedef MessageCallback = void Function(String? message, {MessageType type});

/// Base class for format checkers.
///
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/hooks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 288,7 @@ bool _onError(Object error, StackTrace? stackTrace) {
return PlatformDispatcher.instance._dispatchError(error, stackTrace ?? StackTrace.empty);
}

// ignore: always_declare_return_types, prefer_generic_function_type_aliases
typedef _ListStringArgFunction(List<String> args);
typedef _ListStringArgFunction = Object? Function(List<String> args);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa, we still have non-assignment typedefs in the code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to search through for other ignores of prefer_generic_function_type_aliases!


@pragma('vm:entry-point')
void _runMain(Function startMainIsolateFunction,
Expand Down
4 changes: 2 additions & 2 deletions lib/web_ui/test/canvaskit/surface_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 150,7 @@ void testMain() {
'getExtension',
<String>['WEBGL_lose_context'],
);
js_util.callMethod(loseContextExtension, 'loseContext', const <void>[]);
js_util.callMethod<void>(loseContextExtension, 'loseContext', const <void>[]);

// Pump a timer to allow the "lose context" event to propagate.
await Future<void>.delayed(Duration.zero);
Expand All @@ -160,7 160,7 @@ void testMain() {
expect(isContextLost, isTrue);

// Emulate WebGL context restoration.
js_util.callMethod(loseContextExtension, 'restoreContext', const <void>[]);
js_util.callMethod<void>(loseContextExtension, 'restoreContext', const <void>[]);

// Pump a timer to allow the "restore context" event to propagate.
await Future<void>.delayed(Duration.zero);
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/test/engine/pointer_binding_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3606,7 3606,7 @@ mixin _ButtonedEventMixin on _BasicEventContext {
});
// timeStamp can't be set in the constructor, need to override the getter.
if (timeStamp != null) {
js_util.callMethod(
js_util.callMethod<void>(
objectConstructor,
'defineProperty',
<dynamic>[
Expand Down
2 changes: 1 addition & 1 deletion testing/scenario_app/bin/utils/logs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 10,7 @@ String _red = _supportsAnsi ? '\u001b[31m' : '';
String _gray = _supportsAnsi ? '\u001b[90m' : '';
String _reset = _supportsAnsi? '\u001B[0m' : '';

Future<void> step(String msg, Function() fn) async {
Future<void> step(String msg, Future<void> Function() fn) async {
stdout.writeln('-> $_green$msg$_reset');
try {
await fn();
Expand Down