Fix out-of-module shadowing

pull/542/head^2
Ibrahim Numanagić 2024-02-15 19:37:17 -08:00
parent a61ed7d164
commit b853397b34
1 changed files with 1 additions and 1 deletions

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);