JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.07k stars 5.43k forks source link

missed coverage for a method whose body is an isbits literal #54214

Open nsajko opened 2 months ago

nsajko commented 2 months ago

In an otherwise empty directory, I have j.jl:

f( ::Tuple{}) = 1
f(t::Tuple{Int}) = only(t)

f(())
f((3,))

When I run julia --code-coverage=@ j.jl, I get:

        - f( ::Tuple{}) = 1
        1 f(t::Tuple{Int}) = only(t)
        - 
        - f(())
        - f((3,))

So the empty tuple method doesn't seem to get any code coverage recorded.

julia> versioninfo()
Julia Version 1.12.0-DEV.387
Commit b5bfd83a3d0 (2024-04-22 13:12 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 3
  JULIA_PKG_PRECOMPILE_AUTO = 0

Hitting this here: https://github.com/JuliaArrays/FixedSizeArrays.jl/pull/26

nsajko commented 2 months ago

Judging by #54293, @kshyatt , it seems like methods such as the one below have the same issue as above, coverage isn't being recorded for them:

ATAN_1_O_2_HI(::Type{Float64}) = 4.63647609000806093515e-01
nsajko commented 2 months ago

I guess (just guessing) this comes down to the different ways a function can be executed. If a method only ever gets executed via that abstract interpretation thing/constant folding, I guess it doesn't get recorded at all for the purposes of code coverage.

nsajko commented 2 months ago

Usually it is constant-folded values that get evaluated, but not run so they end up not getting counted

35395