[dart/vm] Fix bug in new lazy tear of construction
Rationale:
As shown in the comment, I was already not sure about
what argument to use. Clearly one of the two type
arguments is not needed. This fixes the
language_2/const_inference_test failure that
was temporarily approved.
https://github.com/dart-lang/sdk/issues/36220
Change-Id: I3dd8ddf0e3cf0e992164c005b08ffd59306041f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107064
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
Auto-Submit: Aart Bik <ajcbik@google.com>
diff --git a/runtime/vm/compiler/frontend/constant_evaluator.cc b/runtime/vm/compiler/frontend/constant_evaluator.cc
index e5065e2..7b42371 100644
--- a/runtime/vm/compiler/frontend/constant_evaluator.cc
+++ b/runtime/vm/compiler/frontend/constant_evaluator.cc
@@ -480,6 +480,7 @@
Instance::Handle(Z, EvaluateConstantExpression(entry_offset));
// Happens if the tearoff was in the vmservice library and we have
// [skip_vm_service_library] enabled.
+ // TODO(ajcbik): probably ASSERT that this no longer happens
if (constant.IsNull()) {
instance = Instance::null();
break;
@@ -493,17 +494,18 @@
for (intptr_t j = 0; j < number_of_type_arguments; ++j) {
type_arguments.SetTypeAt(j, type_translator.BuildType());
}
+ type_arguments = type_arguments.Canonicalize();
// Make a copy of the old closure, and set delayed type arguments.
Closure& closure = Closure::Handle(Z, Closure::RawCast(constant.raw()));
Function& function = Function::Handle(Z, closure.function());
TypeArguments& type_arguments2 =
TypeArguments::ZoneHandle(Z, closure.instantiator_type_arguments());
- TypeArguments& type_arguments3 =
- TypeArguments::ZoneHandle(Z, closure.function_type_arguments());
+ // TODO(ajcbik): why was this here in original reader?
+ // TypeArguments& type_arguments3 =
+ // TypeArguments::ZoneHandle(Z, closure.function_type_arguments());
Context& context = Context::Handle(Z, closure.context());
instance = Closure::New(type_arguments2, Object::null_type_arguments(),
- type_arguments3, function, context,
- Heap::kOld); // was type_arguments?
+ type_arguments, function, context, Heap::kOld);
break;
}
case kTearOffConstant: {