diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 3667a36ba..04d5b7a75 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -9247,12 +9247,16 @@ void SemanticsDeclHeaderVisitor::checkDifferentiableCallableCommon(CallableDecl* if (!decl->hasModifier<NoDiffThisAttribute>()) { // Build decl-ref-type from interface. - auto interfaceType = - DeclRefType::create(getASTBuilder(), makeDeclRef(interfaceDecl)); + auto thisType = DeclRefType::create( + m_astBuilder, + createDefaultSubstitutionsIfNeeded( + m_astBuilder, + this, + makeDeclRef(interfaceDecl->getThisTypeDecl()))); // If the interface is differentiable, make the this type a pair. - if (tryGetDifferentialType(getASTBuilder(), interfaceType)) - reqDecl->diffThisType = getDifferentialPairType(interfaceType); + if (tryGetDifferentialType(getASTBuilder(), thisType)) + reqDecl->diffThisType = getDifferentialPairType(thisType); } auto reqRef = m_astBuilder->create<DerivativeRequirementReferenceDecl>(); @@ -9277,13 +9281,17 @@ void SemanticsDeclHeaderVisitor::checkDifferentiableCallableCommon(CallableDecl* reqDecl->parentDecl = interfaceDecl; if (!decl->hasModifier<NoDiffThisAttribute>()) { - // Build decl-ref-type from interface. - auto interfaceType = - DeclRefType::create(getASTBuilder(), makeDeclRef(interfaceDecl)); + // Build decl-ref-type for this-type. + auto thisType = DeclRefType::create( + m_astBuilder, + createDefaultSubstitutionsIfNeeded( + m_astBuilder, + this, + makeDeclRef(interfaceDecl->getThisTypeDecl()))); // If the interface is differentiable, make the this type a pair. - if (tryGetDifferentialType(getASTBuilder(), interfaceType)) - reqDecl->diffThisType = getDifferentialPairType(interfaceType); + if (tryGetDifferentialType(getASTBuilder(), thisType)) + reqDecl->diffThisType = getDifferentialPairType(thisType); } auto reqRef = m_astBuilder->create<DerivativeRequirementReferenceDecl>(); |
