Kampfkarren / full-moon

A lossless Lua 5.1 parser
Mozilla Public License 2.0
394 stars 52 forks source link

Chaining optional type operator bug #290

Closed jeparlefrancais closed 7 months ago

jeparlefrancais commented 1 year ago

(At this point I suppose this is already fixed in the parser rewrite but I just want to make sure!)

Luau syntax allow chaining multiple optional type operators ?. You may think adding multiple ? to your type is redundant, but not at all. It allows you to write different levels of optional-ness:

type Config = {
    option1: string??, -- you probably need it once in a while
    option2: string???, -- once a year
    option3: string?????? -- once in your life!
}

Unfortunately, full-moon does not support it 😛 Jokes aside, it would be cool to fix this so that I don't have to add specific rules in darklua fuzz tests and code generators!

JohnnyMorganz commented 1 year ago

Can confirm, fixed in rewrite :) I'll add a test case for it