Skip to content

Fix Diagnostics subclasses that had the wrong default value for the named parameter. - #50645

Merged
goderbauer merged 2 commits into
flutter:masterfrom
jacob314:fix_default_value
Feb 12, 2020
Merged

goderbauer merged 2 commits into
flutter:masterfrom
jacob314:fix_default_value

Conversation

@jacob314

@jacob314 jacob314 commented Feb 12, 2020 •

Copy link
Copy Markdown
Contributor

…

Description

the toString method for the base class used the correct default value of DiagnosticLevel.info but a couple subclasses accidentally used the wrong default.

Related Issues

#50644

Tests

I added the following tests:

Added a regression test for this issue in diagnostics_test.dart

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.
    • I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
    • I got input from the developer relations team, specifically from: Replace with the names of who gave advice
    • I wrote a migration guide: Replace with a link to your migration guide

@fluttergithubbot fluttergithubbot added the framework flutter/packages/flutter repository. See also f: labels. label Feb 12, 2020
@jacob314

Copy link
Copy Markdown
Contributor Author

@pq it would be great if there was a lint that warned if a subclass used a different default value for a named parameter than the base class. I can't think of many cases where using a different default value in a subclass is intentional. Having a different default value makes the default value shown in the base API very misleading.

@gspencergoog gspencergoog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@jacob314

Copy link
Copy Markdown
Contributor Author

Fixed a few missing lint warnings about subclasses with mismatched defaults. I was a bit confused in the original CL description. DiagnosticsNode had the right default value for the toString but DiagnosticableMixin did not which was why the existing lint for named parameters didn't catch this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants