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

[camerax] Ignore new unreachable_switch_default warning. #7592

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

stereotype441
Copy link
Contributor

The Dart analyzer will soon be changed so that if the default clause of a switch statement is determined to be unreachable by the exhaustiveness checker, a new warning of type
unreachable_switch_default will be issued. This parallels the behavior of the existing unreachable_switch_case warning, which is issued whenever a case clause of a switch statement is determined to be unreachable.

In the vast majority of cases, the most reasonable way to address the warning is to remove the unreachable default clause. However, in a few rare cases, it makes sense to keep the default clause, because it's intentionally future-proofing the code in case new possible values are added to the enum being switched on.

Three of these rare cases crop up in the camerax package. This change adds ignore comments to avoid a spurious warning.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

The Dart analyzer will soon be changed so that if the `default` clause
of a `switch` statement is determined to be unreachable by the
exhaustiveness checker, a new warning of type
`unreachable_switch_default` will be issued. This parallels the
behavior of the existing `unreachable_switch_case` warning, which is
issued whenever a `case` clause of a `switch` statement is determined
to be unreachable.

In the vast majority of cases, the most reasonable way to address the
warning is to remove the unreachable `default` clause. However, in a
few rare cases, it makes sense to keep the `default` clause, because
it's intentionally future-proofing the code in case new possible
values are added to the enum being switched on.

Three of these rare cases crop up in the camerax package. This change
adds `ignore` comments to avoid a spurious warning.
Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@stereotype441 stereotype441 merged commit 03623b6 into flutter:main Sep 9, 2024
76 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 10, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 10, 2024
flutter/packages@b4e0fc1...bb53e5d

2024-09-09 magder@google.com [ci] Increase deprecation check minimum to macOS 14 (flutter/packages#7544)
2024-09-09 paulberry@google.com [camerax] Ignore new `unreachable_switch_default` warning. (flutter/packages#7592)
2024-09-09 109111084+yaakovschectman@users.noreply.github.com [google_maps_flutter_platform_interface] Split `CameraUpdate` into derived classes to use structured data (flutter/packages#7596)
2024-09-09 stuartmorgan@google.com [google_maps_flutter] Disable setAndGetScrollPosition on iOS (flutter/packages#7609)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants