Fix class reference assignment checking (#4296)

This commit is contained in:
Ryszard Rozak
2023-06-15 14:00:47 +02:00
committed by GitHub
parent 43fa6858f6
commit d1ff81a41c
3 changed files with 26 additions and 18 deletions
+2 -2
View File
@@ -6377,7 +6377,7 @@ private:
}
void checkClassAssign(AstNode* nodep, const char* side, AstNode* rhsp,
AstNodeDType* lhsDTypep) {
if (AstClassRefDType* const lhsClassRefp = VN_CAST(lhsDTypep, ClassRefDType)) {
if (AstClassRefDType* const lhsClassRefp = VN_CAST(lhsDTypep->skipRefp(), ClassRefDType)) {
UASSERT_OBJ(rhsp->dtypep(), rhsp, "Node has no type");
AstNodeDType* const rhsDtypep = rhsp->dtypep()->skipRefp();
if (AstClassRefDType* const rhsClassRefp = VN_CAST(rhsDtypep, ClassRefDType)) {
@@ -6385,7 +6385,7 @@ private:
} else if (auto* const constp = VN_CAST(rhsp, Const)) {
if (constp->num().isNull()) return;
}
nodep->v3error(side << " expects a " << lhsDTypep->prettyTypeName() << ", got "
nodep->v3error(side << " expects a " << lhsClassRefp->prettyTypeName() << ", got "
<< rhsDtypep->prettyTypeName());
}
}