summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-01-24 16:12:38 -0500
committerGitHub <noreply@github.com>2025-01-24 13:12:38 -0800
commit92c9fffb95c92b0bc07eb1c656375928b5cd5c33 (patch)
tree7faf537e1d56a22cd8e16133867da745b32b2aef /source/slang/slang-check-decl.cpp
parentac174d260d90b66ebbc8264001a75b9527611cbc (diff)
improve error message on generic value decls (#6169)
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 0319eb260..3453d0538 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -1775,7 +1775,14 @@ void SemanticsDeclHeaderVisitor::checkVarDeclCommon(VarDeclBase* varDecl)
{
if (!varDecl->type.type)
{
- getSink()->diagnose(varDecl, Diagnostics::varWithoutTypeMustHaveInitializer);
+ if (as<GenericValueParamDecl>(varDecl))
+ {
+ getSink()->diagnose(varDecl, Diagnostics::genericValueParameterMustHaveType);
+ }
+ else
+ {
+ getSink()->diagnose(varDecl, Diagnostics::varWithoutTypeMustHaveInitializer);
+ }
varDecl->type.type = m_astBuilder->getErrorType();
}
}