Commit ec828579 authored by Daniel Clifford's avatar Daniel Clifford Committed by Commit Bot

[torque] fix bugs found by using implicit params in generics at scale

Bug: v8:7793
Change-Id: I2d5154eabd549c0518ca41dae6ef7bd047f3e1ef
Reviewed-on: https://chromium-review.googlesource.com/c/1348072Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Daniel Clifford <danno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57772}
parent 56e161e8
......@@ -71,9 +71,10 @@ base::Optional<const Type*> Generic::InferTypeArgument(
const std::string type_name = declaration()->generic_parameters[i];
const std::vector<TypeExpression*>& parameters =
declaration()->callable->signature->parameters.types;
for (size_t i = 0; i < arguments.size() && i < parameters.size(); ++i) {
size_t j = declaration()->callable->signature->parameters.implicit_count;
for (size_t i = 0; i < arguments.size() && j < parameters.size(); ++i, ++j) {
BasicTypeExpression* basic =
BasicTypeExpression::DynamicCast(parameters[i]);
BasicTypeExpression::DynamicCast(parameters[j]);
if (basic && basic->namespace_qualification.empty() &&
!basic->is_constexpr && basic->name == type_name) {
return arguments[i];
......
......@@ -261,7 +261,7 @@ bool Signature::HasSameTypesAs(const Signature& other,
compare_types = GetExplicitTypes();
other_compare_types = other.GetExplicitTypes();
}
if (!(compare_types == other.parameter_types.types &&
if (!(compare_types == other_compare_types &&
parameter_types.var_args == other.parameter_types.var_args &&
return_type == other.return_type)) {
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment