Skip to content

Commit a4e6fe1

Browse files
author
Dart CI
committed
Version 2.12.0-143.0.dev
Merge commit 'e2b88eea9596b10772c959cf5bdcecd45423624b' into 'dev'
2 parents 1f83e54 + e2b88ee commit a4e6fe1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1396
-669
lines changed

DEPS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ vars = {
6868
"gperftools_revision": "180bfa10d7cb38e8b3784d60943d50e8fcef0dcb",
6969

7070
# Revisions of /third_party/* dependencies.
71-
"args_rev": "139140125126661fac88c9aa5882165936d01c91",
71+
"args_rev": "6921e2f63796368bbe65a64ad943df84932dff55",
7272
"async_rev": "695b3ac280f107c84adf7488743abfdfaaeea68f",
7373
"bazel_worker_rev": "060c55a933d39798681a4f533b161b81dc48d77e",
7474
"benchmark_harness_rev": "ec6b646f5443faa871e126ac1ba248c94ca06257",
@@ -82,7 +82,7 @@ vars = {
8282
"clock_rev" : "a494269254ba978e7ef8f192c5f7fec3fc05b9d3",
8383
"collection_rev": "e4bb038ce2d8e66fb15818aa40685c68d53692ab",
8484
"convert_rev": "6513985a1b1ea8a0b987fbef699250ce2cdc3cca",
85-
"crypto_rev": "a5ec902dda5a635a35c6b363ec64458cf84c5872",
85+
"crypto_rev": "c89a5be0375875fe7ff71625fa2b79f5a421f06d",
8686
"csslib_rev": "6f77b3dcee957d3e2d5083f666221a220e9ed1f1",
8787
"dart2js_info_rev" : "e0acfeb5affdf94c53067e68bd836adf589628fd",
8888

pkg/analysis_server/lib/lsp_protocol/protocol_generated.dart

Lines changed: 113 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14592,6 +14592,98 @@ class FileEvent implements ToJsonable {
1459214592
String toString() => jsonEncoder.convert(toJson());
1459314593
}
1459414594

14595+
/// A filter to describe in which file operation requests or notifications the
14596+
/// server is interested in.
14597+
/// @since 3.16.0
14598+
class FileOperationFilter implements ToJsonable {
14599+
static const jsonHandler = LspJsonHandler(
14600+
FileOperationFilter.canParse, FileOperationFilter.fromJson);
14601+
14602+
FileOperationFilter({this.scheme, @required this.pattern}) {
14603+
if (pattern == null) {
14604+
throw 'pattern is required but was not provided';
14605+
}
14606+
}
14607+
static FileOperationFilter fromJson(Map<String, dynamic> json) {
14608+
final scheme = json['scheme'];
14609+
final pattern = json['pattern'] != null
14610+
? FileOperationPattern.fromJson(json['pattern'])
14611+
: null;
14612+
return FileOperationFilter(scheme: scheme, pattern: pattern);
14613+
}
14614+
14615+
/// The actual file operation pattern.
14616+
final FileOperationPattern pattern;
14617+
14618+
/// A Uri like `file` or `untitled`.
14619+
final String scheme;
14620+
14621+
Map<String, dynamic> toJson() {
14622+
var __result = <String, dynamic>{};
14623+
if (scheme != null) {
14624+
__result['scheme'] = scheme;
14625+
}
14626+
__result['pattern'] =
14627+
pattern?.toJson() ?? (throw 'pattern is required but was not set');
14628+
return __result;
14629+
}
14630+
14631+
static bool canParse(Object obj, LspJsonReporter reporter) {
14632+
if (obj is Map<String, dynamic>) {
14633+
reporter.push('scheme');
14634+
try {
14635+
if (obj['scheme'] != null && !(obj['scheme'] is String)) {
14636+
reporter.reportError('must be of type String');
14637+
return false;
14638+
}
14639+
} finally {
14640+
reporter.pop();
14641+
}
14642+
reporter.push('pattern');
14643+
try {
14644+
if (!obj.containsKey('pattern')) {
14645+
reporter.reportError('must not be undefined');
14646+
return false;
14647+
}
14648+
if (obj['pattern'] == null) {
14649+
reporter.reportError('must not be null');
14650+
return false;
14651+
}
14652+
if (!(FileOperationPattern.canParse(obj['pattern'], reporter))) {
14653+
reporter.reportError('must be of type FileOperationPattern');
14654+
return false;
14655+
}
14656+
} finally {
14657+
reporter.pop();
14658+
}
14659+
return true;
14660+
} else {
14661+
reporter.reportError('must be of type FileOperationFilter');
14662+
return false;
14663+
}
14664+
}
14665+
14666+
@override
14667+
bool operator ==(Object other) {
14668+
if (other is FileOperationFilter &&
14669+
other.runtimeType == FileOperationFilter) {
14670+
return scheme == other.scheme && pattern == other.pattern && true;
14671+
}
14672+
return false;
14673+
}
14674+
14675+
@override
14676+
int get hashCode {
14677+
var hash = 0;
14678+
hash = JenkinsSmiHash.combine(hash, scheme.hashCode);
14679+
hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
14680+
return JenkinsSmiHash.finish(hash);
14681+
}
14682+
14683+
@override
14684+
String toString() => jsonEncoder.convert(toJson());
14685+
}
14686+
1459514687
/// A pattern to describe in which file operation requests or notifications the
1459614688
/// server is interested in.
1459714689
/// @since 3.16.0 - proposed state
@@ -14818,45 +14910,46 @@ class FileOperationRegistrationOptions implements ToJsonable {
1481814910
FileOperationRegistrationOptions.canParse,
1481914911
FileOperationRegistrationOptions.fromJson);
1482014912

14821-
FileOperationRegistrationOptions({@required this.patterns}) {
14822-
if (patterns == null) {
14823-
throw 'patterns is required but was not provided';
14913+
FileOperationRegistrationOptions({@required this.filters}) {
14914+
if (filters == null) {
14915+
throw 'filters is required but was not provided';
1482414916
}
1482514917
}
1482614918
static FileOperationRegistrationOptions fromJson(Map<String, dynamic> json) {
14827-
final patterns = json['patterns']
14919+
final filters = json['filters']
1482814920
?.map(
14829-
(item) => item != null ? FileOperationPattern.fromJson(item) : null)
14830-
?.cast<FileOperationPattern>()
14921+
(item) => item != null ? FileOperationFilter.fromJson(item) : null)
14922+
?.cast<FileOperationFilter>()
1483114923
?.toList();
14832-
return FileOperationRegistrationOptions(patterns: patterns);
14924+
return FileOperationRegistrationOptions(filters: filters);
1483314925
}
1483414926

14835-
final List<FileOperationPattern> patterns;
14927+
/// The actual filters.
14928+
final List<FileOperationFilter> filters;
1483614929

1483714930
Map<String, dynamic> toJson() {
1483814931
var __result = <String, dynamic>{};
14839-
__result['patterns'] =
14840-
patterns ?? (throw 'patterns is required but was not set');
14932+
__result['filters'] =
14933+
filters ?? (throw 'filters is required but was not set');
1484114934
return __result;
1484214935
}
1484314936

1484414937
static bool canParse(Object obj, LspJsonReporter reporter) {
1484514938
if (obj is Map<String, dynamic>) {
14846-
reporter.push('patterns');
14939+
reporter.push('filters');
1484714940
try {
14848-
if (!obj.containsKey('patterns')) {
14941+
if (!obj.containsKey('filters')) {
1484914942
reporter.reportError('must not be undefined');
1485014943
return false;
1485114944
}
14852-
if (obj['patterns'] == null) {
14945+
if (obj['filters'] == null) {
1485314946
reporter.reportError('must not be null');
1485414947
return false;
1485514948
}
14856-
if (!((obj['patterns'] is List &&
14857-
(obj['patterns'].every(
14858-
(item) => FileOperationPattern.canParse(item, reporter)))))) {
14859-
reporter.reportError('must be of type List<FileOperationPattern>');
14949+
if (!((obj['filters'] is List &&
14950+
(obj['filters'].every(
14951+
(item) => FileOperationFilter.canParse(item, reporter)))))) {
14952+
reporter.reportError('must be of type List<FileOperationFilter>');
1486014953
return false;
1486114954
}
1486214955
} finally {
@@ -14873,8 +14966,8 @@ class FileOperationRegistrationOptions implements ToJsonable {
1487314966
bool operator ==(Object other) {
1487414967
if (other is FileOperationRegistrationOptions &&
1487514968
other.runtimeType == FileOperationRegistrationOptions) {
14876-
return listEqual(patterns, other.patterns,
14877-
(FileOperationPattern a, FileOperationPattern b) => a == b) &&
14969+
return listEqual(filters, other.filters,
14970+
(FileOperationFilter a, FileOperationFilter b) => a == b) &&
1487814971
true;
1487914972
}
1488014973
return false;
@@ -14883,7 +14976,7 @@ class FileOperationRegistrationOptions implements ToJsonable {
1488314976
@override
1488414977
int get hashCode {
1488514978
var hash = 0;
14886-
hash = JenkinsSmiHash.combine(hash, lspHashCode(patterns));
14979+
hash = JenkinsSmiHash.combine(hash, lspHashCode(filters));
1488714980
return JenkinsSmiHash.finish(hash);
1488814981
}
1488914982

pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,15 @@ class BulkFixProcessor {
327327
HintCode.DEPRECATED_MEMBER_USE: [
328328
DataDriven.newInstance,
329329
],
330+
HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE: [
331+
DataDriven.newInstance,
332+
],
330333
HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE: [
331334
DataDriven.newInstance,
332335
],
336+
HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE: [
337+
DataDriven.newInstance,
338+
],
333339
HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD: [
334340
DataDriven.newInstance,
335341
],

pkg/analysis_server/tool/lsp_spec/lsp_specification.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ Many of the interfaces contain fields that correspond to the URI of a document.
352352
type DocumentUri = string;
353353
```
354354

355+
There is also a tagging interface for normal non document URIs. It maps to a `string` as well.
356+
357+
```typescript
358+
type URI = string;
359+
```
360+
355361
#### <a href="#regExp" name="regExp" class="anchor"> Regular Expressions </a>
356362

357363
Regular expression are a powerful tool and there are actual use cases for them in the language server protocol. However the downside with them is that almost every programming language has its own set of regular expression features so the specification can not simply refer to them as a regular expression. So the LSP uses a two step approach to support regular expressions:
@@ -3422,7 +3428,10 @@ _Server Capability_:
34223428
* @since 3.16.0 - proposed state
34233429
*/
34243430
interface FileOperationRegistrationOptions {
3425-
patterns: FileOperationPattern[];
3431+
/**
3432+
* The actual filters.
3433+
*/
3434+
filters: FileOperationFilter[];
34263435
}
34273436

34283437
/**
@@ -3492,6 +3501,25 @@ interface FileOperationPattern {
34923501
*/
34933502
options?: FileOperationPatternOptions;
34943503
}
3504+
3505+
/**
3506+
* A filter to describe in which file operation requests or notifications
3507+
* the server is interested in.
3508+
*
3509+
* @since 3.16.0
3510+
*/
3511+
export interface FileOperationFilter {
3512+
3513+
/**
3514+
* A Uri like `file` or `untitled`.
3515+
*/
3516+
scheme?: string;
3517+
3518+
/**
3519+
* The actual file operation pattern.
3520+
*/
3521+
pattern: FileOperationPattern;
3522+
}
34953523
```
34963524

34973525
The capability indicates that the server is interested in receiving `workspace/willCreateFiles` requests.

pkg/analyzer/lib/src/error/best_practices_verifier.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
421421
_inDoNotStoreMember = true;
422422
}
423423
try {
424-
_checkForMissingReturn(
425-
node.returnType, node.functionExpression.body, element, node);
424+
_checkForMissingReturn(node.functionExpression.body, node);
426425

427426
// Return types are inferred only on non-recursive local functions.
428427
if (node.parent is CompilationUnit && !node.isSetter) {
@@ -447,7 +446,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
447446
@override
448447
void visitFunctionExpression(FunctionExpression node) {
449448
if (node.parent is! FunctionDeclaration) {
450-
_checkForMissingReturn(null, node.body, node.declaredElement, node);
449+
_checkForMissingReturn(node.body, node);
451450
}
452451
DartType functionType = InferenceContext.getContext(node);
453452
if (functionType is! FunctionType) {
@@ -557,7 +556,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
557556
try {
558557
// This was determined to not be a good hint, see: dartbug.com/16029
559558
//checkForOverridingPrivateMember(node);
560-
_checkForMissingReturn(node.returnType, node.body, element, node);
559+
_checkForMissingReturn(node.body, node);
561560
_mustCallSuperVerifier.checkMethodDeclaration(node);
562561
_checkForUnnecessaryNoSuchMethod(node);
563562

@@ -1153,8 +1152,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
11531152
/// function has a return type that Future<Null> is not assignable to.
11541153
///
11551154
/// See [HintCode.MISSING_RETURN].
1156-
void _checkForMissingReturn(TypeAnnotation returnNode, FunctionBody body,
1157-
ExecutableElement element, AstNode functionNode) {
1155+
void _checkForMissingReturn(FunctionBody body, AstNode functionNode) {
11581156
if (_isNonNullableByDefault) {
11591157
return;
11601158
}
@@ -1436,8 +1434,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
14361434
}
14371435
}
14381436

1439-
/// In "strict-inference" mode, check that [returnNode]'s return type is
1440-
/// specified.
1437+
/// In "strict-inference" mode, check that [returnType] is specified.
14411438
void _checkStrictInferenceReturnType(
14421439
AstNode returnType, AstNode reportNode, String displayName) {
14431440
if (!_strictInference) {

0 commit comments

Comments
 (0)