fix #21153 - [REG 2.111.0] Infinite loop in isAliasThisTuple

Partially reverts the regressing change in 08901365d4. The "fixed"
refactoring should be applied to master/development branch.
This commit is contained in:
Iain Buclaw 2025-04-05 18:42:56 +02:00
parent ce16000c48
commit 51816cd01d

View file

@ -641,23 +641,23 @@ TupleDeclaration isAliasThisTuple(Expression e)
Type t = e.type.toBasetype();
while (true)
{
Dsymbol s = t.toDsymbol(null);
if (!s)
return null;
auto ad = s.isAggregateDeclaration();
if (!ad)
return null;
s = ad.aliasthis ? ad.aliasthis.sym : null;
if (s && s.isVarDeclaration())
if (Dsymbol s = t.toDsymbol(null))
{
TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration();
if (td && td.isexp)
return td;
}
if (Type att = t.aliasthisOf())
{
t = att;
continue;
if (auto ad = s.isAggregateDeclaration())
{
s = ad.aliasthis ? ad.aliasthis.sym : null;
if (s && s.isVarDeclaration())
{
TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration();
if (td && td.isexp)
return td;
}
if (Type att = t.aliasthisOf())
{
t = att;
continue;
}
}
}
return null;
}