Skip to content

AST Returns Invalid JSON for Generic Packs #1782

@Wingysam

Description

@Wingysam

I'm running into an issue with a case like this:

a = function<b..., c...>()
end

The AST looks like this:

root@4cc223a530e7:/app# luau-ast test.lua  | rg '\[,\]'
{"root":{"type":"AstStatBlock","location":"0,0 - 2,0","hasEnd":true,"body":[{"type":"AstStatAssign","location":"0,0 - 1,3","vars":[{"type":"AstExprGlobal","location":"0,0 - 0,1","global":"a"}],"values":[{"type":"AstExprFunction","location":"0,4 - 1,3","attributes":[],"generics":[],"genericPacks":[,],"args":[],"vararg":false,"varargLocation":"0,0 - 0,0","body":{"type":"AstStatBlock","location":"0,26 - 1,0","hasEnd":true,"body":[]},"functionDepth":1,"debugname":""}]}]},"commentLocations":[]}

The problem is the empty array with a comma in it:

"genericPacks":[,]

I suspect there is meant to be data here that gets serialized to empty string rather than valid JSON.

Tested with a build from a2303a6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions