-
Notifications
You must be signed in to change notification settings - Fork 6
Detect syntax version from project files to support parsing newer Julia syntax #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c7445f4 to
8571768
Compare
Codecov Report❌ Patch coverage is
❌ Your project status has failed because the head coverage (96.06%) 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 #80 +/- ##
==========================================
- Coverage 98.36% 96.06% -2.30%
==========================================
Files 4 4
Lines 245 356 +111
==========================================
+ Hits 241 342 +101
- Misses 4 14 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ia syntax When analyzing code coverage, detect the appropriate syntax version by: - Checking Project.toml/JuliaProject.toml for syntax.julia_version or compat.julia - Falling back to VERSION file for Julia's base/ source - Using Base.project_get_syntax_version() when available (Julia 1.14+) This allows Coverage.jl running under Julia 1.11 to correctly parse Julia 1.14+ source code containing features like labeled breaks, by passing the detected syntax version to Meta.parse via the version keyword argument. Co-Authored-By: Claude <noreply@anthropic.com>
This change enables CoverageTools to parse Julia source code using syntax versioning, allowing coverage collection when the runner Julia version differs from the source code version. This fixes coverage jobs that run on Julia 1.11 but need to parse Julia 1.14 code containing features like labeled break/continue statements. Fixes JuliaLang/julia#60826 CoverageTools: Add version-aware parsing using JuliaSyntax This enables CoverageTools running on Julia 1.11 to parse Julia 1.14+ code with labeled breaks. Fixes JuliaLang/julia#60826
Per review feedback: - Default to v"1.14" instead of VERSION since JuliaSyntax maintains backwards compatibility - Remove incorrect compat parsing logic - only respect explicit syntax.julia_version - Keep Base.project_file_load_spec() usage for Julia 1.14+
3f00816 to
d420916
Compare
- Simplify has_embedded_errors() using early returns and any() - Clarify current_line computation (lineoffset + 1) - Add TOML fallback test for Julia < 1.14 syntax version detection
Add version-aware parsing using JuliaSyntax
This PR enables CoverageTools to parse Julia source code across different syntax versions by:
Key Changes:
detect_syntax_version()to automatically detect the appropriate Julia syntax version by:Project.toml/JuliaProject.tomlfor explicitsyntax.julia_versionentriesBase.project_file_load_spec()when available (Julia 1.14+)VERSIONfile for Julia'sbase/source treev"1.14"(JuliaSyntax maintains backwards compatibility)amend_coverage_from_src!()to useJuliaSyntax.parsestmt()with the detected version parameterhas_embedded_errors()helper to detect parse errors in ASTs with proper error reportingWhy This Matters:
This allows CoverageTools running under Julia 1.11 (or any version) to correctly parse Julia 1.14+ source code containing new syntax features like labeled breaks. Since JuliaSyntax provides version-aware parsing independent of the running Julia version, coverage analysis now works seamlessly across version boundaries.
Implementation Details:
Fixes JuliaLang/julia#60826
Developed with Claude