Codecov missing coverage of myfunction(::SomeType) = 1

I have some packages that previously had 100% code coverage but now the badges are showing <100% coverage because codecov is falsely claiming that some lines that look like
myfunction(::SomeType) = 1
are not being covered, when in fact I am sure they are covered.
I have a hunch that the compiler is optimizing these functions away and codecov does not realize that. Is there any way to make the codecov report more accurate?

Here is a concrete example report (but I don’t know if such reports are publicly viewable):

1 Like

Known issue, see, for example:

2 Likes

Thanks! I had searched discourse for info and couldn’t find anything, figuring it was a codecov bug. I didn’t realize it was an issue with Julia itself.
And indeed my examples are always cases where the function returns an isbits literal.
What is not mentioned in that Julia issue is that these things used to be covered properly not that long ago, so some change in 1.10 or 1.11 or so caused the problem.

1 Like

I think this is a long-standing issue for Julia. It’s probably just that the bug didn’t trigger for your code before, perhaps because Julia wasn’t able to constant-fold the relevant pieces of code previously.