Wrong supertype for compiled sysimage

I have the following two functions in my code

function test_supertype1(t::Type)
    return supertype(t)
end

function test_supertype2(t::Type{T}) where T <: AssetLayer
    return supertype(t)
end

Normally both work as intended. However when I compile the code to a sysimage the second one test_supertype2 gives the incorrect answer. For some reason it seems to always return supertype(supertype(t)) instead of just supertype(t).

Any idea why?

Julia v 1.10 Beta 3
compile=all for the sysimage

Can you produce a MWE? With removing AssetLayer I couldn’t reproduce it.

Best to file this as a bug under https://github.com/JuliaLang/julia

Thanks!! I will try later when I find the time. Just threw it out here meanwhile to see if someone had experienced something similar.

OK So now I have ran a bit more experiments and this is where I stand now.

I have the two following functions in my package

function test_supertype(t::Type)
    return supertype(t)
end

function test_supertype_math(t::Type{T}) where T <: Number
    return supertype(t)
end

If I then compile a sysimage from the package with the arguments compile=all --strip-ir
I get
test_supertype(Int64) -> Signed (correct)
test_supertype_math(Int64) -> Integer (incorrect)
So it seems like for some reason if the --strip-ir command is included then the second function is broken and actually returns supertype(supertype(t))

Julia 1.10 Beta 3
PackageCompiler v2.1.5

2 Likes