full-moon icon indicating copy to clipboard operation
full-moon copied to clipboard

Classify ambiguous syntax

Open OverHash opened this issue 5 years ago • 0 comments

In Lua (and Luau) users may write code like the following:

local myVar = workspace.Part.CFrame

(workspace.Part).Touched:Connect(function()
	print(myVar)
end)

This should be classified as ambiguous syntax, as the parser will identify workspace.Part.CFrame as a function as we then call it on the following line. full-moon should classify this as ambiguous syntax as the programmer probably wanted to assign workspace.Part.CFrame to myVar and then listen to workspace.Part.Touched, using myVar inside the callback function.

Other linters such as Roblox Studio's linter will give a useful warning message: image

And Roblox LSP will suggest to add a semicolon to make the parser identify what you want to do image

OverHash avatar Dec 30 '20 01:12 OverHash