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

Generate valid functions with optional non-nullable arguments #717

Closed
wants to merge 0 commits into from

Conversation

copybara-service[bot]
Copy link

Generate valid functions with optional non-nullable arguments

If a method of a mocked class returns a function with optional
yet non-nullable argument, Mockito currently produces something
like

(int x, {int y}) => /* doesn't matter */

which is not a valid Dart, since y must either be required or
have a default value. required won't fit into the desired type
and coming up with a default value is not easy, since it has to
be a constant, but dummyValue doesn't always produce one.

Fortunately, we can just widen the type here and make it nullable.

@copybara-service copybara-service bot closed this Nov 15, 2023
@copybara-service copybara-service bot deleted the test_582653014 branch November 15, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants