diff options
| author | Yong He <yonghe@outlook.com> | 2025-02-20 14:48:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-20 14:48:51 -0800 |
| commit | 19867ffca6dca7995c799354081219c9e76f13d1 (patch) | |
| tree | b9153428fc8b7b6f3069931cf816ad374a2e7c52 /source/slang/slang-check-decl.cpp | |
| parent | 9580e311e0cefb0f8e11afc316783a67201654eb (diff) | |
Simplify implicit cast ctors for vector & matrix. (#6408)
* Simplify implicit cast ctors for vector & matrix.
* Fix formatting.
* Fix tests.
* Fix Falcor test.
* Mark __builtin_cast as internal.
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 12 |
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? |
