diff options
| author | Yong He <yonghe@outlook.com> | 2022-11-07 12:26:29 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-07 12:26:29 -0800 |
| commit | ca882a1ef46a5a8bbff50e3a1a6f973e16358634 (patch) | |
| tree | 1a4d37ad67d3844b6c69ebec68d3858f0c318747 /source/slang/slang-check-conformance.cpp | |
| parent | ea99c274dea12fffdc89a8d4eeefcbb670232ba8 (diff) | |
Small cleanups on forward differentiation. (#2498)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-conformance.cpp')
| -rw-r--r-- | source/slang/slang-check-conformance.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp index eb072e9dd..d2335efbf 100644 --- a/source/slang/slang-check-conformance.cpp +++ b/source/slang/slang-check-conformance.cpp @@ -378,45 +378,6 @@ namespace Slang } } } - - // If a generic type parameter does not declare itself to conform to `IDifferentiable`, - // we treat it as a subtype of `DifferentialBottom` to make it conform to `IDifferentiable`. - // Note: we only consider this option for `originalSubType` so a type that implements `IDifferential` but - // inherits from some other non differentiable types don't get to inherit `DifferentialBottom`. - if (m_astBuilder->isDifferentiableInterfaceAvailable() && - subType == originalSubType && - superTypeDeclRef.getDecl() == m_astBuilder->getDifferentiableInterface()) - { - if (as<GenericTypeParamDecl>(declRefType->declRef.getDecl()) || - as<AssocTypeDecl>(declRefType->declRef.getDecl())) - { - auto sup = DeclRefType::create(m_astBuilder, superTypeDeclRef); - auto differentialBottomType = as<DeclRefType>(m_astBuilder->getDifferentialBottomType()); - auto container = differentialBottomType->declRef.as<ContainerDecl>().getDecl(); - SLANG_RELEASE_ASSERT(container); - auto inheritanceDecl = container->getMembersOfType<InheritanceDecl>().getFirst(); - auto witnessDifferentialBottomIsIDifferentiable = - m_astBuilder->getOrCreate<DeclaredSubtypeWitness>( - m_astBuilder->getDifferentialBottomType(), - sup, - inheritanceDecl, - nullptr); - - auto witnessSubIsDifferentialBottom = - m_astBuilder->getOrCreate<DifferentialBottomSubtypeWitness>( - subType, differentialBottomType); - - TransitiveSubtypeWitness* transitiveWitness = - m_astBuilder->getOrCreateWithDefaultCtor<TransitiveSubtypeWitness>( - witnessSubIsDifferentialBottom, witnessDifferentialBottomIsIDifferentiable); - transitiveWitness->sub = subType; - transitiveWitness->sup = sup; - transitiveWitness->midToSup = witnessDifferentialBottomIsIDifferentiable; - transitiveWitness->subToMid = witnessSubIsDifferentialBottom; - *outWitness = transitiveWitness; - return true; - } - } } else if (auto extractExistentialType = as<ExtractExistentialType>(subType)) { |
