aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--progs/tests/tuples_fail_invalid_singleton.sy7
-rw-r--r--src/compiler.rs8
2 files changed, 15 insertions, 0 deletions
diff --git a/progs/tests/tuples_fail_invalid_singleton.sy b/progs/tests/tuples_fail_invalid_singleton.sy
new file mode 100644
index 0000000..c70fc21
--- /dev/null
+++ b/progs/tests/tuples_fail_invalid_singleton.sy
@@ -0,0 +1,7 @@
+start :: fn {
+ a := (,)
+ a
+}
+
+//TODO(gu) See #100
+// errors: [ErrorKind::SyntaxError(_, _), ErrorKind::SyntaxError(_, _), ErrorKind::SyntaxError(_, _), ErrorKind::SyntaxError(_, _)]
diff --git a/src/compiler.rs b/src/compiler.rs
index 46fe38c..c4f687f 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -691,6 +691,14 @@ impl Compiler {
Token::Newline => {
self.eat();
}
+ Token::Comma => {
+ //TODO(gu): This creates a lot of syntax errors since the compiler panic is
+ // ignored and the statement is tried as a grouping instead, even though we
+ // _know_ that this can't be parsed as a grouping either.
+ // Tracked in #100.
+ error!(self, "Tuples must begin with an element or ')'.");
+ return;
+ }
_ => {
self.expression(block);
num_args += 1;