From 4ae6e9d8b7790d827ca9edd729ad94f38a0c73de Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 12 Jun 2025 07:57:42 -0700 Subject: 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> --- tests/diagnostics/inheritance-1.slang | 13 +++++++++++++ tests/diagnostics/inheritance-2.slang | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/diagnostics/inheritance-1.slang create mode 100644 tests/diagnostics/inheritance-2.slang (limited to 'tests/diagnostics') 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 {} -- cgit v1.2.3