I found that the following code makes Julia crash in macOS Sierra (10.12.6):
import Base: one
one(::Type{<:Real}) = nothing
This happens also with when replacing nothing
by, for example, Real
.
The output I get is:
Error showing value of type typeof(one):
SYSTEM: show(lasterr) caused an error
MethodError(Int64, (nothing,), 0x00000000000061d6)
Stacktrace:
[1] oneunit(::Type{Int64}) at ./number.jl:321
[2] first(::Base.OneTo{Int64}) at ./range.jl:544
[3] first(::LinearIndices{1,Tuple{Base.OneTo{Int64}}}) at ./indices.jl:422
[4] methods(::Any, ::Any) at ./reflection.jl:754
[5] methods(::Any) at ./reflection.jl:769
[6] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol(“text/plain”)}, ::Function) at ./show.jl:34
[7] display(::REPL.REPLDisplay{REPL.LineEditREPL}, ::MIME{Symbol(“text/plain”)}, ::Function) at /Users/userX/.julia/packages/OhMyREPL/f919j/src/output_prompt_overwrite.jl:6
[8] display(::REPL.REPLDisplay, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:135
[9] display(::Any) at ./multimedia.jl:287
[10] #invokelatest#1 at ./essentials.jl:697 [inlined]
[11] invokelatest at ./essentials.jl:696 [inlined]
[12] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:154
[13] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:139
[14] (::getfield(REPL, Symbol(“#do_respond#40”)){Bool,getfield(REPL, Symbol(“##50#59”)){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:708
[15] #invokelatest#1 at ./essentials.jl:697 [inlined]
[16] invokelatest at ./essentials.jl:696 [inlined]
[17] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2261
[18] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:1029
[19] run_repl(::REPL.AbstractREPL, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:191
[20] (::getfield(Base, Symbol(“##719#721”)){Bool,Bool,Bool,Bool})(::Module) at ./logging.jl:311
[21] #invokelatest#1 at ./essentials.jl:697 [inlined]
[22] invokelatest at ./essentials.jl:696 [inlined]
[23] macro expansion at ./logging.jl:308 [inlined]
[24] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:330
[25] exec_options(::Base.JLOptions) at ./client.jl:242
[26] start() at ./client.jl:421
julia>
fatal: error thrown and no exception handler available.
MethodError(f=Int64, args=(nothing,), world=0x00000000000061d6)
rec_backtrace at /Users/osx/buildbot/slave/package_osx64/build/src/stackwalk.c:94
record_backtrace at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:246 [inlined]
jl_throw at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:577
jl_method_error_bare at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1616
jl_method_error at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1634
jl_lookup_generic at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2161
jl_apply_generic at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2181
oneunit at ./number.jl:321
first at ./range.jl:544
#83 at ./abstractarray.jl:85
_tuple_any at ./tuple.jl:415
unknown function (ip: 0x12c31acb7)
_tuple_any at ./tuple.jl:412
unknown function (ip: 0x12c31ac09)
has_offset_axes at ./abstractarray.jl:85
Type at ./iobuffer.jl:19
Type at ./iobuffer.jl:27
#IOBuffer#299 at ./iobuffer.jl:98
unknown function (ip: 0x12c31a8bc)
Type at ./none:0
#IOBuffer#300 at ./iobuffer.jl:114
unknown function (ip: 0x12c31a67c)
Type at ./iobuffer.jl:112
#with_output_color#660 at ./util.jl:364
unknown function (ip: 0x12c31f86b)
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
#with_output_color at ./none:0
unknown function (ip: 0x12c31f800)
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
#printstyled#661 at ./util.jl:398
unknown function (ip: 0x12c31f717)
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
#printstyled at ./none:0
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
display_error at ./client.jl:93
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
display_error at ./client.jl:102
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1537 [inlined]
jl_f__apply at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:556
jl_f__apply_latest at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:594
#invokelatest#1 at ./essentials.jl:697 [inlined]
invokelatest at ./essentials.jl:696 [inlined]
_start at ./client.jl:423
true_main at /usr/local/bin/julia (unknown line)
main at /usr/local/bin/julia (unknown line)