The parser rejects a flat list literal whose elements contain subscripts, reporting "expression nesting too deep", even though nothing in it nests. Found by EigenLua round 2, which emits upvalues as cell subscripts (c5[0]): a Lua call or table constructor that references about 250 upvalues stops compiling.
Reproducer (main @ 686d3b7)
E is [1]
x is [E[0], E[0], ... 300 times ...] # Parse error: expression nesting too deep
y is [(E), (E), ... 300 times ...] # fine
z is [E[0] + 1, ... 127 times ...] # already refused at 127
Full file: EigenLua gaps/subscript-nesting.eigs (branch frontend/r2). Measured counts:
- plain-sub: 200 elements OK, 300 refused;
- sum-sub: 100 elements OK, 127 refused;
- paren: 300 elements OK.
Each subscript appears to consume a nesting level that is never returned when the element finishes, so the depth counter tracks the total number of subscripts in the expression, not the actual depth.
Done when
- The nesting depth is measured as depth: a flat list of N subscripted elements parses for any N the other limits allow.
- A regression test covers 1000
E[0] elements and 1000 E[0] + 1 elements.
- Real deep nesting is still refused at the same limit.
The parser rejects a flat list literal whose elements contain subscripts, reporting "expression nesting too deep", even though nothing in it nests. Found by EigenLua round 2, which emits upvalues as cell subscripts (
c5[0]): a Lua call or table constructor that references about 250 upvalues stops compiling.Reproducer (main @ 686d3b7)
Full file: EigenLua
gaps/subscript-nesting.eigs(branchfrontend/r2). Measured counts:Each subscript appears to consume a nesting level that is never returned when the element finishes, so the depth counter tracks the total number of subscripts in the expression, not the actual depth.
Done when
E[0]elements and 1000E[0] + 1elements.