PlutoLang / Pluto

A superset of Lua 5.4 with a focus on general-purpose programming.
https://pluto-lang.org/docs/Introduction
MIT License
337 stars 20 forks source link

Single fallthrough not allowed #859

Closed XmiliaH closed 1 month ago

XmiliaH commented 1 month ago

Currently cases with just a fallthrough statement are not allowed which seems strage to me.

switch 1 do
    case 1:
        --[[@fallthrough]]
    case 2:
end
Sainan commented 1 month ago

I can't say if this was intended, but I'm also not sure of the merit of allowing the developer to write nonsensical annotations like this.

XmiliaH commented 1 month ago

I do not really care if it is or is not allowed, but I would not say that this is always a nonsensical annotations. Maybe there is a developer out there who has a special case in the switch statment that is empty and should fall trhough and mark this case as such to make it distinct, yet obvious.