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

Remove all dynamic calls and properly enforce lint rule #2582

Merged
merged 7 commits into from
Mar 18, 2021

Conversation

srawlins
Copy link
Member

No description provided.

@google-cla google-cla bot added the cla: yes Google CLA check succeeded. label Mar 17, 2021
@coveralls
Copy link

coveralls commented Mar 17, 2021

Coverage Status

Coverage decreased (-0.05%) to 91.624% when pulling 641f36b on srawlins:dcalls2 into d0a87c7 on dart-lang:master.

Copy link
Contributor

@jcollins-g jcollins-g left a comment

Choose a reason for hiding this comment

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

Nicely done. Just one little optional nit.

lib/src/dartdoc_options.dart Outdated Show resolved Hide resolved
for (var item in yamlData) {
returnData.add(item.toString());
}
returnData = [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine, though it seems odd to me to omit <String>?

Copy link
Member Author

Choose a reason for hiding this comment

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

String is inferred from the elements as the type of the list. This is listed in Effective Dart:

https://dart.dev/guides/language/effective-dart/design#dont-write-type-arguments-on-generic-invocations-that-are-inferred

@@ -1097,7 +1097,7 @@ abstract class ModelElement extends Canonicalization
}
if (params == null && element is FunctionTypedElement) {
if (_originalMember != null) {
params = (_originalMember as dynamic).parameters;
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a good one to get rid of. That might cover up some nasty bugs otherwise. Don't remember why that is there...

Copy link
Member Author

Choose a reason for hiding this comment

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

Haha it was a little weird.

String name = decodedJson['name'];
var versions = List<Version>.from(
decodedJson['versions'].map((v) => Version.parse(v)));
var versions = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming inference works properly for the list type here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, Version.parse returns a Version, and this is the only element (repeated) in the list, so inference will find Version.

tool/doc_packages.dart Show resolved Hide resolved
tool/doc_packages.dart Show resolved Hide resolved
@srawlins srawlins merged commit 52e50c9 into dart-lang:master Mar 18, 2021
@srawlins srawlins deleted the dcalls2 branch March 18, 2021 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants