|  | // Copyright (c) 2025, 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. | 
|  |  | 
|  | import 'package:expect/expect.dart'; | 
|  | import 'package:reload_test/reload_test_utils.dart'; | 
|  |  | 
|  | late String noInitializer; | 
|  | late int withInitializer = 1; | 
|  |  | 
|  | class Lates { | 
|  | static late String noInitializer; | 
|  | static late int withInitializer = 2; | 
|  | } | 
|  |  | 
|  | class LatesGeneric<T> { | 
|  | static late String noInitializer; | 
|  | static late int withInitializer = 3; | 
|  | } | 
|  |  | 
|  | Future<void> main() async { | 
|  | // Late statics should throw on get when not initialized. | 
|  | Expect.throws(() => noInitializer); | 
|  | Expect.throws(() => Lates.noInitializer); | 
|  | Expect.throws(() => LatesGeneric.noInitializer); | 
|  |  | 
|  | // Set uninitialized static late fields again. | 
|  | noInitializer = 'set via setter'; | 
|  | Lates.noInitializer = 'Lates set via setter'; | 
|  | LatesGeneric.noInitializer = 'LatesGeneric set via setter'; | 
|  |  | 
|  | // All statics should contain their set values. | 
|  | Expect.equals('set via setter', noInitializer); | 
|  | Expect.equals('Lates set via setter', Lates.noInitializer); | 
|  | Expect.equals('LatesGeneric set via setter', LatesGeneric.noInitializer); | 
|  | Expect.equals(1, withInitializer); | 
|  | Expect.equals(2, Lates.withInitializer); | 
|  | Expect.equals(3, LatesGeneric.withInitializer); | 
|  |  | 
|  | await hotRestart(); | 
|  | } | 
|  |  | 
|  | /** DIFF **/ | 
|  | /* | 
|  | } | 
|  |  | 
|  | Future<void> main() async { | 
|  | -  // Set uninitialized static late fields. Avoid calling getters for these | 
|  | -  // statics to ensure they are reset even if they are never accessed. | 
|  | +  // Late statics should throw on get when not initialized. | 
|  | +  Expect.throws(() => noInitializer); | 
|  | +  Expect.throws(() => Lates.noInitializer); | 
|  | +  Expect.throws(() => LatesGeneric.noInitializer); | 
|  | + | 
|  | +  // Set uninitialized static late fields again. | 
|  | noInitializer = 'set via setter'; | 
|  | Lates.noInitializer = 'Lates set via setter'; | 
|  | LatesGeneric.noInitializer = 'LatesGeneric set via setter'; | 
|  |  | 
|  | -  // Initialized statics should contain their values. | 
|  | +  // All statics should contain their set values. | 
|  | +  Expect.equals('set via setter', noInitializer); | 
|  | +  Expect.equals('Lates set via setter', Lates.noInitializer); | 
|  | +  Expect.equals('LatesGeneric set via setter', LatesGeneric.noInitializer); | 
|  | Expect.equals(1, withInitializer); | 
|  | Expect.equals(2, Lates.withInitializer); | 
|  | Expect.equals(3, LatesGeneric.withInitializer); | 
|  | */ |