-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Fix runtime type comparison #113212
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 runtime type comparison #113212
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Using Ideally, we need a test case covering the bug that this is fixing. However, I am right now not sure how to write this one here... Maybe @Piinks has an idea? |
This should either be an |
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.
Hmm I recall copying a lot of the notification logic here out of the glowing overscroll indicator.
Some of it was cleaned up in #87839, (see https://github.com/flutter/flutter/pull/87839/files#r994796453) but it looks like some tidying was left out.
Glowing overscroll indicator still sets _lastNotification = notification.runtimeType
in the glowing one instead of _lastNotification = notification
like in the stretching , can you update that as well so this is more consistent across the two?
It should be possible to write a test that enters this if block currently when it shouldn't, and that test will confirm this fixes the issue.
I see a To be honest I don't have the time to dive into it the coming weeks. Maybe it's better if someone takes this change. I won't feel bad if this PR is closed in favor of a more complete fix. |
No worries @GeertJohan, thanks for contributing and bringing this to our attention. I'll file an issue to follow up on this. |
Filed #113840 for follow up. Once we can identify a case where this creates a bug, we can write test for the fix. :) Thanks @GeertJohan! |
I was looking for wrong
something.runtimeType is
comparisons in our codebase and the search matched this line in the vendored flutter sdk.I'm not 100% sure this MR results in correct behavior. But since
.runtimeType
always returnsType
which can never matchOverscrollNotification
, the current code must be wrong?