66f1dee48c
'await e' should check that e is a Future<flatten(S)>, where S is a static type of e before awaiting e. If e is not a Future<flatten(S)>, then 'await e' should await Future.value(e) instead of e. So futures of incompatible type are not awaited and soundness is not violated. TEST=tests/language/async/await_type_check_test.dart (Based on https://dart-review.git.corp.google.com/c/sdk/+/267422.) Fixes https://github.com/dart-lang/sdk/issues/50529 Part of https://github.com/dart-lang/sdk/issues/49396 Change-Id: Ia418db1be6736710abc9be87d95584c50cbc677e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273002 Reviewed-by: Erik Ernst <eernst@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>