Fixed handling of template template specialization parameters in instantiation deduction

This commit is contained in:
Bartek Kryza
2023-05-03 12:41:12 +02:00
parent f01ddc63f2
commit 3fea01d452
5 changed files with 105 additions and 39 deletions

View File

@@ -59,17 +59,19 @@ TEST_CASE("t00051", "[test-case][class]")
REQUIRE_THAT(puml, (IsMethod<Public>("ff", "void")));
REQUIRE_THAT(puml,
IsClassTemplate(
"B", "(lambda at ../../tests/t00051/t00051.cc:43:18)"));
//,(lambda at ../../tests/t00051/t00051.cc:43:27)"));
IsClassTemplate("B",
"(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
"../../tests/t00051/t00051.cc:43:27)"));
REQUIRE_THAT(puml,
IsInstantiation(_A("B<F,FF=F>"),
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18)>")));
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
"at ../../tests/t00051/t00051.cc:43:27)>")));
REQUIRE_THAT(puml,
IsDependency(_A("A"),
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18)>")));
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
"at ../../tests/t00051/t00051.cc:43:27)>")));
save_puml(
config.output_directory() + "/" + diagram->name + ".puml", puml);

View File

@@ -86,14 +86,16 @@ template <typename U> struct A<U(...)> {
bool u;
};
//
// template <typename T> struct eval;
//
// template <template <typename, typename...> class TT, typename T1,
// typename... Rest>
// struct eval<TT<T1, Rest...>> { };
//
// eval<A<int>> eA;
// eval<std::map<int, float>> eB;
template <template <typename> class C, typename T> struct A<C<T>> {
C<T> c;
};
template <template <typename, typename...> class C, typename T,
typename... Args>
struct A<C<T, Args...>> {
C<T> c;
std::tuple<Args...> args;
};
}
}

View File

@@ -52,6 +52,8 @@ TEST_CASE("t00062", "[test-case][class]")
REQUIRE_THAT(puml, IsClassTemplate("A", "char[1000]"));
REQUIRE_THAT(puml, IsClassTemplate("A", "U(...)"));
REQUIRE_THAT(puml, IsClassTemplate("A", "C<T>"));
REQUIRE_THAT(puml, IsClassTemplate("A", "C<T,Args...>"));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<U &>")));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<U &&>")));
@@ -67,6 +69,9 @@ TEST_CASE("t00062", "[test-case][class]")
puml, IsInstantiation(_A("A<char[N]>"), _A("A<char[1000]>")));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<U(...)>")));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<U(...)>")));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<C<T>>")));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<C<T,Args...>>")));
save_puml(
config.output_directory() + "/" + diagram->name + ".puml", puml);