From 441e13e13f30b96eb04c05725ad7fe1983c92f53 Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Thu, 5 Oct 2023 12:52:49 -0400 Subject: Various AD Fixes (#3263) * Various fixes * Remove unused parameter * Update slang-ir-loop-unroll.cpp --------- Co-authored-by: Yong He --- source/slang/slang-check-expr.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source/slang/slang-check-expr.cpp') diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index abdd89b01..05a6ed249 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -422,7 +422,9 @@ namespace Slang return result; } - Expr* SemanticsVisitor::maybeUseSynthesizedDeclForLookupResult(LookupResultItem const& item, Expr* originalExpr) + Expr* SemanticsVisitor::maybeUseSynthesizedDeclForLookupResult( + LookupResultItem const& item, + Expr* originalExpr) { // If the only result from lookup is an entry in an interface decl, it could be that // the user is leaving out an explicit definition for the requirement and depending on @@ -521,13 +523,16 @@ namespace Slang conformanceDecl->base.type = m_astBuilder->getDiffInterfaceType(); conformanceDecl->parentDecl = structDecl; structDecl->members.add(conformanceDecl); + structDecl->parentDecl = parent; synthesizedDecl = structDecl; auto typeDef = m_astBuilder->create(); typeDef->nameAndLoc.name = getName("Differential"); - auto declRef = createDefaultSubstitutionsIfNeeded(m_astBuilder, this, makeDeclRef(structDecl)); - typeDef->type.type = DeclRefType::create(m_astBuilder, declRef); typeDef->parentDecl = structDecl; + + auto synthDeclRef = createDefaultSubstitutionsIfNeeded(m_astBuilder, this, makeDeclRef(structDecl)); + + typeDef->type.type = DeclRefType::create(m_astBuilder, synthDeclRef); structDecl->members.add(typeDef); } break; @@ -545,8 +550,9 @@ namespace Slang auto toBeSynthesized = m_astBuilder->create(); addModifier(synthesizedDecl, toBeSynthesized); + auto synthDeclMemberRef = m_astBuilder->getMemberDeclRef(subType->getDeclRef(), synthesizedDecl); return ConstructDeclRefExpr( - makeDeclRef(synthesizedDecl), + synthDeclMemberRef, nullptr, originalExpr ? originalExpr->loc : SourceLoc(), originalExpr); -- cgit v1.2.3