Skip to content

Invalid double function call syntax is not squiggled for Lua version 5.2 and prior #1422

Description

@sewbacca

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

Syntax squiggles, notifying invalid Lua code, if the version is set to Lua 5.2, Lua 5.1 or Lua JIT.
Expected error: lua5.1: luatest.lua:9: ambiguous syntax (function call x new statement) near '('

Actual Behaviour

Syntax is accepted, as it would be expected for Lua 5.3 and Lua 5.4.

Reproduction steps

local function nestedFunction(name)
	return function(f)
		f()
	end
end

nestedFunction "My function"
(function ()
	print "Hello"
end)

Additional Notes

Correct function call for 5.2 and prior would be:

nestedFunction "My function" (
function ()
	print "Hello"
end)

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions