Skip to content

Commit b8e557d

Browse files
authored
[cupertino_ui] Work around dart2wasm optional parameter inference bug in example checkbox tests (flutter#12961)
Follow-up to flutter/packages#12956 to unblock the Flutter-to-packages roller (flutter/packages#12904). flutter/packages#12956 resolved the dart2wasm hang in packages/cupertino_ui/test/. Previously, CI never reached packages/cupertino_ui/example because the shard timed out while running packages/cupertino_ui. Now that packages/cupertino_ui passes, CI runs a separate flutter test --platform=chrome --wasm invocation for packages/cupertino_ui/example. Because the example suite compiles into its own standalone Wasm bundle that includes both CupertinoSheet (RoundedSuperellipseBorder) and CupertinoCheckbox, it hits the same dart2wasm optional parameter inference bug in _CheckboxPainter._drawBox when running test/checkbox/cupertino_checkbox.snippet.0_test.dart. Adds the same OutlinedBorder.copyWith() workaround to cupertino_checkbox.snippet.0_test.dart and cupertino_checkbox.0_test.dart so the example Wasm bundle also keeps the circularity and eccentricity selector parameters nullable. Workaround for flutter#193021 Workaround for dart-lang/sdk#64326 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 7e3db3b commit b8e557d

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

‎packages/cupertino_ui/example/test/checkbox/cupertino_checkbox.0_test.dart‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ import 'package:cupertino_ui_examples/checkbox/cupertino_checkbox.0.dart'
88
import 'package:flutter_test/flutter_test.dart';
99

1010
void main() {
11+
// Workaround for https://github.com/dart-lang/sdk/issues/64326:
12+
// Ensure TFA infers nullable `circularity` and `eccentricity` parameters on
13+
// `_ShapeToCircleBorder.copyWith` implementations in the `OutlinedBorder.copyWith`
14+
// dispatch selector so dart2wasm does not miscompile `shape.copyWith(side: side)`
15+
// in `_CheckboxPainter._drawBox` into `unreachable`.
16+
// TODO(Piinks): Restore original test when https://github.com/dart-lang/sdk/issues/64326 is resolved.
17+
(ShapeBorder.lerp(const RoundedRectangleBorder(), const CircleBorder(), 0.5)!
18+
as OutlinedBorder)
19+
.copyWith();
20+
(ShapeBorder.lerp(
21+
const RoundedSuperellipseBorder(),
22+
const CircleBorder(),
23+
0.5,
24+
)!
25+
as OutlinedBorder)
26+
.copyWith();
27+
1128
testWidgets('Checkbox can be checked', (WidgetTester tester) async {
1229
await tester.pumpWidget(const example.CupertinoCheckboxApp());
1330

‎packages/cupertino_ui/example/test/checkbox/cupertino_checkbox.snippet.0_test.dart‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ import 'package:cupertino_ui_examples/checkbox/cupertino_checkbox.snippet.0.dart
88
import 'package:flutter_test/flutter_test.dart';
99

1010
void main() {
11+
// Workaround for https://github.com/dart-lang/sdk/issues/64326:
12+
// Ensure TFA infers nullable `circularity` and `eccentricity` parameters on
13+
// `_ShapeToCircleBorder.copyWith` implementations in the `OutlinedBorder.copyWith`
14+
// dispatch selector so dart2wasm does not miscompile `shape.copyWith(side: side)`
15+
// in `_CheckboxPainter._drawBox` into `unreachable`.
16+
// TODO(Piinks): Restore original test when https://github.com/dart-lang/sdk/issues/64326 is resolved.
17+
(ShapeBorder.lerp(const RoundedRectangleBorder(), const CircleBorder(), 0.5)!
18+
as OutlinedBorder)
19+
.copyWith();
20+
(ShapeBorder.lerp(
21+
const RoundedSuperellipseBorder(),
22+
const CircleBorder(),
23+
0.5,
24+
)!
25+
as OutlinedBorder)
26+
.copyWith();
27+
1128
testWidgets('Checkbox color is affected by whether it is enabled', (
1229
WidgetTester tester,
1330
) async {

0 commit comments

Comments
 (0)