fix a bug

This commit is contained in:
lcw 2023-08-30 23:53:50 +08:00
parent c921a9f9cd
commit 8f01835cab
2 changed files with 34 additions and 1 deletions

View File

@ -35,7 +35,8 @@ shared_ptr<ValType> StructType::struct_replace(
shared_ptr<StructType> ut,
map<shared_ptr<TemplateType>, shared_ptr<TemplateType>>& eq) {
auto tt = make_shared<StructType>();
(*tt) = (*ut);
tt->str = str;
tt->mp = ut->mp;
set<shared_ptr<Struct>> vis;
for (auto u = str; u.get() != nullptr; u = u->fa.lock()) {
vis.insert(u);

32
tests/ok/simple-logic3.ac Normal file
View File

@ -0,0 +1,32 @@
struct
{
struct A<x>()
{
struct AA<y>(){};
struct AB<y>()
{
struct ABA<z>()
{
};
};
};
struct B<x>()
{
struct BA<y>()
{
a = A<y>::AB<x>::ABA<y>();
};
struct BB<y>()
{
struct BBA<z>()
{
};
struct BBB<z>(p:z)
{
a = BA<z>();
};
};
};
struct C(delete){};
a = Fn<>()->A<C>::AB<B<C>>::ABA<C>{return B<B<C>>::BB<B<C>::BB<C>>::BBB<C>(admit<C>()).a.a;};
}main;