Skip to content

Fix parsing of labeled break statements#84

Closed
IanButterworth wants to merge 1 commit intomasterfrom
ib/fix
Closed

Fix parsing of labeled break statements#84
IanButterworth wants to merge 1 commit intomasterfrom
ib/fix

Conversation

@IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Feb 1, 2026

When JuliaSyntax parses 'break label' statements where the label name is a keyword like 'error' or 'done', it creates Expr(:error, :label) nodes that look like parse errors but are actually just label references. This was causing false positive parse errors when running Julia 1.11 with JuliaSyntax to parse Julia 1.14+ source code containing constructs like '@Label error begin ... break error ... end'.

The fix updates has_embedded_errors() to distinguish between real parse errors (Expr(:error) or Expr(:error, "message")) and false positives (Expr(:error, :symbol) from labeled breaks).

Fixes http://buildkite.com/julialang/julia-master-scheduled/builds/1425#019c1312-26d0-4716-8642-7ac68180293e

When JuliaSyntax parses 'break label' statements where the label name
is a keyword like 'error' or 'done', it creates Expr(:error, :label)
nodes that look like parse errors but are actually just label references.
This was causing false positive parse errors when running Julia 1.11
with JuliaSyntax to parse Julia 1.14+ source code containing constructs
like '@Label error begin ... break error ... end'.

The fix updates has_embedded_errors() to distinguish between real parse
errors (Expr(:error) or Expr(:error, "message")) and false positives
(Expr(:error, :symbol) from labeled breaks).

Fixes buildkite.com/julialang/julia-master-scheduled/builds/1425#019c1312-26d0-4716-8642-7ac68180293e

Co-authored-by: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.10%. Comparing base (777708a) to head (2ab84ac).

❌ Your project status has failed because the head coverage (96.10%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #84      +/-   ##
==========================================
+ Coverage   96.06%   96.10%   +0.03%     
==========================================
  Files           4        4              
  Lines         356      359       +3     
==========================================
+ Hits          342      345       +3     
  Misses         14       14              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@IanButterworth
Copy link
Member Author

JuliaLang/JuliaSyntax.jl#618 should be the proper fix

@IanButterworth IanButterworth deleted the ib/fix branch February 1, 2026 12:50
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.

1 participant