summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/interfaces
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-31 09:52:51 -0800
committerGitHub <noreply@github.com>2024-12-31 09:52:51 -0800
commita8471a1d9a5591202bf4a552aa7d1bf11088fdce (patch)
treebd8c9fe1c761c5328f0c6485fc9d31d8e3ec69c2 /tests/language-feature/interfaces
parentb7eb585241b3f3519ff494004efedae680cb44b9 (diff)
Fix `getInheritanceInfo` for `ExtractExistentialType`. (#5971)
Diffstat (limited to 'tests/language-feature/interfaces')
-rw-r--r--tests/language-feature/interfaces/gh-5900.slang40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/language-feature/interfaces/gh-5900.slang b/tests/language-feature/interfaces/gh-5900.slang
new file mode 100644
index 000000000..996347b41
--- /dev/null
+++ b/tests/language-feature/interfaces/gh-5900.slang
@@ -0,0 +1,40 @@
+//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type
+
+interface IFoo
+{
+ float get();
+}
+
+extension<FooType : IFoo> FooType {
+ float load()
+ {
+ return get();
+ }
+}
+
+struct Foo : IFoo
+{
+ RWStructuredBuffer<float> buffer;
+ int dummy;
+
+ float get() { return buffer[0]; }
+}
+
+float bugTest(IFoo t)
+{
+ return t.load();
+}
+
+//TEST_INPUT: set input = new Foo { ubuffer(data=[1.0 0 0 0], stride=4), 0 }
+ConstantBuffer<Foo> input;
+
+//TEST_INPUT: set output = out ubuffer(data=[0], stride=4)
+uniform RWStructuredBuffer<float> output;
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ // CHECK: 1.0
+ output[0] = bugTest(input);
+} \ No newline at end of file