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

CPLAT-6464 Improve error message for props/state variables with initializers #318

Merged
merged 2 commits into from
Jul 15, 2019

Conversation

greglittlefield-wf
Copy link
Contributor

@greglittlefield-wf greglittlefield-wf commented Jul 10, 2019

Motivation

How would one initialize a list field of a class?

I have

@State()
class _$FooState extends UiState {
  List<ReactElement> inputs = [];
}

But get an error Fields are stubs for generated setters/getters and should not have initializers.. > If I remove the = [], i get errors claiming the list is null everywhere, so I’m not sure where to initialize it.

This error message could be better, and indicate how to initialize these values.

Changes

In error message, add note on where to initialize values

Release Notes

Improve error message for props/state variables with initializers

Review

See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.

Please review:

QA Checklist

  • Tests were updated and provide good coverage of the changeset and other affected code
  • Manual testing was performed if needed

Merge Checklist

While we perform many automated checks before auto-merging, some manual checks are needed:

  • A Client Platform member has reviewed these changes
  • There are no unaddressed comments - this check can be automated if reviewers use the "Request Changes" feature
  • For release PRs - Version metadata in Rosie comment is correct

@aviary3-wk
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@@ -400,8 +403,8 @@ class ImplGenerator {
keyConstants[keyConstantName] = keyValue;
constants[constantName] = constantValue;

final type = field.fields.type?.toSource();
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 was renamed so I could use the type argument above without it being shadowed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

you answered my feedback before i could leave it... damn you

@rmconsole2-wf rmconsole2-wf changed the title Improve error message for props/state variables with initializers CPLAT-6464 Improve error message for props/state variables with initializers Jul 12, 2019
@kealjones-wk
Copy link
Contributor

QA +1

@greglittlefield-wf
Copy link
Contributor Author

@Workiva/release-management-pp

@rmconsole5-wk rmconsole5-wk merged commit 0167d92 into master Jul 15, 2019
@rmconsole5-wk rmconsole5-wk deleted the greglittlefield-wf-patch-2 branch July 15, 2019 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants