Fix class typedef elaboration (#6080)

This commit is contained in:
Kamil Rakoczy 2025-06-10 18:03:26 +02:00 committed by GitHub
parent 75a36a6ef8
commit 58ea7ad361
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -1167,7 +1167,7 @@ class ParamVisitor final : public VNVisitor {
void relinkDots() {
for (AstDot* const dotp : m_dots) {
const AstClassOrPackageRef* const classRefp = VN_AS(dotp->lhsp(), ClassOrPackageRef);
const AstClass* const lhsClassp = VN_AS(classRefp->classOrPackageNodep(), Class);
const AstClass* const lhsClassp = VN_AS(classRefp->classOrPackageSkipp(), Class);
AstClassOrPackageRef* const rhsp = VN_AS(dotp->rhsp(), ClassOrPackageRef);
for (auto* itemp = lhsClassp->membersp(); itemp; itemp = itemp->nextp()) {
if (itemp->name() == rhsp->name()) {
@ -1323,7 +1323,7 @@ class ParamVisitor final : public VNVisitor {
// by a class with actual parameter values.
const AstClass* lhsClassp = nullptr;
const AstClassOrPackageRef* const classRefp = VN_CAST(nodep->lhsp(), ClassOrPackageRef);
if (classRefp) lhsClassp = VN_CAST(classRefp->classOrPackageNodep(), Class);
if (classRefp) lhsClassp = VN_CAST(classRefp->classOrPackageSkipp(), Class);
AstNode* rhsDefp = nullptr;
AstClassOrPackageRef* const rhsp = VN_CAST(nodep->rhsp(), ClassOrPackageRef);
if (rhsp) rhsDefp = rhsp->classOrPackageNodep();

View File

@ -6,12 +6,18 @@
typedef class Bar;
typedef Bar Baz;
typedef Quux #(16, 32) Quux_t;
typedef Quux_t Quuux_t;
module t;
initial begin
Bar::Qux::boo(1);
Baz::Qux::boo(1);
Quux_t::Qux::boo(1);
Quuux_t::Qux::boo(1);
if (!Bar::Qux::finish) $stop;
if (!Quux_t::Qux::finish) $stop;
if (!Quuux_t::Qux::finish) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
@ -34,3 +40,8 @@ endclass
class Bar;
typedef Foo#(Bar) Qux;
endclass
class Quux #(PARA_A = 1, PARA_B = 2);
typedef Quux #(PARA_A, PARA_B) this_t;
typedef Foo#(this_t) Qux;
endclass