summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-autodiff.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-03-21 20:03:12 -0700
committerGitHub <noreply@github.com>2023-03-21 20:03:12 -0700
commit83876733d69582eec6bad26af64a651d40fa43aa (patch)
tree641edb23ee4d656b198e1cc840470702f3ac391d /source/slang/slang-ir-autodiff.cpp
parent5d2c5dd9f748d728abf2a4361fca71a7f9ec65b6 (diff)
Fix associated type resolution bug. (#2719)
* Fix associated type resolution bug. * Fix. * Fix language server hinting messed up by breadcrumb nodes. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-autodiff.cpp')
-rw-r--r--source/slang/slang-ir-autodiff.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index e9b78696e..224cca9e0 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -384,6 +384,18 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func)
else
{
differentiableWitnessDictionary.Add((IRType*)item->getConcreteType(), item->getWitness());
+ if (auto diffPairType = as<IRDifferentialPairTypeBase>(item->getConcreteType()))
+ {
+ // For differential pair types, register the differential type as well.
+ IRBuilder builder(diffPairType);
+ builder.setInsertAfter(diffPairType->getWitness());
+ auto diffType = _lookupWitness(&builder, diffPairType->getWitness(), sharedContext->differentialAssocTypeStructKey);
+ auto diffWitness = _lookupWitness(&builder, diffPairType->getWitness(), sharedContext->differentialAssocTypeWitnessStructKey);
+ if (diffType && diffWitness)
+ {
+ differentiableWitnessDictionary.AddIfNotExists((IRType*)diffType, diffWitness);
+ }
+ }
}
}
}