Fix multiple resolution of classes, broke recently (#6396) (#6410) (#6413)

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
This commit is contained in:
Krzysztof Bieganski 2025-09-10 13:09:55 +02:00 committed by GitHub
parent 7f945bf89e
commit 6c69210037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -1693,6 +1693,9 @@ class LinkDotFindVisitor final : public VNVisitor {
VSymEnt* const impp = srcp->findIdFlat(nodep->name());
if (!impp) {
nodep->v3error("Import object not found: " << nodep->prettyPkgNameQ());
} else if (nodep->resolvedClassp()) {
UASSERT_OBJ(nodep->resolvedClassp()->classOrPackageSkipp() == impp->nodep(), nodep,
"Import should resolve to the same node");
} else if (AstClass* const classp = VN_CAST(impp->nodep(), Class)) {
nodep->resolvedClassp(
new AstClassOrPackageRef{nodep->fileline(), classp->name(), classp, nullptr});