Skip to content

Commit

Permalink
Add a test that reproduces hot reload issue when class type arguments…
Browse files Browse the repository at this point in the history
… change.

Bug: #32942
Change-Id: I7f10a327a82ddf23a946b1ba98c63c2e7947d99f
Reviewed-on: https://dart-review.googlesource.com/54313
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
  • Loading branch information
aam authored and commit-bot@chromium.org committed May 8, 2018
1 parent 3beb7fe commit 74d03e7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/tests/vm/vm.status
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cc/Dart2JSCompilerStats: Fail, Crash # Issue 27369
cc/Fail0: Fail # These tests are expected to crash on all platforms.
cc/Fail1: Fail # These tests are expected to crash on all platforms.
cc/Fail2: Fail # These tests are expected to crash on all platforms.
cc/IsolateReload_ChangeInstanceFormat9: Fail, Crash # issue 32942
cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
cc/IsolateReload_PendingStaticCall_DefinedToNSM: Fail # Issue 32981
Expand Down
33 changes: 33 additions & 0 deletions runtime/vm/isolate_reload_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,39 @@ TEST_CASE(IsolateReload_ChangeInstanceFormat8) {
EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
}

// Tests reload fails when type arguments change.
// Change: Baz extends Foo<String> -> Baz extends Bar<String, double>
// Validate: the right error message is returned.
TEST_CASE(IsolateReload_ChangeInstanceFormat9) {
const char* kScript =
"class Foo<A> {\n"
" var a;\n"
"}\n"
"class Bar<B, C> extends Foo<B> {}\n"
"class Baz extends Foo<String> {}"
"main() {\n"
" new Baz();\n"
" return 43;\n"
"}\n";

Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
EXPECT_VALID(lib);
EXPECT_EQ(43, SimpleInvoke(lib, "main"));

const char* kReloadScript =
"class Foo<A> {\n"
" var a;\n"
"}\n"
"class Bar<B, C> extends Foo<B> {}\n"
"class Baz extends Bar<String, double> {}"
"main() {\n"
" new Baz();\n"
" return 43;\n"
"}\n";
lib = TestCase::ReloadTestScript(kReloadScript);
EXPECT_ERROR(lib, "type parameters have changed");
}

TEST_CASE(IsolateReload_ShapeChangeRetainsHash) {
const char* kScript =
"class A{\n"
Expand Down

0 comments on commit 74d03e7

Please sign in to comment.