Skip to content

Conversation

@sgrekhov
Copy link
Contributor

No description provided.

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I left a comment, but it just confirms the choices made in the test.

/// rather than `=> e`.
///
/// @description Checks that it is not an error to declare a synchronous
/// function with a short syntax and the return type `FutureOr<void>`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. The type FutureOr<void> (which is a bad type anyway, but we still need to test it) does not get special treatment. In particular, FutureOr<void> isn't "a kind of void". (Similarly, List<void> doesn't get special treatment, so there is no error if we do things like List<Object?> xs = <void>['secret!'];.)

FutureOr<void> is a top type, though, so we can return anything we want when the return type of a non-asynchronous function is FutureOr<void> (except that expressions of type voidcan't be used unless the situation is on the allowlist, and the allowlist doesn't say anything aboutFutureOr`).

It looks like the analyzer emits warnings, but that's not part of the language definition, so we shouldn't interfere with that.

@eernstg eernstg merged commit 238d3d4 into dart-lang:master Nov 25, 2024
2 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Dec 1, 2024
2024-11-28 [email protected] dart-lang/co19#2976. Update assertion texts according to the new spec (dart-lang/co19#3000)
2024-11-28 [email protected] dart-lang/co19#2119. Add issue number to other_declarations_A04_t07.dart (dart-lang/co19#3001)
2024-11-28 [email protected] dart-lang/co19#2976. Add semantics tests (dart-lang/co19#2998)
2024-11-27 [email protected] Fixes dart-lang/co19#2996. Update CFE expected errors locations (dart-lang/co19#2999)
2024-11-25 [email protected] dart-lang/co19#2559. Add extension types and enums to augmenting constructors test. Part 2. (dart-lang/co19#2972)
2024-11-25 [email protected] dart-lang/co19#2956. Add more type `void` tests (dart-lang/co19#2997)

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try
Change-Id: I858dbf6908fe32f38a401ce4ebfe120e064de4aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398160
Reviewed-by: Alexander Thomas <[email protected]>
Commit-Queue: Alexander Thomas <[email protected]>
Reviewed-by: Erik Ernst <[email protected]>
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