Working on 8eca27df422089a8c21301764c6485fb86d0fee8, I believe the following is a bug in the display logic for unions, although the error message's reference to Tuple{Char} makes me wonder if there's a type system issue as well:
julia> tmp = Array{Union{Tuple{Char}, Tuple{Char, Char}}}(undef, 1)
1-element Array{Union{Tuple{Char}, Tuple{Char,Char}},1}:
('\0',)
julia> tmp[1] = ('a', )
('a',)
julia> tmp
1-element Array{Union{Tuple{Char}, Tuple{Char,Char}},1}:
('a',)
julia> tmp[1] = ('a', 'b')
('a', 'b')
julia> tmp
1-element Array{Union{Tuple{Char}, Tuple{Char,Char}},1}:
Error showing value of type Array{Union{Tuple{Char}, Tuple{Char,Char}},1}:
ERROR: BoundsError: attempt to access Tuple{Char}
at index [2]
Stacktrace:
[1] show_delim_array(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Tuple{Char,Char}, ::Char, ::Char, ::Char, ::Bool, ::Int64, ::Int64) at ./show.jl:692
[2] show_delim_array at ./show.jl:677 [inlined]
[3] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Tuple{Char,Char}) at ./show.jl:710
[4] #sprint#340(::IOContext{REPL.Terminals.TTYTerminal}, ::Int64, ::Function, ::Function, ::Tuple{Char,Char}) at ./strings/io.jl:99
[5] #sprint at ./none:0 [inlined]
[6] alignment at ./show.jl:1757 [inlined]
[7] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Union{Tuple{Char}, Tuple{Char,Char}},1}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:68
[8] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Union{Tuple{Char}, Tuple{Char,Char}},1}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:186
[9] print_matrix at ./arrayshow.jl:159 [inlined]
[10] print_array at ./arrayshow.jl:308 [inlined]
[11] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::Array{Union{Tuple{Char}, Tuple{Char,Char}},1}) at ./arrayshow.jl:345
[12] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:131
[13] display(::REPL.REPLDisplay, ::Any) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:135
[14] display(::Any) at ./multimedia.jl:287
[15] #invokelatest#1 at ./essentials.jl:742 [inlined]
[16] invokelatest at ./essentials.jl:741 [inlined]
[17] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:155
[18] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:140
[19] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(REPL, Symbol("##48#57")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:714
[20] #invokelatest#1 at ./essentials.jl:742 [inlined]
[21] invokelatest at ./essentials.jl:741 [inlined]
[22] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/LineEdit.jl:2273
[23] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:1035
[24] run_repl(::REPL.AbstractREPL, ::Any) at /Users/johnmyleswhite/julia/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:192
[25] (::getfield(Base, Symbol("##735#737")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
[26] #invokelatest#1 at ./essentials.jl:742 [inlined]
[27] invokelatest at ./essentials.jl:741 [inlined]
[28] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
[29] exec_options(::Base.JLOptions) at ./client.jl:284
[30] _start() at ./client.jl:436
Might be due to https://github.com/JuliaLang/julia/pull/30442#issuecomment-449759082? It was noted that CI fails since that PR has been merged.
Undoing those changes locally doesn't seem to fix the problem.
To expand on that, this issue shows up on the v1.0.3 tag.
The underlying issue is with fieldtype; fieldtype(Union{Tuple{Char},Tuple{Char,Char}},2) throws a bounds error. I would be ok with that returning Char, but it is a bit subtle --- we probably want fieldtype(Tuple{Char},2) to continue to throw an error instead of returning Union{}.
Hmm, that raises the question of what fieldtype(Union{Tuple{Char},Tuple{Char,Char}}, 3) does... throw an error if all types in the union would give an error?
Maybe we should add a keyword arg throw/raise/error/strict/etc that selects for the alternate behavior for all types and indexes (basically the getfield tfunc)?
Most helpful comment
The underlying issue is with
fieldtype;fieldtype(Union{Tuple{Char},Tuple{Char,Char}},2)throws a bounds error. I would be ok with that returningChar, but it is a bit subtle --- we probably wantfieldtype(Tuple{Char},2)to continue to throw an error instead of returningUnion{}.