[pigeon] Minor fixes to NNBD type handling in Dart#1543
[pigeon] Minor fixes to NNBD type handling in Dart#1543fluttergithubbot merged 6 commits intoflutter:mainfrom
Conversation
|
(This deliberately skips from 3.0.0 to 3.0.2 to make it easier to resolve with #1532, which I will land first.) |
gaaclarke
left a comment
There was a problem hiding this comment.
LGTM, one one suggestion is adding a platform unit test.
| @HostApi() | ||
| abstract class NonNullCollectionHostApi { | ||
| List<String?>? doit(); | ||
| } |
There was a problem hiding this comment.
Adding this here is making sure that the generated code compiles and the dart unit tests below make sure it is generating code as you expect it. But we aren't executing the generated code in the platform tests. Did you want to take a stab at that? That could be added here: https://github.com/flutter/packages/blob/master/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart
There was a problem hiding this comment.
Added tests. I noticed that there were also no platform tests of the existing non-collection null return handling, so I added that too.
This spawned a few other changes:
- Renamed the null-return-type API classes in the Pigeon file, because they made no sense. Originally I had just copied the non-collection versions and hadn't paid close attention to the names, but when using them in the tests they were actively misleading, and it seemed pretty clear once I looked at them again that they were copypasta'd from another
pigeons/file that was testing something completely different. - Updated
build_runnersince I couldn't run the current version (to generate new mocks).
I'm now including the updated generated files, since otherwise the mocks and mock annotations that are now in this PR would refer to things that weren't in the versions of the files checked into the tree, which would be really weird.
gaaclarke
left a comment
There was a problem hiding this comment.
Thanks for adding the tests, lgtm.
Fixes invalid Dart output for the following cases:
Fixes flutter/flutter#101515
Fixes flutter/flutter#100594
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).