summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-05-20 16:00:40 +0200
committerJo-Philipp Wich <jo@mein.io>2022-05-20 16:04:19 +0200
commit081871e18db544e2c834a516950e1c16c9bc4d2c (patch)
treea518d9229859f527253794eb0f4f6339e1dc6ea9 /tests
parent090b426b00a82cac7b4ea386b077e21ae32f1c17 (diff)
compiler: fix segmentation fault on compiling unexpected unary expressions
When compiling expressions followed by a unary operator, the compiler triggered a segmentation fault due to invoking an unset infix parser routine. Explicitly handle this case and raise a syntax error if such an invalid expression is encountered. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/custom/04_bugs/37_compiler_unexpected_unary_op21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/custom/04_bugs/37_compiler_unexpected_unary_op b/tests/custom/04_bugs/37_compiler_unexpected_unary_op
new file mode 100644
index 0000000..e652319
--- /dev/null
+++ b/tests/custom/04_bugs/37_compiler_unexpected_unary_op
@@ -0,0 +1,21 @@
+When compiling expressions followed by a unary operator, the compiler
+triggered a segmentation fault due to invoking an unset infix parser
+routine.
+
+-- Testcase --
+1~1
+-- End --
+
+-- Args --
+-R
+-- End --
+
+-- Expect stderr --
+Syntax error: Expecting ';' or binary operator
+In line 1, byte 2:
+
+ `1~1`
+ ^-- Near here
+
+
+-- End --