From 093bf1eb9149ba82258b5a5a159b2f54263b17c2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 31 Oct 2017 11:12:08 -0400 Subject: work in-progress: type checking associated types --- tests/compute/assoctype-simple.slang | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/compute') 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 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.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(), 2.0, 1.0); // == 3.0 + Simple s; + float outVal = test(s, 2.0, 1.0); // == 3.0 outputBuffer[tid] = outVal; } \ No newline at end of file -- cgit v1.2.3