@@ -4012,23 +4012,10 @@ void repro(){
40124012 await _checkSingleFileChanges (content, expected);
40134013 }
40144014
4015- Future <void > test_late_hint_followed_by_underscore () async {
4016- var content = '''
4017- class _C {}
4018- /*late*/ _C c;
4019- ''' ;
4020- var expected = '''
4021- class _C {}
4022- late _C c;
4023- ''' ;
4024- await _checkSingleFileChanges (content, expected);
4025- }
4026-
4027- Future <void > test_late_hint_instance_field_with_constructor () async {
4015+ Future <void > test_late_final_hint_instance_field_without_constructor () async {
40284016 var content = '''
40294017class C {
4030- C();
4031- /*late*/ int x;
4018+ /*late final*/ int x;
40324019 f() {
40334020 x = 1;
40344021 }
@@ -4037,8 +4024,7 @@ class C {
40374024''' ;
40384025 var expected = '''
40394026class C {
4040- C();
4041- late int x;
4027+ late final int x;
40424028 f() {
40434029 x = 1;
40444030 }
@@ -4048,32 +4034,69 @@ class C {
40484034 await _checkSingleFileChanges (content, expected);
40494035 }
40504036
4051- Future <void > test_late_hint_instance_field_without_constructor () async {
4037+ Future <void > test_late_final_hint_local_variable () async {
40524038 var content = '''
4053- class C {
4054- /*late*/ int x;
4055- f( ) {
4039+ int f(bool b1, bool b2) {
4040+ /*late final */ int x;
4041+ if (b1 ) {
40564042 x = 1;
40574043 }
4058- int g() => x;
4044+ if (b2) {
4045+ return x;
4046+ }
4047+ return 0;
40594048}
40604049''' ;
40614050 var expected = '''
4062- class C {
4063- late int x;
4064- f( ) {
4051+ int f(bool b1, bool b2) {
4052+ late final int x;
4053+ if (b1 ) {
40654054 x = 1;
40664055 }
4067- int g() => x;
4056+ if (b2) {
4057+ return x;
4058+ }
4059+ return 0;
40684060}
40694061''' ;
40704062 await _checkSingleFileChanges (content, expected);
40714063 }
40724064
4073- Future <void > test_late_final_hint_instance_field_without_constructor () async {
4065+ Future <void > test_late_final_hint_top_level_var () async {
4066+ var content = '''
4067+ /*late final*/ int x;
4068+ f() {
4069+ x = 1;
4070+ }
4071+ int g() => x;
4072+ ''' ;
4073+ var expected = '''
4074+ late final int x;
4075+ f() {
4076+ x = 1;
4077+ }
4078+ int g() => x;
4079+ ''' ;
4080+ await _checkSingleFileChanges (content, expected);
4081+ }
4082+
4083+ Future <void > test_late_hint_followed_by_underscore () async {
4084+ var content = '''
4085+ class _C {}
4086+ /*late*/ _C c;
4087+ ''' ;
4088+ var expected = '''
4089+ class _C {}
4090+ late _C c;
4091+ ''' ;
4092+ await _checkSingleFileChanges (content, expected);
4093+ }
4094+
4095+ Future <void > test_late_hint_instance_field_with_constructor () async {
40744096 var content = '''
40754097class C {
4076- /*late final*/ int x;
4098+ C();
4099+ /*late*/ int x;
40774100 f() {
40784101 x = 1;
40794102 }
@@ -4082,7 +4105,8 @@ class C {
40824105''' ;
40834106 var expected = '''
40844107class C {
4085- late final int x;
4108+ C();
4109+ late int x;
40864110 f() {
40874111 x = 1;
40884112 }
@@ -4092,38 +4116,32 @@ class C {
40924116 await _checkSingleFileChanges (content, expected);
40934117 }
40944118
4095- Future <void > test_late_hint_local_variable () async {
4119+ Future <void > test_late_hint_instance_field_without_constructor () async {
40964120 var content = '''
4097- int f(bool b1, bool b2) {
4121+ class C {
40984122 /*late*/ int x;
4099- if (b1 ) {
4123+ f( ) {
41004124 x = 1;
41014125 }
4102- if (b2) {
4103- return x;
4104- }
4105- return 0;
4126+ int g() => x;
41064127}
41074128''' ;
41084129 var expected = '''
4109- int f(bool b1, bool b2) {
4130+ class C {
41104131 late int x;
4111- if (b1 ) {
4132+ f( ) {
41124133 x = 1;
41134134 }
4114- if (b2) {
4115- return x;
4116- }
4117- return 0;
4135+ int g() => x;
41184136}
41194137''' ;
41204138 await _checkSingleFileChanges (content, expected);
41214139 }
41224140
4123- Future <void > test_late_final_hint_local_variable () async {
4141+ Future <void > test_late_hint_local_variable () async {
41244142 var content = '''
41254143int f(bool b1, bool b2) {
4126- /*late final */ int x;
4144+ /*late*/ int x;
41274145 if (b1) {
41284146 x = 1;
41294147 }
@@ -4135,7 +4153,7 @@ int f(bool b1, bool b2) {
41354153''' ;
41364154 var expected = '''
41374155int f(bool b1, bool b2) {
4138- late final int x;
4156+ late int x;
41394157 if (b1) {
41404158 x = 1;
41414159 }
@@ -4188,24 +4206,6 @@ int g() => x;
41884206 await _checkSingleFileChanges (content, expected);
41894207 }
41904208
4191- Future <void > test_late_final_hint_top_level_var () async {
4192- var content = '''
4193- /*late final*/ int x;
4194- f() {
4195- x = 1;
4196- }
4197- int g() => x;
4198- ''' ;
4199- var expected = '''
4200- late final int x;
4201- f() {
4202- x = 1;
4203- }
4204- int g() => x;
4205- ''' ;
4206- await _checkSingleFileChanges (content, expected);
4207- }
4208-
42094209 Future <void > test_leave_downcast_from_dynamic_implicit () async {
42104210 var content = 'int f(dynamic n) => n;' ;
42114211 var expected = 'int f(dynamic n) => n;' ;
0 commit comments