LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.35k stars 318 forks source link

[Feature request] Support for the upvalue limit #2578

Open emmericp opened 7 months ago

emmericp commented 7 months ago

Functions in Lua 5.1 (and LuaJIT) can only reference up to 60 upvalues.

For example, the following code does not compile in Lua 5.1 ("lua5.1: upvals.lua:4: function at line 3 has more than 60 upvalues") but LuaLS accepts it without any warning when the version is set to 5.1. Ideally this would be handled directly in the parser similar to the 200 local limits.

local a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61

function Foo()
    print(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61)
end
emmericp commented 7 months ago

Later versions of Lua also have a limit, I'm just not 100% sure what it is, it maybe 200 or 255?