Skip to content

Commit 8bf4743

Browse files
Create scope for synthesized property decl. (#5817)
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
1 parent 89bf795 commit 8bf4743

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

source/slang/slang-check-decl.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -5070,7 +5070,9 @@ bool SemanticsVisitor::trySynthesizePropertyRequirementWitness(
50705070
synPropertyDecl->nameAndLoc.name =
50715071
getName(String("$syn_property_") + getText(requiredMemberDeclRef.getName()));
50725072
synPropertyDecl->parentDecl = context->parentDecl;
5073-
5073+
synPropertyDecl->ownedScope = m_astBuilder->create<Scope>();
5074+
synPropertyDecl->ownedScope->containerDecl = synPropertyDecl;
5075+
synPropertyDecl->ownedScope->parent = context->parentDecl->ownedScope;
50745076

50755077
// The type of our synthesized property can be derived from the
50765078
// specialized declref to the requirement decl.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK):-output-using-type
2+
3+
public interface ITest {
4+
property int value;
5+
};
6+
7+
struct Test : ITest {
8+
int value;
9+
};
10+
11+
//TEST_INPUT: type_conformance Test:ITest = 1;
12+
13+
//TEST_INPUT: set inputBuffer = ubuffer(data=[0 0 1 0 1 0 0 0], stride=4)
14+
RWStructuredBuffer<ITest> inputBuffer;
15+
16+
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
17+
RWStructuredBuffer<int> outputBuffer;
18+
19+
[NumThreads(1, 1, 1)]
20+
void computeMain()
21+
{
22+
// CHECK: 1
23+
outputBuffer[0] = inputBuffer[0].value;
24+
}

0 commit comments

Comments
 (0)