JohnnyMorganz / StyLua

An opinionated Lua code formatter
Mozilla Public License 2.0
1.6k stars 72 forks source link

Don't remove parenthesis in `Rest...` generics. #884

Closed howmanysmall closed 2 weeks ago

howmanysmall commented 3 months ago

I don't really know how to explain this but I do have a reproduction.

-- Given this type:
type Function<T..., R...> = any

do
    type ThisIsOkay = Function<(), ({[string]: number})>
    type ThisIsInvalidAndWhatResultsFromFormatting = Function<(), {[string]: number}>
end

do
    type ThisIsOkay2 = Function<(string), ({[string]: number})>
    type ThisIsInvalidAndWhatResultsFromFormatting2 = Function<string, {[string]: number}>
end

Basically, if there's two Rest... generics in a type, you should not format away the parenthesis for any of them.

JohnnyMorganz commented 2 weeks ago

I cannot reproduce this. This should've been fixed in https://github.com/JohnnyMorganz/StyLua/pull/730

Are you on the latest version?

howmanysmall commented 2 weeks ago

oh good lord i was WAY out of date