File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed
lib/src/services/correction
test/src/services/correction/fix Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change @@ -1404,6 +1404,15 @@ final _builtInNonLintMultiGenerators = {
14041404 CreateMixin .new ,
14051405 ImportLibrary .forType,
14061406 ],
1407+ CompileTimeErrorCode .UNCHECKED_METHOD_INVOCATION_OF_NULLABLE_VALUE : [
1408+ ImportLibrary .forExtensionMember,
1409+ ],
1410+ CompileTimeErrorCode .UNCHECKED_OPERATOR_INVOCATION_OF_NULLABLE_VALUE : [
1411+ ImportLibrary .forExtensionMember,
1412+ ],
1413+ CompileTimeErrorCode .UNCHECKED_PROPERTY_ACCESS_OF_NULLABLE_VALUE : [
1414+ ImportLibrary .forExtensionMember,
1415+ ],
14071416 CompileTimeErrorCode .UNDEFINED_ANNOTATION : [
14081417 CreateClass .new ,
14091418 ImportLibrary .forTopLevelVariable,
Original file line number Diff line number Diff line change @@ -972,6 +972,66 @@ void f() { new Foo(); }
972972 );
973973 }
974974
975+ Future <void > test_unchecked_methodInvocation () async {
976+ newFile ('$testPackageLibPath /lib.dart' , '''
977+ extension E on Object? {
978+ void m() {}
979+ }
980+ ''' );
981+ await resolveTestCode ('''
982+ void f(Object? o) {
983+ o.m();
984+ }
985+ ''' );
986+ await assertHasFix ('''
987+ import 'package:test/lib.dart';
988+
989+ void f(Object? o) {
990+ o.m();
991+ }
992+ ''' );
993+ }
994+
995+ Future <void > test_unchecked_operatorInvocation () async {
996+ newFile ('$testPackageLibPath /lib.dart' , '''
997+ extension E on Object? {
998+ int operator +(int other) => 0;
999+ }
1000+ ''' );
1001+ await resolveTestCode ('''
1002+ void f(Object? o) {
1003+ o + 1;
1004+ }
1005+ ''' );
1006+ await assertHasFix ('''
1007+ import 'package:test/lib.dart';
1008+
1009+ void f(Object? o) {
1010+ o + 1;
1011+ }
1012+ ''' );
1013+ }
1014+
1015+ Future <void > test_unchecked_propertyAccess () async {
1016+ newFile ('$testPackageLibPath /lib.dart' , '''
1017+ extension E on Object? {
1018+ int get getter => 0;
1019+ }
1020+ ''' );
1021+ await resolveTestCode ('''
1022+ void f(Object? o) {
1023+ o.getter;
1024+ }
1025+ ''' );
1026+ await assertHasFix ('''
1027+ import 'package:test/lib.dart';
1028+
1029+ void f(Object? o) {
1030+ o.getter;
1031+ }
1032+ ''' );
1033+ }
1034+
9751035 Future <void > test_withClass_annotation () async {
9761036 newFile ('$testPackageLibPath /lib.dart' , '''
9771037class Test {
You can’t perform that action at this time.
0 commit comments