summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-06-12 07:57:42 -0700
committerGitHub <noreply@github.com>2025-06-12 07:57:42 -0700
commit4ae6e9d8b7790d827ca9edd729ad94f38a0c73de (patch)
tree1aad23cae09dacf9d3377d040cbc9ac84b48675e /tests/diagnostics
parent7dad68f869502e5c0ab32c12cbf8db866e020713 (diff)
Diagnose on use of struct inheritance. (#7419)
* Diagnose on use of struct inheritance. * fix test. * Fix tests. * fix. --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/inheritance-1.slang13
-rw-r--r--tests/diagnostics/inheritance-2.slang10
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/diagnostics/inheritance-1.slang b/tests/diagnostics/inheritance-1.slang
new file mode 100644
index 000000000..c811623d8
--- /dev/null
+++ b/tests/diagnostics/inheritance-1.slang
@@ -0,0 +1,13 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+
+// Tests that we will diagnose a warning on struct inheritance being unstable
+// before Slang 2026.
+
+#lang 2025
+
+struct Base {}
+
+//CHECK: ([[# @LINE+1]]): warning 30816:
+struct Derived : Base {}
+
+struct Base1 {} \ No newline at end of file
diff --git a/tests/diagnostics/inheritance-2.slang b/tests/diagnostics/inheritance-2.slang
new file mode 100644
index 000000000..6b1bcfaff
--- /dev/null
+++ b/tests/diagnostics/inheritance-2.slang
@@ -0,0 +1,10 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+
+// Tests that we will diagnose an error on struct inheritance in language 2026 or later.
+
+#lang 2026
+
+struct Base {}
+
+//CHECK: ([[# @LINE+1]]): error 30811:
+struct Derived : Base {}