-
Notifications
You must be signed in to change notification settings - Fork 412
Add "implicit-dynamic: false" strong mode analyzer option support for generated files #73
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
Add "implicit-dynamic: false" strong mode analyzer option support for generated files #73
Conversation
@caleo-git please rebase and squash. Also, you should update analysis options
Or we're not going to be able to track this |
… into add-super-strong-mode-support # Conflicts: # json_serializable/lib/src/type_helpers/iterable_helper.dart # json_serializable/pubspec.yaml # json_serializable/test/test_files/json_test_example.non_nullable.wrapped.g.dart # json_serializable/test/test_files/json_test_example.wrapped.g.dart # json_serializable/test/test_files/kitchen_sink.non_nullable.wrapped.dart # json_serializable/test/test_files/kitchen_sink.non_nullable.wrapped.g.dart # json_serializable/test/test_files/kitchen_sink.wrapped.dart # json_serializable/test/test_files/kitchen_sink.wrapped.g.dart
… into add-super-strong-mode-support # Conflicts: # json_serializable/lib/src/type_helpers/iterable_helper.dart # json_serializable/pubspec.yaml # json_serializable/test/test_files/json_test_example.non_nullable.wrapped.g.dart # json_serializable/test/test_files/json_test_example.wrapped.g.dart # json_serializable/test/test_files/kitchen_sink.non_nullable.wrapped.dart # json_serializable/test/test_files/kitchen_sink.non_nullable.wrapped.g.dart # json_serializable/test/test_files/kitchen_sink.wrapped.dart # json_serializable/test/test_files/kitchen_sink.wrapped.g.dart
…nto add-super-strong-mode-support # Conflicts: # json_serializable/test/test_files/json_test_example.non_nullable.wrapped.g.dart # json_serializable/test/test_files/json_test_example.wrapped.g.dart # json_serializable/test/test_files/kitchen_sink.non_nullable.wrapped.g.dart # json_serializable/test/test_files/kitchen_sink.wrapped.dart # json_serializable/test/test_files/kitchen_sink.wrapped.g.dart
@kevmoo I've enabled "implicit-dynamic: false" option, so now changes are ready for review |
@kevmoo When you will be able to check this pull request? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nshahan – thoughts on this CL? Trying to decide if I like the extra noise...
@@ -94,7 +94,7 @@ class JsonSerializableGenerator | |||
// Explicitly using `LinkedHashMap` – we want these ordered. | |||
var fields = new LinkedHashMap<String, FieldElement>.fromIterable( | |||
fieldsList, | |||
key: (f) => (f as FieldElement).name); | |||
key: (FieldElement f) => f.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be key: (Object f) => (f as FieldElement).name);
or you get https://travis-ci.org/dart-lang/json_serializable/jobs/308340768#L588
uses_dynamic_as_bottom
@jakemac53 – thoughts on this? |
@kevmoo I don't have much context here. In what settings are you getting the extra noise? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how I feel about this in general - I don't feel it is harmful and it does solve a real need.
At the same time I feel like this is highlighting a more general issue of how analyzer settings are applied to generated files. It is only a matter of time before we start getting similar cls to solve other random lints and other things which are not actual errors - and that isn't a scalable approach for code generators as a whole.
Possibly we need something from the analyzer so we can annotate these files as generated and disable all non-default checks that the user has opted into explicitly for their package.
(e as Map<String, dynamic>).keys, | ||
(e as Map).values.map((e) => | ||
e == null ? null : new Map<String, List<List<DateTime>>>.fromIterables((e as Map<String, dynamic>).keys, (e as Map).values.map((e) => (e as List)?.map((e) => (e as List)?.map((e) => e == null ? null : DateTime.parse(e as String))?.toList())?.toList()))))) | ||
: new Map<String, Map<String, List<List<DateTime>>>>.fromIterables((e as Map<String, dynamic>).keys, (e as Map).values.map((dynamic e) => e == null ? null : new Map<String, List<List<DateTime>>>.fromIterables((e as Map<String, dynamic>).keys, (e as Map).values.map((dynamic e) => (e as List)?.map((dynamic e) => (e as List)?.map((dynamic e) => e == null ? null : DateTime.parse(e as String))?.toList())?.toList()))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow lol... presumably dartfmt is just giving up here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup!
@caleo-git – this adds a LOT of noise to the code. How important is |
@kevmoo We are preparing migration to Dart 2.0 for our project. So we would like to have strong mode support for generated files. |
@caleo-git |
What @matanlurey said. Closing for now. Happy to set up time to talk about this on VC... |
No description provided.