On Julia master:
julia> struct Pullback{S, T}
t::T
end
julia> function Base.show(io::IO, ::Type{<:Pullback{S}}) where S
S
end
julia> P = Pullback{Tuple{Type{T}}, T} where T
Error showing value of type UnionAll:
ERROR: UndefVarError: S not defined
Stacktrace:
[1] show(::IOContext{REPL.Terminals.TTYTerminal}, ::Type{
SYSTEM (REPL): showing an error caused an error
ERROR: UndefVarError: S not defined
Stacktrace:
[1] show(::IOContext{REPL.Terminals.TTYTerminal}, ::Type{
SYSTEM (REPL): caught exception of type UndefVarError while trying to handle a nested exception; giving up
cc: @vchuravy, major props for helping me track this down
This code is part of Zygote.jl so cc: @MikeInnes
The initial error isn't a bug. The type parameter is undefined. Obviously the subsequent errors are incorrect.
https://github.com/FluxML/Zygote.jl/issues/134 should maybe be reopened.
Overloading show on type and messing up will make showing errors fail, since they use that.
I'm wondering if we should try using the fallback printing for the exception if it throws an error again.
Most helpful comment
I'm wondering if we should try using the fallback printing for the exception if it throws an error again.