Skip to content

Commit 873a88b

Browse files
parloughCommit Queue
authored andcommitted
[analyzer/linter] Mark a few diagnostic docs as published
Also regenerate the diagnostic codes and (deprecated) lint rules.json file. Change-Id: Id50dfe81a7bc3a62fee9d6b99f0e045804e95685 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436960 Commit-Queue: Keerti Parthasarathy <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Keerti Parthasarathy <[email protected]>
1 parent 5d2d5cb commit 873a88b

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

pkg/analyzer/lib/src/error/codes.g.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ class CompileTimeErrorCode extends DiagnosticCode {
13961396
CompileTimeErrorCode(
13971397
'DOT_SHORTHAND_MISSING_CONTEXT',
13981398
"A dot shorthand can't be used where there is no context type.",
1399+
hasPublishedDocs: true,
13991400
);
14001401

14011402
/// Parameters:
@@ -1408,6 +1409,7 @@ class CompileTimeErrorCode extends DiagnosticCode {
14081409
correctionMessage:
14091410
"Try correcting the name to the name of an existing static getter, or "
14101411
"defining a getter or field named '{0}'.",
1412+
hasPublishedDocs: true,
14111413
uniqueName: 'DOT_SHORTHAND_UNDEFINED_GETTER',
14121414
);
14131415

@@ -1422,6 +1424,7 @@ class CompileTimeErrorCode extends DiagnosticCode {
14221424
correctionMessage:
14231425
"Try correcting the name to the name of an existing static method or "
14241426
"constructor, or defining a static method or constructor named '{0}'.",
1427+
hasPublishedDocs: true,
14251428
uniqueName: 'DOT_SHORTHAND_UNDEFINED_INVOCATION',
14261429
);
14271430

@@ -6506,24 +6509,28 @@ class WarningCode extends DiagnosticCode {
65066509
'DOC_IMPORT_CANNOT_BE_DEFERRED',
65076510
"Doc imports can't be deferred.",
65086511
correctionMessage: "Try removing the 'deferred' keyword.",
6512+
hasPublishedDocs: true,
65096513
);
65106514

65116515
static const WarningCode DOC_IMPORT_CANNOT_HAVE_COMBINATORS = WarningCode(
65126516
'DOC_IMPORT_CANNOT_HAVE_COMBINATORS',
65136517
"Doc imports can't have show or hide combinators.",
65146518
correctionMessage: "Try removing the combinator.",
6519+
hasPublishedDocs: true,
65156520
);
65166521

65176522
static const WarningCode DOC_IMPORT_CANNOT_HAVE_CONFIGURATIONS = WarningCode(
65186523
'DOC_IMPORT_CANNOT_HAVE_CONFIGURATIONS',
65196524
"Doc imports can't have configurations.",
65206525
correctionMessage: "Try removing the configurations.",
6526+
hasPublishedDocs: true,
65216527
);
65226528

65236529
static const WarningCode DOC_IMPORT_CANNOT_HAVE_PREFIX = WarningCode(
65246530
'DOC_IMPORT_CANNOT_HAVE_PREFIX',
65256531
"Doc imports can't have prefixes.",
65266532
correctionMessage: "Try removing the prefix.",
6533+
hasPublishedDocs: true,
65276534
);
65286535

65296536
/// Duplicate exports.
@@ -6895,6 +6902,7 @@ class WarningCode extends DiagnosticCode {
68956902
"The annotation '@reopen' can only be applied to a class that opens "
68966903
"capabilities that the supertype intentionally disallows.",
68976904
correctionMessage: "Try removing the '@reopen' annotation.",
6905+
hasPublishedDocs: true,
68986906
);
68996907

69006908
/// This warning is generated anywhere where `@required` annotates a named
@@ -6961,6 +6969,7 @@ class WarningCode extends DiagnosticCode {
69616969
'INVALID_USE_OF_PROTECTED_MEMBER',
69626970
"The member '{0}' can only be used within instance members of subclasses "
69636971
"of '{1}'.",
6972+
hasPublishedDocs: true,
69646973
);
69656974

69666975
/// Parameters:
@@ -7197,6 +7206,7 @@ class WarningCode extends DiagnosticCode {
71977206
'NON_NULLABLE_EQUALS_PARAMETER',
71987207
"The parameter type of '==' operators should be non-nullable.",
71997208
correctionMessage: "Try using a non-nullable type.",
7209+
hasPublishedDocs: true,
72007210
);
72017211

72027212
/// No parameters.
@@ -7651,6 +7661,7 @@ class WarningCode extends DiagnosticCode {
76517661
'UNNECESSARY_WILDCARD_PATTERN',
76527662
"Unnecessary wildcard pattern.",
76537663
correctionMessage: "Try removing the wildcard pattern.",
7664+
hasPublishedDocs: true,
76547665
);
76557666

76567667
/// No parameters.

pkg/analyzer/messages.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,7 +3878,7 @@ CompileTimeErrorCode:
38783878
DOT_SHORTHAND_MISSING_CONTEXT:
38793879
experiment: dot-shorthands
38803880
problemMessage: "A dot shorthand can't be used where there is no context type."
3881-
hasPublishedDocs: false
3881+
hasPublishedDocs: true
38823882
documentation: |-
38833883
#### Description
38843884

@@ -3929,7 +3929,7 @@ CompileTimeErrorCode:
39293929
experiment: dot-shorthands
39303930
problemMessage: "The static getter '{0}' isn't defined for the context type '{1}'."
39313931
correctionMessage: "Try correcting the name to the name of an existing static getter, or defining a getter or field named '{0}'."
3932-
hasPublishedDocs: false
3932+
hasPublishedDocs: true
39333933
comment: |-
39343934
Parameters:
39353935
0: the name of the static getter
@@ -3984,7 +3984,7 @@ CompileTimeErrorCode:
39843984
experiment: dot-shorthands
39853985
problemMessage: "The static method or constructor '{0}' isn't defined for the context type '{1}'."
39863986
correctionMessage: "Try correcting the name to the name of an existing static method or constructor, or defining a static method or constructor named '{0}'."
3987-
hasPublishedDocs: false
3987+
hasPublishedDocs: true
39883988
comment: |-
39893989
Parameters:
39903990
0: the name of the static method or constructor
@@ -24143,7 +24143,7 @@ WarningCode:
2414324143
DOC_IMPORT_CANNOT_BE_DEFERRED:
2414424144
problemMessage: "Doc imports can't be deferred."
2414524145
correctionMessage: Try removing the 'deferred' keyword.
24146-
hasPublishedDocs: false
24146+
hasPublishedDocs: true
2414724147
documentation: |-
2414824148
#### Description
2414924149

@@ -24175,7 +24175,7 @@ WarningCode:
2417524175
DOC_IMPORT_CANNOT_HAVE_COMBINATORS:
2417624176
problemMessage: "Doc imports can't have show or hide combinators."
2417724177
correctionMessage: Try removing the combinator.
24178-
hasPublishedDocs: false
24178+
hasPublishedDocs: true
2417924179
documentation: |-
2418024180
#### Description
2418124181

@@ -24205,7 +24205,7 @@ WarningCode:
2420524205
DOC_IMPORT_CANNOT_HAVE_CONFIGURATIONS:
2420624206
problemMessage: "Doc imports can't have configurations."
2420724207
correctionMessage: Try removing the configurations.
24208-
hasPublishedDocs: false
24208+
hasPublishedDocs: true
2420924209
documentation: |-
2421024210
#### Description
2421124211

@@ -24235,7 +24235,7 @@ WarningCode:
2423524235
DOC_IMPORT_CANNOT_HAVE_PREFIX:
2423624236
problemMessage: "Doc imports can't have prefixes."
2423724237
correctionMessage: Try removing the prefix.
24238-
hasPublishedDocs: false
24238+
hasPublishedDocs: true
2423924239
documentation: |-
2424024240
#### Description
2424124241

@@ -25338,7 +25338,7 @@ WarningCode:
2533825338
Remove the reference to the internal declaration.
2533925339
INVALID_USE_OF_PROTECTED_MEMBER:
2534025340
problemMessage: "The member '{0}' can only be used within instance members of subclasses of '{1}'."
25341-
hasPublishedDocs: false
25341+
hasPublishedDocs: true
2534225342
comment: |-
2534325343
This warning is generated anywhere where a member annotated with
2534425344
`@protected` is used outside of an instance member of a subclass.
@@ -25356,7 +25356,7 @@ WarningCode:
2535625356

2535725357
#### Example
2535825358

25359-
Given a file `a.dart` that contains
25359+
Given a file `a.dart` that contains the following:
2536025360

2536125361
```dart
2536225362
%uri="lib/a.dart"
@@ -25719,7 +25719,7 @@ WarningCode:
2571925719
INVALID_REOPEN_ANNOTATION:
2572025720
problemMessage: "The annotation '@reopen' can only be applied to a class that opens capabilities that the supertype intentionally disallows."
2572125721
correctionMessage: Try removing the '@reopen' annotation.
25722-
hasPublishedDocs: false
25722+
hasPublishedDocs: true
2572325723
comment: |-
2572425724
This warning is generated anywhere where `@reopen` annotates a class which
2572525725
did not reopen any type.
@@ -26416,7 +26416,7 @@ WarningCode:
2641626416
NON_NULLABLE_EQUALS_PARAMETER:
2641726417
problemMessage: "The parameter type of '==' operators should be non-nullable."
2641826418
correctionMessage: Try using a non-nullable type.
26419-
hasPublishedDocs: false
26419+
hasPublishedDocs: true
2642026420
comment: No parameters.
2642126421
documentation: |-
2642226422
#### Description
@@ -28157,7 +28157,7 @@ WarningCode:
2815728157
UNNECESSARY_WILDCARD_PATTERN:
2815828158
problemMessage: Unnecessary wildcard pattern.
2815928159
correctionMessage: Try removing the wildcard pattern.
28160-
hasPublishedDocs: false
28160+
hasPublishedDocs: true
2816128161
comment: No parameters.
2816228162
documentation: |-
2816328163
#### Description

pkg/linter/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# 3.9.0-wip
1+
# 3.10.0-wip
2+
3+
# 3.9.0
24

35
- new lint: `switch_on_type`
46
- new lint: `unnecessary_unawaited`

pkg/linter/tool/machine/rules.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,8 @@
15741574
],
15751575
"state": "experimental",
15761576
"incompatible": [
1577-
"always_specify_types"
1577+
"always_specify_types",
1578+
"type_annotate_public_apis"
15781579
],
15791580
"sets": [],
15801581
"fixStatus": "hasFix",
@@ -2510,7 +2511,9 @@
25102511
"publicInterface"
25112512
],
25122513
"state": "stable",
2513-
"incompatible": [],
2514+
"incompatible": [
2515+
"omit_obvious_property_types"
2516+
],
25142517
"sets": [],
25152518
"fixStatus": "hasFix",
25162519
"details": "From [Effective Dart](https://dart.dev/effective-dart/design#do-type-annotate-fields-and-top-level-variables-if-the-type-isnt-obvious):\n\n**PREFER** type annotating public APIs.\n\nType annotations are important documentation for how a library should be used.\nAnnotating the parameter and return types of public methods and functions helps\nusers understand what the API expects and what it provides.\n\nNote that if a public API accepts a range of values that Dart's type system\ncannot express, then it is acceptable to leave that untyped. In that case, the\nimplicit `dynamic` is the correct type for the API.\n\nFor code internal to a library (either private, or things like nested functions)\nannotate where you feel it helps, but don't feel that you *must* provide them.\n\n**BAD:**\n```dart\ninstall(id, destination) {\n // ...\n}\n```\n\nHere, it's unclear what `id` is. A string? And what is `destination`? A string\nor a `File` object? Is this method synchronous or asynchronous?\n\n**GOOD:**\n```dart\nFuture<bool> install(PackageId id, String destination) {\n // ...\n}\n```\n\nWith types, all of this is clarified.",
@@ -2578,7 +2581,7 @@
25782581
"state": "experimental",
25792582
"incompatible": [],
25802583
"sets": [],
2581-
"fixStatus": "needsFix",
2584+
"fixStatus": "hasFix",
25822585
"details": "Functions that don't do `await` don't have to be `async`.\n\nUsually such functions also don't have to return a `Future`, which allows\nan invoker to avoid `await` in its code, etc. Synchronous code in\ngeneral runs faster, and is easier to reason about.\n\n**BAD:**\n```dart\nvoid f() async {\n // await Future.delayed(const Duration(seconds: 2));\n print(0);\n}\n```\n\n**GOOD:**\n```dart\nvoid f() {\n // await Future.delayed(const Duration(seconds: 2));\n print(0);\n}\n```",
25832586
"sinceDartSdk": "3.7"
25842587
},

0 commit comments

Comments
 (0)