Version 2.17.0-60.0.dev
Merge commit 'b979f797f3e676f113bf760463f5728f33bd0b75' into 'dev'
diff --git a/DEPS b/DEPS
index b448946..a59dfd6 100644
--- a/DEPS
+++ b/DEPS
@@ -129,7 +129,7 @@
"logging_rev": "575781ef196e4fed4fb737e38fb4b73d62727187",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
"markdown_rev": "7479783f0493f6717e1d7ae31cb37d39a91026b2",
- "matcher_rev": "6ba4a6d68bdfacff3d572c9ea98333dfc66fd6bf",
+ "matcher_rev": "07595a7739d47a8315caba5a8e58fb9ae3d81261",
"mime_rev": "c931f4bed87221beaece356494b43731445ce7b8",
"mockito_rev": "d39ac507483b9891165e422ec98d9fb480037c8b",
"oauth2_rev": "7cd3284049fe5badbec9f2bea2afc41d14c01057",
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_leading_newline_to_string.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_leading_newline_to_string.dart
new file mode 100644
index 0000000..d078389
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_leading_newline_to_string.dart
@@ -0,0 +1,38 @@
+// 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.
+
+import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+
+class AddLeadingNewlineToString extends CorrectionProducer {
+ @override
+ bool get canBeAppliedInBulk => true;
+
+ @override
+ bool get canBeAppliedToFile => true;
+
+ @override
+ FixKind get fixKind => DartFixKind.ADD_LEADING_NEWLINE_TO_STRING;
+
+ @override
+ FixKind get multiFixKind => DartFixKind.ADD_LEADING_NEWLINE_TO_STRING_MULTI;
+
+ @override
+ Future<void> compute(ChangeBuilder builder) async {
+ var stringLiteral = coveredNode;
+ if (stringLiteral is! SimpleStringLiteral) {
+ return;
+ }
+
+ await builder.addDartFileEdit(file, (builder) {
+ builder.addSimpleInsertion(stringLiteral.contentsOffset, eol);
+ });
+ }
+
+ /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
+ static AddLeadingNewlineToString newInstance() => AddLeadingNewlineToString();
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index d1778fb..b4fb0b2 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -143,6 +143,16 @@
DartFixKindPriority.DEFAULT,
"Add 'late' modifier",
);
+ static const ADD_LEADING_NEWLINE_TO_STRING = FixKind(
+ 'dart.fix.add.leadingNewlineToString',
+ DartFixKindPriority.DEFAULT,
+ 'Add leading new line',
+ );
+ static const ADD_LEADING_NEWLINE_TO_STRING_MULTI = FixKind(
+ 'dart.fix.add.leadingNewlineToString.multi',
+ DartFixKindPriority.DEFAULT,
+ 'Add leading new line everywhere in file',
+ );
static const ADD_MISSING_ENUM_CASE_CLAUSES = FixKind(
'dart.fix.add.missingEnumCaseClauses',
DartFixKindPriority.DEFAULT,
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 0a0a125..17c749b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -15,6 +15,7 @@
import 'package:analysis_server/src/services/correction/dart/add_field_formal_parameters.dart';
import 'package:analysis_server/src/services/correction/dart/add_key_to_constructors.dart';
import 'package:analysis_server/src/services/correction/dart/add_late.dart';
+import 'package:analysis_server/src/services/correction/dart/add_leading_newline_to_string.dart';
import 'package:analysis_server/src/services/correction/dart/add_missing_enum_case_clauses.dart';
import 'package:analysis_server/src/services/correction/dart/add_missing_enum_like_case_clauses.dart';
import 'package:analysis_server/src/services/correction/dart/add_missing_parameter.dart';
@@ -436,6 +437,9 @@
LintNames.hash_and_equals: [
CreateMethod.equalsOrHashCode,
],
+ LintNames.leading_newlines_in_multiline_strings: [
+ AddLeadingNewlineToString.newInstance,
+ ],
LintNames.no_duplicate_case_values: [
RemoveDuplicateCase.newInstance,
],
diff --git a/pkg/analysis_server/lib/src/services/linter/lint_names.dart b/pkg/analysis_server/lib/src/services/linter/lint_names.dart
index 52aee05..adc6a91 100644
--- a/pkg/analysis_server/lib/src/services/linter/lint_names.dart
+++ b/pkg/analysis_server/lib/src/services/linter/lint_names.dart
@@ -54,6 +54,8 @@
static const String eol_at_end_of_file = 'eol_at_end_of_file';
static const String exhaustive_cases = 'exhaustive_cases';
static const String hash_and_equals = 'hash_and_equals';
+ static const String leading_newlines_in_multiline_strings =
+ 'leading_newlines_in_multiline_strings';
static const String no_duplicate_case_values = 'no_duplicate_case_values';
static const String non_constant_identifier_names =
'non_constant_identifier_names';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_leading_newline_to_string_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_leading_newline_to_string_test.dart
new file mode 100644
index 0000000..81d9313
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_leading_newline_to_string_test.dart
@@ -0,0 +1,86 @@
+// 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.
+
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'fix_processor.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(AddLeadingNewlineToStringBulkTest);
+ defineReflectiveTests(AddLeadingNewlineToStringTest);
+ });
+}
+
+@reflectiveTest
+class AddLeadingNewlineToStringBulkTest extends BulkFixProcessorTest {
+ @override
+ String get lintCode => LintNames.leading_newlines_in_multiline_strings;
+
+ Future<void> test_three_fixes() async {
+ await resolveTestCode('''
+var s1 = \'''{
+ "a": 1,
+ "b": 2
+}\''';
+
+var s2 = \'''{
+ "c": 3,
+ "d": 4
+}\''';
+
+var s3 = \'''{
+ "e": 5,
+ "f": 6
+}\''';
+''');
+ await assertHasFix('''
+var s1 = \'''
+{
+ "a": 1,
+ "b": 2
+}\''';
+
+var s2 = \'''
+{
+ "c": 3,
+ "d": 4
+}\''';
+
+var s3 = \'''
+{
+ "e": 5,
+ "f": 6
+}\''';
+''');
+ }
+}
+
+@reflectiveTest
+class AddLeadingNewlineToStringTest extends FixProcessorLintTest {
+ @override
+ FixKind get kind => DartFixKind.ADD_LEADING_NEWLINE_TO_STRING;
+
+ @override
+ String get lintCode => LintNames.leading_newlines_in_multiline_strings;
+
+ Future<void> test_one_fix() async {
+ await resolveTestCode('''
+var s1 = \'''{
+ "a": 1,
+ "b": 2
+}\''';
+''');
+ await assertHasFix('''
+var s1 = \'''
+{
+ "a": 1,
+ "b": 2
+}\''';
+''');
+ }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
index d202946..001e243 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart
@@ -15,6 +15,8 @@
import 'add_field_formal_parameters_test.dart' as add_field_formal_parameters;
import 'add_key_to_constructors_test.dart' as add_key_to_constructors;
import 'add_late_test.dart' as add_late;
+import 'add_leading_newline_to_string_test.dart'
+ as add_leading_newline_to_string;
import 'add_missing_enum_case_clauses_test.dart'
as add_missing_enum_case_clauses;
import 'add_missing_enum_like_case_clauses_test.dart'
@@ -228,6 +230,7 @@
add_field_formal_parameters.main();
add_key_to_constructors.main();
add_late.main();
+ add_leading_newline_to_string.main();
add_missing_enum_case_clauses.main();
add_missing_enum_like_case_clauses.main();
add_missing_parameter_named.main();
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index ae8a33d..ee40393 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -365,7 +365,7 @@
static const bool constant_update_2018 = true;
/// Expiration status of the experiment "constructor-tearoffs"
- static const bool constructor_tearoffs = false;
+ static const bool constructor_tearoffs = true;
/// Expiration status of the experiment "control-flow-collections"
static const bool control_flow_collections = true;
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index b1d7dd6..0966306 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2680,7 +2680,7 @@
<InterfaceType>[...interfaces, supertype];
List<FieldElement> get constants {
- return fields.where((field) => !field.isSynthetic).toList();
+ return fields.where((field) => field.isEnumConstant).toList();
}
@override
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index f405a77..1a8f894 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -127,7 +127,7 @@
ExperimentalFlag.alternativeInvalidationStrategy: false,
ExperimentalFlag.constFunctions: false,
ExperimentalFlag.constantUpdate2018: true,
- ExperimentalFlag.constructorTearoffs: false,
+ ExperimentalFlag.constructorTearoffs: true,
ExperimentalFlag.controlFlowCollections: true,
ExperimentalFlag.enhancedEnums: false,
ExperimentalFlag.extensionMethods: true,
diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc
index 476ad6b..f10cdd7 100644
--- a/runtime/vm/heap/pages.cc
+++ b/runtime/vm/heap/pages.cc
@@ -1330,14 +1330,11 @@
if (words_to_end == 0) {
size = page->memory_->size();
page->Deallocate();
- } else {
- TruncateLargePage(page, words_to_end << kWordSizeLog2);
- }
- ml.Lock();
-
- if (words_to_end == 0) {
+ ml.Lock();
IncreaseCapacityInWordsLocked(-(size >> kWordSizeLog2));
} else {
+ TruncateLargePage(page, words_to_end << kWordSizeLog2);
+ ml.Lock();
AddLargePageLocked(page);
}
}
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 9a9f029..33e2611 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -14000,6 +14000,7 @@
* * [Fullscreen specification](http://www.w3.org/TR/fullscreen/) from W3C.
*/
@SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.SAFARI)
Future<void> requestFullscreen([Map? options]) {
var retValue;
diff --git a/sdk/lib/typed_data/typed_data.dart b/sdk/lib/typed_data/typed_data.dart
index 5d07d41..2a67153 100644
--- a/sdk/lib/typed_data/typed_data.dart
+++ b/sdk/lib/typed_data/typed_data.dart
@@ -82,7 +82,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 16-bit aligned,
- /// and contains [length] 16-bit integers.
+ /// and contains [length] 16-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not even, the last byte can't be part of the view.
@@ -103,7 +104,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 16-bit aligned,
- /// and contains [length] 16-bit integers.
+ /// and contains [length] 16-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not even, the last byte can't be part of the view.
@@ -124,7 +126,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 32-bit aligned,
- /// and contains [length] 32-bit integers.
+ /// and contains [length] 32-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by four, the last bytes can't be part
@@ -146,7 +149,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 32-bit aligned,
- /// and contains [length] 32-bit integers.
+ /// and contains [length] 32-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by four, the last bytes can't be part
@@ -168,7 +172,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 64-bit aligned,
- /// and contains [length] 64-bit integers.
+ /// and contains [length] 64-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by eight, the last bytes can't be part
@@ -190,7 +195,8 @@
/// and vice versa.
///
/// The viewed region start at [offsetInBytes], which must be 64-bit aligned,
- /// and contains [length] 64-bit integers.
+ /// and contains [length] 64-bit integers with
+ /// the same endianness as the host ([Endian.host]).
/// If [length] is omitted, the range extends as far towards the end of
/// the buffer as possible -
/// if [lengthInBytes] is not divisible by eight, the last bytes can't be part
diff --git a/tools/VERSION b/tools/VERSION
index 58a38b3..206390c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 59
+PRERELEASE 60
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 6f5d05c..a0ce567 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -1595,6 +1595,7 @@
* * [Fullscreen specification](http://www.w3.org/TR/fullscreen/) from W3C.
*/
@SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.SAFARI)
Future<void> requestFullscreen([Map? options]) {
var retValue;
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index d4c4bb8..3483305 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -224,3 +224,4 @@
var c = A.new;
c();
}
+ expired: true