summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-check-expr.cpp2
-rw-r--r--source/slang/slang-syntax.cpp46
-rw-r--r--source/slang/slang.natvis11
3 files changed, 40 insertions, 19 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp
index 4d55669e2..b988fac60 100644
--- a/source/slang/slang-check-expr.cpp
+++ b/source/slang/slang-check-expr.cpp
@@ -157,8 +157,6 @@ namespace Slang
openedType->originalInterfaceType = expr->type.type;
openedType->originalInterfaceDeclRef = interfaceDeclRef;
- DeclRef<InterfaceDecl> substDeclRef = openedType->getSpecializedInterfaceDeclRef();
-
ExtractExistentialValueExpr* openedValue = m_astBuilder->create<ExtractExistentialValueExpr>();
openedValue->declRef = varDeclRef;
openedValue->type = QualType(openedType);
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index 9a7200e9d..5b4b61849 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -838,28 +838,40 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
// Otherwise, check if we are trying to apply
// a this-type substitution to the given interface
//
- for(auto s = substsToApply; s; s = s->outer)
+ // Note: We want to skip the ThisTypeSubstitution that specializes
+ // declToSpecialize itself (when declToSpecialize is an interface
+ // decl and the subst specializes it), and only pull the
+ // ThisTypeSubstitution when the decl is referencing a child of
+ // the interface decl being specialized. This is because
+ // by default an interface declref type is a "free" existential
+ // type that shouldn't be specialized by someone else, unless
+ // there is an "implicit" ThisType reference preceeding a child
+ // reference.
+ if (declToSpecialize != ancestorInterfaceDecl)
{
- auto appThisTypeSubst = as<ThisTypeSubstitution>(s);
- if(!appThisTypeSubst)
- continue;
+ for (auto s = substsToApply; s; s = s->outer)
+ {
+ auto appThisTypeSubst = as<ThisTypeSubstitution>(s);
+ if (!appThisTypeSubst)
+ continue;
- if(appThisTypeSubst->interfaceDecl != ancestorInterfaceDecl)
- continue;
+ if (appThisTypeSubst->interfaceDecl != ancestorInterfaceDecl)
+ continue;
- int diff = 0;
- auto restSubst = specializeSubstitutions(
- astBuilder,
- ancestorInterfaceDecl->parentDecl,
- substsToSpecialize,
- substsToApply,
- &diff);
+ int diff = 0;
+ auto restSubst = specializeSubstitutions(
+ astBuilder,
+ ancestorInterfaceDecl->parentDecl,
+ substsToSpecialize,
+ substsToApply,
+ &diff);
- ThisTypeSubstitution* firstSubst = astBuilder->getOrCreateThisTypeSubstitution(
- ancestorInterfaceDecl, appThisTypeSubst->witness, restSubst);
+ ThisTypeSubstitution* firstSubst = astBuilder->getOrCreateThisTypeSubstitution(
+ ancestorInterfaceDecl, appThisTypeSubst->witness, restSubst);
- (*ioDiff)++;
- return firstSubst;
+ (*ioDiff)++;
+ return firstSubst;
+ }
}
}
}
diff --git a/source/slang/slang.natvis b/source/slang/slang.natvis
index 4d5bad2d3..6c8f15ec9 100644
--- a/source/slang/slang.natvis
+++ b/source/slang/slang.natvis
@@ -239,6 +239,7 @@
<ExpandedItem Condition="astNodeType == Slang::ASTNodeType::AndTypeExpr">(Slang::AndTypeExpr*)&amp;astNodeType</ExpandedItem>
<ExpandedItem Condition="astNodeType == Slang::ASTNodeType::ModifiedTypeExpr">(Slang::ModifiedTypeExpr*)&amp;astNodeType</ExpandedItem>
<ExpandedItem Condition="astNodeType == Slang::ASTNodeType::PointerTypeExpr">(Slang::PointerTypeExpr*)&amp;astNodeType</ExpandedItem>
+ <Item Name="[type]">type</Item>
<Item Name="[Expr]">(Slang::Expr*)this,nd</Item>
</Expand>
</Type>
@@ -477,4 +478,14 @@
<Item Name="[Members]">members</Item>
</Expand>
</Type>
+ <Type Name="Slang::Val" Inheritable="false">
+ <DisplayString>{astNodeType}</DisplayString>
+ <Expand>
+ <ExpandedItem Condition="astNodeType == Slang::ASTNodeType::ConstantIntVal">(Slang::ConstantIntVal*)&amp;astNodeType</ExpandedItem>
+ <ExpandedItem Condition="astNodeType == Slang::ASTNodeType::PolynomialIntVal">(Slang::PolynomialIntVal*)&amp;astNodeType</ExpandedItem>
+ <ExpandedItem Condition="astNodeType == Slang::ASTNodeType::GenericParamIntVal">(Slang::GenericParamIntVal*)&amp;astNodeType</ExpandedItem>
+ <ExpandedItem Condition="astNodeType == Slang::ASTNodeType::DeclaredSubtypeWitness">(Slang::DeclaredSubtypeWitness*)&amp;astNodeType</ExpandedItem>
+ <ExpandedItem Condition="astNodeType == Slang::ASTNodeType::TransitiveSubtypeWitness">(Slang::TransitiveSubtypeWitness*)&amp;astNodeType</ExpandedItem>
+ </Expand>
+ </Type>
</AutoVisualizer> \ No newline at end of file