Version 2.18.0-31.0.dev
Merge commit '06f5a509821dcc3022f54dbf8d197d9f190b1935' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart b/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart
index e9659b6..8acb906 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart
@@ -219,9 +219,9 @@
}
Future<void> _proposeMethod(ChangeBuilder builder) async {
- if (node.parent is MethodInvocation) {
- var invocation = node.parent as MethodInvocation;
- await _proposeClassOrMixinMember(builder, invocation.realTarget,
+ var parent = node.parent;
+ if (parent is MethodInvocation) {
+ await _proposeClassOrMixinMember(builder, parent.realTarget,
(Element element) => element is MethodElement && !element.isOperator);
}
}
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 494f1ae..ed60cb1 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1087,6 +1087,7 @@
],
CompileTimeErrorCode.UNDEFINED_ENUM_CONSTANT: [
AddEnumConstant.new,
+ ChangeTo.getterOrSetter,
],
CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER: [
ChangeTo.getterOrSetter,
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart
index 7a14be2..d71de37 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart
@@ -143,6 +143,57 @@
''');
}
+ Future<void> test_enum_constant() async {
+ await resolveTestCode('''
+enum E { ONE }
+
+E e() {
+ return E.OEN;
+}
+''');
+ await assertHasFix('''
+enum E { ONE }
+
+E e() {
+ return E.ONE;
+}
+''');
+ }
+
+ Future<void> test_enum_getter() async {
+ await resolveTestCode('''
+enum E { ONE }
+
+void f() {
+ E.ONE.indxe;
+}
+''');
+ await assertHasFix('''
+enum E { ONE }
+
+void f() {
+ E.ONE.index;
+}
+''');
+ }
+
+ Future<void> test_enum_method() async {
+ await resolveTestCode('''
+enum E { ONE }
+
+void f() {
+ E.ONE.toStrong();
+}
+''');
+ await assertHasFix('''
+enum E { ONE }
+
+void f() {
+ E.ONE.toString();
+}
+''');
+ }
+
Future<void> test_function_fromImport() async {
await resolveTestCode('''
void f() {
diff --git a/tools/VERSION b/tools/VERSION
index 6603a76..0459c27 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 30
+PRERELEASE 31
PRERELEASE_PATCH 0
\ No newline at end of file