6cea1790bd
This change closes a loophole whereby it was possible for "type of interest" promotion to promote to a type that was not a subtype of the declared type. I've gone ahead and included more extensive tests (both in unit test and language test form) of demotion and type of interest promotion, to try to make sure there aren't other loopholes. Fixes https://github.com/dart-lang/sdk/issues/60620. Bug: https://github.com/dart-lang/sdk/issues/60620 Change-Id: Ifef04cde6fda2aee80ec002c7ca04f2be6cff987 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427920 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>