a09c585772
In order to make sure static types in kernel AST are still correct after tree shaking, tree shaker needs to insert no-op unsafeCast calls when removing conditional expressions, as ConditionalExpression nodes have explicit 'staticType' which may be different from static types of sub-expressions. Otherwise we might end up with an untyped function call (FunctionInvocation with FunctionAccessKind.Function) performed from a receiver with a known function type. That would violate VM's assumptions about static type of receiver being checked by the front-end and trigger assertion in pkg/vm/lib/transformations/call_site_annotator.dart. TEST=runtime/tests/vm/dart/untyped_function_invocation_with_known_function_type_test.dart TEST=pkg/vm/testcases/transformations/type_flow/transformer/null_test_elimination2_nnbd_strong.dart Change-Id: I6bf201a979d1b71eb48ed04f154adf2b62dac922 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226741 Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>