Version 2.14.0-92.0.dev
Merge commit '454e633461138516ea052fe869a793c64cf2e490' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart
index ed84716e..ef03f62 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart
@@ -28,6 +28,10 @@
if (body is! BlockFunctionBody || body.isGenerator) {
return;
}
+ var parent = body.parent;
+ if (parent is ConstructorDeclaration && parent.factoryKeyword == null) {
+ return;
+ }
// prepare return statement
List<Statement> statements = body.block.statements;
if (statements.length != 1) {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
index 6e8152d..739509b 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
@@ -90,7 +90,7 @@
''');
}
- Future<void> test_constructor() async {
+ Future<void> test_constructor_factory() async {
await resolveTestCode('''
class A {
A.named();
@@ -109,6 +109,19 @@
''');
}
+ Future<void> test_constructor_generative() async {
+ await resolveTestCode('''
+class A {
+ int x;
+
+ A() {
+ x = 3;
+ }
+}
+''');
+ await assertNoAssistAt('A()');
+ }
+
Future<void> test_function_onBlock() async {
await resolveTestCode('''
fff() {
diff --git a/tests/web/regress/45943_test.dart b/tests/web/regress/45943_test.dart
new file mode 100644
index 0000000..52315f5
--- /dev/null
+++ b/tests/web/regress/45943_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2021, 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.
+
+class _InspectorOverlayLayer {
+ String selection;
+
+ _InspectorOverlayLayer(this.selection) {
+ bool inDebugMode = false;
+ assert(() {
+ inDebugMode = true;
+ return true;
+ }());
+ if (inDebugMode == false) {
+ throw Error();
+ }
+ }
+}
+
+main() {
+ _InspectorOverlayLayer('hello');
+ _InspectorOverlayLayer('hello');
+}
diff --git a/tests/web_2/regress/45943_test.dart b/tests/web_2/regress/45943_test.dart
new file mode 100644
index 0000000..52315f5
--- /dev/null
+++ b/tests/web_2/regress/45943_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2021, 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.
+
+class _InspectorOverlayLayer {
+ String selection;
+
+ _InspectorOverlayLayer(this.selection) {
+ bool inDebugMode = false;
+ assert(() {
+ inDebugMode = true;
+ return true;
+ }());
+ if (inDebugMode == false) {
+ throw Error();
+ }
+ }
+}
+
+main() {
+ _InspectorOverlayLayer('hello');
+ _InspectorOverlayLayer('hello');
+}
diff --git a/tools/VERSION b/tools/VERSION
index e74acea..c2db219 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 91
+PRERELEASE 92
PRERELEASE_PATCH 0
\ No newline at end of file