Skip to content

Commit 5d0e1cc

Browse files
author
Dart CI
committed
Version 2.10.0-85.0.dev
Merge commit 'd27556656fba7b43d44b1bdc10d2635a34102fbe' into 'dev'
2 parents e7810cf + d275566 commit 5d0e1cc

File tree

51 files changed

+2073
-1041
lines changed

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

+2073
-1041
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
to cancel outgoing HTTP requests and stop following IO operations.
99
* A validation check is added to `path` of class `Cookie`. Having characters
1010
ranging from 0x00 to 0x1f and 0x3b (";") will lead to a `FormatException`.
11+
* The `HttpClient` and `HttpServer` clasess now have a 1 MiB limit for the
12+
total size of the HTTP headers when parsing a request or response, instead
13+
of the former 8 KiB limit for each header name and value. This limit cannot
14+
be configured at this time.
1115

1216
#### `dart:typed_data`
1317

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: 8.0.0
2+
version: 9.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/services/correction/bulk_fix_processor.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import 'package:analysis_server/src/services/correction/dart/convert_to_contains
1919
import 'package:analysis_server/src/services/correction/dart/convert_to_generic_function_syntax.dart';
2020
import 'package:analysis_server/src/services/correction/dart/convert_to_if_null.dart';
2121
import 'package:analysis_server/src/services/correction/dart/convert_to_int_literal.dart';
22+
import 'package:analysis_server/src/services/correction/dart/convert_to_null_aware.dart';
2223
import 'package:analysis_server/src/services/correction/dart/convert_to_where_type.dart';
2324
import 'package:analysis_server/src/services/correction/dart/create_method.dart';
2425
import 'package:analysis_server/src/services/correction/dart/make_final.dart';
@@ -99,6 +100,7 @@ class BulkFixProcessor {
99100
LintNames.prefer_is_empty: ReplaceWithIsEmpty.newInstance,
100101
LintNames.prefer_is_not_empty: UesIsNotEmpty.newInstance,
101102
LintNames.prefer_iterable_whereType: ConvertToWhereType.newInstance,
103+
LintNames.prefer_null_aware_operators: ConvertToNullAware.newInstance,
102104
LintNames.prefer_single_quotes: ConvertToSingleQuotes.newInstance,
103105
LintNames.prefer_spread_collections: ConvertAddAllToSpread.newInstance,
104106
LintNames.slash_for_doc_comments: ConvertDocumentationIntoLine.newInstance,

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ abstract class ConvertQuotes extends CorrectionProducer {
3939
});
4040
}
4141
}
42-
} else if (node is InterpolationString) {
43-
StringInterpolation parent = node.parent;
44-
if (_fromDouble ? !parent.isSingleQuoted : parent.isSingleQuoted) {
45-
var newQuote = parent.isMultiline
42+
} else if (node is InterpolationString || node is StringInterpolation) {
43+
StringInterpolation stringNode =
44+
node is StringInterpolation ? node : node.parent;
45+
if (_fromDouble
46+
? !stringNode.isSingleQuoted
47+
: stringNode.isSingleQuoted) {
48+
var newQuote = stringNode.isMultiline
4649
? (_fromDouble ? "'''" : '"""')
4750
: (_fromDouble ? "'" : '"');
48-
var quoteLength = parent.isMultiline ? 3 : 1;
49-
var elements = parent.elements;
51+
var quoteLength = stringNode.isMultiline ? 3 : 1;
52+
var elements = stringNode.elements;
5053
for (var i = 0; i < elements.length; i++) {
5154
var element = elements[i];
5255
if (element is InterpolationString) {
@@ -58,10 +61,11 @@ abstract class ConvertQuotes extends CorrectionProducer {
5861
}
5962
await builder.addDartFileEdit(file, (builder) {
6063
builder.addSimpleReplacement(
61-
SourceRange(parent.offset + (parent.isRaw ? 1 : 0), quoteLength),
64+
SourceRange(
65+
stringNode.offset + (stringNode.isRaw ? 1 : 0), quoteLength),
6266
newQuote);
6367
builder.addSimpleReplacement(
64-
SourceRange(parent.end - quoteLength, quoteLength), newQuote);
68+
SourceRange(stringNode.end - quoteLength, quoteLength), newQuote);
6569
});
6670
}
6771
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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(ConvertToNullAwareTest);
13+
});
14+
}
15+
16+
@reflectiveTest
17+
class ConvertToNullAwareTest extends BulkFixProcessorTest {
18+
@override
19+
String get lintCode => LintNames.prefer_null_aware_operators;
20+
21+
Future<void> test_singleFile() async {
22+
await resolveTestUnit('''
23+
abstract class A {
24+
int m();
25+
}
26+
int f(A a) => null == a ? null : a.m();
27+
int g(A a) => a == null ? null : a.m();
28+
''');
29+
await assertHasFix('''
30+
abstract class A {
31+
int m();
32+
}
33+
int f(A a) => a?.m();
34+
int g(A a) => a?.m();
35+
''');
36+
}
37+
}

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
@@ -16,6 +16,7 @@ import 'convert_to_generic_function_syntax_test.dart'
1616
import 'convert_to_if_element_test.dart' as convert_to_if_element;
1717
import 'convert_to_if_null_test.dart' as convert_to_if_null;
1818
import 'convert_to_int_literal_test.dart' as convert_to_int_literal;
19+
import 'convert_to_null_aware_test.dart' as convert_to_null_aware;
1920
import 'convert_to_single_quoted_strings_test.dart'
2021
as convert_to_single_quoted_strings;
2122
import 'convert_to_spread_test.dart' as convert_to_spread;
@@ -60,6 +61,7 @@ void main() {
6061
convert_to_if_element.main();
6162
convert_to_if_null.main();
6263
convert_to_int_literal.main();
64+
convert_to_null_aware.main();
6365
convert_to_single_quoted_strings.main();
6466
convert_to_spread.main();
6567
convert_to_where_type.main();

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ class ConvertToSingleQuotedStringTest extends FixProcessorLintTest {
2323
@override
2424
String get lintCode => LintNames.prefer_single_quotes;
2525

26+
Future<void> test_one_interpolation() async {
27+
await resolveTestUnit(r'''
28+
main() {
29+
var b = 'b';
30+
var c = 'c';
31+
print("a $b-${c} d");
32+
}
33+
''');
34+
await assertHasFix(r'''
35+
main() {
36+
var b = 'b';
37+
var c = 'c';
38+
print('a $b-${c} d');
39+
}
40+
''');
41+
}
42+
2643
/// More coverage in the `convert_to_single_quoted_string_test.dart` assist test.
2744
Future<void> test_one_simple() async {
2845
await resolveTestUnit('''

0 commit comments

Comments
 (0)