summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-10-31 11:12:08 -0400
committerYong He <yonghe@outlook.com>2017-10-31 11:12:08 -0400
commit093bf1eb9149ba82258b5a5a159b2f54263b17c2 (patch)
tree8ee5c2bd4b730d3bd446546dd50f0284d3e47161 /tests
parent84f381cc180b3176d6a58da4085ee8470f246922 (diff)
work in-progress: type checking associated types
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/assoctype-simple.slang13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/compute/assoctype-simple.slang b/tests/compute/assoctype-simple.slang
index 5a2c339a6..e03bb4e54 100644
--- a/tests/compute/assoctype-simple.slang
+++ b/tests/compute/assoctype-simple.slang
@@ -7,21 +7,21 @@ RWStructuredBuffer<float> outputBuffer;
interface ISimple
{
- assoctype T;
- T add(T v0, T v1);
+ associatedtype U;
+ U add(U v0, U v1);
}
struct Simple : ISimple
{
- typedef float T;
- T add(T v0, float v1)
+ typedef float U;
+ U add(U v0, float v1)
{
return v0 + v1;
}
};
__generic<T:ISimple>
-T.T test(T simple, T.T v0, T.T v1)
+T.U test(T simple, T.U v0, T.U v1)
{
return simple.add(v0, v1);
}
@@ -29,6 +29,7 @@ T.T test(T simple, T.T v0, T.T v1)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- float outVal = test<Simple>(Simple(), 2.0, 1.0); // == 3.0
+ Simple s;
+ float outVal = test<Simple>(s, 2.0, 1.0); // == 3.0
outputBuffer[tid] = outVal;
} \ No newline at end of file