-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
main.1.dart
45 lines (40 loc) · 1.56 KB
/
main.1.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2024, 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';
import 'library_a.dart';
import 'library_b.dart';
/// Tests for constant semantics across hot restart in DDC.
///
/// DDC has multiple layers of constant caching. Failing to clear them can
/// result in stale constants being referenced across hot restarts.
///
/// Cases tested include:
/// 1) Failing to clear all constant caches.
/// An old 'ConstObject' is returned, which fails to reflect the edited
/// 'variableToModifyToForceRecompile'.
/// 2) Clearing constant caches but failing to clear constant containers.
/// Constants in reloaded modules fail to compare with constants in stale
/// constant containers, causing 'ConstantEqualityFailure's.
class ConstObject {
const ConstObject();
String get text => 'ConstObject('
'reloadVariable: $variableToModifyToForceRecompile, '
'${value1 == value2 ? 'ConstantEqualitySuccess' : 'ConstantEqualityFailure'})';
}
void main() {
Expect.equals('ConstObject(reloadVariable: 45, ConstantEqualitySuccess)',
'${const ConstObject().text}');
}
/** DIFF **/
/*
@@ -28,7 +28,6 @@
}
void main() {
- Expect.equals('ConstObject(reloadVariable: 23, ConstantEqualitySuccess)',
+ Expect.equals('ConstObject(reloadVariable: 45, ConstantEqualitySuccess)',
'${const ConstObject().text}');
- hotRestart();
}
*/