[ddc] Adding RTI subtype cache clearing.
This is required when a hot reload causes changes to the subtype hierarchy. This change also adds RTI operations for clearing subtype caches and deleting type rules. The DDC Embedder also now accesses the RTI library to clear subtype caches on hot reload. See: #57049 Change-Id: I50a43ce342f23060bc28a3654c2da37c362492b7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394040 Reviewed-by: Stephen Adams <sra@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Mark Zhou <markzipan@google.com>
This commit is contained in:
@@ -33,7 +33,9 @@ Future<void> main() async {
|
||||
await hotReload();
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.equals(
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'", helper());
|
||||
Expect.throws<TypeError>(
|
||||
() => helper(),
|
||||
(error) => '$error'.contains(
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'"));
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,7 @@ class Foo {
|
||||
late Foo value;
|
||||
|
||||
helper() {
|
||||
try {
|
||||
return value.x.toString();
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
return value.x.toString();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
@@ -36,8 +32,10 @@ Future<void> main() async {
|
||||
await hotReload();
|
||||
|
||||
// B is no longer a subtype of A.
|
||||
Expect.equals(
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'", helper());
|
||||
Expect.throws<TypeError>(
|
||||
() => helper(),
|
||||
(error) => '$error'.contains(
|
||||
"type '(A) => bool' is not a subtype of type '(B) => bool'"));
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
}
|
||||
/** DIFF **/
|
||||
@@ -51,17 +49,13 @@ Future<void> main() async {
|
||||
|
||||
typedef bool Predicate(B b);
|
||||
|
||||
@@ -22,8 +22,11 @@
|
||||
@@ -22,8 +22,7 @@
|
||||
late Foo value;
|
||||
|
||||
helper() {
|
||||
- value = Foo((A a) => true);
|
||||
- return 'okay';
|
||||
+ try {
|
||||
+ return value.x.toString();
|
||||
+ } catch (e) {
|
||||
+ return e.toString();
|
||||
+ }
|
||||
+ return value.x.toString();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
Reference in New Issue
Block a user