d14ab0779a
Change-Id: I9c486f29f3bcf8a6ecf481eb25ea61d0468049b2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150667 Commit-Queue: Joshua Litt <joshualitt@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
41 lines
864 B
Dart
41 lines
864 B
Dart
// Copyright (c) 2020, 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.
|
|
|
|
// Tests that late fields are properly reset after hot restarts.
|
|
|
|
// Requirements=nnbd
|
|
|
|
import 'package:expect/expect.dart';
|
|
import 'dart:_runtime' as dart;
|
|
|
|
late double l;
|
|
|
|
class Lates {
|
|
static late String s;
|
|
}
|
|
|
|
main() {
|
|
Expect.throws(() => Lates.s);
|
|
Expect.throws(() => l);
|
|
Lates.s = "set";
|
|
l = 1.62;
|
|
Expect.equals(Lates.s, "set");
|
|
Expect.equals(l, 1.62);
|
|
|
|
dart.hotRestart();
|
|
|
|
Expect.throws(() => Lates.s);
|
|
Expect.throws(() => l);
|
|
Lates.s = "set";
|
|
Expect.equals(Lates.s, "set");
|
|
l = 1.62;
|
|
Expect.equals(l, 1.62);
|
|
|
|
dart.hotRestart();
|
|
dart.hotRestart();
|
|
|
|
Expect.throws(() => Lates.s);
|
|
Expect.throws(() => l);
|
|
}
|