Closed fperrad closed 11 months ago
@fperrad Thanks for the report! At first glance, I think this is due to the lack of type information (that is, it wouldn't happen on a .tl
file with type annotations in function arguments/variables)... Teal needs type info to know whether to output bit32 compat or metamethod compat calls. It still shouldn't generate invalid operators when outputting Lua 5.1 code, though. I'll need to investigate this further!
Fixed! Now it no longer outputs 5.3 operators with --gen-target=5.1
, even if variable types can't be determined. I tested it with your mqtt311.lua and also added a smaller regression test.
My issue was about bitwise operators. Does your fix include too the floor division operator //
?
@fperrad yes, it covers //
as well!
I try to transpile a Lua 5.3 module (see https://framagit.org/fperrad/lua-mqtt/-/blob/transpile/src/mqtt311.lua) with the following command:
Most of the bitwise operators are transpiled to bit32 calls, except in 3 lines. see commit https://framagit.org/fperrad/lua-mqtt/-/commit/d97093dcd38cf18c558d822f45062a2efed65ac5
note: