-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust the rule about await e where the type of e is an extension type #3560
Conversation
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 |
accepted/future-releases/extension-types/feature-specification.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still prefer the phrasing without "T
is S
bounded".
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>
…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>
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 e
is encountered, and the static type ofe
is 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?
whereE
is an extension type that does not implementFuture
.