Skip to content

Commit 23fea95

Browse files
committed
Improve template instantiation for GetMethodTemplate
1 parent 12e6e69 commit 23fea95

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/Interpreter/CppInterOp.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,8 +1004,9 @@ namespace Cpp {
10041004
continue;
10051005
#endif
10061006

1007-
// FIXME : first score based on the type similarity before forcing
1007+
// TODO(aaronj0) : first score based on the type similarity before forcing
10081008
// instantiation.
1009+
10091010
TCppFunction_t instantiated =
10101011
InstantiateTemplate(candidate, arg_types.data(), arg_types.size());
10111012
if (instantiated)
@@ -1018,6 +1019,19 @@ namespace Cpp {
10181019
explicit_types.size());
10191020
if (instantiated)
10201021
return instantiated;
1022+
1023+
// join explicit and arg_types
1024+
std::vector<TemplateArgInfo> total_arg_set;
1025+
total_arg_set.reserve(explicit_types.size() + arg_types.size());
1026+
total_arg_set.insert(total_arg_set.end(), explicit_types.begin(),
1027+
explicit_types.end());
1028+
total_arg_set.insert(total_arg_set.end(), arg_types.begin(),
1029+
arg_types.end());
1030+
1031+
instantiated = InstantiateTemplate(candidate, total_arg_set.data(),
1032+
total_arg_set.size());
1033+
if (instantiated)
1034+
return instantiated;
10211035
}
10221036
return nullptr;
10231037
}

0 commit comments

Comments
 (0)