From c89055ee32b91d9a91b8c40d1c218ea2aea6628d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Crelier?= Date: Mon, 5 Mar 2018 09:18:06 +0000 Subject: [PATCH] [VM] Fix type finalization for Kernel function types. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I45d1f9686ba52526af17bb9b720eb09f91f91876 Reviewed-on: https://dart-review.googlesource.com/44803 Reviewed-by: Samir Jindel Commit-Queue: Régis Crelier --- runtime/vm/class_finalizer.cc | 10 ++++++++-- tests/language_2/language_2_kernel.status | 10 ---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc index 12c48e75662..3c8a85308a9 100644 --- a/runtime/vm/class_finalizer.cc +++ b/runtime/vm/class_finalizer.cc @@ -639,7 +639,13 @@ void ClassFinalizer::CheckRecursiveType(const Class& cls, const TypeArguments& arguments = TypeArguments::Handle(zone, type.arguments()); // A type can only be recursive via its type arguments. - ASSERT(!arguments.IsNull()); + if (arguments.IsNull()) { + // However, Kernel does not keep the relation between a function type and + // its declaring typedef. Therefore, a typedef-declared function type may + // refer to the still unfinalized typedef via a type in its signature. + ASSERT(type.IsFunctionType()); + return; + } const intptr_t num_type_args = arguments.Length(); ASSERT(num_type_args > 0); ASSERT(num_type_args == type_cls.NumTypeArguments()); @@ -1100,7 +1106,7 @@ void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, } } AbstractType& super_type = AbstractType::Handle(cls.super_type()); - if (!super_type.IsNull()) { + if (!super_type.IsNull() && !super_type.IsBeingFinalized()) { const Class& super_class = Class::Handle(super_type.type_class()); CheckTypeArgumentBounds(super_class, arguments, bound_error); } diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status index 8f3b76af127..42b5f1b7e28 100644 --- a/tests/language_2/language_2_kernel.status +++ b/tests/language_2/language_2_kernel.status @@ -493,11 +493,6 @@ mixin_supertype_subclass_test/05: MissingCompileTimeError [ $compiler == dartk && $mode == debug && $runtime == vm && $strong ] const_instance_field_test/01: Crash # Issue 32326. -cyclic_type_variable_test/01: Crash -cyclic_type_variable_test/02: Crash -cyclic_type_variable_test/03: Crash -cyclic_type_variable_test/04: Crash -cyclic_type_variable_test/none: Crash deopt_inlined_function_lazy_test: Skip tearoff_dynamic_test: Crash @@ -772,11 +767,6 @@ least_upper_bound_expansive_test/none: RuntimeError # Please triage. [ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled && $strong ] const_instance_field_test/01: Crash # Issue 32326. -cyclic_type_variable_test/01: Crash -cyclic_type_variable_test/02: Crash -cyclic_type_variable_test/03: Crash -cyclic_type_variable_test/04: Crash -cyclic_type_variable_test/none: Crash external_test/13: Crash regress_29025_test: Crash tearoff_dynamic_test: Crash