0218c66698
During expression compilation, if the compiled expression is using a type that was not used in the current function, the incremental compiler and DDC produce code that refers to undefined types. To fix that, discharge types created during expression compilation and add their definitions at the beginning of the generated function. Added tests to validate the behavior. Fixes: https://github.com/dart-lang/sdk/issues/41443 Change-Id: If3fdce85a50ab2590d107f3b9e8c19b4768fd482 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148468 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Anna Gringauze <annagrin@google.com>