Skip to content

Remove missingConstantConstructor warning. #3674

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
Feb 23, 2024
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
6 changes: 1 addition & 5 deletions lib/src/model/getter_setter_combo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import 'package:dartdoc/src/model/attribute.dart';
import 'package:dartdoc/src/model/comment_referable.dart';
import 'package:dartdoc/src/model/model.dart';
import 'package:dartdoc/src/utils.dart';
import 'package:dartdoc/src/warnings.dart';
import 'package:meta/meta.dart';

/// Mixin for top-level variables and fields (aka properties).
Expand Down Expand Up @@ -68,10 +67,7 @@ mixin GetterSetterCombo on ModelElement {
var creationExpression = constantInitializer as InstanceCreationExpression;
var constructorName = creationExpression.constructorName.toString();
Element? staticElement = creationExpression.constructorName.staticElement;
if (staticElement == null) {
warn(PackageWarning.missingConstantConstructor, message: constructorName);
return original;
}
if (staticElement == null) return original;
var target = getModelForElement(staticElement) as Constructor;
var enclosingElement = target.enclosingElement;
if (enclosingElement is! Class) return original;
Expand Down
1 change: 0 additions & 1 deletion lib/src/model/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ class PackageGraph with CommentReferable, Nameable {
PackageWarning.toolError ||
PackageWarning.deprecated ||
PackageWarning.unresolvedExport ||
PackageWarning.missingConstantConstructor ||
PackageWarning.missingExampleFile ||
PackageWarning.missingCodeBlockLanguage =>
kind.messageFor([message])
Expand Down
15 changes: 0 additions & 15 deletions lib/src/warnings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,6 @@ enum PackageWarning implements Comparable<PackageWarning> {
shortHelp: 'An export refers to a URI that cannot be resolved.',
defaultWarningMode: PackageWarningMode.error,
),
missingConstantConstructor(
'missing-constant-constructor',
'constant constructor missing: {0}',
shortHelp:
'Dartdoc can not show the value of a constant because its constructor '
'could not be resolved.',
longHelp:
'To resolve a constant into its literal value, Dartdoc relies on the '
"analyzer to resolve the constructor. The analyzer didn't provide the "
"constructor for '$_namePlaceholder', which is usually due to an error "
'in the code. Use the analyzer to resolve the issue.',
// Defaults to ignore as this doesn't impact the docs severely but is
// useful for debugging package structure.
defaultWarningMode: PackageWarningMode.ignore,
),
missingExampleFile(
'missing-example-file',
'example file not found: {0}',
Expand Down