这是indexloc提供的服务,不要输入任何密码
Skip to content

Error message improvements #58204

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

Merged
merged 1 commit into from
Jun 3, 2020
Merged

Conversation

Hixie
Copy link
Contributor

@Hixie Hixie commented May 28, 2020

  • Slightly improve error message for AlignmentDirectional.resolve without textDirection.
  • Improve an error message for buildScope.

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label May 28, 2020
await tester.pumpWidget(Container(child: _WidgetWithNoVisitChildren(_StatefulLeaf(key: key))));
(key.currentState as _StatefulLeafState).markNeedsBuild();
await tester.pumpWidget(Container());
final dynamic exception = tester.takeException();
Copy link
Contributor

Choose a reason for hiding this comment

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

I am surprised this is not allowed. What if there is an inherited widget that both container and _StatefulLeaf depend on. When the inherited widget mark both them dirty, the container rebuilt without the _StatefulLeaf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you think should be allowed? Can you elaborate?

My intent was for this to test the error message that is reported as a result of a bad visitChildren.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh Nvm, I was confused at the setup, I think this is fine. We should update the test title to be a bit more clear though.

@@ -621,7 +621,7 @@ class _MixedAlignment extends AlignmentGeometry {

@override
Alignment resolve(TextDirection direction) {
assert(direction != null);
assert(direction != null, 'Cannot resolve $runtimeType without a TextDirection.');
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The precise message? I can add a test if you like, sure. I hadn't added one for this because I wasn't particularly concerned about whether the message was changed.

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 without a test is fine

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

await tester.pumpWidget(Container(child: _WidgetWithNoVisitChildren(_StatefulLeaf(key: key))));
(key.currentState as _StatefulLeafState).markNeedsBuild();
await tester.pumpWidget(Container());
final dynamic exception = tester.takeException();
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh Nvm, I was confused at the setup, I think this is fine. We should update the test title to be a bit more clear though.

@@ -621,7 +621,7 @@ class _MixedAlignment extends AlignmentGeometry {

@override
Alignment resolve(TextDirection direction) {
assert(direction != null);
assert(direction != null, 'Cannot resolve $runtimeType without a TextDirection.');
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 without a test is fine

@Hixie
Copy link
Contributor Author

Hixie commented Jun 2, 2020

I'll update the test title and land on green. Thanks for the review!

* Slightly improve error message for AlignmentDirectional.resolve without textDirection.

* Improve an error message for buildScope.
@Hixie Hixie force-pushed the error_messages branch from 3260aa5 to 1a00bd8 Compare June 2, 2020 20:45
@Hixie
Copy link
Contributor Author

Hixie commented Jun 2, 2020

I also added some more comments.

@fluttergithubbot fluttergithubbot merged commit 6788117 into flutter:master Jun 3, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants