Version 3.13.0-11.0.dev Merge e7136d47726fce173af6e63896d6064e15274bf2 into dev
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart index 015222d..f4b40a7 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart
@@ -72,6 +72,15 @@ ); if (root != null) { references = findLocalElementReferences(root, element); + } else { + var declaration = node + .thisOrAncestorOfType<PrimaryConstructorDeclaration>(); + if (declaration != null) { + var body = declaration.body; + if (body != null) { + references = findLocalElementReferences(body, element); + } + } } } } else if (element is LocalElement) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_leading_underscore_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_leading_underscore_test.dart index 18f1c56..fa4c5e2 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/remove_leading_underscore_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/remove_leading_underscore_test.dart
@@ -221,17 +221,17 @@ '''); } - Future<void> test_parameter_constructor() async { + Future<void> test_parameter_constructor_primaryConstructor() async { await resolveTestCode(''' -class A { - A(int _foo) { +class C(int _foo) { + this { print(_foo); } } '''); await assertHasFix(''' -class A { - A(int foo) { +class C(int foo) { + this { print(foo); } } @@ -290,6 +290,23 @@ '''); } + Future<void> test_parameter_secondaryConstructor() async { + await resolveTestCode(''' +class C { + C(int _foo) { + print(_foo); + } +} +'''); + await assertHasFix(''' +class C { + C(int foo) { + print(foo); + } +} +'''); + } + Future<void> test_recordPatternAssignment() async { await resolveTestCode(r''' f() {
diff --git a/tools/VERSION b/tools/VERSION index f7e65c9..a6b208a3 100644 --- a/tools/VERSION +++ b/tools/VERSION
@@ -27,5 +27,5 @@ MAJOR 3 MINOR 13 PATCH 0 -PRERELEASE 10 +PRERELEASE 11 PRERELEASE_PATCH 0