summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-type.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-05-15 12:51:29 -0700
committerGitHub <noreply@github.com>2025-05-15 12:51:29 -0700
commit0d6312f3be66f4bff9eec9606228db3edc309e2c (patch)
treea868e452e2d25a88f8a6cdee109a280edd11c0fb /source/slang/slang-check-type.cpp
parentd961f4438ef865028d289148d22e0fb5c0d8319a (diff)
Add checking for hlsl register semantic. (#7118)
* Add checking for hlsl register semantic. * Fix. * Fix test. * Fix switch error. * Fix tests.
Diffstat (limited to 'source/slang/slang-check-type.cpp')
-rw-r--r--source/slang/slang-check-type.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/slang/slang-check-type.cpp b/source/slang/slang-check-type.cpp
index d32903175..b5f5240a5 100644
--- a/source/slang/slang-check-type.cpp
+++ b/source/slang/slang-check-type.cpp
@@ -331,17 +331,27 @@ bool SemanticsVisitor::CoerceToProperTypeImpl(
if (outProperType)
args.add(ExtractGenericArgVal(valParam->initExpr));
}
- else if (auto constraintParam = as<GenericTypeConstraintDecl>(member))
+ }
+
+ for (Decl* member : genericDeclRef.getDecl()->members)
+ {
+ if (auto constraintParam = as<GenericTypeConstraintDecl>(member))
{
auto genericParam = as<DeclRefType>(constraintParam->sub.type)->getDeclRef();
if (!genericParam)
return false;
auto genericTypeParamDecl = as<GenericTypeParamDecl>(genericParam.getDecl());
if (!genericTypeParamDecl)
+ {
+ diagSink->diagnose(typeExp.exp, Diagnostics::genericTypeNeedsArgs, typeExp);
return false;
+ }
auto defaultType = CheckProperType(genericTypeParamDecl->initType);
if (!defaultType)
+ {
+ diagSink->diagnose(typeExp.exp, Diagnostics::genericTypeNeedsArgs, typeExp);
return false;
+ }
auto witness =
tryGetSubtypeWitness(defaultType, CheckProperType(constraintParam->sup));
if (!witness)