Skip to content

Commit 74d03e7

Browse files
aamcommit-bot@chromium.org
authored andcommitted
Add a test that reproduces hot reload issue when class type arguments change.
Bug: #32942 Change-Id: I7f10a327a82ddf23a946b1ba98c63c2e7947d99f Reviewed-on: https://dart-review.googlesource.com/54313 Commit-Queue: Alexander Aprelev <[email protected]> Reviewed-by: Régis Crelier <[email protected]>
1 parent 3beb7fe commit 74d03e7

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

runtime/tests/vm/vm.status

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ cc/Dart2JSCompilerStats: Fail, Crash # Issue 27369
99
cc/Fail0: Fail # These tests are expected to crash on all platforms.
1010
cc/Fail1: Fail # These tests are expected to crash on all platforms.
1111
cc/Fail2: Fail # These tests are expected to crash on all platforms.
12+
cc/IsolateReload_ChangeInstanceFormat9: Fail, Crash # issue 32942
1213
cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
1314
cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
1415
cc/IsolateReload_PendingStaticCall_DefinedToNSM: Fail # Issue 32981

runtime/vm/isolate_reload_test.cc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,6 +2782,39 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat8) {
27822782
EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
27832783
}
27842784

2785+
// Tests reload fails when type arguments change.
2786+
// Change: Baz extends Foo<String> -> Baz extends Bar<String, double>
2787+
// Validate: the right error message is returned.
2788+
TEST_CASE(IsolateReload_ChangeInstanceFormat9) {
2789+
const char* kScript =
2790+
"class Foo<A> {\n"
2791+
" var a;\n"
2792+
"}\n"
2793+
"class Bar<B, C> extends Foo<B> {}\n"
2794+
"class Baz extends Foo<String> {}"
2795+
"main() {\n"
2796+
" new Baz();\n"
2797+
" return 43;\n"
2798+
"}\n";
2799+
2800+
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2801+
EXPECT_VALID(lib);
2802+
EXPECT_EQ(43, SimpleInvoke(lib, "main"));
2803+
2804+
const char* kReloadScript =
2805+
"class Foo<A> {\n"
2806+
" var a;\n"
2807+
"}\n"
2808+
"class Bar<B, C> extends Foo<B> {}\n"
2809+
"class Baz extends Bar<String, double> {}"
2810+
"main() {\n"
2811+
" new Baz();\n"
2812+
" return 43;\n"
2813+
"}\n";
2814+
lib = TestCase::ReloadTestScript(kReloadScript);
2815+
EXPECT_ERROR(lib, "type parameters have changed");
2816+
}
2817+
27852818
TEST_CASE(IsolateReload_ShapeChangeRetainsHash) {
27862819
const char* kScript =
27872820
"class A{\n"

0 commit comments

Comments
 (0)