Formatting a function with a comment after a single return type enclosed in parentheses formats the code from something like this:
function foo(): (
nil -- Some comment
)
return nil
end
To this:
function foo(): (nil -- Some comment)
return nil
end
The closing parentheses is now part of the comment and produces a syntax error.
StyLua could either enforce no parentheses on single return types or format it as the original code block when parentheses are found, either solution works IMO.