Closed
Description
When types contain isbits
parameters, the runtime's built-in printing for these datatypes can end up printing a value whose type doesn't round-trip correctly, causing a (silently) incorrect pre-compile statement:
$ julia --trace-compile=stderr -q
julia> foo(::Type{T}) where T = rand(Bool)
foo (generic function with 1 method)
julia> foo(Tuple{1.0})
precompile(Tuple{typeof(Main.foo), Type{Tuple{1}}})
The problem is that jl_
isn't very careful about giving you a literal of the correct type:
julia> ccall(:jl_, Cvoid, (Any,), Tuple{1.0})
Tuple{1}
julia> ccall(:jl_, Cvoid, (Any,), Tuple{1})
Tuple{1}
This is another version of #28808, but I thought it was worth opening a separate issue since these are "valid" types but they are the wrong types (and we get it wrong for quite common values like Float64
).