Adjust the rule about await e where the type of e is an extension type#3560
Merged
Conversation
Member
Author
|
NB: The rule about being incompatible with await is intended to be evolvable over time, covering the case where we want to make more types incompatible with await (that is, if we wish to make all or part of |
lrhn
reviewed
Jan 16, 2024
lrhn
approved these changes
Jan 16, 2024
lrhn
left a comment
Member
There was a problem hiding this comment.
Still prefer the phrasing without "T is S bounded".
This was referenced Jan 17, 2024
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Feb 20, 2024
PR dart-lang/language#3560 and dart-lang/language#3598 updated the feature specification of extension types to define a notion of types being 'incompatible with await'. This CL adds a test to verify that various types are being classified correctly, and errors are hence reported as expected for expressions of the form `await e`. Change-Id: I39e992b4317ef49fbc2267819481d71d87b56aca Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351143 Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Mar 5, 2024
…ith await This is a cherry-pick of the following 5 commits from the main branch: - Add test about types being incompatible with await (https://dart-review.googlesource.com/c/sdk/+/351143) - [cfe] Report errors on awaiting types incompatible with await (https://dart-review.googlesource.com/c/sdk/+/348640) - [cfe] Implement the update of "incompatible with await" (https://dart-review.googlesource.com/c/sdk/+/350986) - Extension type. Implement isIncompatibleWithAwait() predicate, report AWAIT_OF_INCOMPATIBLE_TYPE. (https://dart-review.googlesource.com/c/sdk/+/350986) - Extension type. Issue 54648. Fix 'incompatible with await' predicate. (https://dart-review.googlesource.com/c/sdk/+/355500) Collectively, these 5 commits implement the new "incompatible with await" error that was specified in dart-lang/language#3560 and then refined in dart-lang/language#3598. Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/348640 Cherry-pick-request: #55095 Change-Id: I84a79ffccce89c4d91c99a09ab7f5107a96e9844 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355542 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the discussion in #2710.
This PR introduces the notion of a type which is incompatible with await and uses that to specify the compile-time error which occurs in the case where
await eis encountered, and the static type ofeis incompatible with await. The main case is when said static type is an extension type that does not implementFuture(that's the case that we had already), but this new rule includes more cases, e.g., the case where the static type isE?whereEis an extension type that does not implementFuture.