From 78d4df0644b20b8ba4eeff459c749c4e8d261345 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 14 Mar 2024 14:14:18 -0700 Subject: Add diagnostic on invalid type constraint. (#3769) --- tests/diagnostics/invalid-constraint.slang | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/diagnostics/invalid-constraint.slang (limited to 'tests') diff --git a/tests/diagnostics/invalid-constraint.slang b/tests/diagnostics/invalid-constraint.slang new file mode 100644 index 000000000..667077ffb --- /dev/null +++ b/tests/diagnostics/invalid-constraint.slang @@ -0,0 +1,27 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): + +interface IFoo +{ + This foo(); +} + +struct Foo : IFoo +{ + float x; + This foo() + { + This f; + f.x = 0.0; + return f; + } +} + +RWStructuredBuffer output; + +// CHECK: ([[# @LINE+1]]): error 30401 +float compute(T f) // error, should be IFoo here. +{ +} + +void main() +{} -- cgit v1.2.3