Are any of these bugs?

julia> immutable Z <: Unsigned
foo
end

julia> Z(12)
Error showing value of type Z:
ERROR: MethodError: no method matching leading_zeros(::Z)
Closest candidates are:
leading_zeros{T<:Union{Int128,Int16,Int32,Int64,Int8,UInt128,UInt16,UInt32,UInt64,UInt8}}(::T<:Union{Int128,Int16,Int32,Int64,Int8,UInt128,UInt16,UInt32,UInt64,UInt8}) at int.jl:150
in hex(::Z, ::Int64, ::Bool) at ./intfuncs.jl:303
in display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::MIME{Symbol(“text/plain”)}, ::Z) at ./REPL.jl:132
in display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::Z) at ./REPL.jl:135
in display(::Z) at ./multimedia.jl:143
in print_response(::Base.Terminals.TTYTerminal, ::Any, ::Void, ::Bool, ::Bool, ::Void) at ./REPL.jl:154
in print_response(::Base.REPL.LineEditREPL, ::Any, ::Void, ::Bool, ::Bool) at ./REPL.jl:139
in (::Base.REPL.##22#23{Bool,Base.REPL.##33#42{Base.REPL.LineEditREPL,Base.REPL.REPLHistoryProvider},Base.REPL.LineEditREPL,Base.LineEdit.Prompt})(::Base.LineEdit.MIState, ::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool) at ./REPL.jl:652
in run_interface(::Base.Terminals.TTYTerminal, ::Base.LineEdit.ModalInterface) at ./LineEdit.jl:1579
in run_interface(::Base.Terminals.TTYTerminal, ::Base.LineEdit.ModalInterface) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
in run_frontend(::Base.REPL.LineEditREPL, ::Base.REPL.REPLBackendRef) at ./REPL.jl:903
in run_repl(::Base.REPL.LineEditREPL, ::Base.##930#931) at ./REPL.jl:188
in _start() at ./client.jl:360
in _start() at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
julia> Base.:==(a::Z,b::Z) = “hello, world”
ERROR: syntax: invalid identifier name “:=”

julia> Base.isequal(a::Z,b::Z) = “hello, world”

julia> Z(12)==Z(13)
false

julia> isequal(Z(12),Z(13))
“hello, world”

None of these are behavioral bugs though it is currently not extremely clear on what method needs to be extended when implementing certain kind of types so you could say it’s interface documentation bugs.

1 Like

OK thanks. I mean, I can create an Unsigned type that does not cause these problems but I find it an odd design choice that subtyping Unsigned automatically breaks the P in REPL.