1
0
mirror of https://github.com/exaloop/codon.git synced 2025-06-03 15:03:52 +08:00

Fix out-of-module shadowing

This commit is contained in:
Ibrahim Numanagić 2024-02-15 19:37:17 -08:00
parent a61ed7d164
commit b853397b34

View File

@ -156,7 +156,7 @@ void SimplifyVisitor::visit(FunctionStmt *stmt) {
// Function bindings cannot be dominated either
if (!isClassMember) {
auto funcVal = ctx->find(stmt->name);
if (funcVal && funcVal->noShadow)
if (funcVal && funcVal->moduleName == ctx->getModule() && funcVal->noShadow)
E(Error::CLASS_INVALID_BIND, stmt, stmt->name);
funcVal = ctx->addFunc(stmt->name, rootName, stmt->getSrcInfo());
ctx->addAlwaysVisible(funcVal);