Add a test that reproduces hot reload issue when class type arguments change.

Bug: https://github.com/dart-lang/sdk/issues/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>
This commit is contained in:
Alexander Aprelev 2018-05-08 23:31:39 +00:00 committed by commit-bot@chromium.org
parent 3beb7fe860
commit 74d03e7a75
2 changed files with 34 additions and 0 deletions

View file

@ -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

View file

@ -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"