From ca882a1ef46a5a8bbff50e3a1a6f973e16358634 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 7 Nov 2022 12:26:29 -0800 Subject: Small cleanups on forward differentiation. (#2498) Co-authored-by: Yong He --- source/slang/slang-check-conformance.cpp | 39 -------------------------------- 1 file changed, 39 deletions(-) (limited to 'source/slang/slang-check-conformance.cpp') 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(declRefType->declRef.getDecl()) || - as(declRefType->declRef.getDecl())) - { - auto sup = DeclRefType::create(m_astBuilder, superTypeDeclRef); - auto differentialBottomType = as(m_astBuilder->getDifferentialBottomType()); - auto container = differentialBottomType->declRef.as().getDecl(); - SLANG_RELEASE_ASSERT(container); - auto inheritanceDecl = container->getMembersOfType().getFirst(); - auto witnessDifferentialBottomIsIDifferentiable = - m_astBuilder->getOrCreate( - m_astBuilder->getDifferentialBottomType(), - sup, - inheritanceDecl, - nullptr); - - auto witnessSubIsDifferentialBottom = - m_astBuilder->getOrCreate( - subType, differentialBottomType); - - TransitiveSubtypeWitness* transitiveWitness = - m_astBuilder->getOrCreateWithDefaultCtor( - witnessSubIsDifferentialBottom, witnessDifferentialBottomIsIDifferentiable); - transitiveWitness->sub = subType; - transitiveWitness->sup = sup; - transitiveWitness->midToSup = witnessDifferentialBottomIsIDifferentiable; - transitiveWitness->subToMid = witnessSubIsDifferentialBottom; - *outWitness = transitiveWitness; - return true; - } - } } else if (auto extractExistentialType = as(subType)) { -- cgit v1.2.3