summaryrefslogtreecommitdiff
path: root/tests/diagnostics/generic-constraint-forward-reference.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics/generic-constraint-forward-reference.slang')
-rw-r--r--tests/diagnostics/generic-constraint-forward-reference.slang16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/diagnostics/generic-constraint-forward-reference.slang b/tests/diagnostics/generic-constraint-forward-reference.slang
new file mode 100644
index 000000000..08a6c3478
--- /dev/null
+++ b/tests/diagnostics/generic-constraint-forward-reference.slang
@@ -0,0 +1,16 @@
+//DIAGNOSTIC_TEST:SIMPLE:
+// Test forward references in generic constraints
+
+interface IFloat {}
+interface IFoo<T : IFloat> {}
+interface IBar<T, U> {}
+
+// Test case 1: Simple forward reference in interface constraint
+void test1<Foo : IFoo<T>, T : IFloat>() {}
+
+// Test case 2: Multiple forward references in a single constraint
+void test2<A : IBar<B, C>, B : IFloat, C : IFloat>() {}
+
+// Valid case that should NOT produce our error:
+// Test case 3: Correct order - type parameter declared before use
+void test3<T : IFloat, Foo : IFoo<T>>() {}