-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix newly surface errors after cleanup #64
Conversation
Some cleanup on the master branch surfaced new static errors in the migration branch. - More variable types (from `var` with an uninitialized variable) requires additional `late` or additional casts. - Use `on Object catch` when the static type of the error shouldn't by `dynamic` since we now disallow implicit casts from `dynamic`. These won't be necessary after a catch with no `on` clause gets an inferred type of `Object` instead of `dynamic`. - Add some more `!` in places where adding more argument types which were previously implicit dynamic caused less dynamic throughout the body of a function.
lib/src/chain.dart
Outdated
@@ -73,7 +73,7 @@ class Chain implements StackTrace { | |||
/// | |||
/// If [callback] returns a value, it will be returned by [capture] as well. | |||
static T capture<T>(T Function() callback, | |||
{void Function(Object error, Chain)? onError, | |||
{void Function(dynamic error, Chain)? onError, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify why this should be dynamic
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was dynamic before. I changed it in https://github.com/dart-lang/stack_trace/pull/62/files#diff-9e567343197420b24b39f009a31aa65aR76
My hope was that it wasn't breaking since any Function(dynamic, Chain)
can work as a Function(Object, Chain)
, but I didn't change it in the typedef here:
typedef _ChainHandler = void Function(dynamic error, Chain chain); |
I can either change that one too, or I need to change this one back to dynamic
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that errors can't be null any more afaik, I think changing the typedef seems reasonable? Or is there some other reason we don't want to change that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I'll go with that
See #64 (comment) Enable and fix the lint `avoid_private_typedef_functions`.
See #64 (comment) Enable and fix the lint `avoid_private_typedef_functions`.
Back to Once I get this in I'll do another merge from master and get things settled. |
Some cleanup on the master branch surfaced new static errors in the
migration branch.
var
with an uninitialized variable)requires additional
late
or additional casts.on Object catch
when the static type of the error shouldn't bydynamic
since we now disallow implicit casts fromdynamic
. Thesewon't be necessary after a catch with no
on
clause gets an inferredtype of
Object
instead ofdynamic
.!
in places where adding more argument types whichwere previously implicit dynamic caused less dynamic throughout the
body of a function.