[CP] Fix nullability of bad cast to FunctionType in pkg/kernel/lib/clone.dart #52634
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
Uh oh!
There was an error while loading. Please reload this page.
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 afunctionType
, but this field is optional. The visitor for this node type hadvisitOptionalType(node.functionType) as FunctionType
instead ofas FunctionType?
, so it would crash whenever there was nofunctionType
.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
toas 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 toFunctionType?
.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
The text was updated successfully, but these errors were encountered: