Skip to content

Fix Issue 21347 - array literal parser doesn't stop on missing comma - #23772

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
usefahmed07:fix/21347-array-literal-error-recovery
Sep 3, 2026
Merged

Fix Issue 21347 - array literal parser doesn't stop on missing comma#23772
thewilsonator merged 1 commit into
dlang:masterfrom
usefahmed07:fix/21347-array-literal-error-recovery

Conversation

@usefahmed07

Copy link
Copy Markdown
Contributor

Fixes #21347

… syntax error

When a comma is missing after an element in an array literal or a
subscript argument list, the parser used to keep consuming tokens
past the syntax error all the way to the end of file, producing a
long cascade of spurious errors instead of a small, focused set.

Break out of the parsing loop as soon as a required comma is
missing, after reporting the original error, instead of continuing
to loop until the closing bracket or end of file is reached.

Fixes Bugzilla Issue 21347
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

DMD perf check

Metric Base PR Δ
compile hello.d (instr) 214.9 M 231.0 M +7.489%
compile hello.d -O -release (instr) 233.2 M 249.3 M +6.893%
compile Phobos (instr) 5,121.9 M 5,182.3 M +1.180%
compile vibe.d (instr) 15,124.3 M 15,207.4 M +0.549%
dmd binary size (stripped) 6.86 MB 7.09 MB +3.30%
Breakdown — compile hello.d
Phase (wall, self time) Base PR Δ
parse 36.9 ms 35.1 ms -4.91%
sema1 11.9 ms 10.7 ms -10.38%
sema_other 14.9 ms 14.3 ms -3.48%
sema3 6.0 ms 6.1 ms +1.14%
codegen 2.0 ms 2.0 ms -2.73%
Breakdown — compile Phobos

+60.4 M instructions: frontend +59.8 M (+1.64%), codegen +0.7 M (+0.04%)

Phase (wall, self time) Base PR Δ
sema3 578 ms 594 ms +2.79%
sema1 226 ms 234 ms +3.57%
sema_other 203 ms 206 ms +1.93%
parse 119 ms 117 ms -1.61%
codegen 413 ms 413 ms -0.15%
inline 4.6 ms 4.8 ms +3.97%
ctfe 14.3 ms 14.2 ms -0.48%
sema2 2.3 ms 2.2 ms -2.82%
All measurements
Metric Base PR Δ
compile hello.d (instr) 214.9 M 231.0 M +7.489%
compile hello.d -O -release (instr) 233.2 M 249.3 M +6.893%
compile Phobos (instr) 5,121.9 M 5,182.3 M +1.180%
compile Phobos codegen (instr) 1,472.0 M 1,472.7 M +0.044%
compile vibe.d (instr) 15,124.3 M 15,207.4 M +0.549%
dmd binary size (stripped) 6.86 MB 7.09 MB +3.30%
hello binary size (stripped) 0.72 MB 0.72 MB 0.00%
peak RSS (compile hello.d) 43.40 MB 43.62 MB +0.52%
peak RSS (compile Phobos) 617.4 MB 620.2 MB +0.44%
peak RSS (compile vibe.d) 1918 MB 1917 MB -0.03%
compile dmd itself (wall) 12.4 s 12.5 s +0.52%
compile hello.d (wall) 71.7 ms 68.2 ms -4.95%
compile Phobos (wall) 1,560 ms 1,585 ms +1.64%

eecd1b2 vs merge-base 52c8c25 · about these metrics

@thewilsonator
thewilsonator merged commit b759d71 into dlang:master Sep 3, 2026
41 of 42 checks passed
@usefahmed07
usefahmed07 deleted the fix/21347-array-literal-error-recovery branch September 3, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diagnostic: Parser never stops looking for ',' on array literal syntax error

2 participants