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

Switch expression does not reset pinnedreg #852

Closed XmiliaH closed 1 month ago

XmiliaH commented 1 month ago

The switch expression resets the pinnedreg at the end of the switch expression to -1, not the previous value causing issues with nested switch expression as can be seen in the following exmaple which causes a assertion failure when pluto is compiled with -DLUAI_ASSERT.

local l = switch 1 do
    case 1->switch 1 do
        case 1->1
    end
    case 2->2
    case 3->3
end