Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: runtime/vm/class_finalizer.cc

Issue 2952743003: Fix type argument finalization of some recursive generic types (fixes #29949). (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/regress_29949_test.dart » ('j') | tests/language/regress_29949_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index f6d693b4c28aa1e478c73234cce9cc15e8e29a4f..bf749382d8e314d89b0446b10336afd2c2fd2404 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -980,12 +980,15 @@ void ClassFinalizer::FinalizeTypeArguments(const Class& cls,
TypeArguments::Handle(ref_super_type_arg.arguments());
// Mark as finalized before finalizing to avoid cycles.
ref_super_type_arg.SetIsFinalized();
- // Since the instantiator is different, do not pass the current
- // instantiation trail, but create a new one by passing NULL.
+ // Although the instantiator is different between cls and super_cls,
+ // we still need to pass the current instantiation trail as to avoid
+ // divergence. Finalizing the type arguments of super_cls may indeed
+ // recursively require instantiating the same type_refs already
+ // present in the trail (see issue #29949).
FinalizeTypeArguments(
super_cls, super_args,
super_cls.NumTypeArguments() - super_cls.NumTypeParameters(),
- bound_error, pending_types, NULL);
+ bound_error, pending_types, instantiation_trail);
if (FLAG_trace_type_finalization) {
THR_Print("Finalized instantiated TypeRef '%s': '%s'\n",
String::Handle(super_type_arg.Name()).ToCString(),
« no previous file with comments | « no previous file | tests/language/regress_29949_test.dart » ('j') | tests/language/regress_29949_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698