Version 2.17.0-39.0.dev
Merge commit '2da95997c348449bc9c449b3a620303557470907' into 'dev'
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart
index 3be8c02..b7e793b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart
@@ -29,11 +29,9 @@
new A(1, b: 2, named: 3.0);
}
''');
- // TODO(brianwilkerson) The fix should make added named parameters be
- // `required`. I'm leaving it as is to match the current behavior.
await assertHasFix('''
class A {
- A(int a, {int b = 0, double named}) {}
+ A(int a, {int b = 0, required double named}) {}
}
main() {
@@ -54,7 +52,7 @@
''');
await assertHasFix('''
class A {
- A(int a, {double named}) {}
+ A(int a, {required double named}) {}
}
main() {
@@ -75,7 +73,7 @@
''');
await assertHasFix('''
class A {
- A({int named}) {}
+ A({required int named}) {}
}
main() {
@@ -96,7 +94,7 @@
''');
await assertHasFix('''
class A {
- A.aaa({int named}) {}
+ A.aaa({required int named}) {}
}
main() {
@@ -114,7 +112,7 @@
}
''');
await assertHasFix('''
-test(int a, {int b: 0, double named}) {}
+test(int a, {int b: 0, required double named}) {}
main() {
test(1, b: 2, named: 3.0);
@@ -131,7 +129,7 @@
}
''');
await assertHasFix('''
-test(int a, {double named}) {}
+test(int a, {required double named}) {}
main() {
test(1, named: 2.0);
@@ -148,7 +146,7 @@
}
''');
await assertHasFix('''
-test({int named}) {}
+test({required int named}) {}
main() {
test(named: 42);
@@ -168,7 +166,7 @@
''');
await assertHasFix('''
class A {
- test(int a, {int b: 0, double named}) {}
+ test(int a, {int b: 0, required double named}) {}
main() {
test(1, b: 2, named: 3.0);
@@ -202,7 +200,7 @@
''');
await assertHasFix('''
class A {
- test(int a, {double named}) {}
+ test(int a, {required double named}) {}
main() {
test(1, named: 2.0);
@@ -223,7 +221,7 @@
''');
await assertHasFix('''
class A {
- test({int named}) {}
+ test({required int named}) {}
main() {
test(named: 42);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
index dbfcc51..5f54e50 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
@@ -415,17 +415,21 @@
await resolveTestCode('''
class A {
void f() {
- myUndefinedMethod(0, bbb: 1.0, ccc: '2');
+ var c = '2';
+ int? d;
+ myUndefinedMethod(0, bbb: 1.0, ccc: c, ddd: d);
}
}
''');
await assertHasFix('''
class A {
void f() {
- myUndefinedMethod(0, bbb: 1.0, ccc: '2');
+ var c = '2';
+ int? d;
+ myUndefinedMethod(0, bbb: 1.0, ccc: c, ddd: d);
}
- void myUndefinedMethod(int i, {double bbb, String ccc}) {}
+ void myUndefinedMethod(int i, {required double bbb, required String ccc, int? ddd}) {}
}
''');
// linked positions
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
index 23110a9..24a549e 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
@@ -578,9 +578,15 @@
Expression argument, int index, Set<String> usedNames) {
// append type name
var type = argument.staticType;
+ var library = dartFileEditBuilder.resolvedUnit.libraryElement;
if (type == null || type.isBottom || type.isDartCoreNull) {
type = DynamicTypeImpl.instance;
}
+ if (argument is NamedExpression &&
+ library.isNonNullableByDefault &&
+ type.nullabilitySuffix == NullabilitySuffix.none) {
+ write('required ');
+ }
if (writeType(type, addSupertypeProposals: true, groupName: 'TYPE$index')) {
write(' ');
}
diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
index 481147a..c7211d4 100644
--- a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
@@ -1145,7 +1145,10 @@
});
});
var edit = getEdit(builder);
- expect(edit.replacement, equalsIgnoringWhitespace('String s, {int index}'));
+ var expectedReplacement = this is WithoutNullSafetyMixin
+ ? 'String s, {int index}'
+ : 'String s, {required int index}';
+ expect(edit.replacement, equalsIgnoringWhitespace(expectedReplacement));
}
Future<void> test_writeParametersMatchingArguments_required() async {
diff --git a/sdk/lib/_internal/vm/lib/expando_patch.dart b/sdk/lib/_internal/vm/lib/expando_patch.dart
index a8a4be4..882231f 100644
--- a/sdk/lib/_internal/vm/lib/expando_patch.dart
+++ b/sdk/lib/_internal/vm/lib/expando_patch.dart
@@ -170,10 +170,7 @@
@patch
class WeakReference<T extends Object> {
@patch
- factory WeakReference(T object) {
- final weakProperty = _WeakProperty()..key = object;
- return _WeakReferenceImpl<T>(weakProperty);
- }
+ factory WeakReference(T object) = _WeakReferenceImpl<T>;
}
class _WeakReferenceImpl<T extends Object> implements WeakReference<T> {
@@ -181,9 +178,9 @@
// instead of reusing WeakProperty.
final _WeakProperty _weakProperty;
- _WeakReferenceImpl(this._weakProperty);
+ _WeakReferenceImpl(T object) : _weakProperty = _WeakProperty()..key = object;
- T? get target => _weakProperty.key as T?;
+ T? get target => unsafeCast<T?>(_weakProperty.key);
}
@patch
diff --git a/sdk/lib/convert/convert.dart b/sdk/lib/convert/convert.dart
index de5aa6f..9f9bfa6 100644
--- a/sdk/lib/convert/convert.dart
+++ b/sdk/lib/convert/convert.dart
@@ -2,13 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-///
/// Encoders and decoders for converting between different data representations,
/// including JSON and UTF-8.
///
/// In addition to converters for common data representations, this library
-/// provides support for implementing converters in a way which makes them easy to
-/// chain and to use with streams.
+/// provides support for implementing converters in a way which makes them easy
+/// to chain and to use with streams.
///
/// To use this library in your code:
/// ```dart
@@ -17,21 +16,91 @@
/// Two commonly used converters are the top-level instances of
/// [JsonCodec] and [Utf8Codec], named [json] and [utf8], respectively.
///
-/// JSON is a simple text format for representing
-/// structured objects and collections.
-/// The JSON encoder/decoder transforms between strings and
+/// ## JSON
+/// JSON is a simple text format for representing structured objects and
+/// collections.
+///
+/// A [JsonCodec] encodes JSON objects to strings and decodes strings to
+/// JSON objects. The [json] encoder/decoder transforms between strings and
/// object structures, such as lists and maps, using the JSON format.
///
-/// UTF-8 is a common variable-width encoding that can represent
-/// every character in the Unicode character set.
-/// The UTF-8 encoder/decoder transforms between Strings and bytes.
+/// The [json] is the default implementation of [JsonCodec].
///
+/// Examples
+/// ```dart
+/// var encoded = json.encode([1, 2, { "a": null }]);
+/// var decoded = json.decode('["foo", { "bar": 499 }]');
+/// ```
+/// For more information, see also [JsonEncoder] and [JsonDecoder].
+///
+/// ## UTF-8
+/// A [Utf8Codec] encodes strings to UTF-8 code units (bytes) and decodes
+/// UTF-8 code units to strings.
+///
+/// The [utf8] is the default implementation of [Utf8Codec].
+///
+/// Example:
+/// ```dart
+/// var encoded = utf8.encode('Îñţérñåţîöñåļîžåţîờñ');
+/// var decoded = utf8.decode([
+/// 195, 142, 195, 177, 197, 163, 195, 169, 114, 195, 177, 195, 165, 197,
+/// 163, 195, 174, 195, 182, 195, 177, 195, 165, 196, 188, 195, 174, 197,
+/// 190, 195, 165, 197, 163, 195, 174, 225, 187, 157, 195, 177]);
+/// ```
+/// For more information, see also [Utf8Encoder] and [Utf8Decoder].
+///
+/// ## ASCII
+/// An [AsciiCodec] encodes strings as ASCII codes stored as bytes and decodes
+/// ASCII bytes to strings. Not all characters can be represented as ASCII, so
+/// not all strings can be successfully converted.
+///
+/// The [ascii] is the default implementation of [AsciiCodec].
+///
+/// Example:
+/// ```dart
+/// var encoded = ascii.encode('This is ASCII!');
+/// var decoded = ascii.decode([0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73,
+/// 0x20, 0x41, 0x53, 0x43, 0x49, 0x49, 0x21]);
+/// ```
+/// For more information, see also [AsciiEncoder] and [AsciiDecoder].
+///
+/// ## Latin-1
+/// A [Latin1Codec] encodes strings to ISO Latin-1 (aka ISO-8859-1) bytes
+/// and decodes Latin-1 bytes to strings. Not all characters can be represented
+/// as Latin-1, so not all strings can be successfully converted.
+///
+/// The [latin1] is the default implementation of [Latin1Codec].
+///
+/// Example:
+/// ```dart
+/// var encoded = latin1.encode('blåbærgrød');
+/// var decoded = latin1.decode([0x62, 0x6c, 0xe5, 0x62, 0xe6,
+/// 0x72, 0x67, 0x72, 0xf8, 0x64]);
+/// ```
+/// For more information, see also [Latin1Encoder] and [Latin1Decoder].
+///
+/// ## Base64
+/// A [Base64Codec] encodes bytes using the default base64 alphabet,
+/// decodes using both the base64 and base64url alphabets,
+/// does not allow invalid characters and requires padding.
+///
+/// The [base64] is the default implementation of [Base64Codec].
+///
+/// Example:
+/// ```dart
+/// var encoded = base64.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
+/// 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
+/// var decoded = base64.decode('YmzDpWLDpnJncsO4ZAo=');
+/// ```
+/// For more information, see also [Base64Encoder] and [Base64Decoder].
+///
+/// ## Converters
/// Converters are often used with streams
/// to transform the data that comes through the stream
/// as it becomes available.
/// The following code uses two converters.
/// The first is a UTF-8 decoder, which converts the data from bytes to UTF-8
-/// as it's read from a file,
+/// as it is read from a file,
/// The second is an instance of [LineSplitter],
/// which splits the data on newline boundaries.
/// ```dart import:io
@@ -51,6 +120,45 @@
/// See the documentation for the [Codec] and [Converter] classes
/// for information about creating your own converters.
///
+/// ## HTML Escape
+/// [HtmlEscape] converter escapes characters with special meaning in HTML.
+/// The converter finds characters that are significant in HTML source and
+/// replaces them with corresponding HTML entities.
+///
+/// Custom escape modes can be created using the [HtmlEscapeMode.HtmlEscapeMode]
+/// constructor.
+///
+/// Example:
+/// ```dart
+/// const htmlEscapeMode = HtmlEscapeMode(
+/// name: 'custom',
+/// escapeLtGt: true,
+/// escapeQuot: false,
+/// escapeApos: false,
+/// escapeSlash: false,
+/// );
+///
+/// const HtmlEscape htmlEscape = HtmlEscape(htmlEscapeMode);
+/// String unescaped = 'Text & subject';
+/// String escaped = htmlEscape.convert(unescaped);
+/// print(escaped); // Text & subject
+///
+/// unescaped = '10 > 1 and 1 < 10';
+/// escaped = htmlEscape.convert(unescaped);
+/// print(escaped); // 10 > 1 and 1 < 10
+///
+/// unescaped = "Single-quoted: 'text'";
+/// escaped = htmlEscape.convert(unescaped);
+/// print(escaped); // Single-quoted: 'text'
+///
+/// unescaped = 'Double-quoted: "text"';
+/// escaped = htmlEscape.convert(unescaped);
+/// print(escaped); // Double-quoted: "text"
+///
+/// unescaped = 'Path: /system/';
+/// escaped = htmlEscape.convert(unescaped);
+/// print(escaped); // Path: /system/
+/// ```
/// {@category Core}
library dart.convert;
diff --git a/tests/web/native/dart2js_native.status b/tests/web/native/dart2js_native.status
deleted file mode 100644
index fd86b1b..0000000
--- a/tests/web/native/dart2js_native.status
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-[ $browser ]
-*: Skip
-
diff --git a/tests/web/dart2js.status b/tests/web/web.status
similarity index 95%
rename from tests/web/dart2js.status
rename to tests/web/web.status
index 9faa92a..481ba3d 100644
--- a/tests/web/dart2js.status
+++ b/tests/web/web.status
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
@@ -8,6 +8,9 @@
[ $runtime == jsshell ]
deferred/load_in_correct_order_test: SkipByDesign # jsshell preamble does not support this test.
+[ $browser ]
+native/*: Skip
+
[ $compiler == dart2js && $mode == debug ]
operator_test: Skip
string_interpolation_test: Skip
diff --git a/tests/web_2/dart2js_2.status b/tests/web_2/dart2js_2.status
deleted file mode 100644
index 9faa92a..0000000
--- a/tests/web_2/dart2js_2.status
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-[ $compiler != dart2js ]
-dummy_compiler_test: SkipByDesign # Issue 30773. Test should be migrated as a unit test of dart2js, is only intended to test self-hosting.
-
-[ $runtime == jsshell ]
-deferred/load_in_correct_order_test: SkipByDesign # jsshell preamble does not support this test.
-
-[ $compiler == dart2js && $mode == debug ]
-operator_test: Skip
-string_interpolation_test: Skip
-
-[ $compiler == dart2js && $runtime == chrome && $system == windows ]
-class_test: Slow, Pass # Issue 25940
-closure_capture3_test: Slow, Pass # Issue 25940
-closure_capture5_test: Slow, Pass # Issue 25940
-conditional_test: Slow, Pass # Issue 25940
-consistent_codeUnitAt_error_test: Slow, Pass # Issue 25940
-constant_javascript_semantics2_test: Slow, Pass # Issue 25940
-deferred_split_test: Slow, Pass # Issue 25940
-
-[ $compiler == dart2js && $runtime == chrome && $csp ]
-deferred/load_in_correct_order_test: SkipByDesign # Purposely uses `eval`
-
-[ $compiler == dart2js && $runtime == ff && $system == windows ]
-consistent_index_error_string_test: Slow, Pass # Issue 25940
-
-[ $compiler == dart2js && $csp ]
-deferred_custom_loader_test: SkipByDesign # Issue 25683
-deferred_fail_and_retry_test: SkipByDesign # Uses eval to simulate failed loading.
-
-[ $compiler == dart2js && !$host_checked ]
-dummy_compiler_test: Slow, Pass # Issue 32439. self-hosting doesn't work with CFE yet.
-
-[ $compiler == dart2js && $minified ]
-code_motion_exception_test: Skip # Requires unminified operator names.
-
-[ $compiler == dart2js && ($runtime == ff || $runtime == jsshell || $runtime == safari) ]
-code_motion_exception_test: Skip # Required V8 specific format of JavaScript errors.
-
-[ $compiler == dart2js && ($browser || $host_checked) ]
-dummy_compiler_test: SkipByDesign # Issue 30773. Test should be migrated as a unit test of dart2js, is only intended to test self-hosting.
-
-[ $compiler == none && $runtime == vm ]
-new_from_env_test: SkipByDesign # dart2js only test
-unconditional_dartio_import_test: SkipByDesign # dart2js only test
diff --git a/tests/web_2/native/dart2js_native.status b/tests/web_2/native/dart2js_native.status
deleted file mode 100644
index fd86b1b..0000000
--- a/tests/web_2/native/dart2js_native.status
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-[ $browser ]
-*: Skip
-
diff --git a/tests/web/dart2js.status b/tests/web_2/web_2.status
similarity index 95%
copy from tests/web/dart2js.status
copy to tests/web_2/web_2.status
index 9faa92a..481ba3d 100644
--- a/tests/web/dart2js.status
+++ b/tests/web_2/web_2.status
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
@@ -8,6 +8,9 @@
[ $runtime == jsshell ]
deferred/load_in_correct_order_test: SkipByDesign # jsshell preamble does not support this test.
+[ $browser ]
+native/*: Skip
+
[ $compiler == dart2js && $mode == debug ]
operator_test: Skip
string_interpolation_test: Skip
diff --git a/tools/VERSION b/tools/VERSION
index fc2fee1..af0f4b8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 38
+PRERELEASE 39
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 0400f5d..d638c36 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -3899,21 +3899,50 @@
},
"steps": [
{
- "name": "build dart (aot and jit)",
+ "name": "build dart (x64)",
"script": "tools/build.py",
"arguments": [
"--mode=debug,release",
- "--arch=x64,x64c,simarm64,simarm64c,simriscv32,simriscv64",
+ "--arch=x64,x64c",
"runtime",
"dart_precompiled_runtime"
]
},
{
- "name": "build dart (jit)",
+ "name": "build dart (arm64)",
"script": "tools/build.py",
"arguments": [
"--mode=debug,release",
- "--arch=ia32,simarm",
+ "--arch=simarm64,simarm64c",
+ "runtime",
+ "dart_precompiled_runtime"
+ ]
+ },
+ {
+ "name": "build dart (riscv)",
+ "script": "tools/build.py",
+ "arguments": [
+ "--mode=debug,release",
+ "--arch=simriscv32,simriscv64",
+ "runtime",
+ "dart_precompiled_runtime"
+ ]
+ },
+ {
+ "name": "build dart (ia32)",
+ "script": "tools/build.py",
+ "arguments": [
+ "--mode=debug,release",
+ "--arch=ia32",
+ "runtime"
+ ]
+ },
+ {
+ "name": "build dart (arm)",
+ "script": "tools/build.py",
+ "arguments": [
+ "--mode=debug,release",
+ "--arch=simarm",
"runtime"
]
},