From b5afdfaa4605f9112bd6c8d363f9e60ba5362118 Mon Sep 17 00:00:00 2001 From: Dibyendu Majumdar Date: Sat, 20 Feb 2021 22:47:01 +0000 Subject: [PATCH] issue #215 The top level check v->ravi_type != vartype is not correct as it means we miss out checking scenario where v->k == VINDEXED. --- src/lparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lparser.c b/src/lparser.c index fc01ab8..4b742b8 100644 --- a/src/lparser.c +++ b/src/lparser.c @@ -1371,7 +1371,7 @@ static void ravi_typecheck(LexState *ls, expdesc *v, int *var_types, TString **usertypes, int nvars, int n) { /* NOTE that 'v' may not have register assigned yet */ ravitype_t vartype = var_types[n]; - if (n < nvars && vartype != RAVI_TANY && v->ravi_type != vartype) { + if (n < nvars && vartype != RAVI_TANY) { if (v->ravi_type != vartype && (vartype == RAVI_TARRAYFLT || vartype == RAVI_TARRAYINT) && v->k == VNONRELOC) { @@ -1454,7 +1454,7 @@ static void ravi_typecheck(LexState *ls, expdesc *v, int *var_types, luaK_exp2nextreg(ls->fs, v); ravi_code_typecoersion(ls, v->u.info, vartype, usertype); } - else { + else if (vartype != v->ravi_type){ luaX_syntaxerror(ls, "Invalid local assignment"); } }