Index: pkg/analysis_server/test/services/correction/fix_test.dart |
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart |
index 14f2fc8811e317029f828a76b90c4914250ce2df..3a8c20cd20fb7e5665a0270dec991f9403ad2ecb 100644 |
--- a/pkg/analysis_server/test/services/correction/fix_test.dart |
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
@@ -398,6 +398,51 @@ main() { |
'''); |
} |
+ void test_canBeNullAfterNullAware_chain() { |
+ resolveTestUnit(''' |
+main(x) { |
+ x?.a.b.c; |
+} |
+'''); |
+ assertHasFix( |
+ DartFixKind.REPLACE_WITH_NULL_AWARE, |
+ ''' |
+main(x) { |
+ x?.a?.b?.c; |
+} |
+'''); |
+ } |
+ |
+ void test_canBeNullAfterNullAware_methodInvocation() { |
+ resolveTestUnit(''' |
+main(x) { |
+ x?.a.b(); |
+} |
+'''); |
+ assertHasFix( |
+ DartFixKind.REPLACE_WITH_NULL_AWARE, |
+ ''' |
+main(x) { |
+ x?.a?.b(); |
+} |
+'''); |
+ } |
+ |
+ void test_canBeNullAfterNullAware_propertyAccess() { |
+ resolveTestUnit(''' |
+main(x) { |
+ x?.a().b; |
+} |
+'''); |
+ assertHasFix( |
+ DartFixKind.REPLACE_WITH_NULL_AWARE, |
+ ''' |
+main(x) { |
+ x?.a()?.b; |
+} |
+'''); |
+ } |
+ |
void test_changeToStaticAccess_method() { |
resolveTestUnit(''' |
class A { |