Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Enforce and fix prefer_typing_uninitialized_variables #100

Merged
merged 1 commit into from
Jan 3, 2020

Conversation

natebosch
Copy link
Contributor

No description provided.

@natebosch natebosch requested a review from jakemac53 January 2, 2020 21:48
@googlebot googlebot added the cla: yes Google CLA signed label Jan 2, 2020
@@ -666,7 +666,7 @@ class _Parser {
// '}'
_next();

var name;
dynamic name;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is kind of a fun one - I wanted to avoid changing any behavior so I only gave real types where I could. This surfaced the fact that _peekIdentifier() must always return false for this code path. If it doesn't then name would be an Identifier, since identifier always returns a non-null Identifier. However the StyletDirective constructor expects name to be a String, so the only value that works is null. There is almost certainly a logic bug here that was masked by overly dynamic code, but I don't know exactly what it is to fix it... The null safe Dart migration won't be fun for this package...

Copy link
Contributor

Choose a reason for hiding this comment

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

🤷‍♂️

This isn't making things worse in any case.

@@ -666,7 +666,7 @@ class _Parser {
// '}'
_next();

var name;
dynamic name;
Copy link
Contributor

Choose a reason for hiding this comment

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

🤷‍♂️

This isn't making things worse in any case.

@natebosch natebosch merged commit bf372d4 into master Jan 3, 2020
@natebosch natebosch deleted the uninitialized-variable-types branch January 3, 2020 01:03
mosuem pushed a commit to dart-lang/tools that referenced this pull request Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Google CLA signed
Development

Successfully merging this pull request may close these issues.

3 participants