[vm] Fixes and review comments to change in partial instantiation semantics revision.
Change-Id: Ic6eb4f7827ef60e7347a747912dee434080d5da6
Reviewed-on: https://dart-review.googlesource.com/72420
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
diff --git a/runtime/lib/internal_patch.dart b/runtime/lib/internal_patch.dart
index b906776..8446926 100644
--- a/runtime/lib/internal_patch.dart
+++ b/runtime/lib/internal_patch.dart
@@ -105,7 +105,7 @@
// Check that a set of type arguments satisfy the type parameter bounds on a
// closure.
@pragma("vm:entry-point")
-_boundsCheckForPartialInstantiation(closure, type_args)
+_boundsCheckForPartialInstantiation(closure, typeArgs)
native "Internal_boundsCheckForPartialInstantiation";
// Called by IRRegExpMacroAssembler::GrowStack.
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index b68fac0..7b0537f 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -492,7 +492,7 @@
// This should be guaranteed by the front-end.
ASSERT(type_args_to_check.IsNull() ||
- bounds.Length() == type_args_to_check.Length());
+ bounds.Length() <= type_args_to_check.Length());
// The bounds on the closure may need instantiation.
const TypeArguments& instantiator_type_args =
@@ -503,16 +503,17 @@
AbstractType& supertype = AbstractType::Handle(zone);
AbstractType& subtype = AbstractType::Handle(zone);
TypeParameter& parameter = TypeParameter::Handle(zone);
+ Error& bound_error = Error::Handle(zone);
for (intptr_t i = 0; i < bounds.Length(); ++i) {
parameter ^= bounds.TypeAt(i);
supertype = parameter.bound();
- subtype = type_args_to_check.TypeAt(i);
+ subtype = type_args_to_check.IsNull() ? Object::dynamic_type().raw()
+ : type_args_to_check.TypeAt(i);
ASSERT(!subtype.IsNull() && !subtype.IsMalformedOrMalbounded());
ASSERT(!supertype.IsNull() && !supertype.IsMalformedOrMalbounded());
// The supertype may not be instantiated.
- Error& bound_error = Error::Handle(zone);
if (!AbstractType::InstantiateAndTestSubtype(
&subtype, &supertype, &bound_error, instantiator_type_args,
function_type_args)) {