[multiple] Avoid new unreachable_switch_default warning. (flutter/engine#54996)

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.

Before adding the new warning to the analyzer, code in the engine needs
to first be updated to eliminate these unreachable `default` clauses, so
that the warning won't cause builds to break.

For more information, see
https://github.com/dart-lang/sdk/issues/54575.
This commit is contained in:
Paul Berry 2024-09-06 15:24:36 -07:00 committed by GitHub
parent adfd4c03de
commit 92e2915b51
6 changed files with 0 additions and 11 deletions

View File

@ -266,7 +266,5 @@ CkColorFilter? createCkColorFilter(EngineColorFilter colorFilter) {
return const CkLinearToSrgbGammaColorFilter();
case ColorFilterType.srgbToLinearGamma:
return const CkSrgbToLinearGammaColorFilter();
default:
throw StateError('Unknown mode $colorFilter.type for ColorFilter.');
}
}

View File

@ -844,8 +844,6 @@ class Mutator {
return matrix == typedOther.matrix;
case MutatorType.opacity:
return alpha == typedOther.alpha;
default:
return false;
}
}

View File

@ -1337,7 +1337,6 @@ String? stringForStrokeCap(ui.StrokeCap? strokeCap) {
case ui.StrokeCap.round:
return 'round';
case ui.StrokeCap.square:
default:
return 'square';
}
}
@ -1349,7 +1348,6 @@ String stringForStrokeJoin(ui.StrokeJoin strokeJoin) {
case ui.StrokeJoin.bevel:
return 'bevel';
case ui.StrokeJoin.miter:
default:
return 'miter';
}
}

View File

@ -914,7 +914,5 @@ EngineHtmlColorFilter? createHtmlColorFilter(EngineColorFilter? colorFilter) {
throw UnimplementedError('ColorFilter.linearToSrgbGamma not implemented for HTML renderer');
case ColorFilterType.srgbToLinearGamma:
throw UnimplementedError('ColorFilter.srgbToLinearGamma not implemented for HTML renderer.');
default:
throw StateError('Unknown mode $colorFilter.type for ColorFilter.');
}
}

View File

@ -1118,8 +1118,6 @@ String? _decorationStyleToCssString(ui.TextDecorationStyle decorationStyle) {
return 'solid';
case ui.TextDecorationStyle.wavy:
return 'wavy';
default:
return null;
}
}

View File

@ -75,7 +75,6 @@ class TextCapitalizationConfig {
case TextCapitalization.sentences:
autocapitalize = 'sentences';
case TextCapitalization.none:
default:
autocapitalize = 'off';
}
if (domInstanceOfString(domElement, 'HTMLInputElement')) {