From c15a9eab7f45f27df915e96292e99de53c4ad3a0 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 8 Dec 2021 12:51:19 -0700 Subject: [PATCH] GH-1740: Report a better error message if table key is not a list --- src/Expr.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Expr.cc b/src/Expr.cc index b1d7ebb153..9271cf7e22 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -2626,7 +2626,7 @@ TypePtr AssignExpr::InitType() const { if ( op1->Tag() != EXPR_LIST ) { - Error("bad initializer"); + Error("bad initializer, first operand should be a list"); return nullptr; } @@ -3490,7 +3490,10 @@ TableConstructorExpr::TableConstructorExpr(ListExprPtr constructor_list, SetType(init_type(op.get())); if ( ! type ) + { SetError(); + return; + } else if ( type->Tag() != TYPE_TABLE || type->AsTableType()->IsSet() ) SetError("values in table(...) constructor do not specify a table");