Skip to content

Commit

Permalink
[vm/reload] Do class reload type parameter count check before finaliz…
Browse files Browse the repository at this point in the history
…ation.

Fixes #45602

TEST=pkg/vm/test/incremental_compiler_test.dart

Change-Id: Iebf64c4d7ca8ba42209de27fe35ab1e03302d308
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195305
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
  • Loading branch information
aam authored and commit-bot@chromium.org committed Apr 19, 2021
1 parent 77466f2 commit 701c06d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions runtime/vm/object_reload.cc
Expand Up @@ -657,6 +657,17 @@ void Class::CheckReload(const Class& replacement,
}

if (is_finalized()) {
// Make sure the declaration types parameter count matches for the two
// classes.
// ex. class A<int,B> {} cannot be replace with class A<B> {}.
auto group_context = context->group_reload_context();
if (NumTypeParameters() != replacement.NumTypeParameters()) {
group_context->AddReasonForCancelling(
new (context->zone())
TypeParametersChanged(context->zone(), *this, replacement));
return;
}

// Ensure the replacement class is also finalized.
const Error& error =
Error::Handle(replacement.EnsureIsFinalized(Thread::Current()));
Expand Down

0 comments on commit 701c06d

Please sign in to comment.