Skip to content

#3847. Add function literal inference tests for return type. Part 3.#3940

Merged
eernstg merged 3 commits into
dart-lang:masterfrom
sgrekhov:co19-3847-13
Jul 16, 2026
Merged

#3847. Add function literal inference tests for return type. Part 3.#3940
eernstg merged 3 commits into
dart-lang:masterfrom
sgrekhov:co19-3847-13

Conversation

@sgrekhov

@sgrekhov sgrekhov commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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

@sgrekhov sgrekhov requested a review from eernstg July 3, 2026 08:44
@sgrekhov

Copy link
Copy Markdown
Contributor Author

@eernstg please review

@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.

Looks good!

One thing may slip through, though: I think a compiler/analyzer could conclude that the return type of a number of function literals can be Object? or some other top type which is not void, and the existing tests will not detect the issue. So we will probably need to have some void specific tests confirming that it is an error to use those returned values..

Comment thread TypeSystem/inference/function_literal_inference_A06_t01.dart
Comment thread TypeSystem/inference/function_literal_inference_A06_t02.dart
Comment thread TypeSystem/inference/function_literal_inference_A06_t03.dart
@sgrekhov

Copy link
Copy Markdown
Contributor Author

Updates as suggested. PTAL.

@sgrekhov sgrekhov requested a review from eernstg July 16, 2026 08:17

@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.

LGTM.

Nice, thank you!

@eernstg eernstg merged commit beb8e4a into dart-lang:master Jul 16, 2026
8 checks passed
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