Fix nullability of cast to FunctionType.

Fixes: #52403
Change-Id: I6eeaad51f45b8dabfd61132d2deae0893b01e99b
Fixed: 52403
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303420
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart
index 5f30a3d..fd38853 100644
--- a/pkg/kernel/lib/clone.dart
+++ b/pkg/kernel/lib/clone.dart
@@ -832,7 +832,7 @@
   TreeNode visitInstanceGetterInvocation(InstanceGetterInvocation node) {
     return new InstanceGetterInvocation.byReference(
         node.kind, clone(node.receiver), node.name, clone(node.arguments),
-        functionType: visitOptionalType(node.functionType) as FunctionType,
+        functionType: visitOptionalType(node.functionType) as FunctionType?,
         interfaceTargetReference: node.interfaceTargetReference);
   }