Repository navigation
Avoid counting macro call locations as uncovered lines - #91
Merged
maleadt merged 1 commit intoOct 2, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #91 +/- ##
==========================================
+ Coverage 96.08% 96.09% +0.01%
==========================================
Files 4 4
Lines 383 384 +1
==========================================
+ Hits 368 369 +1
Misses 15 15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A macro call's second argument records its location. When a macro is nested inside an uncalled function, treating that node as a body statement creates an uncovered line for which Julia emits no coverage counter. Skip the location node while still visiting the macro arguments. Macro calls used as statements keep the line from their enclosing block.
maleadt
force-pushed
the
macrocall-location-is-not-runnable-code
branch
from
October 2, 2026 11:55
295c3ce to
4a40496
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CoverageTools uses source analysis to mark lines inside uncalled functions as uncovered. A macro call contains a
LineNumberNoderecording where the macro was written. When the macro appears inside another statement, Julia may emit no coverage counter for that line, but CoverageTools currently marks it uncovered anyway. This produces a miss that no test can turn into a hit (#90).The source analysis now skips that location node while continuing through the macro's arguments. A macro call used as a statement still gets its line from the enclosing block. For example, in
return sum(@view(x[1:1]))split across lines, the@viewline remains without a count in both called and uncalled functions; the surrounding runnable lines are still reported.The regression tests cover a nested macro, a macro used as a statement, and code after the location node. The full suite passes on Julia 1.10 and nightly. I also reproduced the coverage output with Julia's
.covwriter on 1.10.Fixes #90.