summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ast-decl-ref.cpp2
-rw-r--r--source/slang/slang-check-overload.cpp18
2 files changed, 18 insertions, 2 deletions
diff --git a/source/slang/slang-ast-decl-ref.cpp b/source/slang/slang-ast-decl-ref.cpp
index 3025381ea..9f140a524 100644
--- a/source/slang/slang-ast-decl-ref.cpp
+++ b/source/slang/slang-ast-decl-ref.cpp
@@ -318,7 +318,7 @@ void DeclRefBase::toText(StringBuilder& out)
return;
}
- if (as<GenericTypeParamDecl>(this->getDecl()))
+ if (as<GenericTypeParamDeclBase>(this->getDecl()))
{
SLANG_ASSERT(as<DirectDeclRef>(this));
out << this->getDecl()->getName()->text;
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp
index fcc6780b6..1ab3aa5b0 100644
--- a/source/slang/slang-check-overload.cpp
+++ b/source/slang/slang-check-overload.cpp
@@ -10,6 +10,17 @@
namespace Slang
{
+
+bool isFreeFormTypePackParam(SemanticsVisitor* visitor, Type* type, ParamDecl* paramDecl)
+{
+ if (auto declRef = isDeclRefTypeOf<GenericTypePackParamDecl>(type))
+ {
+ return visitor->GetOuterGeneric(declRef.getDecl()) ==
+ visitor->GetOuterGeneric(paramDecl->parentDecl);
+ }
+ return false;
+}
+
SemanticsVisitor::ParamCounts SemanticsVisitor::CountParameters(
FilteredMemberRefList<ParamDecl> params)
{
@@ -25,10 +36,15 @@ SemanticsVisitor::ParamCounts SemanticsVisitor::CountParameters(
counts.required += typePack->getTypeCount();
allowedArgCountToAdd = typePack->getTypeCount();
}
- else
+ else if (isFreeFormTypePackParam(this, paramType, param.getDecl()))
{
counts.allowed = -1;
}
+ else
+ {
+ counts.required++;
+ counts.allowed++;
+ }
}
else if (!param.getDecl()->initExpr)
{