Skip to content

#3847. Add function literal inference tests for return type. Part 2.#3939

Open
sgrekhov wants to merge 1 commit into
dart-lang:masterfrom
sgrekhov:co19-3847-12
Open

#3847. Add function literal inference tests for return type. Part 2.#3939
sgrekhov wants to merge 1 commit into
dart-lang:masterfrom
sgrekhov:co19-3847-12

Conversation

@sgrekhov

@sgrekhov sgrekhov commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

For review it's enough to review top-level functions only. The other code repeats these functions as static and instance members in classes, mixins, mixin classes, enums, extensions and extension types.

@sgrekhov
sgrekhov requested a review from eernstg July 2, 2026 09:10

@eernstg eernstg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Almost every test in this PR depends on dart-lang/language#4718 (about the spurious ? which is added to the element type in all return types of generators when the end of the body can be reached).

Perhaps we should just block this until that issue has been clarified.

/// super-interface of `S;` and update `T` to be `UP(E, T)`.
///
/// @description Check that the return type of a `sync*` function with a single
/// `yield e;` is `Iterable<X>;`, where `X` is the static type of `e`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd actually expect the current specification and implementation to make the return type Iterable<X?> because of the spurious Null mentioned in dart-lang/language#4718.

Perhaps this particular test should be postponed until this has been resolved? Otherwise, we should expect the ? to be included in all cases because all function bodies can be completed normally.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The same consideration holds for the following tests about generators where the body can complete normally (I think that's all of them, they don't have any return statements or other constructs that prevent the body from completing normally).

Comment thread TypeSystem/inference/function_literal_inference_A05_t02.dart
@sgrekhov sgrekhov added the needs-info Additional information needed from the issue author label Jul 2, 2026
@sgrekhov

sgrekhov commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Blocked by dart-lang/language#4718.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-info Additional information needed from the issue author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants