Skip to content

Migrate warnings.dart #2787

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 4 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/src/dartdoc_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ abstract class DartdocOption<T> {

/// To avoid accessing early, call [add] on the option's parent before
/// looking up unless this is a [DartdocRootOption].
late final DartdocOption parent;
late final DartdocOption<dynamic> parent;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary? I'm trying to avoid having explicit dynamics dropped in to solve nullability problems...

Copy link
Member Author

Choose a reason for hiding this comment

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

It was not necessary; it is a no-op. I was just trying to avoid implicit dynamic. Should I revert?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh. I actually don't know what is better here, I suppose I'm against putting dynamic in just in case some magic in the type system allows for something more specific later. That isn't really on solid ground though?

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, type args in a declaration are never filled in by inference. The strict-raw-types analysis mode would catch each such case, so that the human doesn't have to guess at where inference happens and where it doesn't.

I can revert for now and add that analysis mode in a different CL?

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds fine


/// The [DartdocOptionRoot] containing this object.
DartdocOptionRoot get root {
Expand Down Expand Up @@ -516,10 +516,13 @@ abstract class DartdocOption<T> {
void addAll(Iterable<DartdocOption> options) => options.forEach(add);

/// Get the immediate child of this node named [name].
DartdocOption<dynamic> operator [](String name) {
DartdocOption operator [](String name) {
return _children[name]!;
}

/// Get the immediate child of this node named [name] as a [DartdocOption<U>].
DartdocOption<U> getAs<U>(String name) => _children[name] as DartdocOption<U>;

/// Apply the function [visit] to [this] and all children.
void traverse(void Function(DartdocOption option) visit) {
visit(this);
Expand Down
10 changes: 6 additions & 4 deletions lib/src/model/accessor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ class Accessor extends ModelElement implements EnclosedElement {
}

@override
void warn(PackageWarning kind,
{String message,
Iterable<Locatable> referredFrom,
Iterable<String> extendedDebug}) {
void warn(
PackageWarning kind, {
String message,
Iterable<Locatable> referredFrom = const [],
Iterable<String> extendedDebug = const [],
}) {
enclosingCombo.warn(kind,
message: message,
referredFrom: referredFrom,
Expand Down
Loading