Skip to content

[CP] Fix nullability of bad cast to FunctionType in pkg/kernel/lib/clone.dart #52634

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

Closed
fishythefish opened this issue Jun 7, 2023 · 2 comments
Assignees
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. cherry-pick-approved Label for approved cherrypick request cherry-pick-merged Cherry-pick has been merged to the stable or beta branch. cherry-pick-review Issue that need cherry pick triage to approve legacy-area-front-end Legacy: Use area-dart-model instead. merge-to-stable

Comments

@fishythefish
Copy link
Member

fishythefish commented Jun 7, 2023

Commit(s) to merge

ea84221

Target

stable

Prepared changelist for beta/stable

https://dart-review.googlesource.com/c/sdk/+/307964

Issue Description

There is a visitor in the CFE whose job it is to clone AST nodes. InstanceGetterInvocation nodes have a functionType, but this field is optional. The visitor for this node type had visitOptionalType(node.functionType) as FunctionType instead of as FunctionType?, so it would crash whenever there was no functionType.

This likely affects all platforms. (Edit: This might only be the Flutter web workflow - see Siggi's comment below and the linked issue for details.)

What is the fix

Change the cast from as FunctionType to as FunctionType?

Why cherry-pick

It's a low-risk fix that addresses an obvious bug in the CFE that users cannot work around easily. The code still statically typechecks and any successful cast to FunctionType will still be a successful cast to FunctionType?.

It fixes the issues users are running into in #52403. (Note the last few comments - users are looking for this to be addressed quickly.)

Risk

low

Issue link(s)

#52403

Extra Info

No response

@fishythefish fishythefish added the cherry-pick-review Issue that need cherry pick triage to approve label Jun 7, 2023
@sigmundch sigmundch added legacy-area-front-end Legacy: Use area-dart-model instead. area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. labels Jun 7, 2023
@sigmundch
Copy link
Member

cc @johnniwinther since the fix is in the CFE.

I'm very much in favor of cherry-picking. The change is extremely small and low risk, and mitigates crashes multiple customers have noticed in the Flutter 3.10 release.

Even though the change is in the CFE, I've only seen this issue because of the serialization step used in the flutter tool for flutter-web. So, I'm not sure if this crash is visible in other workflows.

@johnniwinther
Copy link
Member

LGTM

@itsjustkevin itsjustkevin added cherry-pick-approved Label for approved cherrypick request merge-to-stable labels Jun 8, 2023
copybara-service bot pushed a commit that referenced this issue Jun 8, 2023
Bug: #52403
Fixes: #52634
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/303420
Change-Id: If05caab1b89236872092bdb6a1ee4a1c45953660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307964
Reviewed-by: Sigmund Cherem <[email protected]>
Commit-Queue: Mayank Patke <[email protected]>
@itsjustkevin itsjustkevin added the cherry-pick-merged Cherry-pick has been merged to the stable or beta branch. label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. cherry-pick-approved Label for approved cherrypick request cherry-pick-merged Cherry-pick has been merged to the stable or beta branch. cherry-pick-review Issue that need cherry pick triage to approve legacy-area-front-end Legacy: Use area-dart-model instead. merge-to-stable
Projects
None yet
Development

No branches or pull requests

8 participants