JohnnyMorganz / StyLua

An opinionated Lua code formatter
Mozilla Public License 2.0
1.53k stars 68 forks source link

Parsing error with leading & in a type #877

Open iamawatermelo opened 1 month ago

iamawatermelo commented 1 month ago
local f: & number & string = "hi"

This is valid Luau code:

image

StyLua cannot format it, though:

sarah@localhost ~/project (main) [2]> StyLua example.luau
error: could not format file example.luau: error parsing: error occurred while creating ast: unexpected token `&`. (starting from line 1, character 10 and ending on line 1, character 11)
additional information: expected type after colon
sarah@localhost ~/project (main) [2]> StyLua --version
stylua 0.20.0
sarah@localhost ~/project (main)>

StyLua was installed from aftman.

JohnnyMorganz commented 1 month ago

Requires support upstream in full-moon, our Luau parser