summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-07-15 17:42:43 -0700
committerGitHub <noreply@github.com>2025-07-16 00:42:43 +0000
commit652a8ee6883f08ce7cb55ef372277a535ce4d88f (patch)
tree856308f1cd3089408046c3d41cf2b5e7bfa2d19e /source/slang/slang-check-decl.cpp
parent21a66267c661a55c8ad27248c0765276dd6f72ea (diff)
Add clear diagnostic for unsupported float types in generic value parameters (#7737)
* Initial plan * Add validation and clear error message for float generic parameters Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 584b1f081..9853b0097 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -3413,6 +3413,18 @@ void SemanticsDeclHeaderVisitor::visitGenericTypeParamDecl(GenericTypeParamDecl*
void SemanticsDeclHeaderVisitor::visitGenericValueParamDecl(GenericValueParamDecl* decl)
{
checkVarDeclCommon(decl);
+
+ // Validate that the type is supported for generic value parameters
+ if (decl->type.type)
+ {
+ if (!isValidCompileTimeConstantType(decl->type.type))
+ {
+ getSink()->diagnose(
+ decl,
+ Diagnostics::genericValueParameterTypeNotSupported,
+ decl->type.type);
+ }
+ }
}
void SemanticsDeclHeaderVisitor::visitGenericDecl(GenericDecl* genericDecl)