| Index: runtime/vm/intermediate_language.cc
|
| diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
|
| index 1ed759b493a3e8fd8574373539a3366afc7cdde3..894d7fa7912055d89f517c2c9b7cee6f83200f47 100644
|
| --- a/runtime/vm/intermediate_language.cc
|
| +++ b/runtime/vm/intermediate_language.cc
|
| @@ -2065,24 +2065,33 @@ Definition* AssertAssignableInstr::Canonicalize(FlowGraph* flow_graph) {
|
| return value()->definition();
|
| }
|
|
|
| - // For uninstantiated target types: If the instantiator type arguments
|
| - // are constant, instantiate the target type here.
|
| - if (dst_type().IsInstantiated()) return this;
|
| + // For uninstantiated target types: If the instantiator and function
|
| + // type arguments are constant, instantiate the target type here.
|
| + // If the uninstantiated type refers to parent function type parameters, we
|
| + // cannot instantiated it here.
|
| + if (dst_type().IsInstantiated() ||
|
| + !dst_type().IsInstantiated(kParentFunctions)) {
|
| + return this;
|
| + }
|
|
|
| - // TODO(regis): Only try to instantiate here if function_type_args is constant
|
| - // or null and dst_type does not refer to parent function type parameters.
|
| - ConstantInstr* constant_type_args =
|
| + ConstantInstr* constant_instantiator_type_args =
|
| instantiator_type_arguments()->definition()->AsConstant();
|
| - if (constant_type_args != NULL) {
|
| - ASSERT(constant_type_args->value().IsNull() ||
|
| - constant_type_args->value().IsTypeArguments());
|
| + ConstantInstr* constant_function_type_args =
|
| + function_type_arguments()->definition()->AsConstant();
|
| + if ((constant_instantiator_type_args != NULL) &&
|
| + (constant_function_type_args != NULL)) {
|
| + ASSERT(constant_instantiator_type_args->value().IsNull() ||
|
| + constant_instantiator_type_args->value().IsTypeArguments());
|
| + ASSERT(constant_function_type_args->value().IsNull() ||
|
| + constant_function_type_args->value().IsTypeArguments());
|
| TypeArguments& instantiator_type_args = TypeArguments::Handle();
|
| - instantiator_type_args ^= constant_type_args->value().raw();
|
| + instantiator_type_args ^= constant_instantiator_type_args->value().raw();
|
| + TypeArguments& function_type_args = TypeArguments::Handle();
|
| + function_type_args ^= constant_function_type_args->value().raw();
|
| Error& bound_error = Error::Handle();
|
| - AbstractType& new_dst_type =
|
| - AbstractType::Handle(dst_type().InstantiateFrom(
|
| - instantiator_type_args, /* function_type_args, */
|
| - &bound_error, NULL, NULL, Heap::kOld));
|
| + AbstractType& new_dst_type = AbstractType::Handle(
|
| + dst_type().InstantiateFrom(instantiator_type_args, function_type_args,
|
| + &bound_error, NULL, NULL, Heap::kOld));
|
| if (new_dst_type.IsMalformedOrMalbounded() || !bound_error.IsNull()) {
|
| return this;
|
| }
|
| @@ -2100,7 +2109,7 @@ Definition* AssertAssignableInstr::Canonicalize(FlowGraph* flow_graph) {
|
|
|
| ConstantInstr* null_constant = flow_graph->constant_null();
|
| instantiator_type_arguments()->BindTo(null_constant);
|
| - // TODO(regis): function_type_arguments()->BindTo(null_constant);
|
| + function_type_arguments()->BindTo(null_constant);
|
| }
|
| return this;
|
| }
|
|
|