dibyendumajumdar/ravi

bad error conversion

fperrad opened this issue · 3 comments

the test suite lua-Harness detects many failures with 1.0-beta4 (and 1.0-beta5).

for example with the conversion string to number.

currently, ravi gives

$ ../../../RAVI/bin/ravi -v -e "print(3 & '7')"
Ravi 5.3.5
Copyright (C) 1994-2019 Lua.org, PUC-Rio
Portions Copyright (C) 2015-2020 Dibyendu Majumdar
Options mirjit
../../../RAVI/bin/ravi: (command line):1: number has no integer representation
stack traceback:
	(command line):1: in main chunk
	[C]: in ?

but 1.0-beta3 behaves like Lua 5.3

$ ../../../LUA/lua-5.3.6/bin/lua -v -e "print(3 & '7')"
Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio
3

note: with specific compilation (LUA_NOCVTS2N), Lua 5.3 could give

$ ../../../LUA/lua-5.3.6-nocvts2n/bin/lua -v -e "print(3 & '7')"
Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio
../../../LUA/lua-5.3.6-nocvts2n/bin/lua: (command line):1: attempt to perform bitwise operation on a string value
stack traceback:
	(command line):1: in main chunk
	[C]: in ?

Lua 5.4 throws another kind of error

$ ../../../LUA/lua-5.4.3/bin/lua -v -e "print(3 & '7')"
Lua 5.4.3  Copyright (C) 1994-2021 Lua.org, PUC-Rio
../../../LUA/lua-5.4.3/bin/lua: (command line):1: attempt to perform bitwise operation on a string value (constant '7')
stack traceback:
	(command line):1: in main chunk
	[C]: in ?

Lua 5.3 (and 5.4) throws the error number has no integer representation only with this kind of code (float -> integer)

$ ../../../LUA/lua-5.3.6/bin/lua -v -e "print(3 & 7.5)"
Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio
../../../LUA/lua-5.3.6/bin/lua: (command line):1: number has no integer representation
stack traceback:
	(command line):1: in main chunk
	[C]: in ?

beta3 works Lua 5.3,
beta4 tries to follow Lua 5.4, but doesn't succeed.

note: with beta4 & 5, you must toggle nocvts2n in profile_ravi.lua
see https://framagit.org/fperrad/lua-Harness/-/blob/master/test_lua/profile_ravi.lua#L34

@fperrad Thank you for the report. I will have a look. Ravi is kind of in-between 5.3 and 5.4 right now - so this is probably the result of that.

It seems I had missed a change. However the error is still not 100% same as Lua 5.4