StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Parsing error with leading & in a type

Open iamawatermelo opened this issue 1 year ago • 1 comments

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.

iamawatermelo avatar Jul 19 '24 16:07 iamawatermelo

Requires support upstream in full-moon, our Luau parser

JohnnyMorganz avatar Jul 19 '24 20:07 JohnnyMorganz

full-moon was updated in https://github.com/JohnnyMorganz/StyLua/pull/854, this should be available in the next release

JohnnyMorganz avatar Nov 16 '24 20:11 JohnnyMorganz