summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-overload.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-01-25 17:47:40 -0800
committerGitHub <noreply@github.com>2024-01-25 17:47:40 -0800
commit013bcf28da22fd569154bd9f98368e670fbeb873 (patch)
tree1fde8373912f2576744b7a797878d373cc51e531 /source/slang/slang-check-overload.cpp
parent64804ce0bec66a428f8784b5deb139535909c242 (diff)
Fixes for `module` and `include`. (#3519)
* Fix type checking of enum cases. * Allow decl to have same name as module. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-overload.cpp')
-rw-r--r--source/slang/slang-check-overload.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp
index 2912a79b0..37c92a317 100644
--- a/source/slang/slang-check-overload.cpp
+++ b/source/slang/slang-check-overload.cpp
@@ -992,6 +992,12 @@ namespace Slang
if(leftIsInterfaceRequirement != rightIsInterfaceRequirement)
return int(leftIsInterfaceRequirement) - int(rightIsInterfaceRequirement);
+ // Any decl is strictly better than a module decl.
+ bool leftIsModule = (as<ModuleDeclarationDecl>(left.declRef) != nullptr);
+ bool rightIsModule = (as<ModuleDeclarationDecl>(right.declRef) != nullptr);
+ if(leftIsModule != rightIsModule)
+ return int(rightIsModule) - int(leftIsModule);
+
// If both are interface requirements, prefer to more derived interface.
if (leftIsInterfaceRequirement && rightIsInterfaceRequirement)
{