Skip to content
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 incompatible-with-await to be more strict on intersections #3598

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented Jan 31, 2024

The PR #3560 introduced the notion of a type which is 'incompatible with await' and used that to introduce an error on await e when the static type of e is such a type.

This PR adjusts the definition of 'incompatible with await' such that X & S is incompatible with await when S is incompatible with await. This is a bit more strict than the previous version. It is motivated by the fact that a promotion of a variable of type X to a type X & S where S isn't compatible with await is a strong signal that it should not be awaited.

Of course, await (e as T) for some suitable value of T can always be used to force the await.

The change is not breaking because 'incompatible with await' has not yet been implemented in any release.

@eernstg eernstg requested a review from lrhn January 31, 2024 12:52
@eernstg eernstg merged commit aad1953 into main Jan 31, 2024
2 of 3 checks passed
@eernstg eernstg deleted the spec_exttype_await_incompat_jan24 branch January 31, 2024 14:29
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Feb 2, 2024
This CL implements the udpate to the notion of a type being
"incompatible with await" as found here:
dart-lang/language#3598

Change-Id: I7792564c1854468709d0da3238c02e912df52369
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349882
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants