issue #210 bug in recognizing the type change when an expression of VINDEXED type gets resolved

pull/212/head
Dibyendu Majumdar 3 years ago
parent fe7c76fff5
commit 9ced7e2bc0

@ -1266,8 +1266,8 @@ static int constfolding (FuncState *fs, int op, expdesc *e1,
** Expression to produce final result will be encoded in 'e'.
*/
static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) {
ravitype_t e_type = e->ravi_type;
int r = luaK_exp2anyreg(fs, e); /* opcodes operate only on registers */
ravitype_t e_type = e->ravi_type;
freeexp(fs, e);
if (op == OP_BNOT) {
if (e->ravi_type == RAVI_TNUMINT)

@ -1811,6 +1811,14 @@ end
check(x, 'TOIARRAY', 'IARRAY_GET', 'LEN', 'ADD', 'RETURN', 'RETURN')
print 'Test 85 OK'
-- Test that #() applied to non integer type produces any type
-- issue #210
function x(x:integer[])
return #x[1]+1
end
check(x, 'TOIARRAY', 'IARRAY_GET', 'LEN', 'ADD', 'RETURN', 'RETURN')
print 'Test 86 OK'
for k,v in pairs(opcodes_coverage)
do

Loading…
Cancel
Save