Skip to content

Commit 2f9d45b

Browse files
bwilkersonCommit Bot
authored andcommitted
Add new diagnostic documentation
This also adds links for some annotation in `meta` that were in existing tests. Change-Id: I8260e0d4f40f88228c953ead19b77680c2f69ef4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234449 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
1 parent 2b9656a commit 2f9d45b

File tree

11 files changed

+4033
-522
lines changed

11 files changed

+4033
-522
lines changed

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

Lines changed: 554 additions & 132 deletions
Large diffs are not rendered by default.

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

Lines changed: 655 additions & 61 deletions
Large diffs are not rendered by default.

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

Lines changed: 109 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,87 +51,167 @@ class JS {
5151
libFolder.getChildAssumingFile('meta.dart').writeAsStringSync(r'''
5252
library meta;
5353
54-
const _AlwaysThrows alwaysThrows = const _AlwaysThrows();
54+
import 'meta_meta.dart';
55+
56+
const _AlwaysThrows alwaysThrows = _AlwaysThrows();
57+
58+
@Deprecated('Use the `covariant` modifier instead')
59+
const _Checked checked = _Checked();
60+
5561
const _DoNotStore doNotStore = _DoNotStore();
56-
const _Factory factory = const _Factory();
57-
const Immutable immutable = const Immutable();
58-
const _Internal internal = const Internal();
59-
const _Literal literal = const _Literal();
60-
const _MustCallSuper mustCallSuper = const _MustCallSuper();
61-
const _NonVirtual nonVirtual = const _NonVirtual();
62-
const _OptionalTypeArgs optionalTypeArgs = const _OptionalTypeArgs();
63-
const _Protected protected = const _Protected();
64-
const Required required = const Required();
65-
const _Sealed sealed = const _Sealed();
62+
63+
const _Experimental experimental = _Experimental();
64+
65+
const _Factory factory = _Factory();
66+
67+
const Immutable immutable = Immutable();
68+
69+
const _Internal internal = _Internal();
70+
71+
const _IsTest isTest = _IsTest();
72+
73+
const _IsTestGroup isTestGroup = _IsTestGroup();
74+
75+
const _Literal literal = _Literal();
76+
77+
const _MustCallSuper mustCallSuper = _MustCallSuper();
78+
79+
const _NonVirtual nonVirtual = _NonVirtual();
80+
81+
const _OptionalTypeArgs optionalTypeArgs = _OptionalTypeArgs();
82+
83+
const _Protected protected = _Protected();
84+
85+
const Required required = Required();
86+
87+
const _Sealed sealed = _Sealed();
88+
6689
const UseResult useResult = UseResult();
90+
91+
@Deprecated('No longer has meaning')
92+
const _Virtual virtual = _Virtual();
93+
6794
const _VisibleForOverriding visibleForOverriding = _VisibleForOverriding();
68-
const _VisibleForTesting visibleForTesting = const _VisibleForTesting();
6995
70-
class _AlwaysThrows {
71-
const _AlwaysThrows();
96+
const _VisibleForTesting visibleForTesting = _VisibleForTesting();
97+
98+
class Immutable {
99+
final String reason;
100+
101+
const Immutable([this.reason = '']);
72102
}
103+
104+
class Required {
105+
final String reason;
106+
107+
const Required([this.reason = '']);
108+
}
109+
73110
@Target({
74111
TargetKind.field,
75112
TargetKind.function,
76113
TargetKind.getter,
77114
TargetKind.method,
78115
TargetKind.topLevelVariable,
79116
})
117+
class UseResult {
118+
final String reason;
119+
120+
final String? parameterDefined;
121+
122+
const UseResult([this.reason = '']) : parameterDefined = null;
123+
124+
const UseResult.unless({required this.parameterDefined, this.reason = ''});
125+
}
126+
127+
class _AlwaysThrows {
128+
const _AlwaysThrows();
129+
}
130+
131+
class _Checked {
132+
const _Checked();
133+
}
134+
135+
@Target({
136+
TargetKind.classType,
137+
TargetKind.function,
138+
TargetKind.getter,
139+
TargetKind.library,
140+
TargetKind.method,
141+
})
80142
class _DoNotStore {
81143
const _DoNotStore();
82144
}
145+
146+
class _Experimental {
147+
const _Experimental();
148+
}
149+
83150
class _Factory {
84151
const _Factory();
85152
}
86-
class Immutable {
87-
final String reason;
88-
const Immutable([this.reason]);
89-
}
153+
90154
class _Internal {
91-
const Internal();
155+
const _Internal();
92156
}
157+
158+
class _IsTest {
159+
const _IsTest();
160+
}
161+
162+
class _IsTestGroup {
163+
const _IsTestGroup();
164+
}
165+
93166
class _Literal {
94167
const _Literal();
95168
}
169+
96170
class _MustCallSuper {
97171
const _MustCallSuper();
98172
}
173+
99174
class _NonVirtual {
100175
const _NonVirtual();
101176
}
177+
178+
@Target({
179+
TargetKind.classType,
180+
TargetKind.extension,
181+
TargetKind.function,
182+
TargetKind.method,
183+
TargetKind.mixinType,
184+
TargetKind.typedefType,
185+
})
102186
class _OptionalTypeArgs {
103187
const _OptionalTypeArgs();
104188
}
189+
105190
class _Protected {
106191
const _Protected();
107192
}
108-
class Required {
109-
final String reason;
110-
const Required([this.reason]);
111-
}
193+
112194
class _Sealed {
113195
const _Sealed();
114196
}
115-
class UseResult {
116-
final String? parameterDefined;
117-
final String reason;
118-
const UseResult([this.reason = '']);
119-
const UseResult.unless({required this.parameterDefined, this.reason = ''});
120-
}
197+
121198
class _VisibleForOverriding {
122199
const _VisibleForOverriding();
123200
}
201+
124202
class _VisibleForTesting {
125203
const _VisibleForTesting();
126204
}
127205
''');
128206
libFolder.getChildAssumingFile('meta_meta.dart').writeAsStringSync(r'''
129207
library meta_meta;
130208
209+
@Target({TargetKind.classType})
131210
class Target {
132211
final Set<TargetKind> kinds;
133212
const Target(this.kinds);
134213
}
214+
135215
enum TargetKind {
136216
classType,
137217
enumType,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,8 @@ class Symbol {
624624
625625
class Type {}
626626
627+
class TypeError extends Error {}
628+
627629
class UnsupportedError {
628630
UnsupportedError(String message);
629631
}

0 commit comments

Comments
 (0)