[CP] Implement error about awaiting a type that is incompatible with await #55095
Labels
cherry-pick-approved
Label for approved cherrypick request
cherry-pick-review
Issue that need cherry pick triage to approve
merge-to-stable
Commit(s) to merge
bf17088, 1672177, a5bbbe8, adee0a2, 690d49c
Target
Stable
Prepared changelist for beta/stable
https://dart-review.googlesource.com/c/sdk/+/355542
Issue Description
The new extension types feature contains a rule preventing an extension type from being used as the operand of an
await
, unless the extension type implementsFuture
. However, the logic that was released in Dart 3.3.0 has a loophole in that it allows some types based on an extension type to be used as the operand of anawait
, such as:The loophole was fixed in the specification on Jan 17 (dart-lang/language#3560) and Jan 31 (dart-lang/language#3598). However, the implementation of this fix didn't land until after the release cutoff for Dart 3.3. This cherry-pick closes the loophole for the stable release.
What is the fix
Why cherry-pick
Since the extension types feature is so new, it's highly unlikely that it's seen enough widespread usage for anyone to have run into the loophole described above. It's far better to cherry-pick a fix to the loophole now, than to defer the fix until Dart 3.4.0 (at which point, use of the feature will probably be much more widespread).
Risk
low
Issue link(s)
#54647
Extra Info
No response
The text was updated successfully, but these errors were encountered: