diff options
| author | Yong He <yonghe@outlook.com> | 2023-03-13 10:57:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-13 10:57:28 -0700 |
| commit | a911ca6e06ce41e403b80fe6054162393491c8ac (patch) | |
| tree | 6c8d56a3060b1887e7fd3126fe54a1241160eddd /source/slang/slang-syntax.cpp | |
| parent | 3fea56ef77a33273bf5af6f432163b30c0a0e1dc (diff) | |
Support high order diff pattern: `bwd_diff(fwd_diff(f))`. (#2695)
* Support high order diff pattern: `bwd_diff(fwd_diff(f))`.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-syntax.cpp')
| -rw-r--r-- | source/slang/slang-syntax.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 6076a41ca..470f5f983 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -1232,6 +1232,25 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } break; } + + // Hard code implementation of T.Differential.Differential == T.Differential rule. + if (auto builtinReq = substDeclRef.getDecl()->findModifier<BuiltinRequirementModifier>()) + { + if (builtinReq->kind == BuiltinRequirementKind::DifferentialType) + { + // Is the concrete type a Differential associated type? + if (auto innerDeclRefType = as<DeclRefType>(thisSubst->witness->sub)) + { + if (auto innerBuiltinReq = innerDeclRefType->declRef.decl->findModifier<BuiltinRequirementModifier>()) + { + if (innerBuiltinReq->kind == BuiltinRequirementKind::DifferentialType) + { + return innerDeclRefType; + } + } + } + } + } } } } |
