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).
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))