summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-04-28 08:52:49 -0400
committerGitHub <noreply@github.com>2022-04-28 08:52:49 -0400
commit1f3298e3eecff60170f16b40739b4448d6403b8d (patch)
treeee2689627e00241e50f52af33ffcbaac701d09fc /tests
parent634f5414f332f904c7db968810b3d6f0ca253959 (diff)
Disable `class` keyword to define a new type (#2212)
* #include an absolute path didn't work - because paths were taken to always be relative. * Disable class keyword. * Add class keyword test. * Fix test diagnostic.
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/class-keyword.slang10
-rw-r--r--tests/diagnostics/class-keyword.slang.expected8
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/diagnostics/class-keyword.slang b/tests/diagnostics/class-keyword.slang
new file mode 100644
index 000000000..c0495a614
--- /dev/null
+++ b/tests/diagnostics/class-keyword.slang
@@ -0,0 +1,10 @@
+//DIAGNOSTIC_TEST:SIMPLE:
+
+// `class` keyword is a reserved keyword in this context, and wso should produce an error.
+// It can be used in the form of `enum class`
+
+class SomeClass
+{
+ int a;
+ int b;
+};
diff --git a/tests/diagnostics/class-keyword.slang.expected b/tests/diagnostics/class-keyword.slang.expected
new file mode 100644
index 000000000..9a3a07a63
--- /dev/null
+++ b/tests/diagnostics/class-keyword.slang.expected
@@ -0,0 +1,8 @@
+result code = -1
+standard error = {
+tests/diagnostics/class-keyword.slang(6): error 20014: 'class' is a reserved keyword in this context; use 'struct' instead.
+class SomeClass
+^~~~~
+}
+standard output = {
+}