From b853397b34cb8fdd18b1f695a220580e85de64ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ibrahim=20Numanagic=CC=81?= Date: Thu, 15 Feb 2024 19:37:17 -0800 Subject: [PATCH] Fix out-of-module shadowing --- codon/parser/visitors/simplify/function.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codon/parser/visitors/simplify/function.cpp b/codon/parser/visitors/simplify/function.cpp index 2a36dd30..961805a5 100644 --- a/codon/parser/visitors/simplify/function.cpp +++ b/codon/parser/visitors/simplify/function.cpp @@ -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);