Skip to content

Commit 0265477

Browse files
author
Dart CI
committed
Version 2.12.0-245.0.dev
Merge commit '88c1be7e3b718bf00ff4f01b62d7ab1521abc5c7' into 'dev'
2 parents 4a6764b + 88c1be7 commit 0265477

File tree

380 files changed

+29068
-8820
lines changed

Some content is hidden

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

380 files changed

+29068
-8820
lines changed

CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ opted out of null safety by adding `// @dart=2.9` to the beginning of the file.
7979

8080
#### Linter
8181

82-
Updated the Linter to `0.1.127`, which includes:
82+
Updated the Linter to `0.1.128`, which includes:
8383

84-
* fixed crash in `prefer_collection_literals` when there is no static parameter
84+
* New lint: `avoid_dynamic_calls`.
85+
* (Internal): `avoid_type_to_string` updated to use `addArgumentList` registry API.
86+
* Miscellaneous documentation improvements.
87+
* Fixed crash in `prefer_collection_literals` when there is no static parameter
8588
element.
86-
* fixed false negatives for `prefer_collection_literals` when a LinkedHashSet or
89+
* Fixed false negatives for `prefer_collection_literals` when a LinkedHashSet or
8790
LinkedHashMap instantiation is passed as the argument to a function in any
8891
position other than the first.
89-
* fixed false negatives for `prefer_collection_literals` when a LinkedHashSet or
92+
* Fixed false negatives for `prefer_collection_literals` when a LinkedHashSet or
9093
LinkedHashMap instantiation is used in a place with a static type other than
9194
Set or Map.
9295
* (Internal): test updates to the new `PhysicalResourceProvider` API.

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ vars = {
118118
"intl_tag": "0.17.0-nullsafety",
119119
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
120120
"json_rpc_2_rev": "b8dfe403fd8528fd14399dee3a6527b55802dd4d",
121-
"linter_tag": "0.1.127",
121+
"linter_tag": "0.1.128",
122122
"logging_rev": "e2f633b543ef89c54688554b15ca3d7e425b86a2",
123123
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
124124
"markdown_rev": "6f89681d59541ddb1cf3a58efbdaa2304ffc3f51",

pkg/analysis_server/lib/protocol/protocol_constants.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ const String DIAGNOSTIC_RESPONSE_GET_DIAGNOSTICS_CONTEXTS = 'contexts';
166166
const String DIAGNOSTIC_RESPONSE_GET_SERVER_PORT_PORT = 'port';
167167
const String EDIT_REQUEST_BULK_FIXES = 'edit.bulkFixes';
168168
const String EDIT_REQUEST_BULK_FIXES_INCLUDED = 'included';
169+
const String EDIT_REQUEST_BULK_FIXES_IN_TEST_MODE = 'inTestMode';
169170
const String EDIT_REQUEST_DARTFIX = 'edit.dartfix';
170171
const String EDIT_REQUEST_DARTFIX_EXCLUDED_FIXES = 'excludedFixes';
171172
const String EDIT_REQUEST_DARTFIX_INCLUDED = 'included';

pkg/analysis_server/lib/protocol/protocol_generated.dart

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7301,12 +7301,15 @@ class DiagnosticGetServerPortResult implements ResponseResult {
73017301
///
73027302
/// {
73037303
/// "included": List<FilePath>
7304+
/// "inTestMode": optional bool
73047305
/// }
73057306
///
73067307
/// Clients may not extend, implement or mix-in this class.
73077308
class EditBulkFixesParams implements RequestParams {
73087309
List<String> _included;
73097310

7311+
bool _inTestMode;
7312+
73107313
/// A list of the files and directories for which edits should be suggested.
73117314
///
73127315
/// If a request is made with a path that is invalid, e.g. is not absolute
@@ -7330,8 +7333,27 @@ class EditBulkFixesParams implements RequestParams {
73307333
_included = value;
73317334
}
73327335

7333-
EditBulkFixesParams(List<String> included) {
7336+
/// A flag indicating whether the bulk fixes are being run in test mode. The
7337+
/// only difference is that in test mode the fix processor will look for a
7338+
/// configuration file that can modify the content of the data file used to
7339+
/// compute the fixes when data-driven fixes are being considered.
7340+
///
7341+
/// If this field is omitted the flag defaults to false.
7342+
bool get inTestMode => _inTestMode;
7343+
7344+
/// A flag indicating whether the bulk fixes are being run in test mode. The
7345+
/// only difference is that in test mode the fix processor will look for a
7346+
/// configuration file that can modify the content of the data file used to
7347+
/// compute the fixes when data-driven fixes are being considered.
7348+
///
7349+
/// If this field is omitted the flag defaults to false.
7350+
set inTestMode(bool value) {
7351+
_inTestMode = value;
7352+
}
7353+
7354+
EditBulkFixesParams(List<String> included, {bool inTestMode}) {
73347355
this.included = included;
7356+
this.inTestMode = inTestMode;
73357357
}
73367358

73377359
factory EditBulkFixesParams.fromJson(
@@ -7345,7 +7367,12 @@ class EditBulkFixesParams implements RequestParams {
73457367
} else {
73467368
throw jsonDecoder.mismatch(jsonPath, 'included');
73477369
}
7348-
return EditBulkFixesParams(included);
7370+
bool inTestMode;
7371+
if (json.containsKey('inTestMode')) {
7372+
inTestMode = jsonDecoder.decodeBool(
7373+
jsonPath + '.inTestMode', json['inTestMode']);
7374+
}
7375+
return EditBulkFixesParams(included, inTestMode: inTestMode);
73497376
} else {
73507377
throw jsonDecoder.mismatch(jsonPath, 'edit.bulkFixes params', json);
73517378
}
@@ -7360,6 +7387,9 @@ class EditBulkFixesParams implements RequestParams {
73607387
Map<String, dynamic> toJson() {
73617388
var result = <String, dynamic>{};
73627389
result['included'] = included;
7390+
if (inTestMode != null) {
7391+
result['inTestMode'] = inTestMode;
7392+
}
73637393
return result;
73647394
}
73657395

@@ -7375,7 +7405,8 @@ class EditBulkFixesParams implements RequestParams {
73757405
bool operator ==(other) {
73767406
if (other is EditBulkFixesParams) {
73777407
return listEqual(
7378-
included, other.included, (String a, String b) => a == b);
7408+
included, other.included, (String a, String b) => a == b) &&
7409+
inTestMode == other.inTestMode;
73797410
}
73807411
return false;
73817412
}
@@ -7384,6 +7415,7 @@ class EditBulkFixesParams implements RequestParams {
73847415
int get hashCode {
73857416
var hash = 0;
73867417
hash = JenkinsSmiHash.combine(hash, included.hashCode);
7418+
hash = JenkinsSmiHash.combine(hash, inTestMode.hashCode);
73877419
return JenkinsSmiHash.finish(hash);
73887420
}
73897421
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:analyzer/dart/ast/ast.dart';
88
import 'package:analyzer/dart/ast/token.dart';
99
import 'package:analyzer/dart/element/element.dart';
1010
import 'package:analyzer/src/dart/ast/extensions.dart';
11+
import 'package:analyzer/src/generated/source.dart';
1112
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
1213
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
1314

@@ -70,16 +71,18 @@ class AddLate extends CorrectionProducer {
7071
var keywordToken = declarationList.keyword;
7172
if (declarationList.variables.length == 1 &&
7273
keywordToken.keyword == Keyword.FINAL) {
73-
await _insertAt(builder, keywordToken.offset);
74+
await _insertAt(builder, keywordToken.offset,
75+
source: declarationResult.element.source);
7476
}
7577
}
7678
}
7779
}
7880
}
7981
}
8082

81-
Future<void> _insertAt(ChangeBuilder builder, int offset) async {
82-
await builder.addDartFileEdit(file, (builder) {
83+
Future<void> _insertAt(ChangeBuilder builder, int offset,
84+
{Source source}) async {
85+
await builder.addDartFileEdit(source?.fullName ?? file, (builder) {
8386
builder.addSimpleInsertion(offset, 'late ');
8487
});
8588
}

pkg/analysis_server/test/completion_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,9 @@ f() { var vvv = 42; return !1 }''', <String>['1+vvv']);
14661466
class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flower() {x!Xc = y!Yc = MA!1 }}''',
14671467
<String>['1+MAX_D', 'X+xc', 'Y+yc', '2+num', '3+num', '4+Sunflower']);
14681468

1469+
buildTests('testCompletion_staticField_withoutVarOrFinal', '''
1470+
class num{}class Sunflower {static n!1}''', <String>['1+num']);
1471+
14691472
buildTests('testCompletion_super_superType', '''
14701473
class A {
14711474
var fa;

pkg/analysis_server/test/integration/support/integration_test_methods.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,15 @@ abstract class IntegrationTestMixin {
15821582
/// analysis.setAnalysisRoots), an error of type FILE_NOT_ANALYZED will be
15831583
/// generated.
15841584
///
1585+
/// inTestMode: bool (optional)
1586+
///
1587+
/// A flag indicating whether the bulk fixes are being run in test mode.
1588+
/// The only difference is that in test mode the fix processor will look
1589+
/// for a configuration file that can modify the content of the data file
1590+
/// used to compute the fixes when data-driven fixes are being considered.
1591+
///
1592+
/// If this field is omitted the flag defaults to false.
1593+
///
15851594
/// Returns
15861595
///
15871596
/// edits: List<SourceFileEdit>
@@ -1592,8 +1601,9 @@ abstract class IntegrationTestMixin {
15921601
///
15931602
/// Details that summarize the fixes associated with the recommended
15941603
/// changes.
1595-
Future<EditBulkFixesResult> sendEditBulkFixes(List<String> included) async {
1596-
var params = EditBulkFixesParams(included).toJson();
1604+
Future<EditBulkFixesResult> sendEditBulkFixes(List<String> included,
1605+
{bool inTestMode}) async {
1606+
var params = EditBulkFixesParams(included, inTestMode: inTestMode).toJson();
15971607
var result = await server.send('edit.bulkFixes', params);
15981608
var decoder = ResponseDecoder(null);
15991609
return EditBulkFixesResult.fromJson(decoder, 'result', result);

pkg/analysis_server/test/integration/support/protocol_matchers.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2241,9 +2241,11 @@ final Matcher isDiagnosticGetServerPortResult = LazyMatcher(() =>
22412241
///
22422242
/// {
22432243
/// "included": List<FilePath>
2244+
/// "inTestMode": optional bool
22442245
/// }
22452246
final Matcher isEditBulkFixesParams = LazyMatcher(() => MatchesJsonObject(
2246-
'edit.bulkFixes params', {'included': isListOf(isFilePath)}));
2247+
'edit.bulkFixes params', {'included': isListOf(isFilePath)},
2248+
optionalFields: {'inTestMode': isBool}));
22472249

22482250
/// edit.bulkFixes result
22492251
///

pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class AddLateTest extends FixProcessorTest with WithNullSafetyMixin {
3737
@override
3838
FixKind get kind => DartFixKind.ADD_LATE;
3939

40-
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44534')
4140
Future<void> test_changeInImportedLib() async {
4241
addSource('/home/test/lib/a.dart', '''
4342
class C {
@@ -58,7 +57,7 @@ class C {
5857
''', target: '/home/test/lib/a.dart');
5958
}
6059

61-
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44534')
60+
@FailingTest(reason: 'The lint does not fire for parts.')
6261
Future<void> test_changeInPart() async {
6362
addSource('/home/test/lib/a.dart', '''
6463
part 'test.dart';

pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,12 @@ public interface AnalysisServer {
481481
* file which does not exist, or which is not currently subject to analysis (e.g. because
482482
* it is not associated with any analysis root specified to analysis.setAnalysisRoots), an
483483
* error of type FILE_NOT_ANALYZED will be generated.
484+
* @param inTestMode A flag indicating whether the bulk fixes are being run in test mode. The only
485+
* difference is that in test mode the fix processor will look for a configuration file
486+
* that can modify the content of the data file used to compute the fixes when data-driven
487+
* fixes are being considered. If this field is omitted the flag defaults to false.
484488
*/
485-
public void edit_bulkFixes(List<String> included, BulkFixesConsumer consumer);
489+
public void edit_bulkFixes(List<String> included, boolean inTestMode, BulkFixesConsumer consumer);
486490

487491
/**
488492
* {@code edit.dartfix}

0 commit comments

Comments
 (0)