Skip to content

Commit 72e9ee8

Browse files
bwilkersonCommit Queue
authored andcommitted
Add documentation for a few more lints
Change-Id: Ia6db16cee152856b277b01812b8019eb2afca5a2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373727 Reviewed-by: Marya Belanger <[email protected]> Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 15356d5 commit 72e9ee8

File tree

7 files changed

+1326
-3
lines changed

7 files changed

+1326
-3
lines changed

pkg/analyzer/lib/src/test_utilities/mock_sdk.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,15 @@ abstract final class double extends num {
380380
}
381381
382382
class Duration implements Comparable<Duration> {
383+
static const Duration zero = Duration(seconds: 0);
384+
383385
const Duration({int days = 0,
384386
int hours = 0,
385387
int minutes = 0,
386388
int seconds = 0,
387389
int milliseconds = 0,
388390
int microseconds = 0});
391+
389392
int compareTo(Duration other) => 0;
390393
}
391394
@@ -685,6 +688,12 @@ abstract final class String implements Comparable<String>, Pattern {
685688
String toUpperCase();
686689
}
687690
691+
class StringBuffer implements StringSink {
692+
external void write(Object? object);
693+
}
694+
695+
abstract interface class StringSink {}
696+
688697
class Symbol {
689698
const factory Symbol(String name) = internal.Symbol;
690699
}

pkg/analyzer/test/src/dart/element/name_union_test.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ class _ElementVisitor extends GeneralizingElementVisitor<void> {
5555
element is PropertyAccessorElement) {
5656
var name = element.name;
5757
if (name != null) {
58-
expect(union.contains(name), isTrue, reason: name);
59-
// Might fail, but probably we don't have such names.
60-
expect(union.contains('Z$name'), isFalse, reason: name);
58+
expect(union.contains(name), isTrue, reason: 'Expected to find $name');
59+
// This might fail, but the probability is low. If this does fail, try
60+
// adding another `z` to the prefix.
61+
expect(
62+
union.contains('zz$name'),
63+
isFalse,
64+
reason: 'Expected to not find $name',
65+
);
6166
}
6267
}
6368

pkg/analyzer/test/verify_diagnostics_test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ class DocumentationValidator {
124124
'LintCode.secure_pubspec_urls',
125125
// The test framework doesn't yet support lints in non-dart files.
126126
'LintCode.sort_pub_dependencies',
127+
// Doesn't produce a lint for the first example, even though the analyzer
128+
// does when the example is pasted into a file.
129+
'LintCode.unnecessary_lambdas',
130+
// Produces an unused_field warning.
131+
'LintCode.use_setters_to_change_properties',
127132
// Extra warning.
128133
'LintCode.recursive_getters',
129134

0 commit comments

Comments
 (0)