summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
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 1ef5b1cec..5b5e05b73 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -147,6 +147,8 @@ struct SemanticsDeclHeaderVisitor : public SemanticsDeclVisitorBase,
void visitGenericTypeConstraintDecl(GenericTypeConstraintDecl* decl);
+ void visitTypeCoercionConstraintDecl(TypeCoercionConstraintDecl* decl);
+
void validateGenericConstraintSubType(GenericTypeConstraintDecl* decl, TypeExp type);
void visitGenericDecl(GenericDecl* genericDecl);
@@ -2911,6 +2913,16 @@ void SemanticsDeclHeaderVisitor::validateGenericConstraintSubType(
}
}
+void SemanticsDeclHeaderVisitor::visitTypeCoercionConstraintDecl(TypeCoercionConstraintDecl* decl)
+{
+ CheckConstraintSubType(decl->toType);
+
+ if (!decl->fromType.type)
+ decl->fromType = TranslateTypeNodeForced(decl->fromType);
+ if (!decl->toType.type)
+ decl->toType = TranslateTypeNodeForced(decl->toType);
+}
+
void SemanticsDeclHeaderVisitor::visitGenericTypeConstraintDecl(GenericTypeConstraintDecl* decl)
{
// TODO: are there any other validations we can do at this point?