Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4fb134a

Browse files
author
Dart CI
committed
Version 2.11.0-166.0.dev
Merge commit '280f639fdaa87575d5e13d3f020c3460da01c414' into 'dev'
2 parents adf5469 + 280f639 commit 4fb134a

File tree

35 files changed

+522
-589
lines changed

35 files changed

+522
-589
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
### Dart2JS
88

9+
* Removed `--no-defer-class-types` and `--no-new-deferred-split'.
10+
911
### Tools
1012

1113
#### Dartanalyzer

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ vars = {
144144
"source_maps_rev": "53eb92ccfe6e64924054f83038a534b959b12b3e",
145145
"source_span_rev": "cc7c4288a83f71ecef3414199947b52a8c112c65",
146146
"sse_tag": "e5cf68975e8e87171a3dc297577aa073454a91dc",
147-
"stack_trace_tag": "d3813ca0a77348e0faf0d6af0cc17913e36afa39",
147+
"stack_trace_tag": "a958966148516dfa64e2b54c14492175da5cc8e1",
148148
"stagehand_tag": "v3.3.9",
149149
"stream_channel_tag": "c446774fd077c9bdbd6235a7aadc661ef60a9727",
150150
"string_scanner_rev": "1b63e6e5db5933d7be0a45da6e1129fe00262734",

pkg/_fe_analyzer_shared/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: _fe_analyzer_shared
2-
version: 9.0.0
2+
version: 10.0.0
33
description: Logic that is shared between the front_end and analyzer packages.
44
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/_fe_analyzer_shared
55

pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ class ServerCapabilitiesComputer {
224224
language: 'yaml', scheme: 'file', pattern: '**/pubspec.yaml');
225225
final analysisOptionsFile = DocumentFilter(
226226
language: 'yaml', scheme: 'file', pattern: '**/analysis_options.yaml');
227+
final fixDataFile = DocumentFilter(
228+
language: 'yaml', scheme: 'file', pattern: '**/lib/fix_data.yaml');
227229

228230
final pluginTypes = _server.pluginManager.plugins
229231
.expand((plugin) => plugin.currentSession?.interestingFiles ?? const [])
@@ -243,6 +245,7 @@ class ServerCapabilitiesComputer {
243245
...allTypes,
244246
pubspecFile,
245247
analysisOptionsFile,
248+
fixDataFile,
246249
}.toList();
247250

248251
final registrations = <Registration>[];

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ class BulkFixProcessor {
140140
LintNames.prefer_conditional_assignment: [
141141
ReplaceWithConditionalAssignment.newInstance,
142142
],
143+
// TODO (pq): can produce results incompatible w/ `unnecessary_const`
144+
// LintNames.prefer_const_constructors: [
145+
// AddConst.newInstance,
146+
// ReplaceNewWithConst.newInstance,
147+
// ],
143148
LintNames.prefer_const_constructors_in_immutables: [
144149
AddConst.newInstance,
145150
],

pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_error_code.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@ class TransformSetErrorCode extends ErrorCode {
1515
* 0: the actual type of the value
1616
*/
1717
static const TransformSetErrorCode invalidValue = TransformSetErrorCode(
18-
'invalidValue',
18+
'invalid_value',
1919
"The value of '{0}' should be of type '{1}' but is of type '{2}'.");
2020

2121
/**
2222
* Parameters:
2323
* 0: the missing key
2424
*/
2525
static const TransformSetErrorCode missingKey =
26-
TransformSetErrorCode('missingKey', "Missing the required key '{0}'.");
26+
TransformSetErrorCode('missing_key', "Missing the required key '{0}'.");
2727

2828
/**
2929
* No parameters.
3030
*/
3131
static const TransformSetErrorCode missingTemplateEnd = TransformSetErrorCode(
32-
'missingTemplateEnd', "Missing the end brace for the template.");
32+
'missing_template_end', "Missing the end brace for the template.");
3333

3434
/**
3535
* Parameters:
3636
* 0: the missing key
3737
*/
3838
static const TransformSetErrorCode undefinedVariable = TransformSetErrorCode(
39-
'undefinedVariable', "The variable '{0}' is not defined.");
39+
'undefined_variable', "The variable '{0}' is not defined.");
4040

4141
/**
4242
* Parameters:
4343
* 0: the unsupported key
4444
*/
45-
static const TransformSetErrorCode unsupportedKey =
46-
TransformSetErrorCode('unsupportedKey', "The key '{0}' isn't supported.");
45+
static const TransformSetErrorCode unsupportedKey = TransformSetErrorCode(
46+
'unsupported_key', "The key '{0}' isn't supported.");
4747

4848
/**
4949
* Parameters:
5050
* 0: the message produced by the YAML parser
5151
*/
5252
static const TransformSetErrorCode yamlSyntaxError =
53-
TransformSetErrorCode('yamlSyntaxError', "Parse error: {0}");
53+
TransformSetErrorCode('yaml_syntax_error', "Parse error: {0}");
5454

5555
/// Initialize a newly created error code.
5656
const TransformSetErrorCode(String name, String message,

pkg/analysis_server/test/lsp/diagnostic_test.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,21 @@ void f() {
250250
expect(diagnostics, isNull);
251251
}
252252

253+
Future<void> test_fixDataFile() async {
254+
var fixDataPath = join(projectFolderPath, 'lib', 'fix_data.yaml');
255+
var fixDataUri = Uri.file(fixDataPath);
256+
newFile(fixDataPath, content: '''
257+
version: latest
258+
''').path;
259+
260+
final firstDiagnosticsUpdate = waitForDiagnostics(fixDataUri);
261+
await initialize();
262+
final initialDiagnostics = await firstDiagnosticsUpdate;
263+
expect(initialDiagnostics, hasLength(1));
264+
expect(initialDiagnostics.first.severity, DiagnosticSeverity.Error);
265+
expect(initialDiagnostics.first.code, 'invalid_value');
266+
}
267+
253268
Future<void> test_fromPlugins_dartFile() async {
254269
await checkPluginErrorsForFile(mainFilePath);
255270
}

pkg/analysis_server/test/src/services/correction/fix/bulk/add_const_test.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,36 @@ import 'bulk_fix_processor.dart';
99

1010
void main() {
1111
defineReflectiveSuite(() {
12+
defineReflectiveTests(AddConstToConstructorTest);
1213
defineReflectiveTests(AddConstToImmutableConstructorTest);
1314
});
1415
}
1516

17+
@reflectiveTest
18+
class AddConstToConstructorTest extends BulkFixProcessorTest {
19+
@override
20+
String get lintCode => LintNames.prefer_const_constructors;
21+
22+
/// Disabled in BulkFixProcessor.
23+
@failingTest
24+
Future<void> test_singleFile() async {
25+
addMetaPackage();
26+
await resolveTestUnit(r'''
27+
class C {
28+
const C([C c]);
29+
}
30+
var c = C(C());
31+
''');
32+
// TODO (pq): results are incompatible w/ `unnecessary_const`
33+
await assertHasFix(r'''
34+
class C {
35+
const C([C c]);
36+
}
37+
var c = const C(const C());
38+
''');
39+
}
40+
}
41+
1642
@reflectiveTest
1743
class AddConstToImmutableConstructorTest extends BulkFixProcessorTest {
1844
@override
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:analysis_server/src/services/linter/lint_names.dart';
6+
import 'package:test_reflective_loader/test_reflective_loader.dart';
7+
8+
import 'bulk_fix_processor.dart';
9+
10+
void main() {
11+
defineReflectiveSuite(() {
12+
defineReflectiveTests(ReplaceNewWithConstTest);
13+
});
14+
}
15+
16+
@reflectiveTest
17+
class ReplaceNewWithConstTest extends BulkFixProcessorTest {
18+
@override
19+
String get lintCode => LintNames.prefer_const_constructors;
20+
21+
/// Disabled in BulkFixProcessor.
22+
@failingTest
23+
Future<void> test_singleFile() async {
24+
await resolveTestUnit(r'''
25+
class C {
26+
const C();
27+
}
28+
main() {
29+
print('${new C()} ${new C()}');
30+
}
31+
''');
32+
await assertHasFix(r'''
33+
class C {
34+
const C();
35+
}
36+
main() {
37+
print('${const C()} ${const C()}');
38+
}
39+
''');
40+
}
41+
}

pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import 'remove_unnecessary_new_test.dart' as remove_unnecessary_new;
4949
import 'rename_to_camel_case_test.dart' as rename_to_camel_case;
5050
import 'replace_colon_with_equals_test.dart' as replace_colon_with_equals;
5151
import 'replace_final_with_const_test.dart' as replace_final_with_const;
52+
import 'replace_new_with_const_test.dart' as replace_new_with_const;
5253
import 'replace_null_with_closure_test.dart' as replace_null_with_closure;
5354
import 'replace_with_conditional_assignment_test.dart'
5455
as replace_with_conditional_assignment;
@@ -102,6 +103,7 @@ void main() {
102103
replace_with_conditional_assignment.main();
103104
replace_colon_with_equals.main();
104105
replace_final_with_const.main();
106+
replace_new_with_const.main();
105107
replace_null_with_closure.main();
106108
replace_with_is_empty.main();
107109
replace_with_tear_off.main();

0 commit comments

Comments
 (0)