Version 2.17.0-157.0.dev
Merge commit '27dbfdd6b41f0f8d9c89bb45de37d3ac8a5f7eb3' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
index c42e69b..289767c 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
@@ -55,9 +55,11 @@
}
} else if (element is ParameterElement) {
if (!element.isNamed) {
- var root = node.thisOrAncestorMatching((node) =>
- node.parent is ClassOrMixinDeclaration ||
- node.parent is CompilationUnit);
+ var root = node
+ .thisOrAncestorMatching((node) =>
+ node.parent is FunctionDeclaration ||
+ node.parent is MethodDeclaration)
+ ?.parent;
if (root != null) {
references = findLocalElementReferences(root, element);
}
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 9b4af58..d58a335 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -1536,7 +1536,7 @@
LintNames.curly_braces_in_flow_control_structures:
status: hasFix
LintNames.depend_on_referenced_packages:
- status: needsEvaluation
+ status: needsFix
LintNames.deprecated_consistency:
status: needsEvaluation
LintNames.diagnostic_describe_all_properties:
@@ -1592,9 +1592,9 @@
LintNames.no_duplicate_case_values:
status: hasFix
LintNames.no_leading_underscores_for_library_prefixes:
- status: needsEvaluation
+ status: needsFix
LintNames.no_leading_underscores_for_local_identifiers:
- status: needsEvaluation
+ status: hasFix
LintNames.no_logic_in_create_state:
status: needsEvaluation
LintNames.no_runtimeType_toString:
@@ -1604,7 +1604,14 @@
LintNames.noop_primitive_operations:
status: needsEvaluation
LintNames.null_check_on_nullable_type_parameter:
- status: needsEvaluation
+ status: hasFix
+ notes: |-
+ A second fix is possible, in which we make the type parameter not
+ potentially nullable, something like changing `T foo<T>()` to
+ `T foo<T extends Object>()` and `T foo<T extends num?>()` to
+ `T foo<T extends num>()`. This is particularly valuable in the first
+ case, where the choice to implicitly bound the type to `dynamic` may not
+ have been intentional.
LintNames.null_closures:
status: hasFix
LintNames.omit_local_variable_types:
@@ -1759,11 +1766,11 @@
LintNames.unnecessary_lambdas:
status: hasFix
LintNames.unnecessary_late:
- status: needsEvaluation
+ status: needsFix
LintNames.unnecessary_new:
status: hasFix
LintNames.unnecessary_null_aware_assignments:
- status: needsEvaluation
+ status: needsFix
LintNames.unnecessary_null_checks:
status: needsEvaluation
LintNames.unnecessary_null_in_if_null_operators:
diff --git a/pkg/analysis_server/lib/src/services/correction/sort_members.dart b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
index d257984..7fdb383 100644
--- a/pkg/analysis_server/lib/src/services/correction/sort_members.dart
+++ b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
@@ -95,6 +95,8 @@
for (var unitMember in unit.declarations) {
if (unitMember is ClassOrMixinDeclaration) {
_sortClassMembers(unitMember.members);
+ } else if (unitMember is EnumDeclaration) {
+ _sortClassMembers(unitMember.members);
} else if (unitMember is ExtensionDeclaration) {
_sortClassMembers(unitMember.members);
}
diff --git a/pkg/analysis_server/test/services/correction/sort_members_test.dart b/pkg/analysis_server/test/services/correction/sort_members_test.dart
index 87042b0..5e7fb27 100644
--- a/pkg/analysis_server/test/services/correction/sort_members_test.dart
+++ b/pkg/analysis_server/test/services/correction/sort_members_test.dart
@@ -585,6 +585,156 @@
''');
}
+ Future<void> test_enum_accessor() async {
+ await _parseTestUnit(r'''
+enum E {
+ v;
+ set c(x) {}
+ set a(x) {}
+ get a => null;
+ get b => null;
+ set b(x) {}
+ get c => null;
+}
+''');
+ // validate change
+ _assertSort(r'''
+enum E {
+ v;
+ get a => null;
+ set a(x) {}
+ get b => null;
+ set b(x) {}
+ get c => null;
+ set c(x) {}
+}
+''');
+ }
+
+ Future<void> test_enum_accessor_static() async {
+ await _parseTestUnit(r'''
+enum E {
+ v;
+ get a => null;
+ set a(x) {}
+ static get b => null;
+ static set b(x) {}
+}
+''');
+ // validate change
+ _assertSort(r'''
+enum E {
+ v;
+ static get b => null;
+ static set b(x) {}
+ get a => null;
+ set a(x) {}
+}
+''');
+ }
+
+ Future<void> test_enum_field_static() async {
+ await _parseTestUnit(r'''
+enum E {
+ v;
+ int b;
+ int a;
+ static int d;
+ static int c;
+}
+''');
+ // validate change
+ _assertSort(r'''
+enum E {
+ v;
+ static int d;
+ static int c;
+ int b;
+ int a;
+}
+''');
+ }
+
+ Future<void> test_enum_method() async {
+ await _parseTestUnit(r'''
+enum E {
+ v;
+ c() {}
+ a() {}
+ b() {}
+}
+''');
+ // validate change
+ _assertSort(r'''
+enum E {
+ v;
+ a() {}
+ b() {}
+ c() {}
+}
+''');
+ }
+
+ Future<void> test_enum_method_emptyLine() async {
+ await _parseTestUnit(r'''
+enum E {
+ v;
+
+ b() {}
+
+ a() {}
+}
+''');
+ // validate change
+ _assertSort(r'''
+enum E {
+ v;
+
+ a() {}
+
+ b() {}
+}
+''');
+ }
+
+ Future<void> test_enum_method_ignoreCase() async {
+ await _parseTestUnit(r'''
+enum E {
+ v;
+ m_C() {}
+ m_a() {}
+ m_B() {}
+}
+''');
+ // validate change
+ _assertSort(r'''
+enum E {
+ v;
+ m_a() {}
+ m_B() {}
+ m_C() {}
+}
+''');
+ }
+
+ Future<void> test_enum_method_static() async {
+ await _parseTestUnit(r'''
+enum E {
+ v;
+ static a() {}
+ b() {}
+}
+''');
+ // validate change
+ _assertSort(r'''
+enum E {
+ v;
+ b() {}
+ static a() {}
+}
+''');
+ }
+
Future<void> test_extension_accessor() async {
await _parseTestUnit(r'''
extension E on int {
diff --git a/sdk/lib/_internal/vm/bin/sync_socket_patch.dart b/sdk/lib/_internal/vm/bin/sync_socket_patch.dart
index 708a1e7..beff01e 100644
--- a/sdk/lib/_internal/vm/bin/sync_socket_patch.dart
+++ b/sdk/lib/_internal/vm/bin/sync_socket_patch.dart
@@ -307,9 +307,9 @@
@pragma("vm:external-name", "SynchronousSocket_CloseSync")
external _nativeCloseSync();
@pragma("vm:external-name", "SynchronousSocket_GetPort")
- external int _nativeGetPort();
+ external _nativeGetPort();
@pragma("vm:external-name", "SynchronousSocket_GetRemotePeer")
- external List _nativeGetRemotePeer();
+ external _nativeGetRemotePeer();
@pragma("vm:external-name", "SynchronousSocket_Read")
external _nativeRead(int len);
@pragma("vm:external-name", "SynchronousSocket_ReadList")
diff --git a/tools/VERSION b/tools/VERSION
index 2401c9d..5516267 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 156
+PRERELEASE 157
PRERELEASE_PATCH 0
\ No newline at end of file