Fix extending class by a typedef (#6679) (#6855)

This commit is contained in:
Alex Zhou
2026-02-21 11:13:22 +05:30
committed by GitHub
parent 0051d91555
commit a4ad255438
4 changed files with 22 additions and 7 deletions
+17
View File
@@ -5381,6 +5381,23 @@ class LinkDotResolveVisitor final : public VNVisitor {
refParamp->refDTypep(paramp);
nodep->childDTypep(refParamp);
nodep->parameterized(true);
} else if (AstTypedef* const typedefp = VN_CAST(foundp->nodep(), Typedef)) {
AstNodeDType* const unwrappedp = typedefp->subDTypep()->skipRefp();
if (AstClassRefDType* const classRefp = VN_CAST(unwrappedp, ClassRefDType)) {
AstPin* paramsp = cpackagerefp->paramsp();
if (paramsp) {
paramsp = paramsp->cloneTree(true);
nodep->parameterized(true);
}
nodep->childDTypep(new AstClassRefDType{nodep->fileline(), classRefp->classp(), paramsp});
iterate(nodep->childDTypep());
}
else {
nodep->v3warn(E_UNSUPPORTED,
"Unsupported: " << foundp->nodep()->prettyTypeName()
<< " in 'class extends'");
return;
}
} else {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: " << foundp->nodep()->prettyTypeName()
<< " in 'class extends'");